vtool.maya_lib.blendshape

Class Summary

BlendShape([blendshape_name])

Convenience for working with blendshapes.

BlendShapeTarget(name, index)

Convenience for storing target information.

ShapeComboManager()

Convenience for editing blendshape combos.

Function Summary

is_shape_combo_manager(group)

get_shape_combo_managers()

get_shape_combo_base(shape_combo_group)

recreate_blendshapes([blendshape_mesh, ...])

get_inbetween_parent(inbetween)

find_possible_combos(shapes)

find_increment_value(shape)

is_inbetween(shape)

is_negative(shape)

transfer_blendshape_targets(blend_source, ...)

get_nice_names(names)

get_shape_and_combo_lists(targets)

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 new 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_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(name, mesh=None, inbetween=1)

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.

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.

  • leave_connected (bool) – TODO: Fill in description.

remove_target(name)

Remove the named target.

Parameters

name (str) – The name of a target on the blendshape.

get_target_attr_input(name)
get_target_attr_output(name)
get_target_input(name, inbetween=1)
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.

connect_target_attr(name, input_attr=None, output_attrs=None)
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, group=False)

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_post_deformation_mode(name, value)
connect_target_matrix(name, matrix_attribute)
set_weights(weights, target_name=None, mesh_index=0)

Set the vertex weights on the blendshape. If no target 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()
class BlendShapeTarget(name, index)

Convenience for storing target information.

class ShapeComboManager

Convenience for editing blendshape combos.

vetala_type = 'ShapeComboManager'
is_shape_combo_manager(group)
create(base)
load(manager_group, sync=True)
zero_out()
add_meshes(meshes, preserve_combos=False, preserve_inbetweens=False, delete_shape_on_add=False)
recreate_all()
get_shapes_in_group(group_name)
get_all_shape_names()
set_tag(tag_name, tag_value, append=True)
set_tag_dictionary(dictionary=None)
get_tag(tag_name)
get_tags()
get_tags_from_shape(shape)
get_tag_shapes(tag_name)
remove_tag(tag_name)
remove_tag_shapes(tag_name, shapes)
add_shape(name, mesh=None, preserve_combos=False, preserve_inbetweens=False)
turn_on_shape(name, value=1)
set_shape_weight(name, value)
set_prune_distance(distance)
get_mesh()
get_shapes()
recreate_shape(name, from_shape_combo_channels=False)
rename_shape(old_name, new_name)
remove_shape(name)
key_shapes(start_frame=0)
is_combo(name)
is_combo_valid(name, return_invalid_shapes=False)
is_combo_inbetween(combo)
add_combo(name, mesh=None)
recreate_combo(name, from_shape_combo_channels=False)
remove_combo(name)
get_combos()
find_possible_combos(shapes)
get_shapes_in_combo(combo_name, include_combos=False)
get_associated_combos(shapes)
get_inbetween_combos(combo)
get_inbetween_combo_parent(combo)
get_shape_and_combo_lists(meshes)
is_negative(shape, parent_shape=None)
get_negative_name(shape)
get_negative_parent(shape)
has_negative(shape)
is_inbetween(shape, parent_shape=None, check_exists=True)
get_inbetweens(shape=None)
get_inbetween_parent(inbetween)
get_inbetween_value(shape)
get_inbetween_values(parent_shape, inbetweens)
is_shape_combo_manager(group)
get_shape_combo_managers()
get_shape_combo_base(shape_combo_group)
recreate_blendshapes(blendshape_mesh=None, follow_mesh=None)
get_inbetween_parent(inbetween)
find_possible_combos(shapes)
find_increment_value(shape)
is_inbetween(shape)
is_negative(shape)
transfer_blendshape_targets(blend_source, blend_target, wrap_mesh=None, wrap_exclude_verts=None, use_delta_mush=False, use_uv=False)
get_nice_names(names)
get_shape_and_combo_lists(targets)