My combine function appears to only be using one return out of the three I want to use as arguments. I receive the following error message
how can I resolve this?
Removing references to ikw and ikpv keeps me from getting the error. It thought I could use multiple returns from different functions in this manner but maybe not?
code for my button:
cmds.button(label='IK 2 FK', command = combine_lists, width=100)
def select_joints_afk():
Fks = []
del Fks[:]
if cmds.ls(selection = True,type=("transform",'nurbsCurve')):
sel = cmds.ls(sl=True)
fkCtrls = cmds.listRelatives(sel, allDescendents=True, type=("transform",'nurbsCurve'))
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))
del Fks[1]
del Fks[2]
Fks.extend(sel)
print Fks[0]
print Fks[1]
print Fks[2]
return Fks
else:
text = cmds.confirmDialog( title='Error', message='Must select joint', button=['OK'], defaultButton='Ok', dismissString='No' )
def select_joints_aikw():
ikw = []
del ikw[:]
if cmds.ls(selection = True,type=("transform",'nurbsCurve')):
ikwrist=cmds.ls(selection = True)
ikw = [nurbsCurve for nurbsCurve in ikwrist if nurbsCurve.startswith('IK') & nurbsCurve.endswith('Ctrl')]
cmds.textFieldButtonGrp(gtF1, edit = True, tx ='' .join(ikwrist),buttonLabel='IK OK',backgroundColor = (.5,.8,.2))
print ikw
return ikw
else:
text = cmds.confirmDialog( title='Error', message='Must select joint', button=['OK'], defaultButton='Ok', dismissString='No' )
def select_joints_ikpv():
ikpv = []
del ikpv[:]
if cmds.ls(selection = True,type=("transform",'nurbsCurve')):
ikPvsel = cmds.ls(selection = True)
ikpv = [nurbsCurve for nurbsCurve in ikPvsel if nurbsCurve.startswith('IK') & nurbsCurve.endswith('Ctrl')]
cmds.textFieldButtonGrp(gtF2, edit = True, tx ='' .join(ikPvsel),buttonLabel='IK OK',backgroundColor = (.5,.8,.2))
print ikpv
return ikpv
else:
text = cmds.confirmDialog( title='Error', message='Must select joint', button=['OK'], defaultButton='Ok', dismissString='No' )
def combine_lists(Fks,ikw,ikpv):
Fks = select_joints_afk()
ikw = select_joints_aikw()
ikpv = select_joints_ikpv()
print Fks+ikw+ikpv
You have
def combine_lists(Fks,ikw,ikpv)
which means whenever you call combine_lists() you need to pass it three arguments.. i.e. combine_lists(x, y, z). It looks like you are just using combine_lists to calculate those three things and you are not trying to pass it anything.. so just do:
def combine_lists():
Fks = select_joints_afk()
ikw = select_joints_aikw()
ikpv = select_joints_ikpv()
print Fks+ikw+ikpv