mgear.flex.update_utils module
flex.update_utils
flex.update_utils module contains some simple methods that work as utilities for the flex update process
- module:
flex.update_utils
- mgear.flex.update_utils.add_attribute(source, target, attribute_name)
Adds the given attribute to the given object
Note
This is a generic method to addAttr all type of attributes inside Maya. Using the getAddAttrCmd from the MFnAttribute class allows avoiding to create one method for each type of attribute inside Maya as the addAttr command will differ depending on the attribute type and data.
- Parameters:
source (str) – the maya source node
target (str) – the maya target node
attribute_name (str) – the attribute name to add in the given element
- mgear.flex.update_utils.clean_uvs_sets(shape)
Deletes all uv sets besides map1
This is used to be able to update target shapes with whatever the source shape has. This is only relevant for mesh shape types.
- Parameters:
shape (string) – The Maya shape node
- mgear.flex.update_utils.copy_blendshape_node(node, target)
Copies the given blendshape node into the given target shape
- Parameters:
node (str) – blendshape node
target (str) – target shape node
- Returns:
copied blenshape node
- Return type:
str
- mgear.flex.update_utils.copy_map1_name(source, target)
Copies the name of the uvSet at index zero (map1) to match it
- Parameters:
source (str) – maya shape node
target (str) – maya shape node
- mgear.flex.update_utils.create_clusters_backup(shape, nodes)
Generates weight files for the given cluster nodes in the given shape
- Parameters:
shape (str) – the shape node name containing the cluster deformers nodes
nodes (list) – the cluster nodes
- Returns:
cluster weight files names
- Return type:
dict
- mgear.flex.update_utils.create_deformers_backups(source, target, shape_orig, deformers)
Handles creating the correct backup shapes for the given deformers
- Parameters:
source (str) – the shape containing the new shape
target (str) – the shape containing the deformers
shape_orig (str) – the intermediate shape from the target shape
deformers (dict) – deformers used on target
- Returns:
deformers backups nodes created
- Return type:
list, list
- mgear.flex.update_utils.create_duplicate(shape, duplicate_name)
Creates a shape node duplicate
- Parameters:
shape (str) – the shape node to duplicate
name (str) – the name for the duplicate
- Returns:
the duplicated shape node
- Return type:
str
- mgear.flex.update_utils.create_wrap(source, target, intermediate=None)
Creates a wrap deformer on the target by using source as driver
- Parameters:
source (str) – the maya source node
target (str) – the maya target node
intermediate (str) – the intermediate shape to use on the warp node
- Returns:
wrap node
- Return type:
str
- mgear.flex.update_utils.delete_transform_from_nodes(nodes)
Deletes the dag object transform node found from the given nodes
- Parameters:
shape (list) – nodes names
- mgear.flex.update_utils.filter_shape_orig(shape, intermediate)
Filters whether the intermediate shape provided should be used or not
if an intermediate isn’t provided then
- Parameters:
shape (str) – the shape node name
intermediate (str) – the intermediate shape name
- Returns:
the valid intermediate shape
- Return type:
str
- mgear.flex.update_utils.set_deformer_off(deformer)
Set envelope attribute to 0 on the given deformer
- Parameters:
deformer (str) – deformer node
- mgear.flex.update_utils.set_deformer_on(deformer)
Set envelope attribute to 1 on the given deformer
- Parameters:
deformer (str) – deformer node
- mgear.flex.update_utils.set_deformer_state(deformers, enable)
Set envelope attribute to one on the given deformers dictionary
- Parameters:
deformers (type) – dict containing the deformers set by type
enable (bool) – on or off state for the given deformers
- mgear.flex.update_utils.update_shape(source, target)
Connect the shape output from source to the input shape on target
- Parameters:
source (str) – maya shape node
target (str) – maya shape node