ftrack_connect_pipeline.plugin

class ftrack_connect_pipeline.plugin.BasePluginValidation(plugin_name, required_output, return_type, return_value)[source]

Bases: object

Plugin Validation base class

__init__(plugin_name, required_output, return_type, return_value)[source]

Initialise PluginValidation with plugin_name, required_output, return_type, return_value.

plugin_name : current plugin name.

required_output : required exporters of the current plugin.

return_type : required return type of the current plugin.

return_value : Expected return value of the current plugin.

validate_required_output(result)[source]

Ensures that result contains all the expected required_output keys defined for the current plugin.

result : exporters value of the plugin execution.

Return tuple (bool,str)

validate_result_type(result)[source]

Ensures that result is instance of the defined return_type of the current plugin.

result : exporters value of the plugin execution.

Return tuple (bool,str)

validate_result_value(result)[source]

Ensures that result is equal as the defined return_value of the current plugin.

result : exporters value of the plugin execution.

Return tuple (bool,str)

validate_user_data(user_data)[source]

Ensures that user_data is instance of dict. And validates that contains message and data keys.

Return tuple (bool,str)

class ftrack_connect_pipeline.plugin.BasePlugin(session)[source]

Bases: object

Base Class to represent a Plugin

plugin_type = None

Type of the plugin

plugin_name = None

Name of the plugin

type = 'base'

Type of the plugin default base. (action, collector…)

category = 'plugin'

Category of the plugin (plugin, plugin.widget…)

host_type = 'python'

Host type of the plugin

return_type = None

Required return type

return_value = None

Required return Value

class FtrackObjectManager(event_manager)

Bases: object

FtrackObjectManager class. Mantain the syncronization between asset_info and the ftrack information of the objects in the scene.

class DccObject(name=None, from_id=None, **kwargs)

Bases: dict

Base DccObject class.

__init__(name=None, from_id=None, **kwargs)

If the from_id is provided find an object in the dcc with the given from_id as assset_info_id. If a name is provided create a new object in the dcc.

connect_objects(objects)

Link the given objects ftrack attribute to the self name object asset_link attribute in the DCC.

objects List of DCC objects

create(name)

Creates a new dcc_object with the given name.

static dictionary_from_object(object_name)

Static method to be used without initializing the current class. Returns a dictionary with the keys and values of the given object_name if exists.

object_name ftrack object type from the DCC.

from_asset_info_id(asset_info_id)

Checks the dcc to get all the ftrack objects. Compares them with the given asset_info_id and returns them if matches.

ftrack_plugin_id = None

Plugin id used on some DCC applications

get(k, default=None)

If exists, returns the value of the given k otherwise returns default.

k : Key of the current dictionary.

default : Default value of the given Key.

property name

Return name of the object

property objects_loaded

Returns the attribute objects_loaded of the current self name

setdefault(key, value=None)

Sets a default value for the given key.

update(*args, **kwargs)

Updates the current keys and values with the given ones.

__init__(event_manager)

Initialize FtrackObjectManager with instance of EventManager

property asset_info

Returns instance of FtrackAssetInfo

connect_objects(objects)

Link the given objects ftrack attribute to the self dcc_object.

objects List of objects

create_new_dcc_object()

Creates a new dcc_object with a unique name.

property dcc_object

Returns instance of DccObject

property event_manager

Returns instance of EventManager

property is_sync

Returns if the self dcc_object is sync with the self asset_info

property objects_loaded

Returns whether the objects are loaded in the scene or not.

property session

Returns instance of ftrack_api.session.Session

class DccObject(name=None, from_id=None, **kwargs)

Bases: dict

Base DccObject class.

__init__(name=None, from_id=None, **kwargs)

If the from_id is provided find an object in the dcc with the given from_id as assset_info_id. If a name is provided create a new object in the dcc.

connect_objects(objects)

Link the given objects ftrack attribute to the self name object asset_link attribute in the DCC.

objects List of DCC objects

create(name)

Creates a new dcc_object with the given name.

static dictionary_from_object(object_name)

Static method to be used without initializing the current class. Returns a dictionary with the keys and values of the given object_name if exists.

object_name ftrack object type from the DCC.

from_asset_info_id(asset_info_id)

Checks the dcc to get all the ftrack objects. Compares them with the given asset_info_id and returns them if matches.

ftrack_plugin_id = None

Plugin id used on some DCC applications

get(k, default=None)

If exists, returns the value of the given k otherwise returns default.

k : Key of the current dictionary.

default : Default value of the given Key.

property name

Return name of the object

property objects_loaded

Returns the attribute objects_loaded of the current self name

setdefault(key, value=None)

Sets a default value for the given key.

update(*args, **kwargs)

Updates the current keys and values with the given ones.

property ftrack_object_manager

Initializes and returns an instance of FtrackObjectManager

property dcc_object

Returns the dcc_object from the FtrackObjectManager

property asset_info

Returns the asset_info from the FtrackObjectManager

property output

Returns a copy of required_output

property discover_topic

Return a formatted PIPELINE_DISCOVER_PLUGIN_TOPIC

property run_topic

Return a formatted PIPELINE_RUN_PLUGIN_TOPIC

property session

Returns instance of ftrack_api.session.Session

property event_manager

Returns instance of EventManager

property raw_data

Returns the current context id

property plugin_settings

Returns the current plugin_settings

property method

Returns the current method

__init__(session)[source]

Initialise BasePlugin with instance of ftrack_api.session.Session

plugin_id = None

Id of the plugin

register()[source]

Register function of the plugin to regiter it self.

Note

This function subscribes the plugin to two ftrack_api.event.base.Event topics:

PIPELINE_DISCOVER_PLUGIN_TOPIC: Topic to make the plugin discoverable for the host.

PIPELINE_RUN_PLUGIN_TOPIC: Topic to execute the plugin

run(context_data=None, data=None, options=None)[source]

Runs the current plugin with , context_data , data and options.

context_data provides a mapping with the asset_name, context_id, asset_type_name, comment and status_id of the asset that we are working on.

data a list of data coming from previous collector or empty list

options a dictionary of options passed from outside.

Note

Use always self.exporters as a base to return the values, don’t override self.exporters as it contains the _required_output

fetch(context_data=None, data=None, options=None)[source]

Runs the current plugin with , context_data , data and options.

context_data provides a mapping with the asset_name, context_id, asset_type_name, comment and status_id of the asset that we are working on.

data a list of data coming from previous collector or empty list

options a dictionary of options passed from outside.

Note

This function is meant to be ran as an alternative of the default run function. Usually to fetch information for the widget or to test the plugin.