I'm working on a joint locking tool for weight painting.
It includes a UI which permits the user to type the names of the
joints into a textfield or to create a list from a selection via a
button.

If a list is created via a button, I update the text field to list the
selected joints.
This allow the user to update the selection via keyboard while they
are working.

I convert the list of joints to their names, separated by spaces,
before placing them into the textfield:

numJnts = len(tmpJnts2Unlock)
count = 1
for jnt in tmpJnts2Unlock:
        if count < numJnts:
                print ('if add jnt')
                tmpJntList += jnt.name() + ' '
        else:
                print ('else add jnt')
                tmpJntList += jnt.name()
        count += 1
textField('jnt2Unlock', e = 1, text = tmpJntList)

So far, so good.
When its time to unlock the joints, I retrieve the list from the
textfield, and at that point I can no longer access the attributes via
PyMEL

tmpJnts2UnlockString = textField('jnt2Unlock', query=True, text =
True )
tmpJnts2Unlock = tmpJnts2UnlockString.split(' ')

for jnt in tmpJnts2Unlock:
        if jnt.hasAttr('liw'):
AttributeError: 'unicode' object has no attribute 'hasAttr' #

or
print tmpJnts2Unlock[0].name()
AttributeError: 'unicode' object has no attribute 'name' #

If I use maya.cmds, it works:
if (cmds.attributeQuery( 'liw', node=jnt, exists = 1 ) ):
        cmds.setAttr (jnt + '.liw', 0)

Anyone know the fix?
Thanks much.

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to