vtool.maya_lib.deform¶
Class Summary
|
|
Wrap deform joints from one mesh to another. |
|
|
Convenience class for clustering objects. |
|
Convenience for clustering a surface. |
|
Convenience for clustering a curve. |
|
Convenience class for skinning objects. |
|
Convenience for skinning a surface. |
|
Convenience for clustering a curve. |
|
Split a mesh target edits based on skin weighting. |
This will split the mesh in a way that a shape that doesn't need to be split can interact with shape combos. |
|
|
|
|
Transfer weight has functions for dealing with moving weight from joints to other joints. |
|
|
|
|
|
|
|
Convenience for making maya wraps. |
|
Convenience for turning on/off deformation history on a node. |
|
|
|
|
|
Given a mesh, create joints a specified verts or edges, skin the mesh and weight a target mesh. |
Function Summary
|
|
|
Create clusters on the cvs of a curve. |
|
Create a cluster on a bunch of points. |
|
Create a cluster on a bunch of points. |
|
Create a bind pre matrix for the cluster. |
|
Convenience for creating a lattice. |
|
Get the history of the geometry. |
|
This checks if the node is of type geometryFilter in the history, and returns all found. The first node in the history that isn't a geometryFilter (deformer) the tool assumes it at the end of the deformer stack and returns. |
|
Given a mesh find a deformer with deformer_type in the history. |
|
Set envelopes of deformers on the mesh to the given value |
|
Get the names of the skin influences in the skin cluster. |
|
Get influences that have weight in the skin cluster. |
|
Given an influence name, find at what index it connects to the skin cluster. |
Some commands like the api need the index as it appears in the list of entries Sometimes the skin cluster can be in an order of 50, 51, 55, 56 this will return the index as if those breaks in order couldn't exist. |
|
|
influences = influneces on a skin cluster |
|
Find which influence connect to the skin cluster at the index. |
|
Get the indices of the connected influences. |
|
Get the influences connected to the skin cluster. |
|
Get all meshes that are skinned to the specified joint. |
|
Get the skin weights for the skin cluster. |
|
This is good to use if you just need to query one influence in a skin cluster. |
|
Get the blendWeight values on the skin cluster. |
|
|
|
Given an influence, a triangle and bary_u and v values, find what the weight is. |
|
|
|
Set the blendWeights on the skin cluster given a list of weights. |
|
|
|
Set all the weights on the mesh to zero. |
|
|
|
|
|
|
|
|
|
Args |
|
|
|
|
|
|
|
This seems to require the full skeleton to be under one joint. This can be an issue with say the tweaker joints |
|
|
|
|
|
|
|
Set the weights at the given point index to zero. |
|
|
|
Set the deformer weights. |
|
Get the weights on a deformer. |
|
|
|
Set the wire weights given a list of weights that corresponds to point order. |
|
Get the weights on a wire deformer. |
|
Get the weights on a cluster deformer. |
|
Not implemented |
|
Not implemented |
|
|
|
Get the intermediate object in the list of shape nodes under transform. |
|
Set all the weights on a wire deformer. |
|
Set the wire weights from a skinned joint. |
|
Given a list of verts, get which influences have the most weight. |
|
|
|
Split a mesh into smaller sections based on skin deformer weights. |
|
Add a bind pre locator to the bindPreMatrix of the skin. |
|
Meant to take a wire deformer and turn it into a skinned joint chain. |
|
Convert a wire deformer to skinned joints |
|
Transfer the weight from one joint to another. |
|
Transfer the weight from child joint to parent joint. |
|
Given the weights of a cluster, transfer them to a joint. |
|
Transfer the weight of a joint on a skincluster to a blendshape target weight. |
|
Make sure used influences in skin1 are added to skin2. |
|
This skins a mesh based on the skinning of another mesh. |
|
This skins a group of meshes based on the skinning of the source mesh. |
|
This skins a lattice based on the skinning of the source mesh. |
|
This skins a curve based on the skinning of the source mesh. |
|
Skin all the meshes in a group to the specified joints. |
|
|
|
|
|
|
|
|
|
Not working at all |
|
Lock the joints in the skin cluster except joints in skip_joints |
|
|
|
Get the closest vertices to a joint. |
|
Create a Maya exclusive bind wrap. |
|
|
|
|
|
Removes weights that fall below value. |
|
Create a wire deformer. |
|
One mesh follows the other via a wire deformer. |
|
Convenience to use Maya's weight hammer command on many verts individually. |
|
Get the aliases for blendshape weight targets and the index of the target. |
|
Get a map between the target index and its alias name on the blendshape. |
|
Given a blendshape weight alias, get the corresponding target index. |
|
Get the delta of the skin cluster and blendshape to the corrective. |
|
Create a delta following the equation: delta = orig_mesh + corrective_mesh - source_meshes |
|
Create evenly spaced joints on a surface. |
|
Create a blendshape. |
|
Given a base mesh, only take axis movement on the target that is specified in axis_list. |
|
Reset the tweak node in deformation history. |
|
Reset the tweak nodes found on deformers on the given mesh. |
|
|
|
Create a blendshape between the source_geo hierarchy and target_geo hierarchy. |
|
|
|
|
|
- get_object(name)¶
- class SkinCluster(geometry, add=False)¶
- get_influence_index(influence_name)¶
- add_influence(transform_name)¶
- set_influence_weights(influence, weight, vertex_indices)¶
- normalize(bool_value)¶
- get_skin()¶
- class XformTransfer¶
Wrap deform joints from one mesh to another.
- store_relative_scope(parent)¶
Set all transforms under parent.
- Parameters
parent (str) – The name of a parent transform.
- set_scope(scope)¶
Set the transforms to work on.
- Parameters
scope (list) – Names of transforms.
- set_source_mesh(name)¶
Source mesh must match point order of target mesh.
- set_target_mesh(name)¶
Target mesh must match point order of source mesh.
- run()¶
- class XformTransferAccurate¶
- tag_skeleton(skeleton_bones, radius=- 1)¶
- has_tag(bone)¶
- tag_bone(bone, components=[])¶
- update_tags(skeleton_bones)¶
- transfer_skeleton(skeleton_bones)¶
- transfer_bone(bone)¶
- set_find_verts_options(radius_grow=1.25, min_count=20, max_iterations=30)¶
- find_verts(bone, radius=- 1)¶
- filter_selection(selection=[])¶
- get_bone_components(bone)¶
- get_mirrored_components(components)¶
- select_bone_components(bone)¶
- mirror_components()¶
- mirror_component(source_bone, target_bone)¶
- set_scope(scope)¶
Set the transforms to work on.
- Parameters
scope (list) – Names of transforms.
- set_source_mesh(name)¶
Source mesh must match point order of target mesh.
- set_target_mesh(name)¶
Target mesh must match point order of source mesh.
- class ClusterObject(geometry, name)¶
Convenience class for clustering objects.
- get_cluster_list()¶
- Returns
The names of cluster deformers.
- Return type
list
- get_cluster_handle_list()¶
- Returns
The name of cluster handles.
- Return type
list
- create()¶
Create the clusters.
- class ClusterSurface(geometry, name)¶
Convenience for clustering a surface.
- set_join_ends(bool_value)¶
Clusters on the ends of the surface take up 2 cvs.
- Args:
bool_value (bool): Whether 2 cvs at the start have one cluster, and 2 cvs on the end have one cluster.
- set_join_both_ends(bool_value)¶
Clusters on the ends of the surface are joined together.
- Parameters
bool_value (bool) – Whether to join the ends of the surface.
- set_last_cluster_pivot_at_end(bool_value)¶
Set the last cluster pivot to the end of the curve.
- set_first_cluster_pivot_at_start(bool_value)¶
Set the last cluster pivot to the end of the curve.
- set_cluster_u(bool_value)¶
- Parameters
bool_value (bool) – Whether to cluster the u instead of the v spans.
- create()¶
Create the clusters.
- get_cluster_handle_list()¶
- Returns
The name of cluster handles.
- Return type
list
- get_cluster_list()¶
- Returns
The names of cluster deformers.
- Return type
list
- class ClusterCurve(geometry, name)¶
Convenience for clustering a curve.
- set_cluster_u(bool_value)¶
Not available on curves.
- set_other_curve(curve_name)¶
- create()¶
Create the clusters.
- get_cluster_handle_list()¶
- Returns
The name of cluster handles.
- Return type
list
- get_cluster_list()¶
- Returns
The names of cluster deformers.
- Return type
list
- set_first_cluster_pivot_at_start(bool_value)¶
Set the last cluster pivot to the end of the curve.
- set_join_both_ends(bool_value)¶
Clusters on the ends of the surface are joined together.
- Parameters
bool_value (bool) – Whether to join the ends of the surface.
- set_join_ends(bool_value)¶
Clusters on the ends of the surface take up 2 cvs.
- Args:
bool_value (bool): Whether 2 cvs at the start have one cluster, and 2 cvs on the end have one cluster.
- set_last_cluster_pivot_at_end(bool_value)¶
Set the last cluster pivot to the end of the curve.
- class SkinJointObject(geometry, name)¶
Convenience class for skinning objects.
- get_joint_list()¶
- Returns
The names of joints.
- Return type
list
- get_skin()¶
- create()¶
Create the joints.
- class SkinJointSurface(geometry, name)¶
Convenience for skinning a surface.
- set_join_ends(bool_value)¶
Skin the ends of the surface take up 2 cvs.
- Args:
bool_value (bool): Whether 2 cvs at the start have one joint, and 2 cvs on the end have one joint.
- set_join_both_ends(bool_value)¶
Skin the ends of the surface are joined together.
- Parameters
bool_value (bool) – Whether to join the ends of the surface.
- set_last_joint_pivot_at_end(bool_value)¶
Set the last joint pivot to the end of the curve.
- set_first_joint_pivot_at_start(bool_value)¶
Set the last joint pivot to the end of the curve.
- set_joint_u(bool_value)¶
- Parameters
bool_value (bool) – Whether to skin the u instead of the v spans.
- create()¶
Create the joints.
- get_joint_list()¶
- Returns
The names of joints.
- Return type
list
- get_skin()¶
- class SkinJointCurve(geometry, name)¶
Convenience for clustering a curve.
- set_joint_u(bool_value)¶
Not available on curves.
- create()¶
Create the joints.
- get_joint_list()¶
- Returns
The names of joints.
- Return type
list
- get_skin()¶
- set_first_joint_pivot_at_start(bool_value)¶
Set the last joint pivot to the end of the curve.
- set_join_both_ends(bool_value)¶
Skin the ends of the surface are joined together.
- Parameters
bool_value (bool) – Whether to join the ends of the surface.
- set_join_ends(bool_value)¶
Skin the ends of the surface take up 2 cvs.
- Args:
bool_value (bool): Whether 2 cvs at the start have one joint, and 2 cvs on the end have one joint.
- set_last_joint_pivot_at_end(bool_value)¶
Set the last joint pivot to the end of the curve.
- class SplitMeshTarget(target_mesh)¶
Split a mesh target edits based on skin weighting. The target will be reverted back to the base mesh based on weight of the defined joints on weight mesh. Good for splitting blendshape targets.
Usage
split = SplitMeshTarget(‘smile’) split.set_base_mesh(‘home_mesh’) split.set_weight_mesh(‘weight_mesh’) split.set_weight_joint( ‘joint_weight_L’, suffix = ‘L’) split.set_weight_joint( ‘joint_weight_R’, suffix = ‘R’) split.create()
result = smileL and smileR meshes.
- Parameters
target_mesh (str) – The name of a target mesh, e.g. smile.
- set_weight_joint(joint, suffix=None, prefix=None, split_name=True)¶
Set the joint to split the shape. Must be skinned to the weight mesh
- Parameters
joint (str) – The name of the joint to take weighting from. Must be affecting weight mesh.
suffix (str) – Add string to the end of the target mesh name.
prefix (str) – Add string to the beginning of the target mesh name.
split_name (bool) – Whether to split the name based on “_” and add the suffix and prefix at each part.
'L' (e.g. 'smile_cheekPuff' would become 'smileL_cheekPuffL' if suffix =) –
- set_weight_insert_index(joint, insert_index, insert_name, split_name=True)¶
Insert a string for the new target shape name. Needs to be tested!!
- Parameters
joint (str) – The name of the joint to take weighting from. Must be affecting weight mesh.
insert_index (int) – The index on the string where the insert_name should be inserted.
insert_name (str) – The string to insert at insert_index.
split_name (bool) – Whether to split the name based on “_” and add the insert_name at the insert_index.
- set_weight_joint_replace_end(joint, replace, split_name=True)¶
Replace the string at the end of the target name when splitting. Needs to be tested!!
- Parameters
joint (str) – The name of the joint to take weighting from. Must be affecting weight mesh.
replace (str) – The string to replace the end with.
split_name (bool) – Whether to split the name based on “_”.
- set_weight_joint_insert_at_first_camel(joint, insert_value, split_name=True)¶
- set_center_fade(fade_distance, positive, suffix=None, prefix=None, split_name=True)¶
- Parameters
fade_distance (float) – The distance from the center that the target should fade off.
positive (bool) – Whether the fade off should start at positive or at negative.
split_name (bool) – TODO: Fill in description.
- set_weighted_mesh(weighted_mesh)¶
Set the weight mesh, the mesh that the weight joints are affecting through a skin cluster.
- Parameters
weighted_mesh (str) – The name of a mesh with a skin cluster.
- set_skip_target_rename(list_of_targets)¶
- set_base_mesh(base_mesh)¶
Set the base mesh. The target mesh will revert back to base mesh based on skin weighting. This is the mesh with points at their default positions.
- Parameters
base_mesh (str) – The name of a mesh.
- set_search_for_children_meshes(bool_value)¶
- split_target(target)¶
- create(return_dict=False)¶
Create the splits.
- Returns
The names of the new targets.
- Return type
list
- class SplitPatch¶
This will split the mesh in a way that a shape that doesn’t need to be split can interact with shape combos. This only works if there is a dominate shape in the combos that the combos can be split by. Like if you are splitting blink, you could split the blink_smile with the same split as blink, but use this class on smile.
- add_split(new_name)¶
- set_target_shape(mesh)¶
- set_base_shape(mesh)¶
- create()¶
- class CopyDeformation(source_mesh, target_mesh)¶
- set_use_delta_mush(bool_value)¶
- set_transfer_skin(bool_value)¶
- set_transfer_blends(bool_value)¶
- set_delete_history_first(bool_value)¶
- set_work_in_uv_space(bool_value)¶
- run()¶
- class TransferWeight(mesh)¶
Transfer weight has functions for dealing with moving weight from joints to other joints.
- Parameters
mesh (str) – The name of the mesh that is skinned with joints.
- set_optimize_mesh(percent=50, keep_quads=1)¶
- set_smooth_mesh(iterations=3)¶
- delete_optimize_mesh()¶
- transfer_joint_to_joint(source_joints, destination_joints, source_mesh=None, percent=1)¶
Transfer the weights from source_joints into the weighting of destination_joints. For example if I transfer joint_nose into joint_head, joint_head will lose its weights where joint_nose has overlapping weights. Source joints will take over the weighting of destination_joints. Source mesh must match the mesh TransferWeight(mesh).
- Parameters
source_joints (list) – Joint names.
destination_joints (list) – Joint names.
source_mesh (str) – The name of the mesh were source_joints are weighted. If None, algorithms assumes weighting is coming from the main mesh.
percent (float) – 0-1 value. If value is 0.5, only 50% of source_joints weighting will be added to destination_joints weighting.
- transfer_joint_to_joint_with_undo(source_joints, destination_joints, source_mesh=None, percent=1)¶
Transfer the weights from source_joints into the weighting of destination_joints. For example if I transfer joint_nose into joint_head, joint_head will lose its weights where joint_nose has overlapping weights. Source joints will take over the weighting of destination_joints. Source mesh must match the mesh TransferWeight(mesh).
- Parameters
source_joints (list) – Joint names.
destination_joints (list) – Joint names.
source_mesh (str) – The name of the mesh were source_joints are weighted. If None, algorithms assumes weighting is coming from the main mesh.
percent (float) – 0-1 value. If value is 0.5, only 50% of source_joints weighting will be added to destination_joints weighting.
- transfer_joint_to_joint_fast(source_joints, destination_joints, source_mesh=None, percent=1)¶
This is meant for meshes with high vertex count
Transfer the weights from source_joints into the weighting of destination_joints. For example if I transfer joint_nose into joint_head, joint_head will lose its weights where joint_nose
has overlapping weights.
Source joints will take over the weighting of destination_joints. Source mesh must match the mesh TransferWeight(mesh).
- Parameters
source_joints (list) – Joint names.
destination_joints (list) – Joint names.
source_mesh (str) – The name of the mesh were source_joints are weighted. If None, algorithms assumes weighting is coming from the main mesh.
percent (float) – 0-1 value. If value is 0.5, only 50% of source_joints weighting will be added to destination_joints weighting.
- transfer_joints_to_new_joints(joints, new_joints, falloff=1, power=4, weight_percent_change=1)¶
Transfer the weights from joints onto new_joints which have no weighting. For example, joint_arm could move its weights onto [joint_arm_tweak1, joint_arm_tweak2, joint_arm_tweak3] Weighting is assigned based on distance.
- Parameters
joints (list) – Joint names to take weighting from.
falloff (float) – The distance a vertex has to be from the joint before it has no priority.
power (int) – The power to multiply the distance by. It amplifies the distance, so that if something is closer it has a higher value, and if something is further it has a lower value exponentially.
weight_percent_change (float) – 0-1 value. If value is 0.5, only 50% of source_joints weighting will be added to destination_joints weighting.
- transfer_joints_to_new_joints_keep_undo(joints, new_joints, falloff=1, power=4, weight_percent_change=1)¶
Transfer the weights from joints onto new_joints which have no weighting. For example, joint_arm could move its weights onto [joint_arm_tweak1, joint_arm_tweak2, joint_arm_tweak3] Weighting is assigned based on distance.
- Parameters
joints (list) – Joint names to take weighting from.
falloff (float) – The distance a vertex has to be from the joint before it has no priority.
power (int) – The power to multiply the distance by. It amplifies the distance, so that if something is closer it has a higher value, and if something is further it has a lower value exponentially.
weight_percent_change (float) – 0-1 value. If value is 0.5, only 50% of source_joints weighting will be added to destination_joints weighting.
- transfer_exact_falloff_joints_to_new_joints(joints, new_joints, falloff=1, power=4, weight_percent_change=1)¶
Transfer the weights from joints onto new_joints which have no weighting. For example, joint_arm could move its weights onto [joint_arm_tweak1, joint_arm_tweak2, joint_arm_tweak3] Weighting is assigned based on distance.
- Parameters
joints (list) – Joint names to take weighting from.
falloff (float) – The distance a vertex has to be from the joint before it has no priority.
power (int) – The power to multiply the distance by. It amplifies the distance, so that if something is closer it has a higher value, and if something is further it has a lower value exponentially.
weight_percent_change (float) – 0-1 value. If value is 0.5, only 50% of source_joints weighting will be added to destination_joints weighting.
- class AutoWeight2D(mesh)¶
- set_joints(joints)¶
- set_mesh(mesh)¶
- set_multiplier_weights(weights)¶
- set_skip_zero_weights(weights)¶
- set_weights_to_zero(bool_value)¶
- set_auto_joint_order(bool_value)¶
- set_orientation_transform(transform)¶
Transform to use to define the orientation of joints.
- set_orientation_vector(vector)¶
- set_fade_cosine(bool_value)¶
- set_fade_smoothstep(bool_value)¶
- run()¶
- class ComboControlShape(shape)¶
- add_target(target_name)¶
- add_control_position(control_attribute, value)¶
- set_blendshape(blendshape)¶
- set_base_mesh(base_mesh)¶
- create()¶
- class MultiJointShape(shape)¶
- set_joints(joints)¶
- set_weight_joints(joints)¶
- set_create_hookup(bool_value)¶
- set_target_mesh(base_mesh)¶
- set_skin_mesh(skinned_mesh)¶
- add_control_value(control_attribute, value)¶
- add_control_off_value(control_attribute, value)¶
- add_control_start_value(control_attribute, value)¶
- set_hook_to_empty_group(bool_value, name=None)¶
- set_read_axis(axis_letter)¶
- set_use_only_locator(at_inc=0)¶
- set_delta(bool_value)¶
- create()¶
- class MayaWrap(mesh)¶
Convenience for making maya wraps.
- Parameters
mesh (str) – The name of a mesh that should get wrapped.
- set_driver_meshes(meshes=None)¶
Set the meshes to drive the wrap. If more than 1 exclusive bind won’t work properly. Currently, polygons and nurbSurfaces work.
- Parameters
meshes (list) – List of meshes and nurbSurfaces to influence the wrap.
- set_base_parent(name)¶
Set the parent for the base meshes created.
- create()¶
Create the wrap.
- class EnvelopeHistory(transform)¶
Convenience for turning on/off deformation history on a node.
- Parameters
transform (str) – The name of a transform.
- turn_off()¶
Turn off all the history found.
- turn_off_referenced()¶
Turn off only history that is referenced. Not history that was created after referencing.
- turn_off_exclude(deformer_types)¶
Turn off all but the deformer types specified.
- turn_on(respect_initial_state=False)¶
Turn on all the history found.
- class ZipWire(top_curve, btm_curve)¶
- set_wire_mesh(mesh)¶
- set_controls(zip_left_control, zip_right_control)¶
- create()¶
- class ZipWire2(mesh, follow_curve_top, follow_curve_btm)¶
- set_description(description)¶
- set_attribute_node(name)¶
- set_weight_mesh(weighted_mesh, top_joint, btm_joint)¶
- set_wire_falloff(top_value, btm_value)¶
- set_expose_top_wire_falloff(default_value=1, max_value=1)¶
- set_expose_btm_wire_falloff(default_value=1, max_value=1)¶
- create()¶
- class WeightFromMesh(mesh)¶
Given a mesh, create joints a specified verts or edges, skin the mesh and weight a target mesh. Good for placing a mesh on another and through this class weighting a target mesh. This is useful for splitting blendshapes.
- add_vert_bone(joint_name, vertex_index)¶
- add_edge_bone(joint_name, edge_index)¶
edge index can be a single edge index or a list of edge indices
- set_target_mesh(mesh)¶
- set_bake_delta_mush_smooth(bool_value)¶
- run()¶
- 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) – Whether to joint the 2 start cvs under one cluster, and the two end cvs under another cluster.
join_start_end (bool) – Whether to join the start and end cvs under one cluster.
last_pivot_end (bool) – Whether 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_joint_at_points(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. This will only find deformers (geometryFilter)
- Parameters
geometry (str) – The name of the geometry
- Returns
A list of deformers in the deformation history.
- Return type
list
- find_all_deformers(mesh)¶
This checks if the node is of type geometryFilter in the history, and returns all found. The first node in the history that isn’t a geometryFilter (deformer) the tool assumes it at the end of the
deformer stack and returns.
- 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, e.g. skinCluster, blendShape
return_all (bool) – Whether 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=None)¶
Set envelopes 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) – Exclude 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) –
short_name (bool) – TODO: Fill description.
- 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. e.g. 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_relative_index_at_skin_influence(influence, skin_deformer)¶
Some commands like the api need the index as it appears in the list of entries Sometimes the skin cluster can be in an order of 50, 51, 55, 56 this will return the index as if those breaks in order couldn’t exist. So 55 would be 52
- get_relative_index_at_influences(influence, influences)¶
influences = influneces on a skin cluster
- 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. e.g. 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. e.g. 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, short_name=True)¶
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) – Whether 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 meshes 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, vert_ids=None)¶
Get the skin weights for the skin cluster. Return a dictionary where the key is the influence, and the value is 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
- get_closest_weight(influence, mesh, source_vector)¶
- get_surface_weight_index_at_cv_index(surface, index_u, index_v)¶
- get_skin_weight_at_barycentric(influence, mesh, face_id, triangle_id, bary_u, bary_v)¶
Given an influence, a triangle and bary_u and v values, find what the weight is. This was developed for sticky lips to be able to set the constraint W0 and W1 values from the joint_jaw weight.
- get_surface_weight_at_uv(surface_name, u, v)¶
- set_skin_blend_weights(skin_deformer, weights, index=0)¶
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.
index (int) – TODO: Fill description.
- set_skin_influence_weight(skin_deformer, weights, influence_name)¶
- 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_skin_envelope(mesh)¶
- set_skin_envelope(mesh, envelope_value)¶
- get_joint_index_map(joints, skin_cluster)¶
- average_skin_weights(verts)¶
- average_skin_weights_on_shells(mesh)¶
- smooth_skin_weights(verts, iterations=1, percent=1, mode=0, use_api=False)¶
- Args
- mode (int): 0 = surrounding face vertices
1 = surrounding vertices
- smooth_skin_weights_no_api(verts, iterations=1, percent=1, mode=0)¶
- smooth_skin_weights_api(verts, iterations=1, percent=1, mode=0)¶
- sharpen_skin_weights(verts, iterations=1, percent=1)¶
- delta_smooth_weights(mesh, top_joint=None)¶
- This seems to require the full skeleton to be under one joint. This can be an issue with say the tweaker joints
that sometimes live under controls for speed reasons.
- remove_skin_weights(verts, influences)¶
- has_influence(joint, 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.
- get_mesh_at_deformer_index(deformer, index)¶
- 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. e.g. 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
- remove_deformer_influences(deformer, index=0)¶
- 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
- blend_into_intermediate(source_mesh=None, target_mesh=None, keep_history=False)¶
- 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, auto_prune=False)¶
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.
auto_prune (bool) – TODO: Fill description.
- 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(mesh, skin_deformer=None, vis_attribute=None, constrain=False)¶
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.
vis_attribute (str) – The name of a visibility attribute to connect to. e.g. ‘node_name.sectionVisibility’
constrain (bool) – Whether 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, generate_bind_pre=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) – Whether to delete the original wire deformer.
skin (bool) – Whether to calculate and skin the bones to mimic the wire deformer.
falloff (float) – Corresponds to the wire distance value.
create_controls (bool) – Whether to create controls on the joints.
generate_bind_pre (bool) – TODO: Fill description.
- 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, indicies=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.
indicies – The indicies to work on, by default it does all found.
- 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, then 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 transferring 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(source_mesh, target_mesh, exclude_joints=None, include_joints=None, uv_space=False, layer=False)¶
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. exclude_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) – Whether to copy the skin weights in uv space rather than point space.
- skin_group_from_mesh(source_mesh, group, include_joints=None, exclude_joints=None, leave_existing_skins=False)¶
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. exclude_joints = joints to exclude from the target’s skin cluster. include_joints = only include the specified joints. If exclude_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.
exclude_joints (list) – Exclude the named joints from the skin cluster.
include_joints (list) – Include the named joint from the skin cluster.
leave_existing_skins (bool) – TODO: Fill description.
- skin_lattice_from_mesh(source_mesh, target, divisions=None, falloff=None, name=None, include_joints=None, exclude_joints=None)¶
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. exclude_joints = joints to exclude from the target’s skin cluster. include_joints = only include the specified joints. If exclude_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.
exclude_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=None, exclude_joints=None)¶
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. exclude_joints = joints to exclude from the target’s skin cluster. include_joints = only include the specified joints. If exclude_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.
exclude_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, dropoff_rate=4.0)¶
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.
dropoff_rate (float) – TODO: Fill description.
- skin_nurbs_from_mesh(source_mesh, target_nurbs)¶
- skin_cvs_from_mesh(source_mesh, target_cvs)¶
- skin_verts_from_mesh(source_mesh, target_verts)¶
- skin_mesh_from_nurbs(source_surface, target_mesh)¶
- skin_mirror(mesh)¶
Not working at all
- 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.
- unlock_joint_weights(skin_cluster)¶
- 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, return_class=False)¶
Create a 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.
return_class (bool) – TODO: Fill description.
- Returns
A list of base meshes.
- Return type
list
- proximity_wrap_create(source_mesh, target_mesh)¶
- proximity_wrap_add_driver(proximity_wrap, driver_mesh)¶
- 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 to fill in gaps between edges.
- Parameters
edges (list) – The edges from the source mesh to build the wire curve from. E.g. [“node_name.e[0]”]
geometry (list) – The target geometry that should follow.
description (str) – The description to give the setup.
auto_edge_path (bool) – Whether to fill in the path between the edges.
- Returns
The group name for the setup.
- Return type
str
- weight_hammer_verts(verts=None, print_info=True)¶
Convenience to use Maya’s weight hammer command on many verts individually.
- Parameters
verts (list) – The names of verts to weight hammer. If verts = None, currently selected verts will be hammered.
print_info (bool) – TODO: Fill description.
- 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(skin_mesh, corrective, replace=False)¶
Get the delta of the 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) – Whether 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.
replace (bool) – TODO: Fill description.
- Returns
name of new delta mesh
- Return type
str
- create_surface_joints(surface, name, uv_count=None, 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, front_of_chain=True)¶
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.
front_of_chain (bool) – TODO: Fill description.
- Returns
The name of the blendshape node.
- Return type
str
- isolate_shape_axis(base, target, axis_list=None)¶
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 axes 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.
- set_vert_positions(source_mesh, matching_target_mesh)¶
- match_geo_blendshape(source_geo, target_geo, attr_name, target_group=0)¶
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.
target_group (int) – TODO: Fill description.
- mirror_mesh(mesh_to_mirror, base_mesh)¶
- transfer_skeleton(start_mesh, end_mesh)¶
- accurate_transfer_skeleton(start_mesh, end_mesh)¶