pymel.core.animation.deformerWeights

static animation.deformerWeights(*args, **kwargs)

Command to import and export the deformer weights to simple XML file. The Weight data is store in a per vertex fashion and reference into a point cloud of vertex data coming from the input geometry of the the deformer. For example a cluster deformer would have the following information: On import the weights are then maped back to the given deformer based on the method.

Flags:
Long name (short name) Argument Types Properties
defaultValue (dv) float  
   
deformer (df) unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Specify the deformer whose weights should be exported or imported.
export (ex) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Export the given deformer
ignoreName (ig) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Ignore the names of the layers on import, just use the order of the layers instead. This can be used for case that joint names have been changed. Leaving it on only name that match on import will be write to the deformer. Flag can have multiple arguments, passed either as a tuple or a list.

im (im) bool ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Import the given file to place weight on the listed deformer. See the method flag for details on the weights will be mapped to the destination deformer.
method (m) unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 

Set the method for find the weight of a given vertex on import. indexmethod uses the vertex index to map the weights onto the object. This is used when the object share the same topology as the exported data. nearestmethod find the nearest vertex in the imported data set and set the weight value to that value. This is best used when mapping a higher resolution mesh to a lower resolution. barycentricmethod is only support with polygon meshes. It finds the nearest triangle of the target geometry and rescales the weights by how close the source point is the the vertices. This is normally used with course mesh being mapped to a high resolution mesh. Note that the geometry being used is not the shape node but rather the incoming geometry to the deformer. In the case of a skin cluster this would be that bind pose.

path (p) unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
The path to the given file. Default to the current project.
positionTolerance (pt) float  
   
shape (sh) unicode ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Specify the source deformed shape. CURRENTLY NOT SUPPORTED!
weightTolerance (wt) float  
   
worldSpace (ws) bool  
   

Derived from mel command maya.cmds.deformerWeights

Example:

import pymel.core as pm

# Create plane and a cluster.
#
pm.file( f=True,new=True )
pm.polyPlane( ch=1, w=10, h=10, sx=5, sy=5, ax=(0,1,0) )
pm.cluster('pPlane1', name='testCluster')
# Modify some weights on the -x side of the character
#
pm.select( ['pPlane1.vtx[5]', 'pPlane1.vtx[11]', 'pPlane1.vtx[17]', 'pPlane1.vtx[23]'])
pm.percent( 'testCluster', v=0.5 )
# export the weights from the cluster node
#
pm.deformerWeights ("clusterWeights.xml", ex=True, deformer="testCluster")

Previous topic

pymel.core.animation.deformer

Next topic

pymel.core.animation.deviceManager

Core

Core Modules

Other Modules

This Page