Jump to content

Milan Kolar

Members
  • Posts

    81
  • Joined

  • Last visited

  • Days Won

    14

Reputation Activity

  1. Like
    Milan Kolar got a reaction from Eric L in Slack User Group   
    Soo. I went ahead and created an Ftrack Slack User Group. However there's this small problem I haven't realized till now. Slack is not very good with public access, so every person needs to get an invite (or be within a specific domain, which is even worse).
    There is this lovely service called slackin, but that of course needs to run on something. 
    Right now I'm ok with just sending out invites like crazy if anyone asks here to get it going. Theoretically as it grows this won't be an issue, because any member can send an invite. It'll just be a bit of a hassle at the beginning.
    Maybe ftrack guys would be interested in hosting this tiny slackin service, to make it easier?
     
    Anyways
    the address is: ftrackusers.slack.com
    Come join the party... (it's very, very lonely right now  )
  2. Like
    Milan Kolar got a reaction from Fredrik Limsater in Slack User Group   
    Soo. I went ahead and created an Ftrack Slack User Group. However there's this small problem I haven't realized till now. Slack is not very good with public access, so every person needs to get an invite (or be within a specific domain, which is even worse).
    There is this lovely service called slackin, but that of course needs to run on something. 
    Right now I'm ok with just sending out invites like crazy if anyone asks here to get it going. Theoretically as it grows this won't be an issue, because any member can send an invite. It'll just be a bit of a hassle at the beginning.
    Maybe ftrack guys would be interested in hosting this tiny slackin service, to make it easier?
     
    Anyways
    the address is: ftrackusers.slack.com
    Come join the party... (it's very, very lonely right now  )
  3. Like
    Milan Kolar got a reaction from Mattias Lagergren in Simplify plugins in Connect   
    So I had some time to play with this a little bit and came up with compact and quite efficient way of dealing with environments using launching events. Technically all that is needed is one hook that listens to the launching events and appends environments from simple .json config files based on app identifiers.
    The hook looks for .json files in 'FTRACK_APP_ENVIRONMENTS' and tries to find 2 configs. One that is version independent i.e. 'maya.json' and one that is version dependent i.e. 'maya_2016.json', then it adds both into the environment. Config file names mus match the app identifier or the first part of the identifier when split by '_'.
    You can then have a hierarchical environment config files, where maya.json loads regardless of maya version you launch, and maya_2016.json gets added on top of the environment when you launch Maya 2016 from ftrack.
    'FTRACK_APP_ENVIRONMENTS' folder can then look like this for instance:
    maya.json maya_2015.json maya_2016.json maya_2016.5.json nuke.json nuke_9.0v8.json houdini.json houdini_15.json etc....  
    This is the core part of the hook (full hook attached):
    def modify_application_launch(event): '''Modify the application environment and start timer for the task.''' data = event['data'] context = data['context'] app = data['application'] environment = data['options']['env'] env_path = os.environ.get('FTRACK_APP_ENVIRONMENTS') env_files = [] # determine config file for version independent environment app_name = app['identifier'].split('_')[0] app_file_name = '{}.json'.format(app_name) env_files.append(os.path.join(env_path, app_file_name)) # determine config file for version dependent environment variant_file_name = '{}.json'.format(app['identifier']) env_files.append(os.path.join(env_path, variant_file_name)) env_add = [] # loop through config files for env_file in env_files: try: env_add = load_env(env_file) except: env_add = None # Add each path in config file to the environment if env_add: for variable in env_add: for path in env_add[variable]: ftrack_connect.application.appendPath( str(path), str(variable), environment )  
    This is what the config file look like then:
    { "MAYA_PLUG_IN_PATH": [ "K:\\.core\\dev\\maya\\plug-ins" ], "MAYA_AUTOSAVE_FOLDER": [ "C:\\mayatemp\\autosave" ], "MAYA_SCRIPT_PATH": [ "K:\\.core\\dev\\maya\\scripts", "K:\\.core\\dev\\maya\\shelves", "K:\\.core\\repos\\maya\\scripts", "K:\\.core\\repos\\maya\\prefs\\shelves" ] }  
    Now quite frankly, I think that a simple hook like this (probably a bit more robust version) should be a part of the default connect installation. Straight away people would have 3 options of modifying the app launches. 
    Only need to modify environment: Add your json formatted environment file to 'FTRACK_APP_ENVIRONMENTS' and name it 'app_identifier.json' (e.g.: maya_2016.json) Write your own hook that catches launching events and modify the launch that way. Change the launcher hook in connect and modify to your heart's content  
    One way or another, our enviro setups just went from lot's of python file, to a simple json file per app without the need to tinker with default hooks. Thumbs up.
    modify_app_launch.py
  4. Like
    Milan Kolar got a reaction from tokejepsen in Simplify plugins in Connect   
    So I had some time to play with this a little bit and came up with compact and quite efficient way of dealing with environments using launching events. Technically all that is needed is one hook that listens to the launching events and appends environments from simple .json config files based on app identifiers.
    The hook looks for .json files in 'FTRACK_APP_ENVIRONMENTS' and tries to find 2 configs. One that is version independent i.e. 'maya.json' and one that is version dependent i.e. 'maya_2016.json', then it adds both into the environment. Config file names mus match the app identifier or the first part of the identifier when split by '_'.
    You can then have a hierarchical environment config files, where maya.json loads regardless of maya version you launch, and maya_2016.json gets added on top of the environment when you launch Maya 2016 from ftrack.
    'FTRACK_APP_ENVIRONMENTS' folder can then look like this for instance:
    maya.json maya_2015.json maya_2016.json maya_2016.5.json nuke.json nuke_9.0v8.json houdini.json houdini_15.json etc....  
    This is the core part of the hook (full hook attached):
    def modify_application_launch(event): '''Modify the application environment and start timer for the task.''' data = event['data'] context = data['context'] app = data['application'] environment = data['options']['env'] env_path = os.environ.get('FTRACK_APP_ENVIRONMENTS') env_files = [] # determine config file for version independent environment app_name = app['identifier'].split('_')[0] app_file_name = '{}.json'.format(app_name) env_files.append(os.path.join(env_path, app_file_name)) # determine config file for version dependent environment variant_file_name = '{}.json'.format(app['identifier']) env_files.append(os.path.join(env_path, variant_file_name)) env_add = [] # loop through config files for env_file in env_files: try: env_add = load_env(env_file) except: env_add = None # Add each path in config file to the environment if env_add: for variable in env_add: for path in env_add[variable]: ftrack_connect.application.appendPath( str(path), str(variable), environment )  
    This is what the config file look like then:
    { "MAYA_PLUG_IN_PATH": [ "K:\\.core\\dev\\maya\\plug-ins" ], "MAYA_AUTOSAVE_FOLDER": [ "C:\\mayatemp\\autosave" ], "MAYA_SCRIPT_PATH": [ "K:\\.core\\dev\\maya\\scripts", "K:\\.core\\dev\\maya\\shelves", "K:\\.core\\repos\\maya\\scripts", "K:\\.core\\repos\\maya\\prefs\\shelves" ] }  
    Now quite frankly, I think that a simple hook like this (probably a bit more robust version) should be a part of the default connect installation. Straight away people would have 3 options of modifying the app launches. 
    Only need to modify environment: Add your json formatted environment file to 'FTRACK_APP_ENVIRONMENTS' and name it 'app_identifier.json' (e.g.: maya_2016.json) Write your own hook that catches launching events and modify the launch that way. Change the launcher hook in connect and modify to your heart's content  
    One way or another, our enviro setups just went from lot's of python file, to a simple json file per app without the need to tinker with default hooks. Thumbs up.
    modify_app_launch.py
  5. Like
    Milan Kolar got a reaction from Mattias Lagergren in Simplify plugins in Connect   
    This is getting very close to a simple a straightforward system. I have however ran into some issues.
    The most prominent right now is the fact that I have no way of finding out what task/entity was the source of this launching event. It's not included in the event data and because it seems that this event precedes the ftrack addition of env variables the environment is missing the 'FTRACK_TASKID' key too.  It's important to be able to tell what originated the launch event because the enviro usually changes based on what project or task we're launching (different plugins for example.
     
    EDIT:
    Ah. One of those where you completely skip on part of docs and then realise it's of course all there. If anyone else enjoys skipping important parts of docs, then here's how you get it.
    event['data']['context']['selection'][0]['entityId'] So considering I found it...Nice work guys.
  6. Like
    Milan Kolar got a reaction from TheFridge in Slack User Group   
    Sounds great to me for unofficial "holy crap where's this button I certainly saw yesterday" type problems. I'd certainly be on on it happy to chat about ftrack with other users.
×
×
  • Create New...