PDA

View Full Version : Help updating floatFieldGrp dynamically (Python)


mattforni
06-18-2009, 03:02 AM
Hi all,

So I'm trying to create an automatic biped rigger based on a few locators. My UI has several selection boxes that select one locator at a time to be manipulated (translated). After the locator has been deselected I want to update a float field group to display the locator's new position. How does one go about setting the value of a floatFieldGrp, or a floatField for that matter, using python. As of right now I've tried using the setAttr method like so:

import maya.cmds as mc

root = mc.window(rtf=True)
mc.rowLayout()
fField = mc.floatFieldGrp(nf=3)
mc.showWindow(root)

mc.setAttr(fField+'.v', [1, 2, 3])

but run into the following error

# RuntimeError: No object matches name: window17|rowLayout71|floatFieldGrp56.v

so my question is how do you set the value of an already create floatFieldGrp?
Thanks in advance.
- Matt

djtomservo
06-18-2009, 05:49 PM
edit flag.

floatFieldGrp -e

mattforni
06-18-2009, 06:49 PM
I realized that about ten minutes after I posted, but I was wondering if there was anyway to do it dynamically, like any time the locator is moved regardless of whether or not it is deselected. Thanks for the quick response though.

benio33
06-18-2009, 09:53 PM
import maya.cmds as cmds

window = cmds.window()
cmds.columnLayout()
fltname = cmds.floatFieldGrp( 'testField' , numberOfFields=3, label='Scale', extraLabel='cm', value1=0.3, value2=0.5, value3=0.1 )
cmds.showWindow( window )
cmds.floatFieldGrp(fltname , e=1, v1=1, v2=2, v3=3)

Cheers!

mattforni
06-19-2009, 08:21 AM
thanks guys.

CGTalk Moderation
06-19-2009, 08:22 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.