def UI_custom(self): cmds.rowLayout(nc=2, columnWidth=[1, 100], adj=2) cmds.text(label="Number Of Joints:") numJoints = len(self.jointInfo) self.numberOfJointsField = cmds.intField(value=numJoints, min=2, changeCommand=self.changeNumberOfJoints) cmds.setParent("..") joints = self.getJoints() self.createRotationOrderUIControl(joints[0]) cmds.separator() cmds.text(label="Orientation:", align="left") cmds.rowLayout(nc=3) cmds.attrEnumOptionMenu(attribute=self.moduleNamespace+":module_grp.sao_local", label="Local:") cmds.text(label="will be oriented to") cmds.attrEnumOptionMenu(attribute=self.moduleNamespace+":module_grp.sao_world", label="World:") cmds.setParent("..") cmds.separator() interpolating = False if cmds.objExists(self.moduleNamespace+":interpolation_container"): interpolating = True cmds.rowLayout(nc=2, columnWidth=[1, 80], adj=2) cmds.text(label="Interpolate:") cmds.checkBox(label="", value=interpolating, onc=partial(self.setup_interpolation, True), ofc=self.delete_interpolation)
def UI_custom(self): cmds.rowLayout(nc=2, columnWidth=[1, 100], adj=2) cmds.text(label="Number Of Joints:") numJoints = len(self.jointInfo) self.numberOfJointsField = cmds.intField(value=numJoints, min=2, changeCommand=self.changeNumberOfJoints) cmds.setParent("..") joints = self.getJoints() self.createRotationOrderUIControl(joints[0]) cmds.separator() cmds.text(label="Orientation:", align="left") cmds.rowLayout(nc=3) cmds.attrEnumOptionMenu(attribute=self.moduleNamespace+":module_grp.sao_local", label="Local:") cmds.text(label="will be oriented to") cmds.attrEnumOptionMenu(attribute=self.moduleNamespace+":module_grp.sao_world", label="World:") cmds.setParent("..") cmds.separator() interpolating = False if cmds.objExists(self.moduleNamespace+":interpolation_container"): interpolating = True cmds.rowLayout(nc=2, columnWidth=[1, 80], adj=2) cmds.text(label="Interpolate:") cmds.checkBox(label="", value=interpolating, onc=partial(self.setup_interpolation, True), ofc=self.delete_interpolation)
def UI_custom(self): cmds.rowLayout(nc=2,columnWidth=[1,100],adj=2) cmds.text(label='Number of Joints :') numJoints = len(self.jointInfo) self.numberOfJointsField = cmds.intField(value=numJoints, min=2, changeCommand=self.changeNumberOfJoints) cmds.setParent('..') joints = self.getJoints() self.createRotationOrderUIControl(joints[0]) cmds.separator() cmds.text(label='Orientation:', align='left') cmds.rowLayout(nc=3) cmds.attrEnumOptionMenu(attribute=self.moduleNamespace+':module_grp.sao_local',label='Local:') cmds.text(label=' will be oriented to ') cmds.attrEnumOptionMenu(attribute=self.moduleNamespace+':module_grp.sao_world',label='World:') cmds.setParent('..') cmds.separator() interpolating = False if cmds.objExists(self.moduleNamespace+':interpolation_container'): interpolating = True cmds.rowLayout(nc=2,columnWidth=[1,80], adj=2) cmds.text(label='Interpolate:') cmds.checkBox(label='',value=interpolating, onc=partial(self.setup_interpolation, True),ofc=self.delete_interpolation)
def doubleCheckAttrEnumWidget(self, myLabel, flag, *attrs): myString = [] for i, attr in enumerate(attrs): myString.append((i, attr)) self.tempLayout = mc.rowLayout(nc=4, h=self.widgetHeight, p=self.flagLayout) myCheckBox = mc.checkBox('%sCheckBox' % myLabel, l='', w=20, ann=flag, cc=Callback(self.activateWidget, '%sAttrEnumIn' % myLabel, '%sAttrEnumOut' % myLabel), p=self.tempLayout) mc.text('%sText' % myLabel, l=' '.join(myLabel.split('_')), w=150, align='left', p=self.tempLayout) mc.attrEnumOptionMenu('%sAttrEnumIn' % myLabel, l='', ei=myString, enable=False, w=140, p=self.tempLayout) mc.attrEnumOptionMenu('%sAttrEnumOut' % myLabel, l='', ei=myString, enable=False, w=140, p=self.tempLayout) self.doubleEnumCheckBoxes.append(myLabel)
def simpleCheckAttrEnumWidget(self, myLabel, flag, *attrs): myString = [] for i, attr in enumerate(attrs): myString.append((i, attr)) self.tempLayout = mc.rowLayout(nc=3, h=self.widgetHeight, p=self.form) myCheckBox = mc.checkBox('%sCheckBox' % myLabel, l='', w=20, ann=flag, cc=Callback(self.activateWidget, '%sAttrEnum' % myLabel), p=self.tempLayout) mc.text('%sText' % myLabel, l=' '.join(myLabel.split('_')), w=150, align='left', p=self.tempLayout) mc.attrEnumOptionMenu('%sAttrEnum' % myLabel, l='', ei=myString, enable=False, w=140, p=self.tempLayout) self.enumCheckBoxes.append(myLabel)
def switchFromUI(self, ctrl): """ Switch a spaces nodes to the specified target from the spaces UI @param ctrl: Control whose spaces target will be switched @type ctrl: str """ # Determine spaces node spacesNode = self.getSpacesNode(ctrl) tag = cmds.getAttr(spacesNode + '.nameTag') # Query Target # !!! optionMenu command no longer allows access to attrEnumOptionMenu !!! # target = cmds.optionMenu(tag+'_switchAEO',q=True,v=True) targetIndex = cmds.getAttr(cmds.attrEnumOptionMenu(tag + '_switchAEO', q=True, dtg=True)) target = self.targetList(spacesNode)[targetIndex] # Check keyframe options key = cmds.checkBoxGrp(self.uiKeyCBG, q=True, v1=True) keyPrevious = cmds.checkBoxGrp(self.uiKeyPreviousCBG, q=True, v1=True) # Check offset options maintainPos = cmds.checkBoxGrp(self.uiMaintainPosCBG, q=True, v1=True) # Do switch self.switch(ctrl, target, key, keyPrevious, maintainPos)
def findNamaSpaces(): cmds.namespace(setNamespace=":") namespaces = cmds.namespaceInfo(listOnlyNamespaces=True) for namespace in namespaces: if cmds.objExists(namespace + ":*"): # create a tab widgets[(namespace + "_tab")] = cmds.columnLayout( w=400, h=600, parent=widgets["tabLayout"]) # create attr field grps for translate rotate and scale cmds.separator(h=10, style="none") widgets[(namespace + "_attrFG_T")] = cmds.attrFieldGrp( attribute=(namespace + ":null.translate")) widgets[(namespace + "_attrFG_R")] = cmds.attrFieldGrp( attribute=(namespace + ":null.rotate")) widgets[(namespace + "_attrFG_S")] = cmds.attrFieldGrp( attribute=(namespace + ":null.scale")) cmds.separator(h=10, style="none") widgets[(namespace + "_attrEOM_Vis")] = cmds.attrEnumOptionMenu( label="Test", attribute=(namespace + ":null.Test")) # edit the tab name cmds.tabLayout(widgets["tabLayout"], edit=True, tabLabel=(widgets[(namespace + "_tab")], namespace))
def setupSpaceSwitchingControls(self): existingControls = cmds.columnLayout(self.UIElements["spaceSwitchingColumn"], q=True, childArray=True) if existingControls != None: cmds.deleteUI(existingControls) cmds.setParent(self.UIElements["spaceSwitchingColumn"]) largeButtonSize = 80 smallButtonSize = 35 enumOptionWidth = self.windowWidth -2*(largeButtonSize + smallButtonSize) enable = False selection = cmds.ls(sl=True, transforms=True) spaceSwitcher = None controlObj = None targetObject = None if len(selection) > 0: if cmds.attributeQuery("spaceSwitching", n=selection[0], exists=True): enable = True controlObj = selection[0] spaceSwitcher = selection[0] + "_spaceSwitcher" if len(selection) > 1: targetObject = selection[1] if targetObject == None: targetObject = self.selectedBlueprintModule + ":HOOK_IN" self.UIElements["spaceSwitching_rowLayout"] = cmds.rowLayout(enable=enable, nc=5, adjustableColumn=1, ct5=("both", "both", "both", "both", "both"), cw5=(enumOptionWidth, largeButtonSize, largeButtonSize, smallButtonSize, smallButtonSize)) if enable: attribute = spaceSwitcher + ".currentSpace" self.UIElements["currentSpace"] = cmds.attrEnumOptionMenu(label="Current Space", width=enumOptionWidth, enable=True, attribute=attribute) else: self.UIElements["currentSpace"] = cmds.attrEnumOptionMenu(label="Current Space", width=enumOptionWidth, enable=False) self.UIElements["spaceSwitching_spaceSwitch"] = cmds.button(enable=enable, label="Space Switch", c=partial(self.spaceSwitching_spaceSwitch, controlObj, targetObject)) self.UIElements["spaceSwitching_deleteKey"] = cmds.button(enable=enable, label="Delete Key", c=partial(self.spaceSwitching_deleteKey, spaceSwitcher)) self.UIElements["spaceSwitching_backKey"] = cmds.button(enable=enable, label="<", c=partial(self.spaceSwitching_backKey, spaceSwitcher)) self.UIElements["spaceSwitching_forewardKey"] = cmds.button(enable=enable, label=">", c=partial(self.spaceSwitching_forewardKey, spaceSwitcher))
def setupSpaceSwitchingControls(self): existingControls = cmds.columnLayout(self.UIElements['spaceSwitchingColumn'],q=True,childArray=True) if existingControls != None: cmds.deleteUI(existingControls) cmds.setParent(self.UIElements['spaceSwitchingColumn']) largeButtonSize = 80 smallButtonSize = 35 enumOptionWidth = self.windowWidth - 2*(largeButtonSize + smallButtonSize) enable=False selection=cmds.ls(selection=True, transforms=True) spaceSwitcher=None controlObj=None targetObject=None if len(selection) > 0: if cmds.attributeQuery('spaceSwitching', n=selection[0],exists=True): enable=True controlObj = selection[0] spaceSwitcher = selection[0] + '_spaceSwitcher' if len(selection) > 1: targetObject = selection[1] if targetObject == None: targetObject = self.selectedBlueprintModule + ':HOOK_IN' self.UIElements['spaceSwitching_rowLayout'] = cmds.rowLayout(enable=enable, nc=5, adjustableColumn=1, ct5=('both','both','both','both','both'), cw5=(enumOptionWidth,largeButtonSize,largeButtonSize, smallButtonSize,smallButtonSize)) if enable: attribute = spaceSwitcher + '.currentSpace' self.UIElements['currentSpace'] = cmds.attrEnumOptionMenu(label='Current Space',width=enumOptionWidth, enable=False, attribute=attribute) else: self.UIElements['currentSpace'] = cmds.attrEnumOptionMenu(label='Current Space',width=enumOptionWidth, enable=False) self.UIElements['spaceSwitching_spaceSwitch'] = cmds.button(enable=enable, label='Space Switch', c=partial(self.spaceSwitching_spaceSwitch, controlObj, targetObject)) self.UIElements['spaceSwitching_deleteKey'] = cmds.button(enable=enable, label='Delete Key', c=partial(self.spaceSwitching_deleteKey, spaceSwitcher)) self.UIElements['spaceSwitching_backKey'] = cmds.button(enable=enable, label='<', c=partial(self.spaceSwitching_backKey, spaceSwitcher)) self.UIElements['spaceSwitching_forwardKey'] = cmds.button(enable=enable, label='>', c=partial(self.spaceSwitching_forwardKey, spaceSwitcher))
def setupActiveModuleControls(self): existingControls = cmds.columnLayout(self.UIElements['activeModuleColumn'],q=True, childArray=True) if existingControls != None: cmds.deleteUI(existingControls) cmds.setParent(self.UIElements['activeModuleColumn']) largeButtonSize = 100 enumOptionWidth = 2*largeButtonSize self.settingsLocator = self.selectedBlueprintModule + ':SETTINGS' activeModuleAttribute = self.settingsLocator + '.activeModule' currentEntries = cmds.attributeQuery('activeModule', n=self.settingsLocator, listEnum=True) enable = True if currentEntries[0] == 'None': enable = False self.UIElements['activeModule_rowLayout'] = cmds.rowLayout(nc=3, adjustableColumn=1, ct3=('both','both','both'),cw3=(enumOptionWidth, largeButtonSize, largeButtonSize)) attributes = cmds.listAttr(self.settingsLocator, keyable=False) weightAttributes = [] for attr in attributes: if attr.find('_weight') != -1: weightAttributes.append(attr) self.UIElements['activeModule'] = cmds.attrEnumOptionMenu(label='Active Module', width=enumOptionWidth, attribute=activeModuleAttribute, changeCommand=partial(self.activeModule_enumCallback, weightAttributes),enable=enable) self.UIElements['keyModuleWeights'] = cmds.button(label='Key All',c=partial(self.keyModuleWeights, weightAttributes),enable=enable) self.UIElements['graphModuleWeights'] = cmds.button(label='Graph Weights',c=self.graphModuleWeights,enable=enable) cmds.setParent(self.UIElements['activeModuleColumn']) #self.UIElements['moduleWeights_frameLayout'] = cmds.frameLayout(collapsable=True, collapse=False, label='Module Weights', height=100, collapseCommand=self.moduleWeights_UICollapse, expandCommand=self.moduleWeights_UIExpand) self.UIElements["moduleWeights_frameLayout"] = cmds.frameLayout(collapsable=True, collapse=False, label="Module Weights") cmds.scrollLayout(hst=0) cmds.columnLayout(adj=True) cmds.attrFieldSliderGrp(at=self.settingsLocator + '.creationPoseWeight', enable=False) cmds.separator() for attr in weightAttributes: self.UIElements[attr] = cmds.floatSliderGrp(label=attr, field=True, precision=4, minValue=0.0, maxValue=1.0, value=cmds.getAttr(self.settingsLocator + '.' + attr),cc=partial(self.moduleWeights_sliderCallback,attr, weightAttributes)) parentUIElement = self.UIElements['moduleWeights_frameLayout'] self.create_moduleWeightsScriptJob(parentUIElement, weightAttributes) self.moduleWeights_updateMatchingButton()
def setupActiveModuleControls(self): existingControls = cmds.columnLayout(self.UIElements["activeModuleColumn"], q=True, childArray=True) if existingControls != None: cmds.deleteUI(existingControls) cmds.setParent(self.UIElements["activeModuleColumn"]) largeButtonSize = 100 enumOptionWidth = self.windowWidth - 2*largeButtonSize self.settingsLocator = self.selectedBlueprintModule + ":SETTINGS" activeModuleAttribute = self.settingsLocator + ".activeModule" currentEntries = cmds.attributeQuery("activeModule", n=self.settingsLocator, listEnum=True) enable = True if currentEntries[0] == "None": enable=False self.UIElements["activeModule_rowLayout"] = cmds.rowLayout(nc=3, adjustableColumn=1, ct3=("both", "both", "both"), cw3= (enumOptionWidth, largeButtonSize, largeButtonSize)) attributes = cmds.listAttr(self.settingsLocator, keyable=False) weightAttributes = [] for attr in attributes: if attr.find("_weight") != -1: weightAttributes.append(attr) self.UIElements["activeModule"] = cmds.attrEnumOptionMenu(label="Active Module", width=enumOptionWidth, attribute=activeModuleAttribute, changeCommand=partial(self.activeModule_enumCallback, weightAttributes), enable=enable) self.UIElements["keyModuleWeights"] = cmds.button(label= "Key All", c=partial(self.keyModuleWeights, weightAttributes), annotation='Key Control Switching', enable=enable) self.UIElements["graphModuleWeights"] = cmds.button(label="Graph Weights", c=self.graphModuleWeights, enable=enable) cmds.setParent(self.UIElements["activeModuleColumn"]) self.UIElements["moduleWeights_frameLayout"] = cmds.frameLayout(collapsable=True, collapse=False, label="Module Weights", height=100, collapseCommand = self.moduleWeight_UICollapse, expandCommand=self.moduleWeight_UIExpand) cmds.scrollLayout(hst=0) cmds.columnLayout(adj=True) cmds.attrFieldSliderGrp(at=self.settingsLocator+".creationPoseWeight", enable=False) cmds.separator for attr in weightAttributes: self.UIElements[attr] = cmds.floatSliderGrp(label=attr, field=True, precision=4, minValue=0.0, maxValue=1.0, value=cmds.getAttr(self.settingsLocator+"."+attr), cc=partial(self.moduleWeights_sliderCallback, attr, weightAttributes)) parentUIElements = self.UIElements["moduleWeights_frameLayout"] self.create_moduleWeightsScriptJob(parentUIElements, weightAttributes) self.moduleWeights_updateMatchingButton()
def ui_embed(self, parentLayout, char=''): """ @param parentLayout: Parent UI layout to parent spaces UI to. @type parentLayout: str @param char: Character namespace to create UI for @type char: str """ # Get Character Prefix if char: char += ':' # List all spaces with given prefix spaceNodeList = cmds.ls(char + '*_spn', r=True, et='transform') spaceNodeList = [i for i in spaceNodeList if not i.endswith('_con_spn')] # Generate target list with default elements targetList = ['SuperMover', 'Default'] # Build Spaces List from eNum attributes for node in spaceNodeList: if cmds.objExists(node + '.spaces'): enumList = cmds.addAttr(node + '.spaces', q=True, en=True).split(':') [targetList.append(i) for i in enumList if not targetList.count(i)] # Begin UI Build if not cmds.layout(parentLayout, q=True, ex=True): raise UserInputError('Parent layout ' + parentLayout + ' does not exists! Unable to embed Spaces UI!') cmds.setParent(parentLayout) # Clear Layout childArray = cmds.layout(parentLayout, q=True, ca=True) if type(childArray) == list: cmds.deleteUI(childArray) # Add Spaces control layout cmds.rowColumnLayout(self.uiRCL, numberOfColumns=5, columnWidth=[(1, 160), (2, 160), (3, 80), (4, 80), (5, 80)]) # Add KeyFrame CheckBoxs cmds.checkBoxGrp(self.uiKeyPreviousCBG, numberOfCheckBoxes=1, label="Key Before Switch", v1=0) cmds.checkBoxGrp(self.uiKeyCBG, numberOfCheckBoxes=1, label="Key After Switch", v1=0) for i in range(3): cmds.separator(h=20, style='none') cmds.checkBoxGrp(self.uiMaintainPosCBG, numberOfCheckBoxes=1, label="Maintain Position", v1=1) for i in range(4): cmds.separator(h=20, style='none') for i in range(5): cmds.separator(h=20, style='single') # ALL OptionMenu cmds.text(label='ALL') cmds.optionMenuGrp(self.uiAllOMG, cw=(1, 1), cal=(1, 'center'), label='', cc='glTools.tools.spaces.Spaces().switchAllFromUI()') for item in targetList: cmds.menuItem(label=item) cmds.button(w=80, l='Reset', c='glTools.tools.spaces.Spaces().resetAllFromUI("' + char + '")') cmds.button(w=80, l='Select', c='cmds.select(cmds.ls("' + char + '*_spn"))') cmds.button(w=80, l='Key', c='glTools.tools.spaces.Spaces().keyAllFromUI("' + char + '")') for i in range(5): cmds.separator(h=20, style='single') # Create attrEnumOptionMenu controls to accurately represent attribute values at all times. # ie - Update on frame change for spacesNode in spaceNodeList: tag = cmds.getAttr(spacesNode + '.nameTag') cmds.text(label=tag) cmds.attrEnumOptionMenu(tag + '_switchAEO', w=160, label='', attribute=spacesNode + '.spaces', dtg=spacesNode + '.spaces', cc='glTools.tools.spaces.Spaces().switchFromUI("' + spacesNode + '")') cmds.button(w=80, l='Reset', c='glTools.tools.spaces.Spaces().resetFromUI("' + spacesNode + '")') cmds.button(w=80, l='Select', c='cmds.select("' + spacesNode + '")') cmds.button(w=80, l='Key', c='glTools.tools.spaces.Spaces().key("' + spacesNode + '")')
maya.text(label="On/Off") maya.checkBox(l = 'Use Image Sequence',onCommand = 'maya.setAttr(thisImagePlane+".useFrameExtension",1)',\ offCommand = 'maya.setAttr(thisImagePlane+".useFrameExtension",0)') cameralist = maya.listCameras() #获得当前相机列表 cameralist.remove('persp');cameralist.remove('front');cameralist.remove('top');cameralist.remove('side'); cameralist.reverse() eistr = [] for i in cameralist: eistr.append([cameralist.index(i),i]) #获得ei字符串 cameraenum = maya.attrEnumOptionMenu(w = 100, ei = eistr) #建立一个下拉框显示过滤后的camera cameraindex = maya.attrEnumOptionMenu(cameraenum,q=1,npm=True) for i in eistr: if i[0] == cameraindex: thisCamera = i[1] #获得当前camera break if maya.imagePlane(thisCamera,q= 1,camera=True): thisImagePlane = maya.imagePlane(thisCamera,q = 1,n = True)[0] #获得当前plane else: maya.imagePlane(thisCamera,camera=thisCamera) thisImagePlane = maya.imagePlane(thisCamera,q = 1,n = True)[0] #获得当前plane maya.button(label="Replace sequence",w = 100,command = 'selected_node = maya.ls(sl=1);\
def createPreferredAngleUIControl(self, preferredAngle_representation): label = utils.stripLeadingNamespace(preferredAngle_representation)[1].partition('_representation')[0] enumOptionMenu = cmds.attrEnumOptionMenu(label=label, at=preferredAngle_representation + '.axis') cmds.scriptJob(attributeChange=[preferredAngle_representation+'.axis', partial(self.attributeChange_callBackMethod,preferredAngle_representation, '.axis')],parent=enumOptionMenu)
def __init__(self): self.name = "rsObjectsInPathUI" self.title = "rs Objects In Path" i_windowSize = (300, 385) if (cmds.window(self.name, q=1, exists=1)): cmds.deleteUI(self.name) self.window = cmds.window(self.name, title=self.title) s_winColPro2 = cmds.columnLayout(adjustableColumn=True, parent=self.window) s_winLayOr = cmds.frameLayout(label='Constrain objects in path', li=70, borderStyle='etchedOut', height=140, parent=s_winColPro2) s_winColA = cmds.columnLayout(adjustableColumn=True, parent=s_winLayOr) cmds.separator(height=10, style="none", hr=True, parent=s_winColA) self.intSliderObInPa = cmds.intSliderGrp(field=True, label='Objects in Path', cal=(1, "center"), cw=[(1, 90), (2, 50), (3, 100)], ad3=3, minValue=3, maxValue=50, fieldMinValue=3, fieldMaxValue=1000, value=3, parent=s_winColA) cmds.separator(height=10, style="none", hr=True, parent=s_winColA) cmds.rowLayout(numberOfColumns=6, cw=[(1, 2), (2, 90), (3, 2), (4, 90), (5, 5), (6, 110)], parent=s_winColA) cmds.separator(height=10, style="none", hr=True, parent=s_winColA) s_winLayOptions = cmds.frameLayout(lv=False, borderStyle='in', parent=s_winColA) s_winLayOptionsCol = cmds.columnLayout(adjustableColumn=True, parent=s_winLayOptions) cmds.separator(height=5, style="none", hr=True, parent=s_winLayOptionsCol) s_winRowA = cmds.rowLayout(numberOfColumns=6, cw=[(1, 2), (2, 90), (3, 2), (4, 90), (5, 5), (6, 110)], parent=s_winLayOptionsCol) cmds.separator(height=5, style="none", hr=True, parent=s_winRowA) self.mainPosObInPa = cmds.checkBox("rsConsPos", label='Cons Position', cc=self.rsMaintPos, align='right', v=True, parent=s_winRowA) cmds.separator(height=5, style="none", hr=True, parent=s_winRowA) self.mainTangObInPa = cmds.checkBox("rsConsOri", label='Cons Rotation', cc=self.rsMaintTan, align='right', v=True, parent=s_winRowA) cmds.separator(height=5, style="none", hr=True, parent=s_winRowA) cmds.separator(height=10, style="none", hr=True, parent=s_winLayOptionsCol) self.globalOriObInPaObInPa = cmds.checkBox("rsglobalOriObInPaentation", label='Global Rotation', align='right', v=False, en=False, parent=s_winRowA) s_winRowB = cmds.rowLayout(numberOfColumns=4, cw=[(1, 20), (2, 110), (3, 20), (4, 90)], parent=s_winLayOptionsCol) cmds.separator(height=5, style="none", hr=True, parent=s_winRowB) self.parentHierarObInPa = cmds.checkBox("rsParentHierarchyObInPa", label='Parent Hierarchy', align='right', v=False, parent=s_winRowB, en=False) cmds.separator(height=5, style="none", hr=True, parent=s_winRowB) self.selectNewObjsObInPa = cmds.checkBox("rsSelectNewObjsObInPa", label='Select New Objects', align='right', v=True, parent=s_winRowB) cmds.separator(height=5, style="none", hr=True, parent=s_winLayOptions) cmds.separator(height=10, style="none", hr=True, parent=s_winColA) s_winLayObjects = cmds.frameLayout(label='Objects for the path', li=86, borderStyle='etchedOut', parent=s_winColPro2) s_winColB = cmds.columnLayout(adjustableColumn=True, parent=s_winLayObjects) cmds.separator(height=10, style="none", hr=True, parent=s_winColB) s_winRowType = cmds.rowLayout(numberOfColumns=2, adjustableColumn3=2, cw=[(1, 4), (2, 100)], parent=s_winColB) cmds.separator(width=4, style="none", hr=True, parent=s_winRowType) self.opMenuCoInPa = cmds.attrEnumOptionMenu( l='Object type ', ei=[(0, ' Empty Group'), (1, ' Locator'), (2, ' Joint'), (3, ' Scene Object ')], cc=self.rsObjTypeCoInPa, parent=s_winRowType) cmds.separator(height=10, style="none", hr=True, parent=s_winColB) s_winLayObjOptions = cmds.frameLayout(lv=False, borderStyle='in', parent=s_winColB) s_winLayObjOptionsCol = cmds.columnLayout(adjustableColumn=True, parent=s_winLayObjOptions) cmds.separator(height=10, style="none", hr=True, parent=s_winLayObjOptionsCol) s_winRowObjects = cmds.rowLayout(numberOfColumns=3, adjustableColumn3=2, cw=[(1, 70), (2, 100), (3, 50)], columnAlign=(1, 'center'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)], parent=s_winLayObjOptionsCol) self.textObInPa = cmds.text(label='Scene object', align='center', parent=s_winRowObjects, en=False) self.fieldObInPa = cmds.textField(cmds.textField(), cc=self.rsFieldObInPa, edit=True, parent=s_winRowObjects, text=None, en=False) self.buttonObInPa = cmds.button(label='Pick up', c=self.rsPickObInPa, parent=s_winRowObjects, en=False) cmds.separator(height=10, style="none", hr=True, parent=s_winLayObjOptionsCol) s_winRowObjectsOptions = cmds.rowLayout(numberOfColumns=4, cw=[(1, 60), (2, 60), (3, 30), (4, 60)], columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0), (4, 'both', 0)], parent=s_winLayObjOptionsCol) cmds.separator(width=40, style="none", hr=True, parent=s_winRowObjectsOptions) cmds.radioCollection("OptionObject", parent=s_winRowObjectsOptions) self.copyObInPa = cmds.radioButton(label='Copy', parent=s_winRowObjectsOptions, en=False) cmds.separator(width=40, style="none", hr=True, parent=s_winRowObjectsOptions) self.instanceObInPa = cmds.radioButton(label='Instance', parent=s_winRowObjectsOptions, en=False) cmds.separator(height=10, style="none", hr=True, parent=s_winLayObjOptionsCol) self.frameLayoutLoftObInPa = cmds.frameLayout( label='Loft', li=128, lv=True, borderStyle='in', parent=s_winLayObjOptionsCol, en=False) s_winLayLoftButtonsCol = cmds.columnLayout( adjustableColumn=True, parent=self.frameLayoutLoftObInPa) cmds.separator(height=5, style="none", hr=True, parent=s_winLayLoftButtonsCol) s_winLayObjOptCurveOps = cmds.rowLayout(numberOfColumns=6, cw=[(1, 30), (2, 55), (3, 20), (4, 60), (5, 20), (6, 60)], columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0), (4, 'both', 0)], parent=s_winLayLoftButtonsCol) cmds.separator(width=10, style="none", hr=True, parent=s_winLayObjOptCurveOps) cmds.radioCollection("LoftOptions", parent=s_winLayObjOptCurveOps) self.opNoneObInPa = cmds.radioButton(label='None', parent=s_winLayObjOptCurveOps, en=False) cmds.separator(width=10, style="none", hr=True, parent=s_winLayObjOptCurveOps) self.opPolyObInPa = cmds.radioButton(label='Poligons', parent=s_winLayObjOptCurveOps, en=False) cmds.separator(width=10, style="none", hr=True, parent=s_winLayObjOptCurveOps) self.opNurbsObInPa = cmds.radioButton(label='Nurbs', parent=s_winLayObjOptCurveOps, en=False) cmds.separator(height=5, style="none", hr=True, parent=s_winLayLoftButtonsCol) cmds.separator(height=10, style="none", hr=True, parent=s_winColPro2) self.rsLaunchObInPa = cmds.button(label='Execute', w=100, c=self.rsLaunchObInPa, parent=s_winColPro2) self.rsTextObInPa = cmds.text(label=' Empty Group', vis=False, parent=s_winColPro2) cmds.window(self.window, e=1, w=430, h=103) cmds.showWindow(self.window) cmds.radioButton(self.instanceObInPa, e=True, select=True) cmds.radioButton(self.opNoneObInPa, e=True, select=True) cmds.window(self.window, edit=True, widthHeight=(i_windowSize), s=False)
def __init__(self): self.name = "rsObjectsInPathUI" self.title = "rs Objects In Path" i_windowSize = (300, 385) if (cmds.window(self.name, q=1, exists=1)): cmds.deleteUI(self.name) self.window = cmds.window(self.name, title=self.title) s_winColPro2 = cmds.columnLayout(adjustableColumn=True, parent=self.window) s_winLayOr = cmds.frameLayout(label='Constrain objects in path', li=70, borderStyle='etchedOut', height=140, parent=s_winColPro2) s_winColA = cmds.columnLayout(adjustableColumn=True, parent=s_winLayOr) cmds.separator(height=10, style="none", hr=True, parent=s_winColA) self.intSliderObInPa = cmds.intSliderGrp(field=True, label='Objects in Path', cal=(1, "center"), cw=[(1, 90), (2, 50), (3, 100)], ad3=3, minValue=3, maxValue=50, fieldMinValue=3, fieldMaxValue=1000, value=3, parent=s_winColA) cmds.separator(height=10, style="none", hr=True, parent=s_winColA) cmds.rowLayout(numberOfColumns=6, cw=[(1, 2), (2, 90), (3, 2), (4, 90), (5, 5), (6, 110)], parent=s_winColA) cmds.separator(height=10, style="none", hr=True, parent=s_winColA) s_winLayOptions = cmds.frameLayout(lv=False, borderStyle='in', parent=s_winColA) s_winLayOptionsCol = cmds.columnLayout(adjustableColumn=True, parent=s_winLayOptions) cmds.separator(height=5, style="none", hr=True, parent=s_winLayOptionsCol) s_winRowA = cmds.rowLayout(numberOfColumns=6, cw=[(1, 2), (2, 90), (3, 2), (4, 90), (5, 5), (6, 110)], parent=s_winLayOptionsCol) cmds.separator(height=5, style="none", hr=True, parent=s_winRowA) self.mainPosObInPa = cmds.checkBox("rsConsPos", label='Cons Position', cc=self.rsMaintPos, align='right', v=True, parent=s_winRowA) cmds.separator(height=5, style="none", hr=True, parent=s_winRowA) self.mainTangObInPa = cmds.checkBox("rsConsOri", label='Cons Rotation', cc=self.rsMaintTan, align='right', v=True, parent=s_winRowA) cmds.separator(height=5, style="none", hr=True, parent=s_winRowA) cmds.separator(height=10, style="none", hr=True, parent=s_winLayOptionsCol) self.globalOriObInPaObInPa = cmds.checkBox("rsglobalOriObInPaentation", label='Global Rotation', align='right', v=False, en=False, parent=s_winRowA) s_winRowB = cmds.rowLayout(numberOfColumns=4, cw=[(1, 20), (2, 110), (3, 20), (4, 90)], parent=s_winLayOptionsCol) cmds.separator(height=5, style="none", hr=True, parent=s_winRowB) self.parentHierarObInPa = cmds.checkBox("rsParentHierarchyObInPa", label='Parent Hierarchy', align='right', v=False, parent=s_winRowB, en=False) cmds.separator(height=5, style="none", hr=True, parent=s_winRowB) self.selectNewObjsObInPa = cmds.checkBox("rsSelectNewObjsObInPa", label='Select New Objects', align='right', v=True, parent=s_winRowB) cmds.separator(height=5, style="none", hr=True, parent=s_winLayOptions) cmds.separator(height=10, style="none", hr=True, parent=s_winColA) s_winLayObjects = cmds.frameLayout(label='Objects for the path', li=86, borderStyle='etchedOut', parent=s_winColPro2) s_winColB = cmds.columnLayout(adjustableColumn=True, parent=s_winLayObjects) cmds.separator(height=10, style="none", hr=True, parent=s_winColB) s_winRowType = cmds.rowLayout(numberOfColumns=2, adjustableColumn3=2, cw=[(1, 4), (2, 100)], parent=s_winColB) cmds.separator(width=4, style="none", hr=True, parent=s_winRowType) self.opMenuCoInPa = cmds.attrEnumOptionMenu(l='Object type ', ei=[(0, ' Empty Group'), (1, ' Locator'), (2, ' Joint'), (3, ' Scene Object ')], cc=self.rsObjTypeCoInPa, parent=s_winRowType) cmds.separator(height=10, style="none", hr=True, parent=s_winColB) s_winLayObjOptions = cmds.frameLayout(lv=False, borderStyle='in', parent=s_winColB) s_winLayObjOptionsCol = cmds.columnLayout(adjustableColumn=True, parent=s_winLayObjOptions) cmds.separator(height=10, style="none", hr=True, parent=s_winLayObjOptionsCol) s_winRowObjects = cmds.rowLayout(numberOfColumns=3, adjustableColumn3=2, cw=[(1, 70), (2, 100), (3, 50)], columnAlign=(1, 'center'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)], parent=s_winLayObjOptionsCol) self.textObInPa = cmds.text(label='Scene object', align='center', parent=s_winRowObjects, en=False) self.fieldObInPa = cmds.textField(cmds.textField(), cc=self.rsFieldObInPa, edit=True, parent=s_winRowObjects, text=None, en=False) self.buttonObInPa = cmds.button(label='Pick up', c=self.rsPickObInPa, parent=s_winRowObjects, en=False) cmds.separator(height=10, style="none", hr=True, parent=s_winLayObjOptionsCol) s_winRowObjectsOptions = cmds.rowLayout(numberOfColumns=4, cw=[(1, 60), (2, 60), (3, 30), (4, 60)], columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0), (4, 'both', 0)], parent=s_winLayObjOptionsCol) cmds.separator(width=40, style="none", hr=True, parent=s_winRowObjectsOptions) cmds.radioCollection("OptionObject", parent=s_winRowObjectsOptions) self.copyObInPa = cmds.radioButton(label='Copy', parent=s_winRowObjectsOptions, en=False) cmds.separator(width=40, style="none", hr=True, parent=s_winRowObjectsOptions) self.instanceObInPa = cmds.radioButton(label='Instance', parent=s_winRowObjectsOptions, en=False) cmds.separator(height=10, style="none", hr=True, parent=s_winLayObjOptionsCol) self.frameLayoutLoftObInPa = cmds.frameLayout(label='Loft', li=128, lv=True, borderStyle='in', parent=s_winLayObjOptionsCol, en=False) s_winLayLoftButtonsCol = cmds.columnLayout(adjustableColumn=True, parent=self.frameLayoutLoftObInPa) cmds.separator(height=5, style="none", hr=True, parent=s_winLayLoftButtonsCol) s_winLayObjOptCurveOps = cmds.rowLayout(numberOfColumns=6, cw=[(1, 30), (2, 55), (3, 20), (4, 60), (5, 20), (6, 60)], columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0), (4, 'both', 0)], parent=s_winLayLoftButtonsCol) cmds.separator(width=10, style="none", hr=True, parent=s_winLayObjOptCurveOps) cmds.radioCollection("LoftOptions", parent=s_winLayObjOptCurveOps) self.opNoneObInPa = cmds.radioButton(label='None', parent=s_winLayObjOptCurveOps, en=False) cmds.separator(width=10, style="none", hr=True, parent=s_winLayObjOptCurveOps) self.opPolyObInPa = cmds.radioButton(label='Poligons', parent=s_winLayObjOptCurveOps, en=False) cmds.separator(width=10, style="none", hr=True, parent=s_winLayObjOptCurveOps) self.opNurbsObInPa = cmds.radioButton(label='Nurbs', parent=s_winLayObjOptCurveOps, en=False) cmds.separator(height=5, style="none", hr=True, parent=s_winLayLoftButtonsCol) cmds.separator(height=10, style="none", hr=True, parent=s_winColPro2) self.rsLaunchObInPa = cmds.button(label='Execute', w=100, c=self.rsLaunchObInPa, parent=s_winColPro2) self.rsTextObInPa = cmds.text(label=' Empty Group', vis=False, parent=s_winColPro2) cmds.window(self.window, e=1, w=430, h=103) cmds.showWindow(self.window) cmds.radioButton(self.instanceObInPa, e=True, select=True) cmds.radioButton(self.opNoneObInPa, e=True, select=True) cmds.window(self.window, edit=True, widthHeight=(i_windowSize), s=False)