Hive Commands¶
Hive Commands are subclasses of zoo.libs.command.command.ZooCommandMaya
but are solely built around hive
operation’s.
Hive api is intentionally not undoable but we do have our way’s of making an operation undoable
and that’s what Hive Commands are for.
The general workflow is to use the api directly for queries but for state changes use hive commands
if a hive command doesn’t exist then create one see zoo.libs.command.command.ZooCommandMaya
for more information.
- createRig(name=None, namespace=None)¶
Creates a new instance of a rig or returns the existing one
- Parameters:
name – Create rig with string name, if empty hive will generate a new rig name
namespace –
- Returns:
- renameRig(rig, name)¶
Renames rig to new name
- Parameters:
rig (
zoo.libs.hive.base.rig.Rig
) – The Hive Rigname – New name as string
- Returns:
- deleteRig(rig)¶
Delete hive rig
- Parameters:
rig (
zoo.libs.hive.base.rig.Rig
) –- Returns:
- createComponents(rig, components, buildGuides=False, buildRigs=False, parentNode=None)¶
Create components under the specified rig
- Parameters:
rig (
zoo.libs.hive.base.rig.Rig
) –components (list[dict]) – [{“type”: “”, “name”:””, “side”: “”}, …]
buildGuides (bool) –
buildRigs (bool) –
parentNode –
- Returns:
- deleteComponents(rig, components, children=True)¶
Delete components from rig
- Parameters:
children (bool) – If True will recursively delete all connected child components.
- duplicateComponents(rig, sources)¶
Duplicate component
Sources takes the format of
- [{“component”: component,
“name”: name, “side”: side, “parent”: parent}, …]
- Parameters:
sources (list[dict]) – Components to duplicate.
- updateGuideSettings(component, settings)¶
Execute update guide settings
- showComponents(components)¶
Shows a component in the scene
- Parameters:
components (list[
zoo.libs.hive.base.component.Component
]) – Hive component to show
- hideComponents(components)¶
Hides a component in the scene
- Parameters:
components (list[
zoo.libs.hive.base.component.Component
]) – Hive component to hide
- toggleBlackBox(components, save=True)¶
Toggle Black box for components
- Parameters:
components (list[zoo.libs.hive.base.component.Component]) – List of components
save (bool) – If True the black box state will be saved with the rig.
- setComponentParent(parentComponent, parentGuide, childComponent)¶
Set Parent of Component
- Parameters:
parentComponent (
zoo.libs.hive.base.component.Component
) –parentGuide (
zoo.libs.hive.base.hivenodes.hnodes.Guide
) –childComponent (zoo.libs.hive.base.component.Component) –
- setComponentSide(component, side)¶
Sets the component side (eg. L, R, etc)
- Parameters:
component (
zoo.libs.hive.base.component.Component
) – The components to change.side (str) – The side the change the component to
- renameComponent(component, name)¶
Rename component to new name excluding the side label
- Parameters:
component (
zoo.libs.hive.base.component.Component
) – The components to rename.name (str) – The new name for the component
- matchIKFK(components, state, frameRange=None, bakeEveryFrame=True)¶
Switches between IK FK while matching the transforms of the joints/controls.
- Parameters:
components (list[
zoo.libs.hive.base.component.Component
]) – The list of IKFK components to switchstate (int) – 0 for IK 1 for FK.
frameRange (list[int, int] or None) – The frame range to bake or None if setting the current frame only.
bakeEveryFrame (bool) – When bake frames this determine whether bake every frame or update existing.
- FixFkRotations(components)¶
Fixes the FK rotations on the specified components. This is necessary when the animator rotates off the main rotation axis ie. Z where the twist joints won’t compensate for.
- Parameters:
components (list[
zoo.libs.hive.base.component.Component
]) – List of IKFK components to fix the fk mid joint rotations
- recalculatePoleVector(components, frameRange=None, bakeEveryFrame=True)¶
Recalculates the pole vector for component which contain ik.
- Parameters:
components (list[
zoo.libs.hive.base.component.Component
]) – The list of ik components to set the pole vector position for.frameRange (list[int, int] or None) – The frame range to bake or None if setting the current frame only.
bakeEveryFrame (bool) – When bake frames this determine whether bake every frame or update existing.
- setDeformVisibility(rig, state=False)¶
Sets the visibility of the deformation Layer of every component in the rig
- Parameters:
rig (
zoo.libs.hive.base.rig.Rig
) – The hive rig instance.state (bool) – the visibility state to set too
- mirrorComponents(rig, components)¶
Mirrors the provided components.
- Parameters:
rig (
api.Rig
) – The rig instancecomponents (list[dict[
:class:`zoo.libs.hive.base.component.Component
, bool, tuple[str], str, str]]) – A dict of components to mirror
- Returns:
- Return type:
components argument values:
list[ dict[component :class:`:class:`zoo.libs.hive.base.component.Component` : The component instance to mirror. duplicate bool: Whether to duplicate then mirror or mirror in place. translate tuple[str]: list of axis to mirror translation on. rotate str : mirror plane "yz", "xz", "xy". side str: The newly created component side value. ]]
- applySymmetry(rig, components)¶
- buildGuides(rig)¶
Builds the provided rig guide system.
- Parameters:
rig (
rig.Rig
) – The rig Instance
- buildDeform(rig)¶
Builds the rigs Deformation Layer
- Parameters:
rig (
rig.Rig
) – The rig instance to build- Returns:
True if the build succeeded.
- Return type:
- buildRigs(rig)¶
Builds the provided rig instance Rig Layer.
- Parameters:
rig (
api.Rig
) – The rig instance to build- Returns:
True if succeeded.
- Return type:
- polishRig(rig)¶
Runs polishRig() on the provide rig instance.
Note
Currently this isn’t undoable.
- Parameters:
rig (
api.Rig
) – The rig instance to polish- Returns:
Returns True if successful
- Return type:
- saveTemplate(rig, name, components=None, overwrite=True)¶
Saves the provide rig instance and components to the template library with the registered name.
- Parameters:
- Returns:
The Template path which was exported
- Return type:
- loadTemplate(filePath, rig=None, name=None)¶
Loads the provided filepath as a hive template and either creates or updates the rig.
- Parameters:
- Returns:
Rig instance and a list of created components.
- Return type:
tuple[
api.Rig
, dict[str,api.Component
]
- deleteTemplate(name)¶
Delete a Hive template based on the provided name.
- Parameters:
name (str) – the Template name to delete
- updateRigConfiguration(rig, settings)¶
Updates a set of rig configuration settings.
- setFkGuideParent(parentGuide, childGuides)¶
Re parents the children guides(first selected) to the parent Guide(last Selected)
- Parameters:
parentGuide (
api.Guide
) – The parent Fk guide for the child to re-parent too.childGuides (list[
api.Guide
]) – The child FK guides to re-parent
- Returns:
True if successful
- Return type:
- addFkGuide(components)¶
Creates a new guide for each provided node if that node is linked to a FKChain Component.
- Parameters:
components (dict[
api.Component
, list[zapi.DagNode
]]) – A list of components to show guides for- Returns:
True if successful
- Return type:
- autoAlignGuides(components)¶
Realign all provided component guides. This includes realigning the rotations using the guide settings for autoAlign.
- Parameters:
components (list[
api.Component
]) – The list of hive components which support twists.
- setGuideLRA(components, visibility=True)¶
Sets all LRA shape visibility on the guides for the given components.
- Parameters:
components (list[api.Component]) – Components to set.
visibility (bool) – Visibility state.
- setGuidesWorldMatrices(guides, matrices)¶
Sets all given guide worldMatrices to the given matrices. This command will appropriately maintain all child guide transforms
- Parameters:
guides (list[
zapi.DagNode
] or list[zoo.libs.hive.base.hivenodes.Guide
]) – The guides to set.matrices (list[
zapi.Matrix
]) – The matrices to set.
- updateRigFromTemplateData(rig, templateData, remapData)¶
Updates the rig instance with the template.
It is important to note that this function will completely wipe out all meta-data for each component, except for the component meta node. However, all deform Joints will be maintained.
- Parameters:
rig (
zoo.libs.hive.base.rig.Rig
) – The rig instance to update with the template.templateData (dict) – The template dict which will override the rigInstance.
remapData (dict) – The remapping between the rig and the template components