Standalone

This section describes how to use the pipeline Framework in standalone mode, from within the DCC application or outside.

Python Example

This is an example on how to run the framework in a python console without Connect or any DCC running on the background, this way the framework is able to discover any definition where the host type is python.

mypipeline/standalone-snippets/python_standalone_publish_snippet.py

 1import os
 2from ftrack_connect_pipeline import host, constants, event
 3import ftrack_api
 4
 5# Set the minimum required Environment variables.
 6os.environ['FTRACK_EVENT_PLUGIN_PATH'] = (
 7    '<path-to-your-repo-folder>/ftrack-connect-pipeline-definition/resource/plugins:'
 8    '<path-to-your-repo-folder>/ftrack-connect-pipeline-definition/resource/definitions:'
 9)
10
11# Create a session and Event Manager
12session = ftrack_api.Session(auto_connect_event_hub=False)
13event_manager = event.EventManager(
14    session=session, mode=constants.LOCAL_EVENT_MODE
15)
16
17# Init host
18host_class = host.Host(event_manager)
19
20# Init Client
21from ftrack_connect_pipeline import client
22
23client_connection = client.Client(event_manager)
24
25# Discover hosts
26client_connection.discover_hosts()
27
28# Print discovered hosts
29# client_connection.host_connections
30
31# Setup a host
32client_connection.change_host(client_connection.host_connections[0])
33
34# Set a context id
35# You can choose to set the context id in the host or in the client,
36# booth ways will work.
37host_class.context_id = '<your-context-id>'
38# client_connection.context_id = '<your-context-id>'
39
40# Select the File Publisher definition
41definition = client_connection.host_connection.definitions[
42    'publisher'
43].get_all(name='File Publisher')[0]
44
45# Assign the definition to the client
46client_connection.change_definition(definition)
47
48# Make the desired changes:
49collector_plugins = definition.get_all(category='plugin', type='collector')
50collector_plugins[0].options.path = '<Path-to-the-file-to-publish>'
51collector_plugins[1].options.path = '<Path-to-the-file-to-publish>'
52
53# Execute the definition.
54client_connection.run_definition()
55
56# You could now make more changes and run the definition again to publish a new version.
57# collector_plugins = definition.get_all(category='plugin', type='collector')
58# collector_plugins[0].options.path='<Path-to-another-file-to-publish>'
59# collector_plugins[1].options.path='<Path-to-another-file-to-publish>'
60# client_connection.run_definition()

DCC Maya Example

This is an example on how to run the framework inside the maya console. All the definitions with host_type maya and python will be discovered.

Warning

DCC launch is subject to be improved in future releases of the framework, making it possible to share launcher with Connect to enable consistent and context aware framework setup. For now we highly recommend to launch DCC from connect to avoid having to manually setup all the environment variables. Please refer to the Discover Framework from Standalone DCC section in case you want to manually set them up.

mypipeline/standalone-snippets/maya_standalone_publish_snippet.py

 1import os
 2from ftrack_connect_pipeline import constants, event
 3from ftrack_connect_pipeline_maya import host
 4import ftrack_api
 5
 6# Set the minimum required Environment variables.
 7os.environ['FTRACK_EVENT_PLUGIN_PATH'] = (
 8    '<path-to-your-repo-folder>/ftrack-connect-pipeline-definition/resource/plugins:'
 9    '<path-to-your-repo-folder>/ftrack-connect-pipeline-definition/resource/definitions:'
10)
11
12# Create a session and Event Manager
13session = ftrack_api.Session(auto_connect_event_hub=False)
14event_manager = event.EventManager(
15    session=session, mode=constants.LOCAL_EVENT_MODE
16)
17
18# Init Maya host
19host_class = host.MayaHost(event_manager)
20
21# Init Client
22from ftrack_connect_pipeline import client
23
24client_connection = client.Client(event_manager)
25
26# Discover hosts
27client_connection.discover_hosts()
28
29# Print discovered hosts
30# client_connection.host_connections
31
32# Setup a host
33client_connection.change_host(client_connection.host_connections[0])
34
35# Set a context id
36# You can choose to set the context id in the host or in the client,
37# booth ways will work.
38host_class.context_id = '<your-context-id>'
39# client_connection.context_id = '<your-context-id>'
40
41# Select the File Publisher definition
42definition = client_connection.host_connection.definitions[
43    'publisher'
44].get_all(name='Geometry Publisher')[0]
45
46# Assign the definition to the client
47client_connection.change_definition(definition)
48
49# Make the desired changes:
50collector_plugins = definition.get_all(
51    category='plugin', type='collector', name='Geometry Collector'
52)
53collector_plugins[0].options.collected_objects = ['pCube']
54collector_plugins[1].options.collected_objects = ['pCube']
55collector_plugins[2].options.collected_objects = ['pCube']
56
57# Execute the definition.
58client_connection.run_definition()

Discover Framework from Standalone DCC

These are the necessary environment variables that has to be setup for the framework to be discovered in a DCC application without launching from connect.

Warning

This is a maya example. Please replace maya and the plugin version for your desired DCC and plugin version.

Required Environment Variables:

Name

Values

PYTHONPATH

<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-maya-1.0.2/dependencies;
<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-maya-1.0.2/resource/scripts;
<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-qt-1.0.3/dependencies;
<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-1.0.4/dependencies;
<your-local-path-to>/ftrack/ftrack-connect-plugins/ftrack-connect-pipeline-definition-1.0.3/dependencies;
<your-local-path-to>/ftrack/ftrack-connect-plugins/ftrack-application-launcher-1.0.6/dependencies;

FTRACK_EVENT_PLUGIN_PATH

<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-definition-1.0.3/resource/plugins/maya/python;
<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-definition-1.0.3/resource/plugins/qt/python;
<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-definition-1.0.3/resource/plugins/common/python;
<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-definition-1.0.3/resource/definitions;

FTRACK_DEFINITION_PLUGIN_PATH

<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-definition-1.0.3/resource/plugins

MAYA_SCRIPT_PATH

<your-local-path-to>/ftrack-connect-plugins/ftrack-connect-pipeline-maya-1.0.2/resource/scripts