Open GoogleCodeExporter opened 9 years ago
hi, can you provide the above pymel example translated into maya.cmds so i can
see
the difference? it's also useful to provide some code on how you generated the
'skinCluster1' node. it just makes our lives a bit easier.
Original comment by chad...@gmail.com
on 2 Feb 2010 at 7:14
i'm sorry ! i wasn't really sure about this error so it was a bit confusing
thanks to pymel now i have a good understanding how multi attrs works in maya
with
indices
from pymel.core import *
p=polyCube()
select(cl=1)
j1=joint(p=[-1,0,0])
j2=joint(p=[1,0,0])
select(p,j1,j2)
sk=skinCluster()[0]
so you have this polycube skinned with 2 joints
the mel that works:
string $sk="skinCluster1";
for($k=0; $k<8; $k++) {
setAttr ($sk+".wl["+$k+"].w[0:1]") 0 0;
}
the pymel that doesn't work
sk=PyNode('skinCluster1')
zero=[0 for x in xrange(2)]
for k in xrange(8):
sk.wl[k].w[0:7].set(zero)
it is providing slice to setAttr that fails
i don't know python enough to know if you can fix that but it could be
interesting
at first i thought you could send directly a list to the multi attribute like
that:
multiAttribute.set(list)
but maya mel brings the same error if you do that and you have to provide the
slice
to set before
Original comment by wou...@gmail.com
on 2 Feb 2010 at 2:24
btw here is the cmds version that works ;)
i just remembered that i forgot to write it
for k in xrange(8):
cmds.setAttr('skinCluster1.wl[%s].w[0:1]'%k, 0, 0)
Original comment by wou...@gmail.com
on 5 Feb 2010 at 12:26
the pymel attributes currently don't support slicing, or assigning to multiple
elements at once.
Would be nice to get this working, though, so I'm going to mark this as an
enhancement, and hopefully we'll be able to get to it...
Original comment by elron...@gmail.com
on 21 Jan 2011 at 4:41
Original issue reported on code.google.com by
wou...@gmail.com
on 17 Jan 2010 at 3:46