Hello,
I have a set of 3 buttons that I amusing to select joint chains and pole vectors. When I select the chain, I have the text in the textFieldButtonGrp change to the name of the selected joint.
My problem is that when I create another set of buttons in my UI and select another joint chain, the name still changes in my first set of buttons and not the second set. While I know this is because I declare the textFieldButtonGrp name in the select_joints_afk method I’m not sure how to change this so it could work no matter how many sets of textFieldButtonGrps I add to myUI.
would any know how to go about this?
code for UI:
cmds.text(label = 'Left Arm', align ='center')
tsL0 =cmds.textFieldButtonGrp(ed=False, adj=1,cal=(1,"left"),cw3=(10,100,25), cl3=("left","left","left") ,
buttonLabel='Root FK',bc = 'Create_Selection_Chains.select_joints_afk(right_arm_select)' )
gtF0 = tsL0
Code for selection
class Create_Selection_Chains:
def __init__(self, name, Fks, Ikw, ikpv):
self.name = name
self.Fks = Fks
self.Ikw = Ikw
self.ikpv = ikpv
def select_joints_afk(self):
if cmds.ls(selection = True,type=("transform",'nurbsCurve')):
sel = cmds.ls(sl=True)
fkCtrls = cmds.listRelatives(sel, allDescendents=True, type=("transform",'nurbsCurve'))
self.Fks = [nurbsCurve for nurbsCurve in fkCtrls if nurbsCurve.startswith('FK') & nurbsCurve.endswith('_Ctrl')]
cmds.textFieldButtonGrp(gtF0, edit = True, tx ='' .join(sel),buttonLabel='IK OK',backgroundColor = (.5,.8,.2))
self.Fks.extend(sel)
print self.Fks
return self.Fks
else:
text = cmds.confirmDialog( title='Error', message='Must select joint', button=['OK'],
defaultButton='Ok', dismissString='No' )