0

configuring data organization

Hello,

I' trying to configure data organisation.  I need to have the assets of type "Prop" and "Vegetation" in a separate folder called "Environment".

I used the file system configuration documentation as support https://toolkit.shotgunsoftware.com/entries/23783911#Data%20passed%20to%20the%20hook 

so I updated the asset_Type yml with a filter for assets not having the vegetation and prop type.

and added a new yml config file with filter for assets belonging to prop and vegetation asset types.

however, it's not working.  when creating a new prop asset, it keeps creation corresponding folders directly in the "assets" folder.

Here attached the yml files I'm using.  may be I skipped something in the configuration or may be this not the right way to do so.

thank you in advance for your help.

A.

 




asset_type.yml
asset_type_Veget.yml

17 comments

  • 0
    Avatar
    Ryan Mayeda

    Hi Amina.

    If I'm understanding what you want to do correctly, I think it's doable!  First off, let's confirm I'm on the right track.  Is this what you want your folders to look like (approximately)?

    Screen_Shot_2014-04-17_at_1.12.48_AM.png

    Where you have two different top-level folders that contain Assets, and only certain Asset Types appear in each?

    You were on the right track with using the 'in' and 'not_in' filters, but you want to put them on the Asset folders (of type 'shotgun_entity') not the Asset Type folders (of type 'shotgun_list_field').  You can leave asset_type.yml alone, as it will be dictated by the filters you put on the asset.yml configuration below it.  In a nutshell, Asset Type folders will only be created based on the Asset folders beneath them, since they're a field on the Asset entity to begin with.

    In your asset.yml, you'll want to add another filter criteria, so the configuration that excludes Props and Vegetation would look like this:

        # the type of dynamic content
        type: "shotgun_entity"

        # the shotgun field to use for the folder name
        name: "code"

        # the shotgun entity type to connect to
        entity_type: "Asset"

        # shotgun filters to apply when getting the list of items
        filters:
        - { "path": "project", "relation": "is", "values": [ "$project" ] }
        - { "path": "sg_asset_type", "relation": "is", "values": [ "$asset_type"] }
        - { "path": "sg_asset_type", "relation": "not_in", "values": [ "Prop", "Vegetation"] }

    Then, similarly, the configuration for Props and Vegetation would look like this:

        # the type of dynamic content
        type: "shotgun_entity"

        # the shotgun field to use for the folder name
        name: "code"

        # the shotgun entity type to connect to
        entity_type: "Asset"

        # shotgun filters to apply when getting the list of items
        filters:
        - { "path": "project", "relation": "is", "values": [ "$project" ] }
        - { "path": "sg_asset_type", "relation": "is", "values": [ "$asset_type"] }
        - { "path": "sg_asset_type", "relation": "in", "values": [ "Prop", "Vegetation"] }

    I have attached the schema directory from my test configuration that produced the above screengrab as well.   Hope this helps!

    Let me know if I misunderstood what you're after and I can take another stab at this!

    Ryan.

  • 0
    Avatar
    Ryan Mayeda

    Hi Amina.

    That's doable too!  Try this schema example, which will hopefully work for you!

    Ryan.

  • 0
    Avatar
    Amina Rachdi

    Hello Ryan,

     

    Thank you for your response.

    It approaches the configuration I want, except that I want the Props and Vegetation assets to be in another folder inside the assets folder.

     

  • 0
    Avatar
    Amina Rachdi

    Hi Ryan,

    It starts working because it creates the folder but the process stops while I'm creating the asset.  I had this message error in Maya when creating a new vegetation asset.  May be I should modify one more thing in the configuration.

     

    file -f -new;
    // Warning: file: C:/Program Files/Autodesk/Maya2014/scripts/startup/rememberViewportSettings.mel line 43: Active stereo does not work with Aero enabled. Active stereo has been disabled. //
    // untitled //
    commandPort -securityWarning -name commandportDefault;
    # pymel.internal.factories : MFnDagNode.model is deprecated
    // Shotgun: Setting Maya project to 'Z:\mnt\projects\perforce_version\assets\Prop\firstAsset\MOD\work\maya'
    // Error: file: C:/Program Files/Autodesk/Maya2014/scripts/others/setProject.mel line 345: New project location Z:\mnt\projects\perforce_version\assets\Prop\firstAsset\MOD\work\maya is not a valid directory, project not created. //
    // Error: Shotgun: Failed to complete new file operation

    Failed to change work area and start a new engine - Error during execution of MEL script: file: C:/Program Files/Autodesk/Maya2014/scripts/others/setProject.mel line 345: New project location Z:\mnt\projects\perforce_version\assets\Prop\firstAsset\MOD\work\maya is not a valid directory, project not created.
    Calling Procedure: setProject, in file "C:\Program Files (x86)\Google\Chrome\Application\34.0.1847.116\C"
    setProject("Z:\\mnt\\projects\\perforce_version\\assets\\Prop\\firstAsset\\MOD\\work\\maya")
    The current environment is asset.

    Code Traceback:
    File "Z:\mnt\software\shotgun\studio\install\apps\app_store\tk-multi-workfiles\v0.4.4\python\tk_multi_workfiles\work_files.py", line 877, in _on_new_file
    self._restart_engine(self._context)
    File "Z:\mnt\software\shotgun\studio\install\apps\app_store\tk-multi-workfiles\v0.4.4\python\tk_multi_workfiles\work_files.py", line 473, in _restart_engine
    raise TankError("Failed to change work area and start a new engine - %s" % e)
    //

     

    Thank you for your support,

    Amina

  • 0
    Avatar
    Amina Rachdi

    Hello Ryan,

    I didn't find a way to counter the Maya error described in my last comment.  Did you please have time to check it ?

     

    thank you in advance,

    A.

     

  • 0
    Avatar
    Ryan Mayeda

    Hi Amina.

    I'm so sorry, I missed your previous reply and didn't see that you had a follow up question.

    Looking at this again, I left out one more key step in the process.  Since Assets can live in two different places, relative to if they are of type [Prop, Vegetation] or not, you'll need to account for this in your environment configuration.

    First, you'll need to define two sets of Asset templates instead of just one.  Let's use the Maya work file as an example:

    maya_asset_work_env: 'assets/{sg_asset_type}/{Asset}/{Step}/work/maya/{name}.v{version}.ma'
    maya_asset_work_no_env: 'assets/{sg_asset_type}/Environment/{Asset}/{Step}/work/maya/{name}.v{version}.ma'

    Next, you'll also need to define two environment configurations instead of just one.  You should be able to just copy config/env/asset_step.yml and for our test have config/env/asset_step_env.yml and config/env/asset_step_no_env.yml.  The environments are basically the same, they just have all the template settings to either the template with or without the 'env' designation from the templates above.

    Finally, you'll need to give the config/core/hooks/pick_environment.py core hook some logic to differentiate if the Asset has of type [Prop, Vegetation] or not, and then direct the system to use the corresponding environment.  I added this bit of logic to it in my test:

    if context.entity and context.step:
      # we have a step and an entity
      if context.entity["type"] == "Shot":
        return "shot_step"
      if context.entity["type"] == "Asset":
        # find the asset type for the asset whose id is in the context
        sg_asset = self.parent.shotgun.find_one('Asset', [['id', 'is', context.entity["id"]]], fields=["sg_asset_type"])
        # check to see if the asset type is "Prop" or "Vegetation" and return the relevant environment
        if sg_asset.get("sg_asset_type") in ["Prop", "Vegetation"]:
          return "asset_step_env"
        return "asset_step_no_env"

    My full example config is attached so you can see the entire thing in action.

    Hope this helps!

    Ryan.

  • 0
    Avatar
    Amina Rachdi

    Hello Ryan,

     

    No problem.  thank you for the details :)

    I followed all the steps; but now I have a new message.  please check the screenshot here attached.

     

    Thank you in advance,

    A.

  • 0
    Avatar
    Amina Rachdi

    Hello Ryan,

    Any feedback / help please on my last comment.

     

    Thank you in advance,

    A.

     

  • 0
    Avatar
    Ryan Mayeda

    Hi Amina.

    Hmm, that's a strange error.  I think something might still not be right with your pick_environment.py core hook.  Would you be able to send your entire config?  If you don't want to post it publicly, you can just email it to me.  That way I can see the entire thing and not have to potentially ask you for more stuff later...

    Thanks!

    Ryan.

  • 0
    Avatar
    Amina Rachdi

    Hello Ryan,

     

    here attached is the environment file I'm using for my test project.

    Thanks for your help,

    A.

     

  • 0
    Avatar
    Amina Rachdi

    Please note that I backuped everything to default config, emptied the cache, but still having the error ... really strange !!

     

  • 0
    Avatar
    Ryan Mayeda

    Hi Amina.

    I took a look at your config and had a quick question about how you're launching.  Are you launching from the Asset arbre and then using the File Manager to set the Task 02_Model?  I think this is what you're doing so with that in mind, here's what I think will fix it.

    Given the way we set up the pick_environment.py core hook, when you launch from the Asset arbre, the config/env/asset.yml environment gets used.  This is a valid environment and everything works as expected.  But, when you switch your work area to the Task Model_02, pick_environment.py tries to switch your environment over to config/env/asset_step_env.yml and that environment has a couple of configuration errors.  I think if you launched directly from Task 02_Model in Shotgun, you would see the errors in the Maya Script Editor.

    Anyhow, here are the two things to fix:

    1. The tk-shell environment has references to some launchers that aren't valid.  I noticed in your config/env/includes/app_launchers.yml, you removed everything except Maya and Photoshop, so you'll also need to remove them from tk-shell in the environments (here starting at L427):

    tk-shell:
      apps:
        tk-multi-about: '@about'
        tk-multi-screeningroom: '@launch_screeningroom'
        # tk-shotgun-launch3dsmax: '@launch_3dsmax'
        # tk-shotgun-launchhoudini: '@launch_houdini'
        tk-shotgun-launchmaya: '@launch_maya'
        # tk-shotgun-launchmotionbuilder: '@launch_motionbuilder'
        # tk-shotgun-launchnuke: '@launch_nuke'
        tk-shotgun-launchphotoshop: '@launch_photoshop'
      debug_logging: false
      location: {name: tk-shell, type: app_store, version: v0.3.5}

     

    2. There is a mistake in your templates configuration (config/core/templates.yml) and the file paths don't match your folder schema.  Let's just use one template (asset_work_area_maya_env) as our example.  You defined it like this:

    # define the location of a work area
    asset_work_area_maya_no_env: '@asset_root/work/maya'
    asset_work_area_maya_env: 'assets/Environment/{sg_asset_type}/{Asset}/{Step}/work/maya'

    But in your folder schema, you called the folder '06_Environment' rather than 'Environment' so your template should be this instead:

    # define the location of a work area
    asset_work_area_maya_no_env: '@asset_root/work/maya'
    asset_work_area_maya_env: 'assets/06_Environment/{sg_asset_type}/{Asset}/{Step}/work/maya'

    The error you're getting in the File Manager happens when you switch work areas to an environment that has an error.  I think if you fix these two issues, everything should start to work for you...

    Ryan.

  • 0
    Avatar
    Ryan Mayeda

    Hi Amina.

    Just confirming - are you using the BlurOffline_python27_2013-12-05_install_15445_64 build?

    Max 2014 works for me as long as I'm using that Blur build, but the freezing has happened before with other clients.  A few things to ask/check:

    1. Can you also try an older Max version, like say 2012, to see if you get the same error?
    2. Are you using the browser plugin or Java for Shotgun (web)?  I assume browser plugin but just want to check.
    3. Do you launch Max directly from the executable or do you have a wrapper of some sort?

    Ryan.

  • 0
    Avatar
    Amina Rachdi

    hello Ryan,

     

    Thank you.  I found the errors and corrected them yesterday ... everything is working great now :)

     

    but still another problem; I made all tests with maya, but when I wanted to check with 3dsmax 2014, It seems not working with toolkit.

    I checked the documentation online, and installed the last python version that supports 2014 version.  but it doesn't seem to fix the problem.

    I don't have any shotgun message errors when I launch 3dsmax from menu, during the launch, 3dsmax freezes at startup.  

    did you get this kind of problems with 2014 version ?

     

    thank you in advance,

    A.

  • 0
    Avatar
    Amina Rachdi

    Hi Ryan,

     

    1- I had 3dsmax 2012, and it was working fine.  

    I had this kind of problems only with 2014 version

    2- I'm using the browser plugin

    3- not sure I get the question ... I launch max from Shotgun 

     

  • 0
    Avatar
    Alan Dann

    Hi Amina,

    Are you running the latest version of the Browser Plugin (v0.0.5) from here?

    We recently fixed an issue in the plug-in which could cause some Applications to freeze on launch and 3ds Max was one of them so making sure you are on this version if you aren't already may help.

    Thanks

    Alan

  • 0
    Avatar
    Amina Rachdi

    Hi Alan,

     

    works fine with this browser version.

     

    Thank you for your help.

    A.

Please sign in to leave a comment.