zBuilder package

Subpackages

Submodules

zBuilder.commands module

Module contains public commands for Ziva VFX operations.

zBuilder.commands.clean_scene()[source]

Deletes all Ziva nodes in scene. Effectively cleaning it up.

zBuilder.commands.copy_paste_with_substitution(regular_expression, string_to_substitute_matches_with)[source]

Copy/Pastes the Ziva objects of the selected objects onto non-Ziva-rigged objects whose names are defined using regular expressions.

This is useful, for example, for mirroring a Ziva rig, rig one side of the character first, then use this command to automatically “copy” the rig to the other side. Of course, objects must follow a proper naming convention, such as l_humerus, r_humerus, or similar.

The specific naming convention is defined via a regular expression and a string with which to replace any regular expression matches. For example, if the regular expression is ^l_ and the string to substitute with is r_, then all instances of geometry that begin with r_ will be rigged in the same way as the corresponding geometry that begins with l_. The selected objects should come from exactly one solver. Upon exiting, the command selects a few common Ziva node types (zTissue, zBone, zCloth), for better visual feedback to the user.

Deprecated since version 2.2.0: This method is deprecated and will be removed in future. Use mirror() instead.

zBuilder.commands.load_rig(file_name, solver_name=None)[source]

Load a Ziva rig from a file. The requisite geometry must already be in the scene.

If solver_name is not provided, the rig is applied to the solver stored in the zBuilder file. If solver_name is provided, replace the name of the solver stored in the zBuilder file with the given solver_name, and apply the rig to that solver.

Example code:

from zBuilder import commands as vfx_cmds
vfx_cmds.load_rig(file_name)
zBuilder.commands.merge_solvers(solver_transforms)[source]

Given a list of zSolverTransform nodes, merge them all into the first solver.

The zSolverTransform, zSolver, and zEmbedder nodes for all but the first solver in the list will be deleted. If that’s not possible, such as when the solvers are referenced nodes, those solvers will remain in the scene but be empty. They will have no bones, tissues, cloth, attachments, etc.

The first solver keeps all of its attribute values and connections. Any differences between this solver and the others is ignored.

All other nodes (besides the zSolverTransform, zSolver, and zEmbedder) are re-wired to connect to the first solver. All existing attributes, connections, or any other properties remain unchanged.

Example code:

from maya import cmds
from zBuilder import commands as vfx_cmds
# Example 1
vfx_cmds.merge_solvers(cmds.ls(sl=True))
# Example 2
vfx_cmds.merge_solvers(['zSolver1', 'zSolver2'])
zBuilder.commands.merge_two_solvers(solver_transform1, solver_transform2)[source]

Given two solvers, take everything from the second solver and put it into the first solver; then, delete the second solver.

See merge_solvers() for details. e.g. merge_two_solvers(‘zSolver1’, ‘zSolver2’)

zBuilder.commands.mirror(source_prefix='^l_', target_prefix='r_', center_prefix='c_', mirror_axis='X')[source]

Mirrors a Ziva VFX setup. Select the solver and run the command to mirror whole setup. Select a part of the rig to mirror a subset of the whole setup.

Parameters:
  • source_prefix (str) – Prefix of geometry on the source side. Defaults to ‘^l_’

  • target_prefix (str) – Prefix of geometry on the target side. Defaults to ‘r_’

  • center_prefix (str) – Prefix of the geometry of the center. Defaults to ‘c_’

  • mirror_axis (str) – Axis to mirror on. Defaults to ‘x’

Example code:

from zBuilder import commands as vfx_cmds
vfx_cmds.mirror()
zBuilder.commands.remove(nodes)[source]

Safely remove the given Ziva nodes without worrying about breaking the scene. A solver node can be specified either by its transform node or shape node (or both); in any case, both are removed.

zBuilder.commands.remove_all_solvers(confirmation=False)[source]

Removes all Ziva solvers from the scene, including all Ziva rigs. All Ziva nodes are removed from the Maya scene. This command also deletes the solvers themselves.

zBuilder.commands.remove_solver(solvers=None, askForConfirmation=False)[source]

Removes the entire Ziva rig from the solver(s).

If no solver is provided, the currently selected solver is chosen. If no solver is provided, and nothing is selected, an error is returned. Otherwise, the provided solvers are removed. Solvers can be provided either as a solver transform node, or solver shape node. This command also deletes the solver nodes themselves.

zBuilder.commands.remove_zRivetToBone_nodes(nodes)[source]

Remove zRivetToBone nodes and its connected zRivetToBoneLocator nodes according to input Maya scene nodes.

Parameters:

nodes – Maya nodes in the scene

Returns:

None

zBuilder.commands.rename_ziva_nodes(replace=['_muscle', '_bone'], force=False)[source]

Renames Ziva VFX nodes based on the mesh connected to.

Name convention:

  • zBone: <meshName>_zBone

  • zTet: <meshName>_zTet

  • zTissue: <meshName>_zTissue

  • zMaterial: <meshName>_zMaterial[N]

  • zFiber: <meshName>_zFiber[N]

  • zRestShape: <meshName>_zRestShape[N]

  • zCloth: <meshName>_zCloth

  • zAttachment: <sourceMesh>__<destinationMesh>_zAttachment[N]

Parameters:

replace (list) – subset of mesh name to replace with zNode name

zBuilder.commands.rig_copy()[source]

Copy Ziva rig. See rig_cut_copy() for instructions.

Returns:

True if successful

Return type:

bool

zBuilder.commands.rig_cut()[source]

Cut Ziva rig. See rig_cut_copy() for instructions.

Returns:

True if successful

Return type:

bool

zBuilder.commands.rig_cut_copy(cut=False)[source]

Cut or copy the Ziva rig available on the currently selected objects into the Ziva clipboard.

Selection cannot be empty; otherwise an error is reported. Selection can contain zero or one solver node; otherwise an error is reported (it does not matter if the solver node is a solver transform node, or solver shape node). The selected objects must all come from exactly one solver; otherwise an error is reported.

Parameters:

cut (bool, optional) – If cut is True, the Ziva rig is removed from the selection after being copied (i.e., perform a cut). Defaults to False.

Returns:

True if successful

Return type:

bool

zBuilder.commands.rig_paste()[source]

Paste the Ziva rig from the Ziva clipboard onto scene geometry.

If nothing is selected, or the Ziva clipboard contains an explicit solver node, the Ziva rig is applied to scene geometry that is named inside the Ziva clipboard. If something is selected, then:

  • source selection 1 is pasted onto target selection 1;

  • source selection 2 is pasted onto target selection 2; and so on.

The pasted Ziva rig is added to the solver that was used for the last cut/copy operation. If such a solver does not exist in the Maya scene, it is created.

zBuilder.commands.rig_transfer(source_solver, prefix, target_solver='')[source]

Transfers the Ziva rig from source_solver to another solver (target_solver).

This command does not transfer the geometry. It assumes that a copy of the geometry from source_solver is already available in the scene, prefixed by prefix. For example, if source_solver is zSolver1, and prefix is warped_, and zSolver1 has a tissue geometry (a mesh) called tissue1, then this command assumes that there is a mesh called warped_tissue1 in the scene. The command generates a Ziva rig on the warped_* geometry, in the target_solver. If target_solver is "", the command sets the target_solver to source_solver + prefix. If target_solver does not exist yet, the command generates it. Note that the target_solver may be the same as the source_solver, in which case the rig on the warped_* geometry is added into the source_solver.

Example code:

from zBuilder import commands as vfx_cmds
vfx_cmds.rig_transfer(source_solver, prefix, targetSolver="")
zBuilder.commands.rig_update(solvers=None)[source]

Updates the Ziva rig in the solver(s).

This command can be used if you made geometry modifications and you’d like to re-use a previously built Ziva rig on the modified geometry. If no solvers are provided, they are inferred from selection.

Example code:

from zBuilder import commands as vfx_cmds
vfx_cmds.rig_update()
zBuilder.commands.save_rig(file_name)[source]

Save a Ziva rig to file.

If there is only one solver in the scene, it is saved. If there are multiple solvers present, save the first solver in the union of selected solvers and the default solver.

Example code:

from zBuilder import commands as vfx_cmds
vfx_cmds.save_rig(file_name)
zBuilder.commands.skincluster_transfer(prefix='')[source]

Transfer the skin clusters for some selected meshes onto their warped counterparts and connect the warped joint hierarchy.

This requires both geometries (selected and warped) to have the same topology. The names of the warped meshes must also be prefixed with prefix.

Note: Warp the source meshes and the corresponding joint hierarchy before running the command.

Example code:

from zBuilder import commands as vfx_cmds
vfx_cmds.skincluster_transfer()

Module contents