Я пытаюсь выбрать несколько кривых резюме
это коды моей функции
это setArg
Func:
import maya.cmds as mc from functools import partial
def setArg(CTS, option, *args):
option = mc.radioButtonGrp(CTS, q=True, select=True)
if option == 1:
cvToSel = 'first'
print cvToSel
elif option == 2:
cvToSel = 'last'
print cvToSel
return cvToSel
это execute
Func:
def execute(cvToSel, *args):
newSel = []
curves = mc.listRelatives (type = 'nurbsCurve', shapes = True)
if not curves:
print ('no curves selected')
#mc.select(clear = True)
#print curves
for crv in curves:
len = mc.getAttr(crv+'.cp', s=True, multiIndices=True)
cvSelect = mc.intFieldGrp('numberOfCvs', q = True, value1 = True)
numCv = len - cvSelect
if cvToSel == 'last':
newSel = mc.select(crv+'.cv[%d'%numCv +':%d]'%len, tgl = True)
elif cvToSel == 'first':
newSel = mc.select(crv+'.cv[0' + ':%d]'%cvSelect, tgl = True)
#mc.select(newSel, replace = True)
это ui
Func:
def ui():
if mc.window('CV_Select', exists = True):
mc.deleteUI('CV_Select')
cvWin = mc.window('CV_Select', mxb = False)
mc.columnLayout( adjustableColumn = True )
mc.text( label = 'select curves' )
mc.intFieldGrp( 'numberOfCvs', label = 'Number Of Cvs', value1 = 10 )
ButtonOne = mc.radioButtonGrp( label='Type', labelArray2=['First CVs', 'Last CVs'], numberOfRadioButtons = 2)
mc.button( label = 'Select CVs', command = partial(execute, ButtonOne), align = 'center', aop = True)
mc.showWindow('CV_Select')
ui()
Как использовать аргументы?