hooks.tk-multi-loader2.tk-katana_actions module¶
Hook that loads defines all the available actions, broken down by publish type. Copied from tk-katana_actions
-
class
KatanaActions
(*args, **kwargs)¶ Bases:
sphinx.ext.autodoc.importer._MockObject
-
execute_action
(name, params, sg_publish_data)¶ Execute a given action.
The data sent to this be method will represent one of the actions enumerated by the
generate_actions
method.Parameters: - name (str) – Action name string representing one of the items
returned by
generate_actions
. - params – Params data, as specified by
generate_actions
. - sg_publish_data (dict[str]) – Shotgun data dictionary with all the standard publish fields.
- name (str) – Action name string representing one of the items
returned by
-
execute_multiple_actions
(actions)¶ Executes the specified action on a list of items.
The default implementation dispatches each item from
actions
to theexecute_action
method.The
actions
is a list of dictionaries holding all the actions to execute. Each entry will have the following values:name
: Name of the action to executesg_publish_data
: Publish information coming from Shotgunparams
: Parameters passed from thegenerate_actions
hook
Note
This is the default entry point for the hook. It reuses the
execute_action
method for backward compatibility with hooks written for the previous version of the loader.Note
The hook will stop applying the actions on the selection if an error is raised midway through.
Parameters: actions (list[dict]) – Action dictionaries.
-
generate_actions
(sg_publish_data, actions, ui_area)¶ Get a list of action instances for a particular publish.
This method is called each time a user clicks a publish somewhere in the UI. The data returned from this hook will be used to populate the actions menu for a publish.
The mapping between Publish types and actions are kept in a different place (in the configuration) so at the point when this hook is called, the loader app has already established which actions are appropriate for this object.
The hook should return at least one action for each item passed in via the
actions
parameter.This method needs to return detailed data for those actions, in the form of a list of dictionaries, each with name, params, caption and description keys.
Because you are operating on a particular publish, you may tailor the output (caption, tooltip etc) to contain custom information suitable for this publish.
The
ui_area
parameter is a string and indicates where the publish is to be shown:- If it will be shown in the main browsing area, “main” is passed.
- If it will be shown in the details area, “details” is passed.
- If it will be shown in the history area, “history” is passed.
Please note that it is perfectly possible to create more than one action “instance” for an action! You can for example do scene introspection - if the action passed in is “character_attachment” you may for example scan the scene, figure out all the nodes where this object can be attached and return a list of action instances: “attach to left hand”, “attach to right hand” etc. In this case, when more than one object is returned for an action, use the params key to pass additional data into the run_action hook.
Parameters: - sg_publish_data (dict[str]) – Shotgun data dictionary with all the standard publish fields.
- actions (list[str]) – Action strings which have been defined in the app configuration.
- ui_area (str) – String denoting the UI Area (see above).
Returns: List of dictionaries, each with keys name, params, caption and description.
Return type: list[dict[str]]
-