Help: Pymel: setWeights

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  02 February 2018
Help: Pymel: setWeights


Please help on Pymel!
How to use "setWeights(self, geometry, influnces, weights, normalize=True)" method of "pymel.core.nodetypes.SkinCluster"

Thank you!
  02 February 2018
I imagine it's similar to the method of settings weights with skinPercent, in maya.cmds it would be:
cmds.skinPercent( 'skinCluster1', 'pPlane1.vtx[100]', transformValue=[('joint1', 0.2), ('joint3', 0.8)])

In the above example we understand that skinCluster1 is connected to the shape node of pPlane1.

Of course in PyMel the skinCluster is a python object, if we assume the skinCluster is called sc then we would have:
sc.setWeights(pm.PyNode('pPlane1.vtx[100]'),[pm.PyNode('joint1'), pm.PyNode('joint3')],[0.2, 0.8])

This is just a guess by the way but hopefully it helps you a bit!

LinkedIn | Website | Vimeo | YouTube | Twitter | Facebook
  05 May 2018
The pymel command in invoking the OpenMaya function setWeights() as documented here: cluster_html

the "influences" argument is a list of integers - not pointers to nodes.

So you'll translate the list of influences you get from skinCluster.getInfluences() into a list of integers/indicies matching the weights you are passing into the call.
reply share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 03:28 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.