API Reference

Configuration

class Configuration

Bases: object

buildScriptVar = 'HIVE_BUILD_SCRIPTS_PATH'
namingVar = 'HIVE_NAMING_PATH'
exportPluginVar = 'HIVE_EXPORT_PLUGIN_PATH'
containerType()

Default container type, can be asset, set or None.

Returns

The container Type

Return type

str

serialize(rig)
updateConfigurationFromRig(rig)

Updates the current configuration from the given scene rig instance.

Parameters

rig (zoo.libs.hive.base.rig.Rig) – The rig instance to pull the configuration from.

Returns

The rig configuration dict pull from the scene rig.

Return type

dict

applySettingsState(state, rig=None)
setNamingPresetByName(name)

Sets the current Naming convention preset.

Parameters

name (str) – The Preset Name.

findNamingConfigForType(hiveType, presetName=None)

Finds and returns the naming convention config for the hive Type.

The Hive Type is one of three keys either “rig”, “global” or the component Type.

Parameters
  • hiveType (str) – The Hive Type to search for, ie. componentType, “rig” or “global”

  • presetName (str or None) – The Preset to use to find the component Type

Returns

The naming configuration Manager instance

Return type

zoo.libs.naming.naming.NameManager

setBuildScripts(scriptIds)

Overrides the current build scripts applied to this configuration.

Parameters

scriptIds (list[str]) – A list of build script plugin ids

addBuildScript(scriptId)

Adds/appends the build script plugin given the id.

Parameters

scriptId (str) – The build script plugin id.

Returns

Whether the build script was added to the configuration.

Return type

bool

buildScriptConfig(rig)
static updateBuildScriptConfig(rig, config)
static setBuildScriptConfig(rig, config)

Sets the build script configuration on the provided rig.

Note

Must be json compatible.

The configData is in the following form.

{
    "buildScriptId": {"propertyName": "propertyValue"}
}
Parameters
removeBuildScript(scriptId)

Removes the build script from this rig configuration.

Note

This will not remove any script specified in userPreferences which act as the default for all rigs.

Parameters

scriptId (str) – The script Id for the buildScript instance to remove

Returns

True if removed

Return type

bool

exportPluginForId(pluginId)

Retrieves the exporter plugin class callable by ID.

If the plugin id has been overridden in the hive preferences then use that ID instead.

Parameters

pluginId (str) – The hive exporter plugin id.

Returns

The plugin id which matches the request.

Return type

callable[zoo.libs.hive.base.exporterplugin.ExporterPlugin] or None

componentRegistryObject(componentType)
Parameters

componentType (str) – the component type string

Returns

Return type

zoo.libs.hive.base.component.Component

loadComponentDefinition(componentType)
initComponentDefinition(componentType)
templatePaths()

Returns all current Registered search paths for Templates.

Return type

list[str]

graphPaths()
componentPaths()

Returns all current Registered search paths for Components.

Return type

list[str]

definitionPaths()

Returns all folder search paths registered for the definition files.

Return type

list[str]

static buildScriptPaths()

Returns all current build script paths from the environment variable as a list.

Return type

list[str]

static controlShapeNames()

Returns all the control shape names from the shape library.

Return type

list(str)

classmethod componentRegistry()

Returns the current component registry instance.

Return type

registry.ComponentRegistry

classmethod templateRegistry()

Returns the current template registry instance.

Return type

registry.TemplateRegistry

classmethod graphRegistry()

Returns the current graph registry instance.

Return type

registry.GraphRegistry

classmethod buildScriptRegistry()

Returns the current build script registry instance.

Return type

pluginmanager.PluginManager

classmethod exporterPluginRegistry()

Returns the current build script registry instance.

Return type

pluginmanager.PluginManager

classmethod namePresetRegistry()
Returns

Return type

:class:` namingpresets.PresetManager`

reload(reloadPlugins=False)
initializeComponentRegistry(reload=False)
initializeTemplateRegistry(reload=False)
initializeGraphRegistry(reload=False)
initializeBuildScriptRegistry(preferenceInterface, reload=False)
initializeExporterRegistry(preferenceInterface, reload=False)
initializeNamingPresetManager(preferencesInterface, reload=False)

Registry

class ComponentRegistry(*args, **kwargs)

Bases: object

This class manages and stores a collection of component objects from the component library, this class is a singleton and is responsible for returning the creation of component objects and definitions.

refresh()

Refreshes the library by clearing the registry then rediscovering the component plugins

initComponentDefinition(name)

Creates and returns a new ComponentDefinition instance based on the name parameter

Parameters

name (str) – the componentType

Return type

baseDef.ComponentDefinition or None

fromMetaNode(rig, metaNode)

Create a new component of a specified type and attach it to a rig.

Parameters
  • rig (Rig) – The rig to which the new component will be attached.

  • metaNode (zoo.libs.hive.base.hivenodes.HiveComponent) – The metadata for the new component.

Raises

MissingRootTransform – If the provided metaNode does not have a root transform.

Returns

A new component of the specified type, initialized with the provided rig and metaNode.

Return type

zoo.libs.hive.base.component.Component

findComponentByType(name)

Find and return the component class object from the registry.

Parameters

name (str) – the component name, currently the class name

Returns

callable[zoo.libs.hive.base.component.Component]

loadComponentDefinition(componentName)

Loads the definition file for the component in the registry using json.

Parameters

componentName (str) – the component name currently the class name

Returns

the definition dict

Return type

dict

saveComponentDefinition(definition)

Saves the definition object by overwrite the existing one.

Parameters

definition (baseDef.ComponentDefinition) – The definition object to save.

Return type

bool

componentData(name)

returns the registry component dict

Parameters

name (str) – the component type to get

Returns

{“object”: object(), “path”: str, “definition”: str } # the definition name :rtype: dict

discoverComponents()

Searches the component library specfied by the environment variable “ZOO_HIVE_COMPONENT_PATH”

class TemplateRegistry(*args, **kwargs)

Bases: object

Class to handle hive templates, templates are the serialized form of a rig.

property templates

A property that returns a dictionary of templates in the form of {“templateName”: “templatePath”}.

Returns

A dictionary where the keys are template names and the values are template file paths.

Return type

dict

refresh()

Refreshes the library by clearing the registry then rediscovering the component plugins

saveLocation()

Returns the current save folder path from the zoo preferences.

Return type

str

saveTemplate(name, template, templateRootPath=None, overwrite=False)

Save a template to the specified location on the file system.

Parameters
  • name (str) – The name of the template.

  • template (dict) – The template data to be saved.

  • templateRootPath (str, optional) – The root directory where the template should be saved. If not specified, the default save location will be used.

  • overwrite (bool, optional) – Indicates whether to overwrite an existing template with the same name. If False and a template with the same name already exists, a TemplateAlreadyExistsError will be raised.

Raises
  • TemplateAlreadyExistsError – If a template with the same name already exists and overwrite is False.

  • IOError – If there was an error writing the template to the specified file path.

Returns

The file path where the template was saved.

Return type

str

saveComponentsAsTemplate(rig, components, name, templateRootPath, overwrite)

Save the specified components as a template.

Parameters
  • rig (Rig) – The rig containing the components.

  • components (list) – The components to be saved as a template.

  • name (str) – The name of the template.

  • templateRootPath (str) – The root directory where the template should be saved.

  • overwrite (bool) – Indicates whether to overwrite an existing template with the same name. If False and a template with the same name already exists, a TemplateAlreadyExistsError will be raised.

Returns

The file path where the template was saved.

Return type

str

renameTemplate(name, newName)

Rename a template.

Parameters
  • name (str) – The current name of the template.

  • newName (str) – The new name for the template.

Raises

OSError – If there was an error renaming the template file.

deleteTemplate(name)

Delete a template with the specified name.

Parameters

name (str) – The name of the template to delete.

Raises

OSError – If there was an error deleting the template file.

Returns

True if the template was successfully deleted, False otherwise.

Return type

bool

hasTemplate(name)

Checks whether the registry contains the template with the name.

Parameters

name (str) – The template name to check.

Returns

Returns True if the template exists in the registry.

Return type

bool

template(name)

Returns the rig template dict from the registry

Parameters

name (str) – the template name

Returns

The loaded template dict

Return type

dict

templatePath(name)

Get the file path for the template with the specified name.

Parameters

name (str) – The name of the template.

Returns

The file path for the template with the specified name, or an empty string if no template with the given name was found.

Return type

str

addTemplate(path)

Add a template to the registry.

Parameters

path (str) – The file path for the template.

discoverTemplates()

Discovers all templates in the given paths and stores them in the registry.

class GraphRegistry(*args, **kwargs)

Bases: object

Class to handle hive DependencyGraphs.

This class is a singleton, meaning that there will always be only one instance of it.

property graphs

Get the dictionary of graph names to file paths for all graphs in the registry.

Returns

A dictionary of graph names to file paths.

Return type

dict

refresh()

Refreshes the library by clearing the registry then rediscovering the component plugins

saveGraph(name, namedGraph)

Save a graph with the specified name.

Parameters
Returns

The file path where the graph was saved.

Return type

str

renameGraph(name, newName)

Rename a graph in the registry.

Parameters
  • name (str) – The current name of the graph.

  • newName (str) – The new name for the graph.

hasGraph(name)

Checks whether the registry contains the graph with the name.

Parameters

name (str) – The graph name to check.

Returns

Returns True if the template exists in the registry.

Return type

bool

graph(name)

Returns the rig template dict from the registry

Parameters

name (str) – the graph name

Returns

Return type

baseDef.NamedGraph

graphPath(name)

Returns the file path of the graph with the given name.

Parameters

name (str) – The name of the graph to find.

Returns

The file path of the graph.

Return type

str

addGraph(path)

Add a graph to the registry.

Parameters

path (str) – The file path of the graph to add.

discoverTemplates()

Find all graph files in the graph roots and add them to the registry.

Errors

exception HiveError(msg='', *args, **kwargs)

Bases: Exception

msg = ''
exception HiveRigDuplicateRigsError(dupes, *args, **kwargs)

Bases: HiveError

msg = 'Duplicate rigs in the scene, please use namespace filtering: {}'
exception ComponentDoesntExistError(msg='', *args, **kwargs)

Bases: HiveError

msg = "Component doesn't exist in the scene: "
exception ComponentGroupAlreadyExists(msg='', *args, **kwargs)

Bases: HiveError

msg = 'Component group already exists for this rig instance'
exception TemplateAlreadyExistsError(msg='', *args, **kwargs)

Bases: HiveError

msg = 'Template path: {} already exists!'
exception TemplateMissingComponents(msg='', *args, **kwargs)

Bases: HiveError

msg = 'No Components specified in template: {}'
exception TemplateRootPathDoesntExist(msg='', *args, **kwargs)

Bases: HiveError

msg = "Template root path doesn't exist on disk: {}"
exception InvalidInputNodeMetaData(msg='', *args, **kwargs)

Bases: HiveError

msg = 'InputLayer meta data is missing inputNode connection'
exception InvalidOutputNodeMetaData(msg='', *args, **kwargs)

Bases: HiveError

msg = 'OutputLayer meta data is missing outputNode connection'
exception InitializeComponentError(componentName, *args, **kwargs)

Bases: HiveError

msg = 'Failed to initialize component: {}'
exception MissingRootTransform(metaName, *args, **kwargs)

Bases: HiveError

msg = 'Missing Root transform on meta node: {}'
exception RootNamespaceActiveError(msg='', *args, **kwargs)

Bases: HiveError

msg = 'Current namespace is already the root'
exception BuildComponentGuideUnknownError(msg='', *args, **kwargs)

Bases: HiveError

msg = 'Unknown build guide error'
exception BuildComponentDeformUnknownError

Bases: Exception

msg = 'Unknown build Deform error'
exception BuildComponentRigUnknownError(msg='', *args, **kwargs)

Bases: HiveError

msg = 'Unknown build Rig error'
exception BuildError(msg='', *args, **kwargs)

Bases: HiveError

exception MissingRigForNode(msg='', *args, **kwargs)

Bases: HiveError

msg = 'Node is not attached to a rig'
exception MissingMetaNode(msg='', *args, **kwargs)

Bases: HiveError

msg = 'Attached meta node is not a valid hive node'
exception MissingComponentType(componentName, *args, **kwargs)

Bases: HiveError

msg = 'Missing component of type: {}, from the hive component registry'
exception ComponentNameError(componentName, *args, **kwargs)

Bases: NameError

msg = 'Component by the name: {}, already exists!'
exception MissingJoint(jointId, *args, **kwargs)

Bases: NameError

msg = 'Missing Joint by id : {}'
exception MissingControlError(msg='', *args, **kwargs)

Bases: HiveError

msg = 'Missing Control by id : {}'
exception UnSupportedConnectableNode(msg='', *args, **kwargs)

Bases: HiveError

msg = "Attempting to connect to unsupported guide: '{}'"
exception InvalidDefinitionAttrExpression

Bases: Exception

exception InvalidDefinitionAttrForSceneNode

Bases: Exception