python.tk_houdini.base_hooks.node_handler_base
¶
Implicit, base hook class for all node handlers.
Module Contents¶
Classes¶
Common base class for all node handlers. |
-
class
NodeHandlerBase
[source]¶ Bases:
HookBaseClass
Common base class for all node handlers.
-
_create_sgtk_folder
(self, node, use_sgtk_default=True, hou=None)[source]¶ Create the sgtk folder template.
This contains the common parameters used by all node handlers.
- Parameters
node – A
hou.Node
instance.use_sgtk_default (bool) – Whether the “Use Shotgun” checkbox is to be checked by default.
hou – The houdini module. We have to lazy load the houdini python module here, but not in the hooks, so use hook’s imports and pass it for efficiency.
-
_create_sgtk_parm_fields
(self, node, hou=None)[source]¶ Create the sgtk folder template.
This contains the common parameters used by all node handlers.
- Parameters
node – A
hou.Node
instance.use_sgtk_default (bool) – Whether the “Use Shotgun” checkbox is to be checked by default.
hou – The houdini module. We have to lazy load the houdini python module here, but not in the hooks, so use hook’s imports and pass it for efficiency.
-
_create_sgtk_parms
(self, node)[source]¶ Create the parameters that are going to live within the sgtk folder.
- Parameters
node – A
hou.Node
instance.- Return type
list(
hou.ParmTemplate
)
-
abstract
_customise_parameter_group
(self, node, parameter_group, sgtk_folder)[source]¶ Here is where you define where the sgtk folder is to be placed, but also any other parameters that you wish to add to the node.
- Parameters
node – A
hou.Node
instance.parameter_group – The node’s
ParmGroup
.sgtk_folder – A
hou.ParmFolderTemplate
containing sgtk parameters.
-
_enable_sgtk
(self, node, sgtk_enabled)[source]¶ Enable/disable the sgtk parameters.
- Parameters
node – A
hou.Node
instance.sgtk_enabled (bool) – The state to set the parameters to.
-
_get_all_versions
(self, node)[source]¶ Retrieve all the versions stored on the node.
- Parameters
node – A
hou.Node
instance.- Return type
list(int)
-
_get_parameter_group
(self, node)[source]¶ Get the given node’s parameter group.
- Parameters
node – A
hou.Node
instance.- Return type
ParmGroup
or None.
-
_get_template
(self, template_name)[source]¶ Get a shotgun template from the given name.
- Parameters
template_name (str) – The name of the template to get.
- Return type
An
sgtk.Template
instance.- Raises
sgtk.TankError
if no template name supplied or the template doesn’t exist.
-
_populate_versions
(self, node)[source]¶ Get the versions in a format to populate the “sgtk_all_versions” parameter on the node.
- Parameters
node – A
hou.Node
instance.- Returns
list(str), for example ‘[“1”, “1”, “2”, “2”, “3”, “3”]’
-
_refresh_file_path
(self, node)[source]¶ Refresh the file paths generated by the node handler.
- Parameters
node – A
hou.Node
instance.
-
abstract
_remove_sgtk_items_from_parm_group
(self, parameter_group)[source]¶ Remove all sgtk parameters from the node’s parameter template group.
- Parameters
parameter_group (ParmGroup) – The parameter group containing sgtk parameters.
-
_resolve_all_versions_from_fields
(self, fields, template)[source]¶ Using fields and a shotgun template, get all the versions on disk that relate to the current item.
- Parameters
fields (dict) – The template fields.
template – An
sgtk.Template
.
- Return type
list(int)
-
abstract
_restore_sgtk_parms
(self, node)[source]¶ Restore any removed sgtk parameters onto the given node.
- Parameters
node – A
hou.Node
instance containing sgtk parameters.
-
_set_up_init_node_values
(self, node)[source]¶ From the settings init_node_values, populate this node.
- Parameters
node – A
hou.Node
instance.
-
_set_up_node
(self, node, parameter_group, hou=None)[source]¶ Set up a node for use with shotgun pipeline.
- Parameters
node – A
hou.Node
instance.parameter_group – A
ParmGroup
instance.hou – The houdini module. We have to lazy load the houdini python module here, but not in the hooks, so use hook’s imports and pass it for efficiency.
-
_set_up_parms
(self, node)[source]¶ Set up the given node’s parameters.
- Parameters
node – A
hou.Node
instance.
-
activate_sgtk
(self, node)[source]¶ Activate Shotgun parameters and callbacks if not already.
Commonly used by
tk-multi-loader2
hooks.- Parameters
node – A
hou.Node
instance.
-
add_sgtk_parms
(self, node)[source]¶ Add sgtk parameters to the given node.
- Parameters
node – A
hou.Node
instance.
-
after_last_delete
(self, node=None)[source]¶ Method to run on houdini’s AfterLastDelete callback.
- Parameters
node – A
hou.Node
instance.
-
before_first_create
(self, node=None)[source]¶ Method to run on houdini’s BeforeFirstCreated callback.
- Parameters
node – A
hou.Node
instance.
-
static
generate_callback_script_str
(method_name)[source]¶ Helper function to generate a callback script string for houdini parameters.
-
get_publish_template
(self, node)[source]¶ Get the shotgun publish template for this node handler.
- Parameters
node – A
hou.Node
instance.- Return type
An
sgtk.Template
instance.
-
get_work_template
(self, node)[source]¶ Get the shotgun work template for this node handler.
- Parameters
node – A
hou.Node
instance.- Return type
An
sgtk.Template
instance.
-
classmethod
gracefully_error
(cls, *args, **kwargs)[source]¶ Publicly expose the
gracefully_error_hook_method()
decorator.To be used in sub-classes by any of the following ways:
# Default error message, return None upon fail @HookBaseClass.gracefully_error @HookBaseClass.gracefully_error() # Custom error message, return None upon fail @HookBaseClass.gracefully_error("boo hoo") @HookBaseClass.gracefully_error(message="boo hoo") # Default error message, return 123 upon fail @HookBaseClass.gracefully_error(default_return=123) # Custom error message, return 123 upon fail @HookBaseClass.gracefully_error("message", 123) @HookBaseClass.gracefully_error(message="message", default_return=123)
-
on_created
(self, node=None)[source]¶ Method to run on houdini’s OnCreated callback.
- Parameters
node – A
hou.Node
instance.
-
on_deleted
(self, node=None)[source]¶ Method to run on houdini’s OnDeleted callback.
- Parameters
node – A
hou.Node
instance.
-
on_input_changed
(self, node=None)[source]¶ Method to run on houdini’s OnInputChanged callback.
- Parameters
node – A
hou.Node
instance.
-
on_loaded
(self, node)[source]¶ Method to run on houdini’s OnLoaded callback.
Only refresh/register callback for when node is picked if Houdini has UI. Else don’t update export paths i.e. no UI when on farm.
- Parameters
node (hou.Node) – Node just loaded into scene upon file open.
-
on_name_changed
(self, node=None)[source]¶ Method to run on houdini’s OnNameChanged callback.
- Parameters
node – A
hou.Node
instance.
-
on_updated
(self, node=None)[source]¶ Method to run on houdini’s OnUpdated callback.
- Parameters
node – A
hou.Node
instance.
-
populate_versions
(self, kwargs)[source]¶ Callback to get the versions in a format to populate the “sgtk_all_versions” parameter on the node.
- Returns
list(str), for example ‘[“1”, “1”, “2”, “2”, “3”, “3”]’
-
refresh_file_path
(self, kwargs)[source]¶ Callback to refresh the file paths generated by the node handler.
-
refresh_file_path_from_version
(self, kwargs)[source]¶ Callback to refresh the file paths generated by the node handler when the version is updated.
-
remove_sgtk_parms
(self, node)[source]¶ Remove all sgtk parameters from the node’s parameter template group.
- Parameters
node – A
hou.Node
instance containing sgtk parameters.- Returns
Whether Shotgun parameters were removed from node.
- Return type
-
restore_sgtk_parms
(self, node)[source]¶ Restore any removed sgtk parameters onto the given node.
- Parameters
node – A
hou.Node
instance containing sgtk parameters.
-