base_export_handler

Base Hook for other Houdini export/output node handlers.

These include:

  • base_cache_handler
    • alembic_handler

    • geometry_handler

  • base_render_handler
    • arnold_handler

    • ifd_handler

Module Contents

Classes

ExportNodeHandler

Base class for all export handlers.

HookBaseClass[source]
exception FieldInputError(regex, invalid_value)[source]

Bases: ValueError

Error for when a parameter field is entered incorrectly. Example:

>>> regex = r"^[a-zA-Z0-9]*$"
>>> text = "--- nope ---"
>>> if not re.match(regex, text):
...     raise FieldInputError(regex, text)
...
Traceback (most recent call last):
  File "<string>", line 1, in <module>
FieldInputError: Input does not match "^[a-zA-Z0-9]*$": "--- nope ---"
TEMPLATE = Input does not match "{}": "{}"[source]
class ExportNodeHandler[source]

Bases: HookBaseClass

Base class for all export handlers.

Build the basic parameter templates for all export node types.

DEFAULT_ERROR_STRING = 'Element' not specified[source]
NEXT_VERSION_STR = <NEXT>[source]
OPTIONAL_KEYS = sgtk_optional_keys[source]
OUTPUT_PARM[source]
SGTK_ELEMENT = sgtk_element[source]
SGTK_LOCATION = sgtk_location[source]
SGTK_VARIATION = sgtk_variation[source]
USING_NEXT_VERSION = sgtk_using_next_version[source]
VERSION_POLICIES[source]
_add_optional_key_parm(self, node, parameter_group)[source]

Add special parameter to node to store optional template keys and their values.

Parameters
  • node – A hou.Node instance.

  • parameter_group – The node’s ParmGroup.

_add_using_next_parm(self, node, parameter_group)[source]

Add special parameter to node to store the last state of the version drop down.

Parameters
  • node – A hou.Node instance.

  • parameter_group – The node’s ParmGroup.

_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.

_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)

_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_optional_fields(self, node, template)[source]

Get the optional fields from the sgtk_optional_keys parm.

Parameters
  • node – A hou.Node instance.

  • template – An sgtk.Template instance.

Return type

dict

_get_output_path_and_templates_for_parm(self, node, parm_name, work_template, publish_template, paths_and_templates, is_deep=False)[source]

Get the output path and the templates used for the given parm.

Parameters
  • node – A hou.Node instance.

  • parm_name (str) – The name of the parameter to query.

  • work_template – The work sgtk.Template for this parm.

  • publish_template – The publish sgtk.Template for this parm.

  • paths_and_templates (list) – The current list of paths and templates to append to.

  • is_deep (bool) – Is the parm a deep output or not.

_get_output_paths_and_templates(self, node)[source]

Go through the node’s specified parameters and get the output paths, work and publish templates.

Returns a list of dictionaries, each containing, at least: - work template - publish template - file name

and optionally: - any sequence paths - whether the output is a deep image

Parameters

node – A hou.Node instance.

Return type

list(dict)

_get_sequence_glob_path(self, path, template, fields)[source]

From the given path, shotgun template and fields, derive a glob search path.

Parameters
  • path (str) – The path.

  • template – The relating sgtk.Template.

  • fields (dict) – The template fields.

Returns

The glob path.

_get_sequence_paths(self, path, template, fields)[source]

Get all the paths relating to a sequence.

Parameters
  • path (str) – The sequence path.

  • template – An sgtk.Template.

  • fields (dict) – The template fields.

Returns

A list of file paths

_get_template_for_file_path(self, node, file_path)[source]

Get the template for the given file path. For the most part, this will liekly be the work_template.

Parameters
  • node – A hou.Node instance.

  • file_path (str) – The file path the check against.

Return type

sgtk.Template

_make_sgtk_compliant_path(self, path, template)[source]

Take the path and make the sequence field shotgun compliant (%04d).

Parameters
Return type

str

_populate_from_fields(self, node, fields)[source]

Populate the node from template fields.

Parameters
  • node – A hou.Node instance.

  • fields (dict) – The template fields.

_populate_from_file_path(self, node, file_path)[source]

Populate a node’s sgtk parms from a file path. If the file path doesn’t match the template, disable the use of shotgun on this node.

Parameters
  • node – A hou.Node instance.

  • file_path (str) – The file path to populate from.

_refresh_file_path(self, node)[source]

Refresh the file paths generated by the node handler.

Parameters

node – A hou.Node instance.

_resolve_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.

Parameters
  • all_versions (list(int)) – All the existing versions.

  • current (str) – The currently selected version option.

Return type

int

_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_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.

_set_up_parms(self, node)[source]

Set up the given node’s parameters.

Parameters

node – A hou.Node instance.

_set_version(self, node, current_version)[source]

Set the index of the versions drop down from the given version.

Parameters
  • node – A hou.Node instance.

  • current_version (int) – The version to set.

_update_all_versions(self, node, all_versions)[source]

Update all the versions that exist on disk.

Parameters
  • node – A hou.Node instance.

  • all_versions (list(int)) – Updated list of all versions.

_update_optional_keys(self, node, template, fields)[source]

Update the optional keys parameter to include the currently ‘in use’ fields and their values.

Parameters
  • node – A hou.Node instance.

  • template – An sgtk.Template.

  • fields (dict) – The template fields.

_update_template_fields(self, node, fields)[source]

Update template fields from the node’s parameter values.

Parameters
  • node – A hou.Node instance.

  • fields (dict) – Template fields.

_validate_input(self, input_value)[source]

Validate the user input. Must be alphanumeric.

Parameters

input_value (str) – The input value.

Raises

FieldInputError when the validation fails.

_validate_parm(self, parm)[source]

Run the validation on the given parameter. Resets the parm to empty if fails and shows a message box to inform the user.

Parameters

parm – A hou.Parm instance.

Returns

bool. The status of the validation. True is a pass.

static get_optional_keys(template)[source]

Get the optional keys from the given template.

Parameters

template – An sgtk.Template instance.

Return type

list(sgtk.TemplateKey)

get_output_paths_and_templates(self, node)[source]

Go through the node’s specified parameters and get the output paths, work and publish templates.

Parameters

node – A hou.Node instance.

Return type

list(dict)

on_name_changed(self, node=None)[source]

Method to run on houdini’s OnNameChanged callback.

Parameters

node – A hou.Node instance.

refresh_file_path_from_version(self, kwargs)[source]

Callback to refresh the file paths generated by the node handler when the version is updated.

validate_parm_and_refresh_path(self, kwargs)[source]

Callback to validate the parm and refresh the file path accordingly.