base_import_handler
¶
Base Hook for other Houdini import node handlers.
These include:
alembic_import_handler
file_handler
image_handler
Module Contents¶
Classes¶
Base class for all import node handlers. |
-
class
ImportNodeHandler
[source]¶ Bases:
HookBaseClass
Base class for all import node handlers.
-
_convert_path_to_houdini_seq
(self, path)[source]¶ Convert incoming sequence paths into houdini formatted ones. ($F4)
- Parameters
path (str) – The incoming file path.
- Returns
A houdini-formatted sequence path.
-
_create_sgtk_folder
(self, node)[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.
-
_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
)
-
_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.
-
static
_escape_publish_data
(publish_data_str)[source]¶ Utility to escape publish data strings for json loading.
- Parameters
publish_data_str (str) – The serialised publish data.
- Returns
A string that json can deal with.
-
static
_extract_versions
(versions_and_statuses)[source]¶ Extract just the versions from the versions and statuses dict.
-
_get_all_versions
(self, node)[source]¶ Get all the available versions off the given node.
- Parameters
node – A
hou.Node
instance.- Return type
list(int)
-
_get_file_versions
(self, node)[source]¶ Get all the file versions from the stored data on this node.
- Parameters
node – A
hou.Node
instance.- Return type
list(int)
-
_get_node_file_parms
(self, parent_node)[source]¶ Get all the parameters on the given node that are of the type
hou.stringParmType.FileReference
.- Parameters
parent_node – A
hou.Node
instance.- Return type
list(str)
-
static
_get_search_filters_from_publish_data
(publish_data)[source]¶ Construct search filters from the publish data.
- Parameters
publish_data (dict) – The publish data to use for the query.
- Return type
list
-
_get_template_fields_and_work_versions
(self, parent_node, parm_name)[source]¶ Get the template, template fields and all versions from the file path associated with the given node and parameter name.
This method will initially use the node handler for the given node to retrieve the template, then falls back to
sgtk.Sgtk.template_from_path()
.If no template can be found, all versions will be calculated using regexes that look for v# in the file path.
- Parameters
parent_node – The node to retrieve the data from.
parm_name – The name of the parameter that contains the file path.
- Returns
A
tuple
ofsgtk.Template
, dict and list(int)
-
_get_work_versions
(self, node)[source]¶ Get all the versions from the stored data on this node.
- Parameters
node – A
hou.Node
instance.- Return type
list(int)
-
_load_from_shotgun
(self, node)[source]¶ Open a shotgun loader dialogue and populate the node from the selection made.
- Parameters
node – A
hou.Node
instance.
-
_path_selection
(self, node)[source]¶ Get the index of the current path selection.
- Parameters
node – A
hou.Node
instance.- Return type
-
_populate_from_file_data
(self, node)[source]¶ Populate the node’s File tab from the saved file data.
- Parameters
node – A
hou.Node
instance.
-
_populate_from_work_file_data
(self, node)[source]¶ Populate the node’s work file tab from the saved work file data.
- Parameters
node – A
hou.Node
instance.
-
_refresh_file_path
(self, node)[source]¶ Refresh the file paths generated by the node handler.
- Parameters
node – A
hou.Node
instance.
-
_refresh_file_path_from_node
(self, node)[source]¶ Use another node to populate the file path on this node.
- Parameters
node – A
hou.Node
instance.
-
_refresh_file_path_from_path
(self, node)[source]¶ Use another file path to update the file path on this node.
- Parameters
node – A
hou.Node
instance.
-
_refresh_file_path_from_publish_data
(self, node, publish_data)[source]¶ Refresh the file path from the given publish data.
- Parameters
node – A
hou.Node
instance.publish_data (dict) – The publush data to populate from.
-
_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.
-
_replace_version_in_path
(self, path, version)[source]¶ Replace the version numbers in the file path with the given version.
- Parameters
path – The old version path.
version – The version number to update the path to.
- Returns
The updated file path.
-
_resolve_all_versions_from_path
(self, path)[source]¶ Extract all the versions on disk from the given file path.
Looks for v# in the path to determine the version number.
If the path exists on disk, but does not contain a version number, 1 will be returned. An empty list will be returned if no files exist on disk.
- Parameters
path – The path to check against.
- Return type
list(int)
-
_resolve_all_versions_statuses
(self, publish_data)[source]¶ Get all the available versions and their pipeline statuses from the given entity publish data.
-
_resolve_version
(self, all_versions_and_statuses, current)[source]¶ From a given string, resolve the current version. Either a specified version or the next version in the sequence.
-
_resolve_work_version
(self, all_versions, current)[source]¶ From a given string, resolve the current version. Either a specified version or the next version in the sequence.
-
_restore_sgtk_parms
(self, node)[source]¶ Restore any removed sgtk parameters onto the given node.
- Parameters
node – A
hou.Node
instance containing sgtk parameters.
-
_retrieve_publish_data
(self, node)[source]¶ Retrieve publish data off the given node.
- Parameters
node – A
hou.Node
instance.- Return type
-
_set_up_node
(self, node, parameter_group)[source]¶ Set up a node for use with shotgun pipeline.
- Parameters
node – A
hou.Node
instance.parameter_group – A
ParmGroup
instance.
-
_update_publish_data_parm
(self, node, publish_data, version_policy)[source]¶ Update the publish data parm on the node with the publish data and version policy.
-
_update_version_from_publish_data
(self, node, publish_data, version_policy)[source]¶ Update the version parameter from the given publish data and version policy.
-
static
_validate_publish_data
(publish_data)[source]¶ Validate the publish data.
Must include: - entity - project - name - published_file_type
- Return type
-
get_input_paths
(self, node)[source]¶ Get all the input paths from the given node.
- Parameters
node – A
hou.Node
instance containing sgtk parameters.- Return type
list(str)
-
load_from_shotgun
(self, kwargs)[source]¶ Callback to open a shotgun loader dialogue and populate the node from the selection made.
-
on_loaded
(self, node)[source]¶ Extended to ensure versions are also refreshed on farm i.e. no UI.
- Parameters
node (hou.Node) – Node just loaded into scene upon file open.
-
populate_file_versions
(self, kwargs)[source]¶ Populate the file versions menu with all available versions and <LATEST>.
- Return type
list(str)
-
populate_node_from_publish_data
(self, node, publish_data, version_policy=None)[source]¶ Populate the node from the given publish data.
Populate the parameter name menu.
- Return type
list(str)
-
populate_work_versions
(self, kwargs)[source]¶ Populate the work versions menu with all available versions and <LATEST>.
- Return type
list(str)
-
refresh_file_path_from_version
(self, kwargs)[source]¶ Callback to refresh the file paths generated by the node handler when the version is updated.
-
refresh_from_file_path
(self, kwargs)[source]¶ Callback to refresh the file path when the File tab is active.
-
refresh_from_file_selection
(self, kwargs)[source]¶ Callback to refresh the node’s file path when the file selection is changed.
-
refresh_from_file_version
(self, kwargs)[source]¶ Callback to refresh the file path when the file version parameter is changed.
-
refresh_from_node_selection
(self, kwargs)[source]¶ Call back to refresh the file path when the node selection is changed.
-
refresh_from_parm_selection
(self, kwargs)[source]¶ Callback to refresh the file path when the parameter selection is changed.
-
refresh_from_selection
(self, kwargs)[source]¶ Callback to refresh the node’s file path when the tab selection changes.
-
refresh_from_work_version
(self, kwargs)[source]¶ Callback to refresh the file path when the work version parameter is changed.
-