vtool.maya_lib.deform

Class Summary

XformTransfer() Wrap deform joints from one mesh to another.
ClusterObject(geometry, name) Convenience class for clustering objects.
ClusterSurface(geometry, name) Convenience for clustering a surface.
ClusterCurve(geometry, name) Convenience for clustering a curve.
SplitMeshTarget(target_mesh) Split a mesh target edits based on skin weighting.
TransferWeight(mesh) Transfer weight has functions for dealing with moving weight from joints to other joints.
AutoWeight2D(mesh)
ComboControlShape(shape)
MultiJointShape(shape)
MayaWrap(mesh) Convenience for making maya wraps.
EnvelopeHistory(transform) Convenience for turning on/off deformation history on a node.
ClusterTweakCtx()
ZipWire(top_curve, btm_curve)

Function Summary

cluster_curve(curve, description[, …]) Create clusters on the cvs of a curve.
create_cluster(points, name) Create a cluster on a bunch of points.
create_cluster_bindpre(cluster, handle) Create a bind pre matrix for the cluster.
create_lattice(points, description[, …]) Convenience for creating a lattice.
get_history(geometry) Get the history of the geometry.
find_deformer_by_type(mesh, deformer_type[, …]) Given a mesh find a deformer with deformer_type in the history.
set_envelopes(mesh, value[, exclude_type]) Set envelopse of deformers on the mesh to the given value
get_influences_on_skin(skin_deformer[, …]) Get the names of the skin influences in the skin cluster.
get_non_zero_influences(skin_deformer) Get influences that have weight in the skin cluster.
get_index_at_skin_influence(influence, …) Given an influence name, find at what index it connects to the skin cluster.
get_skin_influence_at_index(index, skin_deformer) Find which influence connect to the skin cluster at the index.
get_skin_influence_indices(skin_deformer) Get the indices of the connected influences.
get_skin_influences(skin_deformer[, return_dict]) Get the influences connected to the skin cluster.
get_meshes_skinned_to_joint(joint) Get all meshses that are skinned to the specified joint.
get_skin_weights(skin_deformer) Get the skin weights for the skin cluster.
get_skin_influence_weights(influence_name, …) This is good to use if you just need to query one influence in a skin cluster.
get_skin_blend_weights(skin_deformer) Get the blendWeight values on the skin cluster.
set_skin_blend_weights(skin_deformer, weights) Set the blendWeights on the skin cluster given a list of weights.
set_skin_weights_to_zero(skin_deformer) Set all the weights on the mesh to zero.
get_joint_index_map(joints, skin_cluster)
invert_weights(weights)
set_vert_weights_to_zero(vert_index, …[, …]) Set the weights at the given point index to zero.
set_deformer_weights(weights, deformer[, index]) Set the deformer weights.
get_deformer_weights(deformer[, index]) Get the weights on a deformer.
set_wire_weights(weights, wire_deformer[, index]) Set the wire weights given a list of weights that corresponds to point order.
get_wire_weights(wire_deformer[, index]) Get the weights on a wire deformer.
get_cluster_weights(cluster_deformer[, index]) Get the weights on a cluster deformer.
get_blendshape_weights(blendshape_deformer, mesh) Not implemented
invert_blendshape_weight(blendshape_deformer) Not implemented
get_intermediate_object(transform) Get the intermediate object in the list of shape nodes under transform.
set_all_weights_on_wire(wire_deformer, weight) Set all the weights on a wire deformer.
set_wire_weights_from_skin_influence(…) Set the wire weights from a skinned joint.
map_influence_on_verts(verts, skin_deformer) Given a list of verts, get which influences have the most weight.
get_faces_at_skin_influence(mesh, skin_deformer)
param mesh:The name of a mesh affected by skin_deformer.
split_mesh_at_skin(*args, **kwargs) Split a mesh into smaller sections based on skin deformer weights.
add_joint_bindpre(skin, joint[, description]) Add a bind pre locator to the bindPreMatrix of the skin.
convert_wire_deformer_to_skin(wire_deformer, …) Meant to take a wire deformer and turn it into a skinned joint chain.
convert_wire_to_skinned_joints(…[, …]) Convert a wire deformer to skinned joints
transfer_joint_weight_to_joint(source_joint, …) Transfer the weight from one joint to another.
transfer_weight_from_joint_to_parent(joint, mesh) Transfer the weight from child joint to parent joint.
transfer_cluster_weight_to_joint(cluster, …) Given the weights of a cluster, transfer them to a joint.
transfer_joint_weight_to_blendshape(…[, …]) Transfer the weight of a joint on a skincluster to a blendshape target weight.
add_missing_influences(skin1, skin2) Make sure used influences in skin1 are added to skin2.
skin_mesh_from_mesh(*args, **kwargs) This skins a mesh based on the skinning of another mesh.
skin_group_from_mesh(source_mesh, group[, …]) This skins a group of meshes based on the skinning of the source mesh.
skin_lattice_from_mesh(source_mesh, target) This skins a lattice based on the skinning of the source mesh.
skin_curve_from_mesh(source_mesh, target[, …]) This skins a curve based on the skinning of the source mesh.
skin_group(joints, group) Skin all the meshes in a group to the specified joints.
lock_joint_weights(skin_cluster[, skip_joints]) Lock the joints in the skin cluster except joints in skip_joints
get_closest_verts_to_joints(joints, verts) Get the closest vertices to a joint.
create_wrap(source_mesh, target_mesh) Create an Maya exclusive bind wrap.
prune_wire_weights(deformer[, value]) Removes weights that fall below value.
wire_mesh(curve, mesh, falloff) Create a wire deformer.
wire_to_mesh(edges, geometry, description[, …]) One mesh follows the other via a wire deformer.
weight_hammer_verts(*args, **kwargs) Convenience to use Maya’s weight hammer command on many verts individually.
map_blend_target_alias_to_index(blendshape_node) Get the aliases for blendshape weight targets and the index of the target.
map_blend_index_to_target_alias(blendshape_node) Get a map between the target index and its alias name on the blendshape.
get_index_at_alias(alias, blendshape_node) Given a blendshape weight alias, get the corresponding target index.
chad_extract_shape(*args, **kwargs) Get the delta of t he skin cluster and blendshape to the corrective.
get_blendshape_delta(orig_mesh, …[, replace]) Create a delta following the equation:
create_surface_joints(surface, name[, …]) Create evenly spaced joints on a surface.
quick_blendshape(source_mesh, target_mesh[, …]) Create a blendshape.
isolate_shape_axis(base, target[, axis_list]) Given a base mesh, only take axis movement on the target that is specified in axis_list.
reset_tweak(tweak_node) Reset the tweak node in deformation history.
reset_tweaks_on_mesh(mesh) Reset the tweak nodes found on deformers on the given mesh.
match_geo_blendshape(source_geo, target_geo, …) Create a blendshape between the source_geo hierarchy and target_geo hierarchy.

Functions

cluster_curve(curve, description, join_ends=False, join_start_end=False, last_pivot_end=False)

Create clusters on the cvs of a curve. joint_start_end, the cv at the start and end of the curve will be joined. join_ends, the 2 start cvs will have one cluster, the 2 end cvs will have one cluster.

Parameters:
  • curve (str) – The name of a curve.
  • description (str) – The description to give the clusters.
  • join_ends (bool) – Wether to joint the 2 start cvs under one cluster, and the two end cvs under another cluster.
  • joint_start_end (bool) – Wether to join the start and end cvs under one cluster.
  • last_pivot_end (bool) – Wether to put the pivot of the last cluster at the end of the curve.
Returns:

[cluster_handle, cluster_handle, …]

Return type:

list

create_cluster(points, name)

Create a cluster on a bunch of points.

Args::
points (list): The names of points to cluster. name (str): The description of the cluster.
Returns:[cluster, handle]
Return type:list
create_cluster_bindpre(cluster, handle)

Create a bind pre matrix for the cluster. This is good if for treating a cluster like a lattice. Lattices have a base. If the base and the lattice move together the lattice has no effect. Likewise if you move the bind pre transform and the cluster handle together the cluster does not deform the mesh. Only when you move the cluster handle without the bind pre.

Parameters:
  • cluster (str) – The name of a cluster deformer.
  • handle (str) – The handle for the cluster deformer in cluster
Returns:

The bindpre group name.

Return type:

str

create_lattice(points, description, divisions=(3, 3, 3), falloff=(2, 2, 2))

Convenience for creating a lattice.

Parameters:
  • points (list) – List of points, meshes to deform.
  • description (str) – The description to give the lattice.
  • divisions (tuple) – eg (3,3,3) The number of divisions to give the lattice on each axis.
  • falloff (tuple) – eg (2,2,2) The falloff to give each axis.
Returns:

ffd, lattice, base

Return type:

list

get_history(geometry)

Get the history of the geometry. This will not search too deep.

Parameters:geometry (str) – The name of the geometry
Returns:A list of deformers in the deformation history.
Return type:list
find_deformer_by_type(mesh, deformer_type, return_all=False)

Given a mesh find a deformer with deformer_type in the history.

Parameters:
  • mesh (str) – The name of a mesh.
  • deformer_type (str) – Corresponds to maya deformer type, eg. skinCluster, blendShape
  • return_all (bool) – Wether to return all the deformers found of the specified type, or just the first one.
Returns:

The names of deformers of type found in the history.

Return type:

list

set_envelopes(mesh, value, exclude_type=[])

Set envelopse of deformers on the mesh to the given value

Parameters:
  • mesh (str) – The name of a mesh
  • value (float) – The value to set the envelopes to.
  • exclude_type (list) – Exlude deformers of type ex. skinCluster
get_influences_on_skin(skin_deformer, short_name=True)

Get the names of the skin influences in the skin cluster.

Parameters:skin_deformer (str) –
Returns:influences found in the skin cluster
Return type:list
get_non_zero_influences(skin_deformer)

Get influences that have weight in the skin cluster.

Parameters:skin_deformer (str) –
Returns:influences found in the skin cluster that have influence.
Return type:list
get_index_at_skin_influence(influence, skin_deformer)

Given an influence name, find at what index it connects to the skin cluster. This corresponds to the matrix attribute. eg. skin_deformer.matrix[0] is the connection of the first influence.

Parameters:
  • influence (str) – The name of an influence.
  • skin_deformer (str) – The name of a skin_deformer affected by influence.
Returns:

The index of the influence.

Return type:

int

get_skin_influence_at_index(index, skin_deformer)

Find which influence connect to the skin cluster at the index. This corresponds to the matrix attribute. eg. skin_deformer.matrix[0] is the connection of the first influence.

Parameters:
  • index (int) – The index of an influence.
  • skin_deformer (str) – The name of the skin cluster to check the index.
Returns:

The name of the influence at the index.

Return type:

str

get_skin_influence_indices(skin_deformer)

Get the indices of the connected influences. This corresponds to the matrix attribute. eg. skin_deformer.matrix[0] is the connection of the first influence.

Parameters:skin_deformer (str) – The name of a skin cluster.
Returns:The list of indices.
Return type:list
get_skin_influences(skin_deformer, return_dict=False)

Get the influences connected to the skin cluster. Return a dictionary with the keys being the name of the influences. The value at the key the index where the influence connects to the skin cluster.

Parameters:
  • skin_deformer (str) – The name of a skin cluster.
  • return_dict (bool) – Wether to return a dictionary.
Returns:

A list of influences in the skin cluster. If return_dict = True, return dict[influence] = index

Return type:

list, dict

get_meshes_skinned_to_joint(joint)

Get all meshses that are skinned to the specified joint.

Parameters:joint (str) – The name of a joint.
Returns:The skin clusters affected by joint.
Return type:list
get_skin_weights(skin_deformer)

Get the skin weights for the skin cluster. Return a dictionary where the key is the influence, and the value is the a list of weights at the influence.

Parameters:skin_deformer (str) – The name of a skin deformer.
Returns:dict[influence_index] = weight values corresponding to point order.
Return type:dict
get_skin_influence_weights(influence_name, skin_deformer)

This is good to use if you just need to query one influence in a skin cluster. If you need to query many influences than use get_skin_weights.

get_skin_blend_weights(skin_deformer)

Get the blendWeight values on the skin cluster.

Parameters:skin_deformer (str) – The name of a skin deformer.
Returns:The blend weight values corresponding to point order.
Return type:list
set_skin_blend_weights(skin_deformer, weights)

Set the blendWeights on the skin cluster given a list of weights.

Parameters:
  • skin_deformer (str) – The name of a skin deformer.
  • weights (list) – A list of weight values corresponding to point order.
set_skin_weights_to_zero(skin_deformer)

Set all the weights on the mesh to zero.

Parameters:skin_deformer (str) – The name of a skin deformer.
get_joint_index_map(joints, skin_cluster)
invert_weights(weights)
set_vert_weights_to_zero(vert_index, skin_deformer, joint=None)

Set the weights at the given point index to zero.

Parameters:
  • vert_index (int) – The index of a vert.
  • skin_deformer (str) – The name of a skin deformer.
  • joint (str) – The name of a joint that is influencing the vert. If not joint given all the influences for the vert will be zeroed out.
set_deformer_weights(weights, deformer, index=0)

Set the deformer weights. Good for cluster and wire deformers.

Parameters:
  • weights (list) – A list of weight values that should correspond to point order.
  • deformer (str) – The name of a deformer. eg. cluster or wire.
  • index (int) – The geometry index to set weights on. By default it will work on the first mesh.
get_deformer_weights(deformer, index=0)

Get the weights on a deformer. In point order.

Parameters:
  • deformer (str) – The name of a deformer.
  • index (int) – The index of the meshes attached.
Returns:

The weight values in point order.

Return type:

list

set_wire_weights(weights, wire_deformer, index=0)

Set the wire weights given a list of weights that corresponds to point order.

Parameters:
  • weights (list) – A list of weight values corresponding to point order.
  • wire_deformer (str) – The name of a wire deformer.
  • index (int) – The index of the mesh to work on. By default it will work on the first mesh.
get_wire_weights(wire_deformer, index=0)

Get the weights on a wire deformer. In point order.

Parameters:
  • wire_deformer (str) – The name of a deformer.
  • index (int) – The index of the meshes attached.
Returns:

The weight values in point order.

Return type:

list

get_cluster_weights(cluster_deformer, index=0)

Get the weights on a cluster deformer. In point order.

Parameters:
  • cluster_deformer (str) – The name of a deformer.
  • index (int) – The index of the meshes attached.
Returns:

The weight values in point order.

Return type:

list

get_blendshape_weights(blendshape_deformer, mesh, index=-1)

Not implemented

invert_blendshape_weight(blendshape_deformer, index=-1)

Not implemented

get_intermediate_object(transform)

Get the intermediate object in the list of shape nodes under transform.

Parameters:transform (str) – The name of a transform.
set_all_weights_on_wire(wire_deformer, weight, slot=0)

Set all the weights on a wire deformer.

Parameters:
  • wire_deformer (str) – The name of a wire deformer.
  • weight (float) – The weight value to assign the weights of a wire deformer.
  • slot (int) – The index of the deformed mesh. Usually 0.
set_wire_weights_from_skin_influence(wire_deformer, weighted_mesh, influence)

Set the wire weights from a skinned joint.

Parameters:
  • wire_deformer (str) – The name of a wire deformer.
  • weighted_mesh (str) – The name of a skinned mesh.
  • influence (str) – The name of an influence.
map_influence_on_verts(verts, skin_deformer)

Given a list of verts, get which influences have the most weight.

Parameters:
  • verts (list) – The index of vertices on the mesh to get weights from.
  • skin_deformer (str) – The name of a skin cluster.
Returns:

dict[influence_index] = value

Return type:

dict

get_faces_at_skin_influence(mesh, skin_deformer)
Parameters:
  • mesh (str) – The name of a mesh affected by skin_deformer.
  • skin_deformer (str) – The name of a skin deformer.
Returns:

dict[influence_index] = [face ids]

Return type:

dict

split_mesh_at_skin(*args, **kwargs)

Split a mesh into smaller sections based on skin deformer weights.

Parameters:
  • mesh (str) – The name of a mesh.
  • skin_deformer (str) – The name of a skin deformer.
  • vs_attribute (str) – The name of a visibility attribute to connect to. eg. ‘node_name.sectionVisibility’
  • constrain (bool) – Wether to constrain the sections or parent them.
Returns:

If constrain = True, the name of the group above the sections. Otherwise return none.

Return type:

str

add_joint_bindpre(skin, joint, description=None)

Add a bind pre locator to the bindPreMatrix of the skin.

Parameters:
  • skin (str) – The name of a skin cluster to add bind pre to.
  • joint (str) – The name of the joint to match bind pre to.
  • description (str) – The description of the bind pre.
Returns:

The name of the bind pre locator.

Return type:

str

convert_wire_deformer_to_skin(wire_deformer, description, joint_count=10, delete_wire=True, skin=True, falloff=1, create_controls=True)

Meant to take a wire deformer and turn it into a skinned joint chain.

Parameters:
  • wire_deformer (str) – The name of a wire deformer.
  • description (str) – The description to give the setup
  • joint_count (int) – The number of joints to create. Higher number better resembles the effect of a wire deformer, but gets slow fast.
  • delete_wire (bool) – Wether to delete the original wire deformer.
  • skin (bool) – Wether to calculate and skin the bones to mimic the wire deformer.
  • falloff (float) – Corresponds to the wire distance value.
  • create_controls (bool) – Wether to create controls on the joints.
Returns:

[convert_group, control_group, zero_verts] Zero verts are the verts that were not affected by the wire conversion.

Return type:

list

convert_wire_to_skinned_joints(wire_deformer, description, joint_count=10, falloff=1)

Convert a wire deformer to skinned joints

Parameters:
  • wire_deformer (str) – The name of a wire deformer.
  • description (str) – The description to give the setup.
  • joint_count (int) – The number of joints to create. Higher number better resembles the effect of a wire deformer, but gets slow fast.
  • falloff (float) – Corresponds to the wire distance value.
Returns:

The top group above the joints.

Return type:

str

transfer_joint_weight_to_joint(source_joint, target_joint, mesh=None)

Transfer the weight from one joint to another. Does it for all vertices affected by source_joint in mesh.

Parameters:
  • source_joint (str) – The name of a joint to take weights from.
  • target_joint (str) – The name of a joint to transfer weights to.
  • mesh (str) – The mesh to work with.
transfer_weight_from_joint_to_parent(joint, mesh)

Transfer the weight from child joint to parent joint. Does it for all vertices affected by child joint in mesh. If no parent joint, then do nothing.

Parameters:
  • joint (str) – The name of a joint to take weights from.
  • mesh (str) – The mesh to work with.
transfer_cluster_weight_to_joint(cluster, joint, mesh)

Given the weights of a cluster, transfer them to a joint.

transfer_joint_weight_to_blendshape(blendshape_node, joint, mesh, index=0, target=-1)

Transfer the weight of a joint on a skincluster to a blendshape target weight.

Parameters:
  • blendshape_node (str) – The name of a blendshape node.
  • joint (str) – The name of a joint influencing mesh.
  • mesh (str) – The name of a mesh that has joint has a skin influence.
  • index (int) – Is the index of the blendshaped mesh. Usually 0. Can be 1 or more if blendshape_node affects more than one mesh.
  • target (int) – If target is -1, than affect the base weights of the blendshapes… which affects all targets. If target = 0 or greater, then affect the weights of the target at that index.
add_missing_influences(skin1, skin2)

Make sure used influences in skin1 are added to skin2. When transfering skin weights this can be handy.

Parameters:
  • skin1 (str) – The name of a skin cluster.
  • skin2 (str) – The name of a skin cluster.
skin_mesh_from_mesh(*args, **kwargs)

This skins a mesh based on the skinning of another mesh. Source mesh must be skinned. The target mesh will be skinned with the joints in the source. The skinning from the source mesh will be projected onto the target mesh. exlude_joints = joints to exclude from the target’s skin cluster. include_joints = only include the specified joints. If exlude_joints, only exclude_joints in include_joints will be excluded.

Parameters:
  • source_mesh (str) – The name of a mesh.
  • target_mesh (str) – The name of a mesh.
  • exlude_joints (list) – Exclude the named joints from the skin cluster.
  • include_joints (list) – Include the named joint from the skin cluster.
  • uv_space (bool) – Wether to copy the skin weights in uv space rather than point space.
skin_group_from_mesh(source_mesh, group, include_joints=[], exclude_joints=[])

This skins a group of meshes based on the skinning of the source mesh. Source mesh must be skinned. The target group will be skinned with the joints in the source. The skinning from the source mesh will be projected onto the meshes in the group. exlude_joints = joints to exclude from the target’s skin cluster. include_joints = only include the specified joints. If exlude_joints, only exclude_joints in include_joints will be excluded.

Parameters:
  • source_mesh (str) – The name of a mesh.
  • group (str) – The name of a group.
  • exlude_joints (list) – Exclude the named joints from the skin cluster.
  • include_joints (list) – Include the named joint from the skin cluster.
skin_lattice_from_mesh(source_mesh, target, divisions=[10, 10, 10], falloff=[2, 2, 2], name=None, include_joints=[], exclude_joints=[])

This skins a lattice based on the skinning of the source mesh. The lattice is generated automatically around the target mesh using divisions and falloff parameters. Source mesh must be skinned. The target lattice will be skinned with the joints in the source. The skinning from the source mesh will be projected onto the target lattice. exlude_joints = joints to exclude from the target’s skin cluster. include_joints = only include the specified joints. If exlude_joints, only exclude_joints in include_joints will be excluded.

Parameters:
  • source_mesh (str) – The name of a mesh.
  • target (str) – The name of a group or mesh.
  • divisions (list) – eg [10,10,10] the divisions of the lattice.
  • falloff (list) – eg [2,2,2] the falloff of the divisions of the lattice.
  • name (str) – The description to give the lattice.
  • exlude_joints (list) – Exclude the named joints from the skin cluster.
  • include_joints (list) – Include the named joint from the skin cluster.
skin_curve_from_mesh(source_mesh, target, include_joints=[], exclude_joints=[])

This skins a curve based on the skinning of the source mesh. Source mesh must be skinned. The target curve will be skinned with the joints in the source. The skinning from the source mesh will be projected onto the curve. exlude_joints = joints to exclude from the target’s skin cluster. include_joints = only include the specified joints. If exlude_joints, only exclude_joints in include_joints will be excluded.

Parameters:
  • source_mesh (str) – The name of a mesh.
  • target (str) – The name of a curve.
  • exlude_joints (list) – Exclude the named joints from the skin cluster.
  • include_joints (list) – Include the named joint from the skin cluster.
skin_group(joints, group)

Skin all the meshes in a group to the specified joints. Good for attaching the face geo to the head joint.

Parameters:
  • joints (list) – A list of joints to skin to.
  • group (str) – The group to skin.
lock_joint_weights(skin_cluster, skip_joints=None)

Lock the joints in the skin cluster except joints in skip_joints

Parameters:
  • skin_cluster (str) – The name of a skin cluster.
  • skip_joints (list) – The names of the joints to skip.
get_closest_verts_to_joints(joints, verts)

Get the closest vertices to a joint.

Parameters:
  • joints (list) – A list of joints.
  • verts (list) – A list of vertices.
Returns:

dict[joint] = vertex list

Return type:

dict

create_wrap(source_mesh, target_mesh)

Create an Maya exclusive bind wrap. Source_mesh drives target_mesh.

Parameters:
  • source_mesh (str) – The mesh to influence target_mesh. This can be a list of meshes.
  • target_mesh (str) – Mesh to be deformed by source_mesh.
Returns:

A list of base meshes.

Return type:

list

prune_wire_weights(deformer, value=0.0001)

Removes weights that fall below value.

Parameters:
  • deformer (str) – The name of a deformer.
  • value (float) – The value below which verts get removed from wire deformer.
wire_mesh(curve, mesh, falloff)

Create a wire deformer.

Parameters:
  • curve (str) – The name of a curve.
  • mesh (str) – The name of a mesh.
  • falloff (float) – The falloff of the wire influence.
Returns:

[wire_deformer, wire_curve]

Return type:

list

wire_to_mesh(edges, geometry, description, auto_edge_path=True)

One mesh follows the other via a wire deformer. A nurbs curve is generated automatically from the edges provided.

auto_edge_path = The command will try fill in gaps between edges.

Parameters:
  • edges (list) – The edges from the source mesh to build the wire curve from. Eg. [“node_name.e[0]”]
  • geometry (list) – The target geometry that should follow.
  • description (str) – The description to give the setup.
  • auto_edge_path (bool) – Wether to fill in the path between the edges.
Returns:

The group name for the setup.

Return type:

str

weight_hammer_verts(*args, **kwargs)

Convenience to use Maya’s weight hammer command on many verts individually.

Parameters:verts (list) – The names of verts to weigth hammer. If verts = None, currently selected verts will be hammered.
map_blend_target_alias_to_index(blendshape_node)

Get the aliases for blendshape weight targets and the index of the target.

Parameters:blendshape_node (str) – The name of the blendshape.
Returns:dict[alias] = target index
Return type:dict
map_blend_index_to_target_alias(blendshape_node)

Get a map between the target index and its alias name on the blendshape.

Parameters:blendshape_node (str) – The name of the blendshape.
Returns:dict[target index] = weight alias
Return type:dict
get_index_at_alias(alias, blendshape_node)

Given a blendshape weight alias, get the corresponding target index.

Parameters:alias (str) – The name of the weight alias.
Returns:The corresponding target index to the alias.
Return type:int
chad_extract_shape(*args, **kwargs)

Get the delta of t he skin cluster and blendshape to the corrective. Requires a skin cluster or blendshape in the deformation stack.

Parameters:
  • skin_mesh (str) – The name of the skinned mesh, or blendshaped mesh to extract a delta from.
  • corrective (str) – The target shape for the skin mesh.
  • replace (bool) – Wether to replace the corrective with the delta.
Returns:

The name of the delta. The delta can be applied to the blendshape before the skin cluster.

Return type:

str

get_blendshape_delta(orig_mesh, source_meshes, corrective_mesh, replace=True)

Create a delta following the equation: delta = orig_mesh + corrective_mesh - source_meshes

Parameters:
  • orig_mesh (str) – The unchanged base mesh.
  • source_meshes (list) – Name of the mesh that represents where the mesh has moved. Can be a list or a single target.
  • corrective_mesh (str) – Name of the mesh where the source mesh needs to move to.
Returns:

name of new delta mesh

Return type:

str

create_surface_joints(surface, name, uv_count=[10, 4], offset=0)

Create evenly spaced joints on a surface.

Parameters:
  • surface (str) – the name of a nurbs surface.
  • name (str) – = the name to give to nodes created.
  • uv_count (list) – = number of joints on u and v, eg [10,4]
  • offset (float) – = the offset from the border.
Returns:

[top_group, joints] The top group is the group for the joints. The joints is a list of joints by name that were created.

Return type:

list

quick_blendshape(source_mesh, target_mesh, weight=1, blendshape=None)

Create a blendshape. Add target source_mesh into the target_mesh. If target_mesh already has a blendshape, add source_mesh into existing blendshape.

Parameters:
  • blendshape (str) – The name of the blendshape to work with.
  • target_mesh (str) – The name of the target mesh to add into the blendshape.
  • weight (float) – The value to set the weight of the target to.
  • blendshape – The name of the blendshape to edit. If None, it will be set to ‘blendshape_%s’ % target_mesh.
Returns:

The name of the blendshape node.

Return type:

str

isolate_shape_axis(base, target, axis_list=[‘X’, ‘Y’, ‘Z’])

Given a base mesh, only take axis movement on the target that is specified in axis_list.

Parameters:
  • base (str) – The base mesh that has no targets applied.
  • target (str) – The target mesh vertices moved to a different position than the base.
  • axis_list (list) – The axises of movement allowed. If axis_list = [‘X’], only vertex movement on x will be present in the result.
Returns:

A new mesh with verts moving only on the isolated axis.

Return type:

str

reset_tweak(tweak_node)

Reset the tweak node in deformation history.

Parameters:tweak_node (str) – The name of the tweak node.
reset_tweaks_on_mesh(mesh)

Reset the tweak nodes found on deformers on the given mesh.

match_geo_blendshape(source_geo, target_geo, attr_name)

Create a blendshape between the source_geo hierarchy and target_geo hierarchy.

Parameters:
  • source_geo (list) – The names of geo in a hierarchy
  • target_geo (list) – The names of geo in a hierarchy
  • attr_name (str) – The name to give the blendshape weight.