BlendShape

vtool.maya_lib.blendshape.BlendShape([…]) Convenience for working with blendshapes.
class BlendShape(blendshape_name=None)

Convenience for working with blendshapes.

Parameters:blendshape_name (str) – The name of the blendshape to work on.
create(mesh)

Create an empty blendshape on the mesh.

Parameters:mesh (str) – The name of the mesh.
rename(name)

Rename the blendshape.

Parameters:name (str) – The ne name of the blendshape.
set_envelope(value)

Set the envelope value of the blendshape node.

Parameters:value (float) –
set(blendshape_name)

Set the name of the blendshape to work on.

Parameters:blendshape_name (str) – The name of a blendshape.
set_mesh_index(index)
set_prune_distance(distance, comparison_mesh)
get_mesh_index(mesh)

Wip

get_mesh_count()
is_target(name)

Check if name is a target on the blendshape.

Parameters:name (str) – The name of a target.
is_target_connected(name)
get_target_names()
create_target(*args, **kwargs)

Add a target to the blendshape.

Parameters:
  • name (str) – The name for the new target.
  • mesh (str) – The mesh to use as the target. If None, the target weight attribute will be created only.
  • inbetween (float) – The inbetween value. 0.5 will have the target activate when the weight is set to 0.5.
insert_target(name, mesh, index)

Not implemented.

replace_target(name, mesh, leave_connected=False)

Replace the mesh at the target.

Parameters:
  • name (str) – The name of a target on the blendshape.
  • mesh (str) – The mesh to connect to the target.
remove_target(name)

Remove the named target.

Parameters:name (str) – The name of a target on the blendshape.
disconnect_target(name, inbetween=1)

Disconnect a target on the blendshape.

Parameters:
  • name (str) – The name of a target on the blendshape.
  • inbetween (float) – 0-1 value of an inbetween to disconnect.
rename_target(old_name, new_name)

Rename a target on the blendshape.

Parameters:
  • old_name (str) – The current name of the target.
  • new_name (str) – The new name to give the target.
recreate_target(name, value=1.0, mesh=None)

Recreate a target on a new mesh from a blendshape. If you wrap a mesh to the blendshaped mesh, you can specify it with the mesh arg. The target will be recreated from the mesh specified.

Parameters:
  • name (str) – The name of a target.
  • value (float) – The weight value to recreate the target it.
  • mesh (float) – The mesh to duplicate. This can be a mesh that doesn’t have the blendshape in its deformation stack.
Returns:

The name of the recreated target.

Return type:

str

recreate_all(mesh=None)

Recreate all the targets on new meshes from the blendshape.

If you wrap a mesh to the blendshaped mesh, you can specify it with the mesh arg. The target will be recreated from the mesh specified.

Parameters:mesh (float) – The mesh to duplicate. This can be a mesh that doesn’t have the blendshape in its deformation stack.
Returns:The name of the recreated target.
Return type:str
set_targets_to_zero()

Set all the target weights to zero.

set_weight(name, value)

Set the weight of a target.

Parameters:
  • name (str) – The name of a target.
  • value (float) – The value to set the target to.
set_weights(weights, target_name=None, mesh_index=0)

Set the vertex weights on the blendshape. If no taget name is specified than the base weights are changed.

Parameters:
  • weights (list) – A list of weight values. If a float is given, the float will be converted into a list of the same float with a count equal to the number of vertices.
  • target_name (str) – The name of the target. If no target given, return the overall weights for the blendshape.
  • mesh_index (int) – The index of the mesh in the blendshape. If the blendshape is affecting multiple meshes. Usually index is 0.
get_weights(target_name=None, mesh_index=0)
set_invert_weights(target_name=None, mesh_index=0)

Invert the blendshape weights at the target. If no target given, the base weights are inverted.

Parameters:
  • target_name (str) – The name of a target.
  • mesh_index (int) – The index of the mesh in the blendshape. If the blendshape is affecting multiple meshes. Usually index is 0.
disconnect_inputs()
reconnect_inputs()