Michal Mocnak Posted August 17, 2016 Report Share Posted August 17, 2016 Hello Guys, i am just wondering if there is any possibility to override those context templates by the new api using hook located on a FTRACK_CONNECT_PLUGIN_PATH instead of rewriting your default context templates delivered in connect package. I just tried something like this but it doesn't work so far. Thank you ! import ftrack_api import ftrack_api.event.base def get_sample_context_template(event): '''Return context templates for Nuke Studio.''' # Define tag regular expressions. return [{ 'name': 'Sample Shot', 'description': ( 'Match name before and after dash. ' 'Example: ch01_dragon_0010 will be matched as sequence with name ' 'ch01 and a shot named ch01_dragon_0010.' ), 'expression': '' }] def register(session, **kw): '''Register plugin.''' # Validate that session is an instance of ftrack_api.Session. If not, # assume that register is being called from an incompatible API # and return without doing anything. if not isinstance(session, ftrack_api.Session): # Exit to avoid registering this plugin again. return session.event_hub.subscribe('topic=ftrack.connect.nuke-studio.get-context-templates',get_sample_context_template) Link to comment Share on other sites More sharing options...
Michal Mocnak Posted August 23, 2016 Author Report Share Posted August 23, 2016 Resolution for now is to use legacy API and override application launch like this import os import ftrack import ftrack_connect.application NUKE_STUDIO_APPLICATION_HOOK = os.path.abspath( os.path.join(os.path.dirname(__file__), '../../../application_hooks/nuke_studio_context_template') ) def modify_application_launch(event): """Modify the application environment to include our location plugin.""" environment = event['data']['options']['env'] ftrack_connect.application.appendPath( NUKE_STUDIO_APPLICATION_HOOK, 'FTRACK_EVENT_PLUGIN_PATH', environment ) def register(registry, **kw): """Register application launch hook plugin.""" # Validate that registry is the correct ftrack.Registry. If not, # assume that register is being called with another purpose or from a # new or incompatible API and return without doing anything. if registry is not ftrack.EVENT_HANDLERS: # Exit to avoid registering this plugin again. return ftrack.EVENT_HUB.subscribe( 'topic=ftrack.connect.application.launch and data.application.identifier=nuke_studio*', modify_application_launch ) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.