def rsLaunchObInPa(self, *args): d_type = {' Empty Group': 0, ' Locator': 1, ' Joint': 2, ' Scene Object ': 3} l_curves = cmds.ls(selection=True) i_number = cmds.intSliderGrp(self.intSliderObInPa, q=True, v=True) s_type = cmds.text(self.rsTextObInPa, q=True, l=True) i_type = d_type[s_type] b_consPos = cmds.checkBox(self.mainPosObInPa, q=True, v=True) b_consOri = cmds.checkBox(self.mainTangObInPa, q=True, v=True) b_orientWorld = cmds.checkBox(self.globalOriObInPaObInPa, q=True, v=True) b_parentHierarchy = cmds.checkBox(self.parentHierarObInPa, q=True, v=True) b_selectNewObjs = cmds.checkBox(self.selectNewObjsObInPa, q=True, v=True) o_toCurve = cmds.textField(self.fieldObInPa, q=True, text=True) if o_toCurve == "": o_toCurve = None try: if cmds.objExists(o_toCurve): pass except: o_toCurve = None i_instance = cmds.radioButton(self.instanceObInPa, q=True, select=True) i_loft = 0 if cmds.radioButton(self.opPolyObInPa, q=True, select=True): i_loft = 1 if cmds.radioButton(self.opNurbsObInPa, q=True, select=True): i_loft = 2 rsObjectsInPath(l_curves, i_number, i_type, b_consPos, b_consOri, b_orientWorld, b_parentHierarchy, b_selectNewObjs, o_toCurve, i_instance, i_loft)
def exportAssets_UI(self, *args): self.UIElements = {} # If the window exists, delete it. if cmds.window("ExportAssets", exists=True): cmds.deleteUI("ExportAssets") # Create the main window self.UIElements["window"] = cmds.window("ExportAssets", widthHeight=(240, 200), s=True ) # Create a flow layout to hold the UI Elements self.UIElements["radioFlowLayout"] = cmds.flowLayout(v=True, w=220) cmds.setParent( '..' ) cmds.setParent(self.UIElements["radioFlowLayout"]) cmds.radioCollection() self.UIElements['rigRadioButton'] = cmds.radioButton(l='Export Rig?') cmds.radioCollection() self.UIElements['setupRadioButton'] = cmds.radioButton(l='Export Setup?') cmds.separator( height=7, style='in' ) cmds.text(l=' Rename the Setup?') self.UIElements['nameTxt'] = cmds.textField(w=220, tx=self.characterName) self.UIElements['exportButton'] = cmds.button(label='Export Game Assets', width=220, c=self.exportGameAssets) cmds.showWindow(self.UIElements["window"])
def create(self): if cmds.window(self.window, exists=True): cmds.deleteUI(self.window); self.window = cmds.loadUI(uiFile=self.uiFile, verbose=False) cmds.showWindow(self.window); try: initPos = cmds.windowPref( self.window, query=True, topLeftCorner=True ) if initPos[0] < 0: initPos[0] = 0 if initPos[1] < 0: initPos[1] = 0 cmds.windowPref( self.window, edit=True, topLeftCorner=initPos ) except : pass ctrlPath = '|'.join([self.window, 'radioButton']); cmds.radioButton(ctrlPath, edit=True, select=True); ctrlPath = '|'.join([self.window, 'groupBox_4']); cmds.control(ctrlPath, edit=True, enable=False); ctrlPath = '|'.join([self.window, 'groupBox_2', 'pushButton_7']); cmds.button(ctrlPath, edit=True, enable=False); ctrlPath = '|'.join([self.window, 'groupBox_2', 'lineEdit']); cmds.textField(ctrlPath, edit=True, text="-u --oiio");
def apply_file(input): filepath = cmds.textField('animlib_filepath', query=True, text=True) data = animlib.file.read(filepath) (info_data, dependency_data, reference_data, anim_curve_data, constraint_data, pairblend_data, channel_data,) = data if 'references' in info_data.keys(): reference_remap = read_ref_map(info_data['references'].keys()) else: reference_remap = None print '!!!!!'+str(reference_remap) force_build_state = cmds.radioButton('animlib_force_build', query=True, select=True) build_unfound = cmds.radioButton('animlib_build_unfound', query=True, select=True) result = animlib.apply.build(data, force_build=force_build_state, reference_filter=reference_remap, reference_unfound=build_unfound) ref_update(None)
def read_windowInfo(): import cPickle import sgBFunction_fileAndPath if not os.path.exists( WinA_Global.infoPath ): sgBFunction_fileAndPath.makeFile( WinA_Global.infoPath ) sgBFunction_fileAndPath.makeFile( WinA_Global.infoPathPath ) try: f = open( WinA_Global.infoPath, 'r' ) data = cPickle.load( f ) f.close() except: return None if not data: return None try:exportPath, exportType, searchFor, searchForType, splitStringAndSerchCheck, splitStringAndSearchString = data except: return None cmds.textField( WinA_Global.exportPath_txf, e=1, tx= exportPath ) items = cmds.radioCollection( WinA_Global.exportType_radio, q=1, cia=1 ) cmds.radioButton( items[ exportType ], e=1, sl=1 ) cmds.textField( WinA_Global.searchFor_txf, e=1, tx=searchFor ) items = cmds.radioCollection( WinA_Global.searchForType_radio, q=1, cia=1 ) cmds.radioButton( items[ searchForType ], e=1, sl=1 ) cmds.checkBox( WinA_Global.searchForType_check, e=1, v=splitStringAndSerchCheck ) cmds.textField( WinA_Global.searchForType_txf, e=1, tx=splitStringAndSearchString )
def build(self): if mc.windowPref(self.win, exists=1): mc.windowPref(self.win, remove=1) if mc.window(self.win,exists=1): mc.deleteUI(self.win) mc.window( self.win, title=self.title, widthHeight=(500, 210) ) cl1 = mc.columnLayout( columnAttach=('both', 2), rowSpacing=3, columnWidth=500, adjustableColumn = True) mc.radioCollection() self.mouth = mc.radioButton( l='user import', select=1, p=cl1 ) self.autoR = mc.radioButton( l='auto import', p=cl1 ) mc.separator() mc.frameLayout('selected') mc.rowLayout(numberOfColumns=3, columnWidth3=(80, 75, 150), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] ) mc.text(l='Mode') mc.columnLayout() mc.radioCollection() self.prop = mc.radioButton( l='Prop', select=1 ) self.character = mc.radioButton( l='Character' ) mc.setParent( '..' ) mc.setParent( '..' ) self.numText = mc.floatFieldGrp( l='Num' ) self.txtProp = mc.textFieldButtonGrp( label='File Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath ) #mc.separator() #self.txtCharacter = mc.textFieldButtonGrp( label='Path', text='', buttonLabel='Browse', cw3 = (40,400,50), adjustableColumn3 = 2, cl3 = ('left', 'center', 'right'), bc = self.browse,cc=self.getPath ) #mc.separator() mc.separator(p=cl1) mc.button( 'importR', l='Import Reference File', p=cl1 ) mc.setParent( '..' )
def secondaryUI(): sec_UIname = 'secondary' if cmds.window(sec_UIname,exists = True): cmds.deleteUI(sec_UIname) cmds.window(sec_UIname,title = 'rosa_secondary') clmLot = cmds.columnLayout( adjustableColumn=True) cmds.textField('ctrl_name',text = 'ctrl_name') cmds.button('createctrl',label = 'create ctrl',h = 30,c = 'ctrl()') cmds.button('load_model',label = 'load "org" model',c = 'load_org()') cmds.textField('org_model',text = '"org" model') cmds.button('load_property_obj',label = 'loading property add object',c = 'load_vis()') cmds.textField('vis',text = 'Visibility') # flLot = cmds.flowLayout(columnSpacing = 6) cmds.text(label = 'ctrl axial:') cmds.radioCollection() cmds.radioButton('follic',label = 'follic',select = 0) cmds.radioButton('Custom',label = 'Custom',select = 1) # cmds.setParent( clmLot) cmds.button(label = 'Generate',c = 'secondary_add()') cmds.button('add_ctrl',label = 'add controller',c = 'add_controller()') cmds.button('Add_modelSec',label = 'Add_modelSec',c = 'Add_modelSec()') cmds.button(label = 'inverse_connect',c = 'inverse_connect01()') # cmds.frameLayout( label='modify ctrl:',borderStyle='etchedOut') cmds.setParent( clmLot) cmds.button(label = 'loding want to modify the controller',c = 'load_ctrl()') cmds.textField('sec_ctrl',text = 'secondary_ctrl') cmds.button(label = 'modify the controller position',c = 'ctrl_modify()') cmds.button(label = 'complete controller modifies',c = 'modify_complete()') cmds.showWindow()
def core(self): addSpaceWidth = 20 editWidt = self._width-addSpaceWidth halfWidth = editWidt/2 lastWidth = editWidt - halfWidth cmds.rowColumnLayout( nc=4, cw=[(1,addSpaceWidth+self._sideWidth), (2,halfWidth), (3,lastWidth), (4,self._sideWidth)] ) self._nameCollection = cmds.radioCollection() mainInfo.setSpace() cmds.radioButton( l='Prefix', sl=1 ) cmds.radioButton( l='Namespace' ) mainInfo.setSpace() cmds.setParent( '..' ) mainInfo.setSpaceH( 5 ) buttonWidth = self._width/2 lastWidth = self._width - buttonWidth cmds.rowColumnLayout( nc=4, cw=[(1,self._sideWidth), (2,buttonWidth), (3,lastWidth), (4,self._sideWidth)] ) mainInfo.setSpace() self._frontNameOptionMenu = cmds.optionMenu( ) cmds.menuItem( l='the file name' ) cmds.menuItem( l='this string') self._thisStringField = cmds.textField( en=0 ) mainInfo.setSpace() cmds.setParent( '..' )
def doIt( self, arglist ): wnd = cmds.window( "kgmEngineWindow_" + str(time.time()), widthHeight = ( 200, 200 ) ) #cmds.columnLayout( adjustableColumn = True ) #cmds.button( label = 'Export Map', command = kgmEngine.exportMap ) #cmds.button( label = 'Export Mesh', command = kgmEngine.exportMesh ) #cmds.button( label = 'Export Skeleton', command = kgmEngine.exportSkeleton ) #cmds.button( label = 'Export Animation', command = kgmEngine.exportAnimation ) #cmds.button( label = 'Insert Node', command = kgmEngine.insertNode ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns = 2 ) cmds.checkBox( "Mesh", label="Mesh", value=False, onCommand=kgmEngine.enableMesh, offCommand=kgmEngine.enableMesh ) cmds.checkBox( "Material", label="Material", value=False, onCommand=kgmEngine.enableMaterial, offCommand=kgmEngine.enableMaterial ) cmds.checkBox( "Skeleton", label="Skeleton", value=False, onCommand=kgmEngine.enableSkeleton, offCommand=kgmEngine.enableSkeleton ) cmds.checkBox( "Animation", label="Animation", value=False, onCommand=kgmEngine.enableAnimation, offCommand=kgmEngine.enableAnimation ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns = 2 ) cmds.columnLayout( adjustableColumn=True ) cmds.button( label = 'Export', command = kgmEngine.export ) cmds.button( label = 'Insert Node', command = kgmEngine.insertNode ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns = 3 ) cmds.columnLayout( adjustableColumn=True ) cmds.radioCollection() cmds.radioButton( label='Bin', align='left', select=False ) cmds.radioButton( label='Xml', align='left', select=True ) #cmds.radioButtonGrp( label='Format', labelArray3=['Bin', 'Txt', 'Xml'], numberOfRadioButtons=3 ) #cmds.radioButton( 'Format', label='Bin', ) cmds.showWindow( wnd )
def create(self): if mc.window(self.window,exists=True): mc.deleteUI(self.window,window=True) self.window = mc.window(self.window, title=self.title,widthHeight=self.size,menuBar=True) self.mainForm = mc.formLayout(nd=100) self.commandMenu() self.commonButtons() self.secondForm = mc.formLayout(nd=100) self.lightRigTypeText = mc.text( label = "Rig Type:", height = 15) radBtnCollection1 = mc.radioCollection() self.indoorRadBtn = mc.radioButton( "indoorRadBtn", label = "Indoor", onCommand = partial(self.rigBtnToggle,1) ) self.outdoorRadBtn = mc.radioButton( "outdoorRadBtn",label = "Outdoor", onCommand = partial(self.rigBtnToggle,2) ) self.timeOfDayText = mc.text( label = "Time of Day:", height = 15) radBtnCollection2 = mc.radioCollection() self.morningRadBtn = mc.radioButton( "morningRadBtn", label = "Morning", enable = True, onCommand = partial(self.dayBtnToggle,1) ) self.noonRadBtn = mc.radioButton( "noonRadBtn", label = "Noon", enable = True, onCommand = partial(self.dayBtnToggle,2) ) self.nightRadBtn = mc.radioButton( "nightRadBtn", label = "Night", enable = True, onCommand = partial(self.dayBtnToggle,3) ) mc.formLayout( self.secondForm, e = True, attachForm = ( [self.lightRigTypeText,"left", 135],[self.lightRigTypeText, "bottom", 500], [self.indoorRadBtn, "left", 185],[self.indoorRadBtn, "bottom", 497], [self.outdoorRadBtn, "left", 185],[self.outdoorRadBtn, "bottom", 477], [self.timeOfDayText,"left", 120], [self.timeOfDayText, "bottom", 452], [self.morningRadBtn, "left", 185],[self.morningRadBtn, "bottom", 449], [self.noonRadBtn, "left", 185],[self.noonRadBtn, "bottom", 429], [self.nightRadBtn, "left", 185],[self.nightRadBtn, "bottom", 409])) mc.radioCollection( radBtnCollection1, edit=True, select = self.indoorRadBtn ) self.displayOptions() mc.showWindow()
def create(self): form = cmds.formLayout() text = cmds.text( l= self.label, w=self.width1, h=self.height, al= self.aline ) radio = cmds.radioCollection() rb1 = cmds.radioButton( l=self.rbLabel1, w=self.width2, sl=1 ) rb2 = cmds.radioButton( l=self.rbLabel2, w=self.width3 ) rb3 = cmds.radioButton( l=self.rbLabel3, w=self.width4 ) check = cmds.checkBox( l=self.rbLabel4 ) txf = cmds.textField( en=0 ) cmds.setParent( '..' ) cmds.formLayout( form, e=1, af = [( text, 'top', 0 ),( text, 'left', 0 ), ( rb1, 'top', 0 ), ( rb2, 'top', 0 ), ( rb3, 'top', 0 )], ac = [( rb1, 'left', 0, text ), ( rb2, 'left', 0, rb1 ), ( rb3, 'left', 0, rb2 ), ( check, 'top', 0, text ), ( check, 'left', 0, text ), ( txf, 'top', 0, text ), ( txf, 'left', 0, check )] ) WinA_Global.searchForType_radio = radio WinA_Global.searchForType_check = check WinA_Global.searchForType_txf = txf WinA_Global.searchForType_form = form return form
def SundayAssetExportOptionsUI(): global assetExportDialog SundayMayaGuiPath = mel.eval('getenv SundayGui;') assetExportDialog = cmds.loadUI(uiFile = SundayMayaGuiPath + 'SundayAssetExportOption.ui') sceneName = cmds.file(query = True, shn = True, sn = True) assetName = sceneName.split('_') cmds.textField('assetExportNameLineEdit', edit = True, text = assetName[0]) cmds.radioButton('assetExportSelectedRadioButton', edit = True, changeCommand = 'SundayAssetExportPy.SundayAssetExportOptionsRigAndGeoCheckBoxToggle()') cmds.showWindow(assetExportDialog)
def ref_update(value): build_colour = [0.4,0.8,0.4] apply_colour = [0.3,0.55,1] skip_colour = [0.8,0.4,0.4] force_build_state = cmds.radioButton('animlib_force_build', query=True, select=True) build_unfound_state = cmds.radioButton('animlib_build_unfound', query=True, select=True) namespaces = cmds.text('animlib_ref_nsp_list', query=True, label=True).split('#') for namespace in namespaces: if namespace: field = 'animlib_ref_'+namespace+'_txt' new_nsp = cmds.textField(field, query=True, text=True) if not new_nsp.startswith(':'): new_nsp = ':' + new_nsp cmds.textField(field, edit=True, text = new_nsp) if new_nsp==':': cmds.textField(field, edit=True, text = '', backgroundColor = skip_colour) continue if force_build_state: cmds.textField(field, edit=True, backgroundColor = build_colour) continue if cmds.namespace(exists=new_nsp): cmds.textField(field, edit=True, backgroundColor = apply_colour) continue if build_unfound_state: cmds.textField(field, edit=True, backgroundColor = build_colour) continue cmds.textField(field, edit=True, backgroundColor = skip_colour)
def ui(self): if mc.window(self.winName,ex=True): mc.deleteUI(self.winName,window=True) else: pass #----- window -----# mc.window(self.winName , t = 'Edit Crv v1.0',w = 235,h = 160 , sizeable=False) # main self.form = mc.formLayout() #1 rowColumnLayout row = mc.rowColumnLayout(nc = 2,cat = [1,'right',5],ro = [(1,'both',2),(2,'both',2),(3,'both',2),(4,'both',2)]) self.rotateBN = mc.iconTextButton( style='textOnly' , w=150 , bgc=[0.5, 0.4, 0.33] , label='r o t a t e - c r v' , c=lambda *args:self.uiRunCmd('rotate') ) self.rotateFLE = mc.textField( 'rotateText' , w=70 , ed=True , text='45' ) self.scaleBN = mc.iconTextButton( style='textOnly' , w=150 , bgc=[0.5, 0.4, 0.33] , label='s c a l e - c r v' , c=lambda *args:self.uiRunCmd('scale') ) self.scaleFLE = mc.textField( 'scaleText' , w=70 , ed=True ,text='0.5' ) mc.setParent('..') #2 columnLayout column = mc.columnLayout(adj = True) mc.separator( style="in" , h=10 ) #2.1 rowLayout self.RIDRow = mc.rowLayout(nc = 3,cat = [1,'left',30]) self.AxisRID = mc.radioCollection() self.xAxisTypeRID = mc.radioButton('x' , l='X', w=60) self.yAxisTypeRID = mc.radioButton('y' , l='Y', w=60) self.zAxisTypeRID = mc.radioButton('z' , l='Z', w=60) mc.radioCollection( self.AxisRID, edit=True, select=self.xAxisTypeRID ) mc.setParent('..') self.runBN = mc.iconTextButton( style='textOnly' , h=30 , bgc=[0.23,0.33,0.39] , label='m i r r o r' , c=lambda *args:self.uiRunCmd('mirror')) mc.separator( style="in" , h=10 ) #2.2 rowLayout self.eximRow = mc.rowLayout(nc = 2) self.exportBN = mc.iconTextButton( style='textOnly' , w=110 , bgc=[0.5, 0.4, 0.33] , label='e x p o r t - s h a p e' , c=lambda *args:self.exportCurveShape() ) self.importBN = mc.iconTextButton( style='textOnly' , w=110 , bgc=[0.5, 0.4, 0.33] , label='i m p o r t - s h a p e' , c=lambda *args:self.importCurveShape() ) mc.setParent('..') mc.formLayout(self.form, edit=True, attachForm=[(row, 'top', 5), (row, 'left', 5), (row, 'right', 5), (column, 'bottom', 5), (column, 'right', 5), (column, 'left', 5) ], attachControl=[(row, 'bottom', 5, column)]) mc.showWindow(self.winName)
def __init__(self): #liste des attributs self.listNamespace = [] self.listEmptyNamespace = [] self.listSelectedNamespace = [] #If the window already exists, erase it if cmds.window('InE_NSMWin', exists=True): cmds.deleteUI('InE_NSMWin') #Create the window #s : Can window be resized? #rtf : Resize to fit childrens? self.window = cmds.window('InE_NSMWin', title = "Namespace Manager", widthHeight=(520, 435), s = False, rtf=True) #Main layout cmds.formLayout("InE_NSMFlowLayout", p = 'InE_NSMWin', w = 50, h = 50) cmds.image(image="R:\Benoit\Scripts\maya\icons\NSMBackground.png") #Layout that draws an empty space at the top to see the beautyful flowers cmds.columnLayout('InE_NSMEmptyLayout', p = "InE_NSMFlowLayout", columnAttach=('both', 14), rowSpacing=5, columnWidth=520, cal="left" ) cmds.text(label = "", p = 'InE_NSMEmptyLayout') cmds.text(label = "", p = 'InE_NSMEmptyLayout') cmds.text(label = "", p = 'InE_NSMEmptyLayout') cmds.text(label = "", p = 'InE_NSMEmptyLayout') cmds.text(label = "", p = 'InE_NSMEmptyLayout') #Real main layout containing all the UI cmds.rowColumnLayout( 'InE_NSMMainLayout', p = "InE_NSMEmptyLayout", numberOfColumns=2, columnWidth=[(1, 300), (2, 190)], h = 330, ro = [[1, "both", 20], [2, "both", 10]], co = [[1, "both", 10], [2, "both", 0]]) cmds.treeView('InE_NSMTextScrollList', parent = "InE_NSMMainLayout", numberOfButtons = 0, h= 150, abr = False, ams = True, adr = True, arp = True, idc = self.emptyMethod, sc = self.selectNamespace ) cmds.treeView('InE_NSMTextScrollList', edit = True, enk = True) cmds.columnLayout('InE_NSMInformations', p = "InE_NSMMainLayout", columnAttach=('both', 0), cw = 250, rowSpacing=5, cal="left" , ebg = True) cmds.text(p = 'InE_NSMInformations', label = "Informations") cmds.text('InE_NSMNameInformations', p = 'InE_NSMInformations', label = "") cmds.text('InE_NSMEmptyInformations', p = 'InE_NSMInformations', label = "") cmds.columnLayout('InE_NSMModifications', p = "InE_NSMMainLayout", columnAttach=('both', 20), co = ("both", 10), cw = 250, rowSpacing=6, cal="left" , ebg = True) cmds.text(p = 'InE_NSMModifications', label = "Rename selected to: ") cmds.textField('InE_NSMNameInput', p = 'InE_NSMModifications') cmds.radioCollection('InE_NSMRadioCollection', p = 'InE_NSMModifications') cmds.radioButton('InE_NSMRadioButton1', label='and keep namespace hierarchy', select=True ) cmds.radioButton('InE_NSMRadioButton2', label='and move namespace to root' ) cmds.button('InE_NSMRenameSelected', p = 'InE_NSMModifications', label = "Rename selected", en = True, command = self.renameSelected) cmds.columnLayout('InE_NSMButtons', p = "InE_NSMMainLayout", columnAttach=('both', 20), co = ("both", 10), rowSpacing=23, cal="left" , ebg = True) cmds.button('InE_NSMRemoveSelected', p = 'InE_NSMButtons', label = "Remove selected", w = 128, en = True, command = self.removeSelected) cmds.button('InE_NSMRemoveEmpty', p = 'InE_NSMButtons', label = "Remove empty", w = 128, en = True, command = self.removeEmpty) cmds.button('InE_NSMRemoveAll', p = 'InE_NSMButtons', label = "Remove all", w = 128, en = True, command = self.removeAll) cmds.showWindow() self.updateTreeView() print self.listNamespace
def buildUi(self): self.wind = cmds.window(self.winName, title='Matrix collision setup | PaulWinex | v2.0', widthHeight=[390,270]) cmds.columnLayout(adjustableColumn=True) cmds.frameLayout( label='Naming' ) self.elementName = cmds.textFieldGrp(label='Element Name') self.sideNameMenu = cmds.optionMenuGrp( label='Side',columnWidth=(2, 180) ) for k in '','center','left','right','lower','upper': cmds.menuItem( label=k ) cmds.setParent( '..' ) cmds.frameLayout( label='Orient collision plane to' ) cmds.rowLayout( numberOfColumns=4) cmds.columnLayout() collection1 = cmds.radioCollection() self.rbMeshNormal = cmds.radioButton( label='Mesh Normal', sl=1 ) self.rbRigControl = cmds.radioButton( label='Rig Control' ) cmds.setParent( '..' ) cmds.columnLayout() self.fromCamera = cmds.radioButton( label='From Camera' ) self.ontocamera = cmds.radioButton( label='Onto Camera' ) cmds.setParent( '..' ) cmds.columnLayout() self.rbX = cmds.radioButton( label='X' ) self.rbY = cmds.radioButton( label='Y' ) self.rbZ = cmds.radioButton( label='Z' ) cmds.setParent( '..' ) cmds.columnLayout() self.rbXn = cmds.radioButton( label='-X' ) self.rbYn = cmds.radioButton( label='-Y' ) self.rbZn = cmds.radioButton( label='-Z' ) cmds.setParent( '..' ) cmds.setParent( '..' ) cmds.frameLayout( label='Source Objects' ) cmds.rowLayout( numberOfColumns=3, columnWidth3=(90, 75, 40), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] ) cmds.text('Rig Control') self.text2 = cmds.textField(editable=0) self.set2 = cmds.button(label='set', c=partial(self.setObject,2)) cmds.setParent('..') cmds.rowLayout( numberOfColumns=3, columnWidth3=(90, 75, 40), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)] ) cmds.text('Collision Mesh') self.text3 = cmds.textField(editable=0) self.set3 = cmds.button(label='set', c=partial(self.setObject,3)) cmds.setParent('..') cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) self.export = cmds.button(label='Do setup', c=self.doSetup)
def addShaderInWindow(): '''This function does: - create radioButton for shader; - extract object type;''' # mc.checkBox(label=shader) radioCollection1 = mc.radioCollection() for material in listMaterials: OnCommandValue = 'checkSelected( "' + material + '")' mc.radioButton( material, label=material, select=True, onCommand=OnCommandValue ) TypeShader = mc.nodeType( material ) mc.text( label=TypeShader )
def SundayLocatorToolCreate(locatorType): objects = cmds.ls(selection = True) locators = [] locatorUp = '0 0 0' if cmds.radioButton('LocatorDirectionXUpRadioButton', query = True, select = True): locatorUp = '0 0 90' if cmds.radioButton('LocatorDirectionYUpRadioButton', query = True, select = True): locatorUp = '0 90 0' if cmds.radioButton('LocatorDirectionZUpRadioButton', query = True, select = True): locatorUp = '90 0 0' if cmds.checkBox('SundayLocatorToolMakeControllerForSelectedCheckBox', query = True, value = True): if len(objects) != 0: for curObj in objects: mel.eval(SundayLocatorToolPy.SundayLocatorToolGetLocator(curObj + '_CTRL', locatorType, locatorUp)) curLocator = cmds.ls(selection = True)[0] locators.append(curLocator) cmds.setAttr(curLocator + '.overrideEnabled', 1) cmds.setAttr(curLocator + '.overrideColor', int(cmds.iconTextRadioCollection('SundayLocatorToolColorCollection', query = True, select = True).split('_')[1])) cmds.select(curObj, curLocator) cmds.pointConstraint(name = curLocator + '_tempJOINTPointConstraint') cmds.orientConstraint(name = curLocator + '_tempJOINTOrientConstraint') cmds.delete(curLocator + '_tempJOINTPointConstraint*') cmds.delete(curLocator + '_tempJOINTOrientConstraint*') else: SundayDialogPy.SundayDialogConfirm('Error ', 'No objects selected', 'OK') return None (len(objects) != 0).select(locators) cmds.headsUpMessage('Transform the locator(s) as you like and deselect to make it an controller') cmds.scriptJob(event = [ 'SelectionChanged', 'SundayLocatorToolPy\nreload(SundayLocatorToolPy)\nSundayLocatorToolPy.SundayLocatorToolMoveSelectedToLocator(' + str(locators) + ', ' + str(objects) + ')'], runOnce = True) elif len(objects) != 0: for curObj in objects: mel.eval(SundayLocatorToolPy.SundayLocatorToolGetLocator(curObj + '_CTRL', locatorType, locatorUp)) curLocator = cmds.ls(selection = True)[0] cmds.setAttr(curLocator + '.overrideEnabled', 1) cmds.setAttr(curLocator + '.overrideColor', int(cmds.iconTextRadioCollection('SundayLocatorToolColorCollection', query = True, select = True).split('_')[1])) locators.append(curLocator) cmds.select(curObj, curLocator) cmds.pointConstraint(name = curLocator + '_tempJOINTPointConstraint') cmds.orientConstraint(name = curLocator + '_tempJOINTOrientConstraint') cmds.delete(curLocator + '_tempJOINTPointConstraint*') cmds.delete(curLocator + '_tempJOINTOrientConstraint*') cmds.select(locators) else: mel.eval(SundayLocatorToolPy.SundayLocatorToolGetLocator('SundayLocator', locatorType, locatorUp)) curLocator = cmds.ls(selection = True)[0] cmds.setAttr(curLocator + '.overrideEnabled', 1) cmds.setAttr(curLocator + '.overrideColor', int(cmds.iconTextRadioCollection('SundayLocatorToolColorCollection', query = True, select = True).split('_')[1]))
def createUI (self, *pArgs): if cmds.window(self.windowID, exists = True): cmds.deleteUI(self.windowID) cmds.window(self.windowID, title = 'normalizeUI', sizeable = True, resizeToFitChildren = True) cmds.columnLayout(columnAttach = ('both', 5), columnWidth = 250) #cmds.rowColumnLayout(numberOfColumns = 2, columnWidth = [(1,120), (2,120)], columnOffset = [(1, 'left', 3), (2, 'left', 3)]) cmds.rowLayout(numberOfColumns = 2, columnWidth2 = (125, 125), columnAlign2 = ("right", "center") ) cmds.text(label = 'scaling factor:', width = 100, align = 'right') scalingFactorField = cmds.floatField(value = 1.0, minValue = 0.1, maxValue = 10, step = 0.1, precision = 2, width = 100) cmds.setParent('..') #cmds.rowLayout(numberOfColumns = 1, columnWidth1 = (250), columnAlign1 = "center") cmds.text(label = '---------- Position ----------') cmds.rowLayout(numberOfColumns = 3, columnWidth3 = (80, 80, 80)) centerMethod = cmds.radioCollection() avPoint = cmds.radioButton("centerPoint", label = 'center', select = 1) centroid = cmds.radioButton("centroidPoint", label = 'centroid') centerOBB = cmds.radioButton("centerOBB", label = 'OBB') cmds.setParent('..') cmds.rowLayout(numberOfColumns = 2, columnWidth2 = (125, 125)) transToZero = cmds.checkBox(label = 'set T = (0,0,0)', value = True) pivToZero = cmds.checkBox(label = 'set piv = (0,0,0)', value = True) cmds.setParent('..') cmds.text(label = '---------- Orientation ----------') cmds.rowLayout(numberOfColumns = 2, columnWidth2 = (125, 125)) alignToAxis = cmds.checkBox(label = 'align obj', value = True) # create dropdown menu for different alignment obtions axisOrder = cmds.optionMenu( label='axis order:') cmds.menuItem( label='xyz' , p = axisOrder) cmds.menuItem( label='xzy' , p = axisOrder) cmds.menuItem( label='yxz' , p = axisOrder) cmds.menuItem( label='yzx' , p = axisOrder) cmds.menuItem( label='zxy' , p = axisOrder) cmds.menuItem( label='zyx' , p = axisOrder) cmds.optionMenu(axisOrder, e = 1, select = 4) cmds.setParent('..') cmds.rowLayout(numberOfColumns = 2, columnWidth2 = (125, 125)) fast = cmds.checkBox(label = 'fast calculation', value = False) cmds.separator(h = 10, style = 'none') cmds.setParent('..') cmds.rowLayout(numberOfColumns = 2, columnWidth2 = (125, 125), columnAlign2 = ("center", "center")) cmds.button(label = 'apply', command = partial(self.__applyCallback, scalingFactorField, transToZero, pivToZero, alignToAxis, axisOrder, fast, centerMethod) , width = 80) cmds.button(label = 'cancel', command = self.__cancelCallback, width = 80) #cmds.window("wNormalize", e = 1, wh = [250,120]) cmds.showWindow()
def UIqury(self): jointA = cmds.textField('jointA',q = True,text = True) jointB = cmds.textField('jointB',q = True,text = True) if cmds.radioButton( 'Replace',q = True,sl=True) == True: paint_operation = 'Replace' if cmds.radioButton( 'Add',q = True,sl=True) == True: paint_operation = 'Add' Opacity = cmds.floatSliderGrp('Opacity',q = True,value=True) Value = cmds.floatSliderGrp('Value',q = True,value=True) weightValue = Opacity * Value print paint_operation,weightValue return jointA,jointB,paint_operation,weightValue
def setUiCommand(self): cmds.button( self.button, e=1, c= WinA_Cmd.export ) items = cmds.radioCollection( WinA_Global.exportType_radio, q=1, cia=1 ) for item in items: cmds.radioButton( item, e=1, cc= WinA_Cmd.setWindowCondition ) cmds.checkBox( WinA_Global.searchForType_check, e=1, cc= WinA_Cmd.splitStringEnable ) exportPathPopup = cmds.popupMenu( p=WinA_Global.exportPath_txf ) sgBFunction_ui.updatePathPopupMenu( WinA_Global.exportPath_txf, exportPathPopup )
def SundayControllerToolApply(locatorType): joints = cmds.ls(selection = True) if len(joints) != 0: ctrls = [] locatorUp = '0 0 0' if cmds.radioButton('ControllerDirectionXUpRadioButton', query = True, select = True): locatorUp = '90 0 0' if cmds.radioButton('ControllerDirectionYUpRadioButton', query = True, select = True): locatorUp = '0 90 0' if cmds.radioButton('ControllerDirectionZUpRadioButton', query = True, select = True): locatorUp = '0 0 90' for curJoint in joints: joint_grp = curJoint + '_GRP' joint_ctrl = curJoint + '_CTRL' ctrls.append(joint_ctrl) cmds.group(empty = True, name = joint_grp) if cmds.checkBox('CreateSDKGroupCheckBox', query = True, value = True): joint_sdk = curJoint + '_SDK' cmds.group(empty = True, name = joint_sdk) cmds.parent(joint_sdk, joint_grp) mel.eval(SundayLocatorToolPy.SundayLocatorToolGetLocator(joint_ctrl, locatorType, locatorUp)) cmds.parent(joint_ctrl, joint_sdk) else: mel.eval(SundayLocatorToolPy.SundayLocatorToolGetLocator(joint_ctrl, locatorType, locatorUp)) cmds.parent(joint_ctrl, joint_grp) print cmds.iconTextRadioCollection('ltColorCollection', query = True, select = True) cmds.setAttr(joint_ctrl + '.overrideEnabled', 1) cmds.setAttr(joint_ctrl + '.overrideColor', int(cmds.iconTextRadioCollection('ltColorCollection', query = True, select = True).split('_')[1])) cmds.select(curJoint, joint_grp) cmds.pointConstraint(name = joint_grp + '_tempJOINTPointConstraint') cmds.orientConstraint(name = joint_grp + '_tempJOINTOrientConstraint') cmds.delete(joint_grp + '_tempJOINTPointConstraint*') cmds.delete(joint_grp + '_tempJOINTOrientConstraint*') if cmds.checkBox('CreateConstraintCheckBox', query = True, value = True): cmds.parentConstraint(joint_ctrl, curJoint) if cmds.checkBox('CreateParentConstraintCheckBox', query = True, value = True): cmds.select(curJoint) cmds.pickWalk(direction = 'up') if cmds.ls(selection = True)[0] != curJoint: cmds.select(joint_grp, add = True) cmds.ParentConstraint() cmds.ls(selection = True)[0] != curJoint cmds.select(ctrls) else: SundayDialogPy.SundayDialogConfirm('Error ', 'No joints selected', 'OK')
def loadUI(self, ui_file): """ Loads the UI and does post-load commands. """ # # Create two new functions, cmds.submit_callb() and cmds.do_submit_callb(). # These functions are called by UI elements in resources/submit_dialog.ui. # Each UI element in that file uses these functions to query this Object # for its initial value. # # For example, the "frange" textbox calls cmds.submit_callb('frange'), # which causes its value to be set to whatever the value of self.frange # is currently set to. # # Initial values can also be function based. For example, the "renderer" dropdown # calls cmds.submit_callb('renderer'), which in turn triggers self.init_renderer(). # cmds.submit_callb = partial(self.get_initial_value, self) cmds.do_submit_callb = partial(self.submit, self) # # Delete the "SubmitDialog" window if it exists. # if cmds.window('SubmitDialog', q=True, ex=True): cmds.deleteUI('SubmitDialog') # # Load the UI file. See the init_* functions below for more info on # what each UI element does as it's loaded. # name = cmds.loadUI(f=ui_file) # # Callbacks - set up functions to be called as UI elements are modified. # cmds.radioButton('existing_project', e=True, onCommand=self.select_existing_project) cmds.radioButton('new_project', e=True, onCommand=self.select_new_project) cmds.checkBox('upload_only', e=True, changeCommand=self.upload_only_toggle) cmds.optionMenu('renderer', e=True, changeCommand=self.change_renderer) cmds.optionMenu('job_type', e=True, changeCommand=self.change_job_type) cmds.checkBox('distributed', e=True, changeCommand=self.distributed_toggle) cmds.textScrollList('layers', e=True, selectCommand=self.change_layers) # # Call a few of those callbacks now to set initial UI state. # self.change_renderer( self.renderer ) self.select_new_project( True ) return name
def loadUI(self, ui_file): """ Loads the UI and does an post-load commands """ # monkey patch the cmds module for use when the UI gets loaded cmds.submit_callb = partial(self.get_initial_value, self) cmds.do_submit_callb = partial(self.submit, self) if cmds.window('SubmitDialog', q=True, ex=True): cmds.deleteUI('SubmitDialog') name = cmds.loadUI(f=ui_file) cmds.textScrollList('layers', e=True, append=self.layers) # check for existing projects to determine how project selection should # be displayed num_existing_projs = cmds.optionMenu('existing_project_name', q=True, ni=True) if num_existing_projs == 0: cmds.radioButton('existing_project', e=True, en=False) else: cmds.radioButton('existing_project', e=True, en=True) # callbacks cmds.checkBox('upload_only', e=True, changeCommand=self.upload_only_toggle) cmds.checkBox('distributed', e=True, changeCommand=self.distributed_toggle) cmds.optionMenu('renderer', e=True, changeCommand=self.change_renderer) cmds.radioButton('new_project', e=True, onCommand=self.select_new_project) cmds.radioButton('existing_project', e=True, onCommand=self.select_existing_project) self.change_renderer( self.renderer ) self.select_new_project( True ) return name
def BuildUI( self ): self.Window = cmds.window( title = self.WINDOW_NAME + " " + self.PLUGIN_VERSION, sizeable = True, resizeToFitChildren = True, widthHeight = ( 1, 1 ) ) HalfWidth = ( self.WINDOW_WIDTH / 2 ) # main column cmds.columnLayout() # rotate around layout cmds.radioCollection() cmds.frameLayout( label = "Rotate Around", collapsable = False, width = self.WINDOW_WIDTH ) cmds.columnLayout() cmds.rowColumnLayout( numberOfColumns = 1, columnWidth = [ ( 1, self.WINDOW_WIDTH ) ] ) self.rbRotateAroundCenterBB = cmds.radioButton( label = "Center of objects", onCommand = self.OnRotateAroundCenterBBoxSelected, select = True ) cmds.setParent( ".." ) #rowColumnLayout cmds.rowColumnLayout( numberOfColumns = 2, columnWidth = [ ( 1, HalfWidth ), ( 2, HalfWidth - 5 ) ] ) self.rbRotateAroundObject = cmds.radioButton( label = "Object Pivot", onCommand = self.OnRotateAroundObjectSelected ) self.bPickObjectToRotateAround = cmds.button( label = "Pick", command = self.OnPickObject ) cmds.setParent( ".." ) #rowColumnLayout cmds.rowColumnLayout( numberOfColumns = 2, columnWidth = [ ( 1, HalfWidth ), ( 2, HalfWidth - 5 ) ] ) self.rbRotateAroundPosition = cmds.radioButton( label = "Position (XYZ)", onCommand = self.OnRotateAroundPositionSelected ) cmds.rowColumnLayout( numberOfColumns = 3, columnWidth = [ ( 1, ( HalfWidth / 3 ) - 1 ), ( 2, ( HalfWidth / 3 ) - 1 ), ( 3, ( HalfWidth / 3 ) - 1 ) ] ) self.txtRAPX = cmds.textField( text = "0", changeCommand = self.OnTextFieldValueChange ) self.txtRAPY = cmds.textField( text = "0", changeCommand = self.OnTextFieldValueChange ) self.txtRAPZ = cmds.textField( text = "0", changeCommand = self.OnTextFieldValueChange ) cmds.setParent( ".." ) #rowColumnLayout cmds.setParent( ".." ) #rowColumnLayout cmds.setParent( ".." ) #columnLayout cmds.setParent( ".." ) #frameLayout # info layout cmds.frameLayout( label = "Rotate Info", collapsable = False, width = self.WINDOW_WIDTH ) cmds.columnLayout() self.txtObjectsToRotate = cmds.text( label = "Objects To Rotate: 0" ) self.txtRotationPivot = cmds.text( label = "Rotate around: none" ) cmds.setParent( ".." ) #columnLayout cmds.setParent( ".." ) #frameLayout # buttons layout cmds.rowColumnLayout( numberOfColumns = 2, columnWidth = [ ( 1, HalfWidth ), ( 2, HalfWidth ) ] ) self.bStartRotate = cmds.button( label = "Start", command = self.OnStartRotate, enable = False ) self.bClose = cmds.button( label = "Close", command = self.OnClose ) cmds.setParent( ".." ) # rowColumnLayout # ... cmds.showWindow( self.Window ) # main column
def sjModeSwitch(): ''' Will adjust the interface for the different modes that are available. ''' # Get Radio Button info rc = cmds.radioCollection(radioCol, q=True, sl=True) # Label is the same name as the scriptJob type sjType = cmds.radioButton(rc, q=True, label=True) # Get selected items from the textScrollList try: selectedTSL = cmds.textScrollList(tsl, q=True, si=True)[0] except TypeError: selectedTSL = "" cmds.textFieldGrp("mecSJConLabel", edit=True, en=True) cmds.textFieldGrp("mecSJConLabel", edit=True, text="") if( sjType == "event"): cmds.textFieldGrp("mecSJConLabel", edit=True, text=selectedTSL) cmds.textFieldGrp("mecSJConLabel", edit=True, label="Event Type") elif( sjType == "attributes" or sjType == "connectionChange"): cmds.textFieldGrp("mecSJConLabel", edit=True, label="Attribute") elif( sjType == "condition"): cmds.textFieldGrp("mecSJConLabel", edit=True, text=selectedTSL) cmds.textFieldGrp("mecSJConLabel", edit=True, label="Condition Type") elif( sjType == "nodeNameChanged"): cmds.textFieldGrp("mecSJConLabel", edit=True, label="Node Name") elif( sjType == "uiDeleted"): cmds.textFieldGrp("mecSJConLabel", edit=True, label="uiName") elif(sjType == "timeChange"): cmds.textFieldGrp("mecSJConLabel", edit=True, label="") cmds.textFieldGrp("mecSJConLabel", edit=True, en=False)
def mirrorClusterCmd(self): """""" sels = cmds.ls(sl=1, ap=1) if not sels: cmds.error("Please select clusters or joints!") # Prepare parameters axisBtn = cmds.radioCollection(self.axisCol, q=1, sl=1) axisId = cmds.radioButton(axisBtn, q=1, l=1).lower() axises = scData.getAxisMap(axisId) mirrorPivot = cmds.textField(self.mirPivTxFld, q=1, tx=1) tol = float(cmds.textFieldGrp(self.tolTxFld, q=1, tx=1)) search = cmds.textFieldGrp(self.searchTxFld, q=1, tx=1) replace = cmds.textFieldGrp(self.replaceTxFld, q=1, tx=1) # Deal with mirror pivot matrix if mirrorPivot: pivotMatrixList = cmds.xform(mirrorPivot, q=1, ws=1, m=1) else: pivotMatrixList = scData.getWorldMatrixList() start = clock() for sel in sels: if cmds.objectType( sel, isType='joint' ): scData.JointFn.mirrorJnt(sel, pivotMatrixList, axises, search, replace, tol) elif cmds.listRelatives(sel, s=1, typ='clusterHandle'): scData.ClusterFn.mirrorCluster(sel, pivotMatrixList, axises, search, replace, tol) else: cmds.warning("%s is skipped!" % sel) finish = clock() om.MGlobal.displayInfo( "Mirror Time Cost: %fs" % (finish-start) )
def getSearchForType(): items = cmds.radioCollection( WinA_Global.searchForType_radio, q=1, cia=1 ) for i in range( len( items ) ): if cmds.radioButton( items[i], q=1, sl=1 ): break return i
def apply(self,*args): selectedAxisBtn = cmds.radioCollection('n_aPT_rC_align', query = True, sl = True) cmds.optionVar(stringValue=['kT_aPT_alignAxis', cmds.radioButton(selectedAxisBtn, query = True, l = True)]) cmds.optionVar(intValue =['kT_aPT_centerAxis', cmds.checkBox('n_cB_centerAxis', query = True, v = True)]) cmds.optionVar(intValue=['kT_aPT_direction', cmds.optionMenu('n_oM_direction', query = True, sl = True)]) alignPivotTool()
def deleteTx(self, *args): ctrlPath = '|'.join([self.window, 'radioButton']); selection = cmds.radioButton(ctrlPath, query=True, select=True); self.deletedFiles = 0 ctrlPath = '|'.join([self.window, 'groupBox_3', 'label_10']); if selection: self.selectedFilesFromList() else: self.selectedFilesFromFolder() if not self.selectedFiles: cmds.text(ctrlPath, edit=True, label="Deleted: {0}".format(self.deletedFiles)); return for texture in self.selectedFiles: if not texture: continue; if 'udim' in os.path.basename(texture): udims = getUdims(texture) for udim in udims: txFile = os.path.splitext(udim)[0]+".tx" if os.path.isfile(txFile): os.remove(txFile) self.deletedFiles += 1 else: txFile = os.path.splitext(texture)[0]+".tx" if os.path.isfile(txFile): os.remove(txFile) self.deletedFiles += 1 cmds.text(ctrlPath, edit=True, label="Deleted: {0}".format(self.deletedFiles)); self.updateList()
def optionsPanelUI(self, name, parent, collapse=False): """Create options panel UI controls""" popupHelp = "For more options, duplicate your objects first using Edit>Duplicate Special, then use the Scatter Selected Objects option." mc.frameLayout(width=400, collapsable=True, cl=collapse, borderStyle="etchedIn", label="Options") mc.columnLayout(name) mc.separator(height=4, style="none") mc.rowLayout(numberOfColumns=1, columnAttach1="left", columnAlign1="both", columnOffset1=142) mc.columnLayout() mc.radioCollection("mode") mc.radioButton("scatterSelected", label="Scatter Selected Objects", select=True) mc.radioButton("duplicateScatter", label="Duplicate and Scatter", onCommand=lambda *args: self.toggleControls(True), offCommand=lambda *args: self.toggleControls(False)) mc.setParent(name) mc.separator(width=396, height=12, style="in") mc.intSliderGrp("nCopies", label="Number of copies: ", value=50, field=True, minValue=1, maxValue=100, fieldMinValue=0, fieldMaxValue=1000) mc.radioButtonGrp( "geoType", label="Geometry type: ", labelArray2=['Copy', 'Instance'], numberOfRadioButtons=2, columnWidth3=[140, 78, 156], select=1, annotation=popupHelp, onCommand1=lambda *args: self.toggleDuplicateControls(True), onCommand2=lambda *args: self.toggleDuplicateControls(False)) mc.rowLayout(numberOfColumns=1, columnAttach1="left", columnAlign1="both", columnOffset1=142) mc.columnLayout() mc.checkBox( "duplicateInputGraph", label="Duplicate input graph", value=0, annotation=popupHelp, onCommand=lambda *args: self.toggleDuplicateIGControls(False), offCommand=lambda *args: self.toggleDuplicateIGControls(True)) mc.checkBox( "duplicateInputConnections", label="Duplicate input connections", value=0, annotation=popupHelp, onCommand=lambda *args: self.toggleDuplicateICControls(False), offCommand=lambda *args: self.toggleDuplicateICControls(True)) mc.separator(height=4, style="none") mc.checkBox("newGroup", label="Parent objects under new group", value=1) mc.checkBox("keepOrig", label="Keep original object(s)", value=1) mc.setParent(name) mc.separator(height=8, style="none") mc.setParent(parent) # If single object is selected, automatically enter duplicate mode if len(mc.ls(selection=True)) == 1: mc.radioCollection("mode", edit=True, select="duplicateScatter") self.toggleControls(True) else: mc.radioCollection("mode", edit=True, select="scatterSelected") self.toggleControls(False)
##### GUI --------------------------------------------------------- win = mc.window('ctrlOrientUI', title='Control orient Tool', rtf=1) mc.window(win, e=1, widthHeight=(580, 100)) mc.columnLayout(cw=500) #Select mc.rowColumnLayout(numberOfColumns=6, cs=[(1, 0), (2, 5), (3, 0), (4, 10), (5, 5), (6, 5)], columnWidth=[(1, 80), (2, 300), (3, 80), (4, 30), (5, 30), (6, 30)]) mc.text(label='1st Plane:', align='left', bgc=[0.5, 0.5, 0.5]) plane01_list = mc.text(label='Select a face or 3 vertices', font='obliqueLabelFont', align='left') mc.button(label=' assign', command=partial(assignSelection, 1)) xyz_collection01 = mc.radioCollection() xrb01 = mc.radioButton(label='x', sl=1) yrb01 = mc.radioButton(label='y') zrb01 = mc.radioButton(label='z') mc.text(label='2nd Plane:', align='left', bgc=[0.5, 0.5, 0.5]) plane02_list = mc.text(label='Select a face or 3 vertices', font='obliqueLabelFont', align='left') mc.button(label='assign', command=partial(assignSelection, 2)) xyz_collection02 = mc.radioCollection() xrb02 = mc.radioButton(label='x', en=0) yrb02 = mc.radioButton(label='y', sl=1) zrb02 = mc.radioButton(label='z') mc.text(label='Control:', align='left', bgc=[0.5, 0.5, 0.5]) anm_control = mc.text(label='Select animation my_control', font='obliqueLabelFont', align='left')
def __init__(self): ''' Creates the GUI window with the image banner and options for what to generate self.curveOptionsFrame : The UI layout that the curve options will be placed into when created self.snowFXOptionsFrame : The UI layout that the particle options will be placed into when created ''' if cmds.window('snowflakeUI', exists = True): cmds.deleteUI('snowflakeUI') self.window = cmds.window('snowflakeUI',t='Snowflake FX Generator',w=545,h=500,mxb=0,mnb=0,s=0) self.mainLayout = cmds.formLayout() imgPane = cmds.paneLayout(h=130, bgc=(0, 0, 0)) bannerLayout = cmds.formLayout() banner = cmds.image(image=cmds.internalVar(upd=1)+'/icons/snowflakeBanner.png') cmds.formLayout(bannerLayout, e=1, attachForm=[(banner,'top',0), (banner,'bottom',0), (banner,'left',0), (banner,'right',0)]) cmds.setParent(self.mainLayout) tabs = cmds.tabLayout(innerMarginWidth=5,innerMarginHeight=5,scr=1) cmds.formLayout(self.mainLayout, e=1, attachForm=[(imgPane,'top',5), (imgPane,'left',5), (imgPane,'right',5), (tabs, 'left', 5), (tabs, 'right', 5), (tabs, 'bottom', 5)], attachControl=[(tabs, 'top', 0, imgPane)]) self.curvesTab = cmds.rowColumnLayout(numberOfColumns=1,cs=[(1,5),(1,5)],cw=(1,500)) cmds.rowLayout(numberOfColumns=5,cw=(1,110)) cmds.text(label='Spiral Type:') curvesRadioMenu = cmds.radioCollection() cmds.radioButton( label='Hyperbolic', cc=self.hypCurveUI) cmds.radioButton( label='Logarithmic', cc=self.logCurveUI ) cmds.radioButton( label='Archimedes', cc=self.arcCurveUI ) cmds.radioButton( label='Archimedes Double', cc=self.arcDoubCurveUI ) cmds.setParent('..') self.curveOptionsFrame = cmds.rowColumnLayout(numberOfColumns=1) cmds.setParent('..') cmds.setParent('..') self.snowFXTab = cmds.rowColumnLayout(numberOfColumns=1,cs=(1,5),cw=(1,500)) cmds.rowLayout(numberOfColumns=5,cw=(1,110)) cmds.text(label='Generate:') snowFXRadioMenu = cmds.radioCollection() cmds.radioButton( label='Emit from Curve', cc=self.curveEmitUI) cmds.radioButton( label='Follow Curve', cc=self.curveFollowUI ) cmds.radioButton( label='Emit from Plane', cc=self.planeEmitUI ) cmds.radioButton( label='Just Snowflakes', cc=self.flakeGenUI ) cmds.setParent('..') self.snowFXOptionsFrame = cmds.rowColumnLayout(numberOfColumns=1) cmds.setParent('..') cmds.tabLayout(tabs, edit=True, tabLabel=((self.curvesTab,'Curves'), (self.snowFXTab,'Snow FX')), scr=True, cr=True ) cmds.showWindow(self.window)
def __init__(self): #[0:uiName, 1:pluginName, 2:get, 3:set] self.__nodeAttrs = { 'cacheFile': [None, self.__get_cacheFile, self.__set_cacheFile], 'AlembicNode': ["AbcImport.mll", self.__get_AlembicNode, self.__set_AlembicNode], 'miProxy': ['Mayatomr.mll', self.__get_miProxy, self.__set_miProxy], 'aiStandIn': ['mtoa.mll', self.__get_aiStadin, self.__set_aiStadin], 'VRayMesh': ['vrayformaya.mll', self.__get_VRayMesh, self.__set_VRayMesh] } self.__typeForSort = ('cacheFile', 'AlembicNode', 'miProxy', 'VRayMesh', 'aiStandIn') self.__loadedNodes = [] for k, v in self.__nodeAttrs.iteritems(): pluginName = v[0] if not pluginName or\ ( pluginName and cmds.pluginInfo( pluginName, query=True, registered=True) and cmds.pluginInfo( pluginName, query=True, loaded=True) ): self.__loadedNodes.append(k) self.allCaches = {} windowName = 'w13_CachePathHelper' if cmds.window(windowName, exists=True): cmds.deleteUI(windowName) sceneName = cmds.file(q=True, sn=True, shortName=True).split('.')[0] cmds.window(windowName, title="w13_CachePathHelper", sizeable=1) cmds.columnLayout("w13_L01", p=windowName, adj=True) cmds.button('w13_uiReset', p="w13_L01", label="Get", h=40, c=self.__getAllCache) cmds.textFieldButtonGrp( 'w13_uiFindWhat', p="w13_L01", label='Find what:', buttonLabel='Workspace', cw=([1, 80]), h=30, adj=2, bc= 'cmds.textFieldButtonGrp("w13_uiFindWhat", e=True, tx=cmds.workspace(q =True, rootDirectory=True) )' ) cmds.textFieldButtonGrp( 'w13_uiRepWith', p="w13_L01", label='Replace with:', buttonLabel='Workspace', cw=([1, 80]), h=30, adj=2, bc= 'cmds.textFieldButtonGrp("w13_uiRepWith", e=True, tx=cmds.workspace(q =True, rootDirectory=True) )' ) cmds.button('w13_uiReplace', p="w13_L01", label="Replace", h=40, c=self.w13_uiReplace_cmd) cmds.separator(height=20, style='out') cmds.rowLayout('w13_uiTypeLay', p='w13_L01', numberOfColumns=len(self.__loadedNodes) + 2) cmds.text(p='w13_uiTypeLay', l='Types:\t\t') cmds.radioCollection('w13_uiTypeList', p='w13_uiTypeLay') cmds.radioButton('w13_uiType_All', p='w13_uiTypeLay', l='All') #print self.__loadedNodes for nt in self.__typeForSort: if nt in self.__loadedNodes: cmds.radioButton('w13_uiType_%s' % (nt), p='w13_uiTypeLay', l=nt + '\t', cc=self.__uiFilter_cmd) cmds.radioCollection('w13_uiTypeList', e=True, select='w13_uiType_All') #cmds.radioButtonGrp( 'w13_uiFilterType', p="w13_L01", label='Type:', numberOfRadioButtons=4, cw=[(1,50)], labelArray4=self.nodeTypeList, sl=1, cc=self.__uiFilter_cmd ) cmds.separator(p='w13_L01', height=10, style='in') cmds.rowLayout('w13_uiDisplayOption_Lay', p='w13_L01', numberOfColumns=2) cmds.text(p='w13_uiDisplayOption_Lay', l='Display:\t\t') cmds.radioButtonGrp('w13_uiNoExists', p="w13_uiDisplayOption_Lay", numberOfRadioButtons=2, labelArray2=['All', 'No exists'], sl=1, cc=self.__uiFilter_cmd) cmds.separator(p='w13_L01', height=20, style='in') cmds.radioButtonGrp('w13_uiAbsRel', p="w13_L01", l='Path display', numberOfRadioButtons=2, labelArray2=['Absolute', 'Relative'], sl=1, cc=self.__uiFilter_cmd) cmds.textScrollList('w13_uiCaches', p="w13_L01", numberOfRows=8, allowMultiSelection=True, bgc=[.2, .2, .2], showIndexedItem=4, h=500, dcc=self.__itemDoubleClick) cmds.button('self.w13_uiSetChange', p="w13_L01", label="Set All Change", h=40, c=self.w13_uiSetChange) cmds.showWindow(windowName) #global allCaches self.__getAllCache() self.__uiFilter_cmd()
def rsPickObInPa(self, *args): sel = cmds.ls(sl=True, o=False) if len(sel) > 0: if len(sel) > 1: cmds.warning("Too many object selecteds") cmds.textField(self.fieldObInPa, e=True, text=sel[0]) o_shape = cmds.listRelatives(sel[0], s=True)[0] if cmds.nodeType(o_shape) == "nurbsCurve" or cmds.nodeType( o_shape) == "bezierCurve": cmds.frameLayout(self.frameLayoutLoftObInPa, e=True, en=True) cmds.radioButton(self.opNoneObInPa, e=True, en=True) cmds.radioButton(self.opPolyObInPa, e=True, en=True) cmds.radioButton(self.opNurbsObInPa, e=True, en=True) else: cmds.radioButton(self.opNoneObInPa, e=True, select=True) cmds.frameLayout(self.frameLayoutLoftObInPa, e=True, en=False) cmds.radioButton(self.opNoneObInPa, e=True, en=False) cmds.radioButton(self.opPolyObInPa, e=True, en=False) cmds.radioButton(self.opNurbsObInPa, e=True, en=False) else: cmds.warning("Select an object, please") cmds.textField(self.fieldObInPa, e=True, text="")
def rsObjTypeCoInPa(self, *args): cmds.text(self.rsTextObInPa, e=True, l=args[0]) if args[0] == ' Scene Object ': cmds.text(self.textObInPa, e=True, en=True) cmds.textField(self.fieldObInPa, e=True, en=True) cmds.button(self.buttonObInPa, e=True, en=True) cmds.radioButton(self.copyObInPa, e=True, en=True) cmds.radioButton(self.instanceObInPa, e=True, en=True) else: cmds.text(self.textObInPa, e=True, en=False) cmds.textField(self.fieldObInPa, e=True, text=None) cmds.textField(self.fieldObInPa, e=True, en=False) cmds.button(self.buttonObInPa, e=True, en=False) cmds.radioButton(self.copyObInPa, e=True, en=False) cmds.radioButton(self.instanceObInPa, e=True, en=False) cmds.radioButton(self.opNoneObInPa, e=True, select=True) cmds.frameLayout(self.frameLayoutLoftObInPa, e=True, en=False) cmds.radioButton(self.opNoneObInPa, e=True, en=False) cmds.radioButton(self.opPolyObInPa, e=True, en=False) cmds.radioButton(self.opNurbsObInPa, e=True, en=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)
def createLensTab(self): self.lensTab = cmds.frameLayout(l='lens', collapsable=True, p=self.mainForm) self.createLensForm = cmds.formLayout(nd=100) self.lensText = cmds.text(l='NONE', fn='obliqueLabelFont', al='left') self.lensManufacturer = cmds.text(l=self.lensManufacturerName) self.lensRadioGroup = cmds.radioCollection() self.lensRadio = [] for i in range(0, len(self.lensRadioName)): self.lensRadio.append( cmds.radioButton(l=self.lensRadioName[i], onCommand=partial(self.lensData, i))) self.lensMode = cmds.optionMenu(cc=self.lensCmd) self.lensModeLable = cmds.text(l=self.lensModelName) self.focalLengthLable = cmds.text(l=self.focalLengthName, en=False) self.focalLength = cmds.floatSliderGrp(f=True, max=100, min=0, en=False) cmds.formLayout(self.createLensForm, e=True, attachForm=([self.lensManufacturer, 'top', 5], [self.lensManufacturer, 'left', 5])) for i in range(0, len(self.lensRadioName)): x = i % 4 + 1 y = i / 4 + 1 cmds.formLayout(self.createLensForm, e=True, attachPosition=([ self.lensRadio[i], 'left', 0, (x - 1) * 25 + 1 ], [self.lensRadio[i], 'right', 0, x * 25 - 1])) if y != 1: cmds.formLayout(self.createLensForm, e=True, attachControl=([ self.lensRadio[i], 'top', 5, self.lensRadio[i - 4] ])) else: cmds.formLayout(self.createLensForm, e=True, attachControl=([ self.lensRadio[i], 'top', 5, self.lensManufacturer ])) cmds.formLayout( self.createLensForm, e=True, attachForm=([self.lensModeLable, 'left', 5], [self.lensMode, 'right', 5], [self.focalLengthLable, 'left', 5], [self.focalLength, 'right', 5], [self.lensText, 'left', 5], [self.lensText, 'bottom', 5]), attachControl=([ self.lensMode, 'top', 5, self.lensRadio[len(self.lensRadio) - 1] ], [ self.lensModeLable, 'top', 9, self.lensRadio[len(self.lensRadio) - 1] ], [self.lensMode, 'left', 4, self.lensModeLable], [ self.focalLengthLable, 'top', 9, self.lensMode ], [self.focalLength, 'top', 5, self.lensMode ], [self.focalLength, 'left', 4, self.focalLengthLable], [self.lensText, 'top', 5, self.focalLength]))
def createUI(self): cmds.setParent(self.window) cmds.columnLayout('columnLayout01', width=290, height=470, adjustableColumn=False) cmds.columnLayout(parent='columnLayout01', adjustableColumn=True) cmds.frameLayout(label='Channels', width=288, borderStyle='in') ChannelsRadioCollection = cmds.radioCollection() cmds.rowLayout(nc=4) cmds.text(label='', width=2, align='left') cmds.radioButton('AllKeyable', label=u'AllKeyable', sl=True, onc=self.toRadioButtonAllKeyable) cmds.radioButton('FromAttributes', label=u'FromAttributes', onc=self.toRadioButtonFromAttributes) cmds.radioButton('FromChannelBox', label=u'FromChannelBox', onc=self.toRadioButtonFromChannelBox) cmds.setParent('..') cmds.setParent('..') cmds.frameLayout(label='Select Attributes', width=288, borderStyle='in', collapse=True, collapsable=True, parent='columnLayout01') cmds.rowLayout(nc=6) cmds.text(label=' Translate:', width=80, align='left') cmds.checkBox('trans_x', label=u'X', value=True, enable=False, ofc=self.toCheckBoxTAll) cmds.checkBox('trans_y', label=u'Y', value=True, enable=False, ofc=self.toCheckBoxTAll) cmds.checkBox('trans_z', label=u'Z', value=True, enable=False, ofc=self.toCheckBoxTAll) cmds.checkBox('trans_All', label=u'All', value=True, enable=False, onc=self.toCheckBoxTTrue, ofc=self.toCheckBoxTFalse) cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.separator(st='in') cmds.setParent('..') cmds.rowLayout(nc=5) cmds.text(label=' Rotate:', width=80, align='left') cmds.checkBox('rot_x', label=u'X', value=True, enable=False, ofc=self.toCheckBoxRAll) cmds.checkBox('rot_y', label=u'Y', value=True, enable=False, ofc=self.toCheckBoxRAll) cmds.checkBox('rot_z', label=u'Z', value=True, enable=False, ofc=self.toCheckBoxRAll) cmds.checkBox('rot_All', label=u'All', value=True, enable=False, onc=self.toCheckBoxRTrue, ofc=self.toCheckBoxRFalse) cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.separator(st='in') cmds.setParent('..') cmds.rowLayout(nc=5) cmds.text(label=' Scale:', width=80, align='left') cmds.checkBox('scl_x', label=u'X', value=True, enable=False, ofc=self.toCheckBoxZAll) cmds.checkBox('scl_y', label=u'Y', value=True, enable=False, ofc=self.toCheckBoxZAll) cmds.checkBox('scl_z', label=u'Z', value=True, enable=False, ofc=self.toCheckBoxZAll) cmds.checkBox('scl_All', label=u'All', value=True, enable=False, onc=self.toCheckBoxZTrue, ofc=self.toCheckBoxZFalse) cmds.setParent('..') cmds.columnLayout(adjustableColumn=True) cmds.separator(st='in') cmds.setParent('..') cmds.columnLayout(parent='columnLayout01', width=288, adjustableColumn=True) cmds.frameLayout(label='Time Range', borderStyle='in') TimeRangeRadioCollection = cmds.radioCollection() cmds.rowLayout(nc=5) cmds.text(label='', width=2, align='left') cmds.radioButton('TimeSlider', label='TimeSlider', sl=True, onc=self.toRadioButtonTimeSlider) cmds.radioButton('StartEnd', label='Start/End:', width=80, onc=self.toRadioButtonStartEnd) cmds.floatField('StartTime', value=0, precision=3, step=1, enable=False) cmds.floatField('EndTime', value=10, precision=3, step=1, enable=False) cmds.setParent('..') cmds.columnLayout(parent='columnLayout01', width=288, adjustableColumn=True) cmds.frameLayout(label='Bake Simulation', borderStyle='in') cmds.rowLayout(nc=4) cmds.text(label='', width=5) cmds.checkBox('POK', label=u'Keep Unbaked', value=True) cmds.checkBox('Euler', label=u'Euler Filter', value=False) cmds.checkBox('Sim', label=u'Simulation', value=False) cmds.setParent('..') cmds.rowLayout(nc=4) cmds.text(label=' SampleBy:', width=70, align='left') cmds.floatField('bakeSample', value=1, precision=3, step=1, width=60) cmds.text(label='', width=45, align='left') cmds.button('Key Bake', width=100, label='Key Bake', c=self.toBake) cmds.setParent('..') cmds.columnLayout(parent='columnLayout01', width=288, adjustableColumn=True, cal='left') cmds.frameLayout(label='Delete static Key', borderStyle='in') cmds.rowLayout(nc=2) cmds.text(label=' Sample:', width=70, align='left') cmds.floatSliderGrp('DelstaticSample', field=True, min=0, max=0.1, precision=3, step=0.001, value=0.01, width=210, cw=(1, 60), cal=(1, 'left')) cmds.setParent('..') cmds.rowLayout(nc=2) cmds.text(label='', width=180, align='left') cmds.button('DelStaticKey', width=100, label='Del Static Key', c=self.toDelStatic) cmds.setParent('..') cmds.columnLayout(parent='columnLayout01', width=288, adjustableColumn=True) cmds.frameLayout(label='Key Reduction (0= flat and linear only)', borderStyle='in') cmds.rowLayout(nc=2) cmds.text(label='', width=5) cmds.checkBox('LockSelectedKey', label=u'Lock Selected Key', value=False) cmds.setParent('..') cmds.rowLayout(nc=2) cmds.text(label=' Sample:', width=70, align='left') cmds.floatSliderGrp('ReductKeySample', field=True, min=0.00, max=1.00, precision=3, step=0.01, value=0.5, width=210, cw=(1, 60), cal=(1, 'left')) cmds.setParent('..') cmds.rowLayout(nc=2) cmds.text(label='', width=180, align='left') cmds.button('ReductKey', width=100, label='Key Reduction', c=self.toReductKey) cmds.setParent('..')
def getRadioButtonText(radioCollection): rc = cmds.radioCollection(radioCollection, query=True, select=True) return cmds.radioButton(rc, query=True, label=True)
if par is not None: mc.parent(spc, par[0]) mc.parent(slc[i], spc) mc.setAttr('{}.t'.format(slc[i]), 0, 0, 0) if mc.window("CreateSpacer", exists=True): mc.deleteUI("CreateSpacer") createWin = mc.window("CreateSpacer", t="CreateSpacer", w=200, h=130) mc.columnLayout(adj=True,h=125) mc.frameLayout(label='Type Select') mc.rowLayout(numberOfColumns=2) rc1 = mc.radioCollection() rb1 = mc.radioButton('selb', l='select', select=True) rb2 = mc.radioButton('hieb', l='hierachy') mc.setParent('..') mc.frameLayout(label='Node Select') mc.rowLayout(numberOfColumns=2) rc2 = mc.radioCollection() rb3 = mc.radioButton('trsb', l='Transform', select=True) rb4 = mc.radioButton('jntb', l='joint') mc.setParent('..') mc.button(l='create', c='Preparation()') mc.showWindow(createWin)
def __init__(self): if (cmds.window('win_ac2s', exists=1)): cmds.deleteUI('win_ac2s') cmds.window('win_ac2s', title='Curve SpineIK') cmds.formLayout('form_ac2sMain') cmds.text('txt_ac2sT1', label=' Joint Length : ') cmds.floatField('ff_ac2sJL', width=60, minValue=0.1, value=1) cmds.text('txt_ac2sT2', label=' Joint Axis : ') cmds.radioCollection('rdc_ac2sJA') cmds.radioButton('rd_ac2sX', label='+X', select=1) cmds.radioButton('rd_ac2sY', label='+Y') cmds.radioButton('rd_ac2sZ', label='+Z') cmds.radioButton('rd_ac2sx', label='-X') cmds.radioButton('rd_ac2sy', label='-Y') cmds.radioButton('rd_ac2sz', label='-Z') #cmds.checkBox('cb_ac2sWUO',label='set Curve to World Up Object') cmds.radioCollection('rdc_ac2sWU') cmds.radioButton('rd_ac2sWU', label='None', select=1) cmds.radioButton('rd_ac2sWUC', label='set Curve to World Up Object') cmds.radioButton('rd_ac2sWUT', label='set to') cmds.button('btn_ac2sST', label='>', width=20, height=20, command=self.setTo) cmds.textField('tf_ac2sST', width=100, height=20) cmds.button('btn_ac2sEx', label='Generate', width=145, height=30, command=self.generate) cmds.window('win_ac2s', e=1, resizeToFitChildren=1, widthHeight=[215, 175]) cmds.showWindow('win_ac2s') cmds.formLayout('form_ac2sMain', e=1, af=[('txt_ac2sT1', 'top', 10), ('txt_ac2sT1', 'left', 5)]) cmds.formLayout('form_ac2sMain', e=1, af=('ff_ac2sJL', 'top', 5), ac=('ff_ac2sJL', 'left', 5, 'txt_ac2sT1')) cmds.formLayout('form_ac2sMain', e=1, af=[('btn_ac2sEx', 'bottom', 5), ('btn_ac2sEx', 'left', 5)]) cmds.formLayout('form_ac2sMain', e=1, af=('txt_ac2sT2', 'left', 5), ac=('txt_ac2sT2', 'top', 10, 'txt_ac2sT1')) cmds.formLayout('form_ac2sMain', e=1, ac=[('rd_ac2sX', 'top', 10, 'txt_ac2sT1'), ('rd_ac2sX', 'left', 5, 'txt_ac2sT2')]) cmds.formLayout('form_ac2sMain', e=1, ac=[('rd_ac2sY', 'top', 10, 'txt_ac2sT1'), ('rd_ac2sY', 'left', 5, 'rd_ac2sX')]) cmds.formLayout('form_ac2sMain', e=1, ac=[('rd_ac2sZ', 'top', 10, 'txt_ac2sT1'), ('rd_ac2sZ', 'left', 5, 'rd_ac2sY')]) cmds.formLayout('form_ac2sMain', e=1, ac=[('rd_ac2sx', 'top', 0, 'rd_ac2sX'), ('rd_ac2sx', 'left', 5, 'txt_ac2sT2')]) cmds.formLayout('form_ac2sMain', e=1, ac=[('rd_ac2sy', 'top', 0, 'rd_ac2sX'), ('rd_ac2sy', 'left', 5, 'rd_ac2sX')]) cmds.formLayout('form_ac2sMain', e=1, ac=[('rd_ac2sz', 'top', 0, 'rd_ac2sX'), ('rd_ac2sz', 'left', 5, 'rd_ac2sY')]) cmds.formLayout('form_ac2sMain', e=1, af=('rd_ac2sWU', 'left', 5), ac=('rd_ac2sWU', 'top', 0, 'rd_ac2sx')) cmds.formLayout('form_ac2sMain', e=1, af=('rd_ac2sWUC', 'left', 5), ac=('rd_ac2sWUC', 'top', 1, 'rd_ac2sWU')) cmds.formLayout('form_ac2sMain', e=1, af=('rd_ac2sWUT', 'left', 5), ac=('rd_ac2sWUT', 'top', 3, 'rd_ac2sWUC')) cmds.formLayout('form_ac2sMain', e=1, ac=[('btn_ac2sST', 'top', 3, 'rd_ac2sWUC'), ('btn_ac2sST', 'left', 5, 'rd_ac2sWUT')]) cmds.formLayout('form_ac2sMain', e=1, ac=[('tf_ac2sST', 'top', 3, 'rd_ac2sWUC'), ('tf_ac2sST', 'left', 0, 'btn_ac2sST')])
def rsFieldObInPa(self, *args): o_sceneObj = cmds.textField(self.fieldObInPa, q=True, text=True) if cmds.objExists(o_sceneObj): o_shape = cmds.listRelatives(o_sceneObj, s=True)[0] if cmds.nodeType(o_shape) == "nurbsCurve" or cmds.nodeType( o_shape) == "bezierCurve": cmds.frameLayout(self.frameLayoutLoftObInPa, e=True, en=True) cmds.radioButton(self.opNoneObInPa, e=True, en=True) cmds.radioButton(self.opPolyObInPa, e=True, en=True) cmds.radioButton(self.opNurbsObInPa, e=True, en=True) else: cmds.radioButton(self.opNoneObInPa, e=True, select=True) cmds.frameLayout(self.frameLayoutLoftObInPa, e=True, en=False) cmds.radioButton(self.opNoneObInPa, e=True, en=False) cmds.radioButton(self.opPolyObInPa, e=True, en=False) cmds.radioButton(self.opNurbsObInPa, e=True, en=False) else: cmds.warning("Wrong input argument") cmds.textField(self.fieldObInPa, e=True, text="") cmds.radioButton(self.opNoneObInPa, e=True, select=True) cmds.frameLayout(self.frameLayoutLoftObInPa, e=True, en=False) cmds.radioButton(self.opNoneObInPa, e=True, en=False) cmds.radioButton(self.opPolyObInPa, e=True, en=False) cmds.radioButton(self.opNurbsObInPa, e=True, en=False)
cmds.group(list(newLocators)[0], list(newDistances)[0], n='measurement') ########################### ### PLAYBLAST HUD3 ### ########################### import maya.cmds as cmds cmds.window(t='Playblast') icon = cmds.internalVar(upd=True) + 'icons/JR_icons/folder.jpg' mainLayout = cmds.columnLayout(w=180, h=80) rowColumnLayout = cmds.rowColumnLayout( nc=3, cw=[(1, 50), (2, 60), (3, 60)], columnOffset=[(1, 'both', 5), (2, 'both', 5), (3, 'both', 5) ]) # first section relates to 1 and 2 columb widths cmds.radioCollection() cmds.text(label='Frame:', align='left') cmds.radioButton(label='1080') cmds.radioButton(label='720') cmds.radioCollection() cmds.text(label='Format:', align='left') cmds.radioButton(label='avi') cmds.radioButton(label='mov') characerOptionMenu = cmds.optionMenu(width=160, label='Codec: ') cmds.text(label='') cmds.text(label='') cmds.text(label='Custom:', align='left') customWidth = cmds.textField(text='W') customHeight = cmds.textField(text='H') inputField = cmds.textField(w=120, text='Location') cmds.text(label='') cmds.symbolButton(w=20, h=20, image=icon) cmds.showWindow()
def cMConnectAttr(): win = 'MassiveShadingTransferTool' ###### GLOBAL VARIABLES ###### global tsl1 global tsl2 global menu1 global radio1 global radioA global radioB global cb1 global cb2 ###### GROBAL PROCEDURE ###### if cmds.window(win, q=1, ex=True): cmds.deleteUI(win) if cmds.windowPref(win, ex=True): cmds.windowPref(win, remove=True) ###### CREATE WINDOW ###### cmds.window(win, t='Massive Shader Transfer Tool v1.0', w=320, h=390) # menu Bar cmds.menuBarLayout() cmds.menu(label='Edit') menu1 = cmds.menuItem(label='reset', c='cMCAReset()') cmds.menu(label='Help', helpMenu=1) cmds.menuItem(label='About...', c='cHelpMenu()') cmds.separator(h=5) cmds.setParent('..') # tsl Layout for both tsk form1 = cmds.formLayout() # tsl1 Layout column1 = cmds.columnLayout(adj=True, w=160, rs=1) cmds.text(label='Source', al='center') tsl1 = cmds.textScrollList(numberOfRows=20, allowMultiSelection=True, w=150) cmds.setParent('..') # tsl2 Layout column2 = cmds.columnLayout(adj=True, w=160, rs=1) cmds.text(label='Target', al='center') tsl2 = cmds.textScrollList(numberOfRows=20, allowMultiSelection=True, w=150) cmds.setParent('..') cmds.setParent('..') cmds.separator(h=5) cmds.formLayout(form1, e=1, af=[(column1, 'left', 5), (column2, 'right', 5)], ap=[(column1, 'right', 2.5, 50), (column2, 'left', 2.5, 50)]) # radio selection Layout cmds.rowColumnLayout(nr=1, cat=[1, 'left', 10], cs=(1, 40)) radio1 = cmds.radioCollection() radioA = cmds.radioButton(sl=1, label='Transfer One ---> One') radioB = cmds.radioButton(label='Transfer One ---> All') cmds.setParent('..') cmds.separator() # add sel buttons Layout cmds.rowLayout(nc=2, cw2=[165, 165], cat=([1, 'both', 1], [2, 'both', 1])) cmds.button(label='Add Selected', c='cMCAAddSel1()') cmds.button(label='Add Selected', c='cMCAAddSel2()') cmds.setParent('..') # remove sel buttons Layout cmds.rowLayout(nc=2, cw2=[165, 165], cat=([1, 'both', 1], [2, 'both', 1])) cmds.button(label='Clear Source List', c='cMACRemoveSel1()') cmds.button(label='Clear Target List', c='cMACRemoveSel2()') cmds.setParent('..') # One to One Button cmds.separator() cmds.separator() cmds.rowLayout(nc=1, cw=[1, 330], cat=[1, 'both', 1]) cmds.button(label='One to One Transfer', bgc=[0.65, 0.65, 0.65], c='cMACOneToOneTransfer()') cmds.setParent('..') # connect button Layout cmds.separator() cmds.rowLayout(nc=1, cw=[1, 330], cat=[1, 'both', 1]) cmds.button(label='Transfer', bgc=[0.85, 0.85, 0.85], c='cMACTransfer()') cmds.showWindow(win)
def showBuildWindow(arg): labelWidth = 100 fieldWidth = 100 cmds.window(uiWindowName, title='SSDS') cmds.formLayout(uiFormName) cmds.columnLayout(uiFormLayoutName, rowSpacing=5) # joints cmds.rowLayout(uiNumJointsName[0], numberOfColumns=2, columnWidth2=(labelWidth, fieldWidth), columnAlign2=('right', 'right')) cmds.text(label='# Joints') cmds.intField(uiNumJointsName[1], minValue=0, maxValue=100, value=0, width=fieldWidth) cmds.setParent('..') # max influences cmds.rowLayout(uiMaxInfluenceName[0], numberOfColumns=2, columnWidth2=(labelWidth, fieldWidth), columnAlign2=('right', 'right')) cmds.text(label='Max Influences') cmds.intField(uiMaxInfluenceName[1], minValue=1, maxValue=8, value=4, width=fieldWidth) cmds.setParent('..') # iterations cmds.rowLayout(uiNumIterationsName[0], numberOfColumns=2, columnWidth2=(labelWidth, fieldWidth), columnAlign2=('right', 'right')) cmds.text(label='# Iterations') cmds.intField(uiNumIterationsName[1], minValue=0, maxValue=100, value=10, width=fieldWidth) cmds.setParent('..') # transform type cmds.rowLayout('SsdsTransformTypeLayout', numberOfColumns=2, columnWidth2=(labelWidth, fieldWidth), columnAlign2=('right', 'right')) cmds.text(label='Transform Type') cmds.columnLayout('temporary', rowSpacing=3) cmds.radioCollection(uiTransformRadioCollectionName) cmds.radioButton(uiTransformNames[0], label='T') cmds.radioButton(uiTransformNames[1], label='R+T') cmds.radioButton(uiTransformNames[2], label='S+R+T') cmds.radioCollection(uiTransformRadioCollectionName, edit=True, select=uiTransformNames[2]) cmds.setParent(uiFormLayoutName) # build cmds.button(uiBuildButtonName, label='Build', command=invokeBuild, width=labelWidth + fieldWidth) cmds.formLayout(uiFormName, edit=True, attachForm=[(uiFormLayoutName, 'top', 5), (uiFormLayoutName, 'left', 5), (uiFormLayoutName, 'right', 5)]) cmds.showWindow(uiWindowName)
def cMCAReset(): cmds.textScrollList(tsl1, e=1, removeAll=True) cmds.textScrollList(tsl2, e=1, removeAll=True) cmds.radioButton(radioA, e=1, sl=1)
def EternalCodeUiDef(): if cmds.window('EternalCodeWin', exists=True): cmds.deleteUI('EternalCodeWin', window=True) if cmds.windowPref('EternalCodeWin', exists=True): cmds.windowPref('EternalCodeWin', r=True) cmds.window('EternalCodeWin', title="ECode", iconName='Short Name', h=800, w=500, s=0) form = cmds.formLayout(numberOfDivisions=100, w=300) backG = cmds.image( i='B:/Eternal_Code_Directory/Backup/Default_Icons/Back.png') searchImg = cmds.image( i='B:/Eternal_Code_Directory/Backup/Default_Icons/searchResult.png') AddImg = cmds.image( i='B:/Eternal_Code_Directory/Backup/Default_Icons/Store.png') Heading = cmds.text(l=' ', align='center', fn='boldLabelFont', hl=True) search = cmds.textField('searchField', w=200, h=22) searchButton = cmds.symbolButton( i="B:/Eternal_Code_Directory/Backup/Default_Icons/Search box.png", c='Procs.searchScripts()') searchResult = cmds.textScrollList('searchResultList', h=350, w=210) AddToScript = cmds.symbolButton( ann='Add To Notepad', i="B:/Eternal_Code_Directory/Backup/Default_Icons/IDE.png", c='Procs.Notepad()') AuthorButton = cmds.symbolButton(i="UVTkBtnHead.png", ann='Author: "Siddarth Mehra"', c='Procs.Procs.Author() ') sepratorone = cmds.textField(height=2, w=280) name = cmds.textField('NameScriptTxF', w=180, h=25) Sendscript = cmds.scrollField('Codee', w=180, h=330) radiocoll = cmds.radioCollection() radioMel = cmds.radioButton('MelRadio', label='Mel', sl=True) radioPython = cmds.radioButton(label='Python') SendSButton = cmds.symbolButton( ann='Store in Database', i="B:/Eternal_Code_Directory/Backup/Default_Icons/add.png", c='Procs.StoreCode()') cmds.formLayout(form, edit=True, attachForm=[ (backG, 'top', 1), (searchImg, 'top', 220), (searchImg, 'left', 25), (AddImg, 'top', 270), (AddImg, 'left', 280), (search, 'top', 240), (search, 'left', 37), (searchButton, 'left', 218), (searchButton, 'top', 239), (Heading, 'left', 250), (Heading, 'top', 8), (searchResult, 'left', 37), (name, 'top', 305), (name, 'left', 290), (AddToScript, 'left', 50), (AuthorButton, 'bottom', 10), (AuthorButton, 'right', 10), (Sendscript, 'left', 290), (radioMel, 'top', 680), (radioMel, 'left', 300), (radioPython, 'top', 700), (radioPython, 'left', 300), (SendSButton, 'top', 685), (SendSButton, 'left', 360), ], attachControl=[ (searchResult, 'top', 7, search), (AddToScript, 'top', 15, searchResult), (Sendscript, 'top', 8, name), ]) cmds.showWindow('EternalCodeWin')
def edArnoldLayout(self): #Create the dummy node for testing shader purposes uiFunc.createEdDebugSahder() marginCheck = 20 def edShadingUICreateRow(): list = uiFunc.getEdToolsShadingAttrTemplate() for data in list: attr = data[0] type = data[1] connectionDest = "edTools." + attr cmds.rowLayout(height=20, numberOfColumns=5, columnWidth5=(10, marginCheck, marginCheck, marginCheck, marginCheck), adjustableColumn=1, columnAlign=(1, 'left'), columnAttach=[1, "right", 5]) cmds.attrNavigationControlGrp("ed" + attr.capitalize() + "Texture", l=attr, columnWidth=[1, 60], columnAttach=[1, "right", 5], attribute=connectionDest) cmds.checkBox("ed" + attr.capitalize() + "Raw", label='', v=data[2]) cmds.checkBox("ed" + attr.capitalize() + "Alpha", label='', v=data[3]) cmds.checkBox("ed" + attr.capitalize() + "Filter", label='', v=data[4]) cmds.checkBox("ed" + attr.capitalize() + "Bias", label='', v=data[5]) cmds.setParent("..") #================================================================ cmds.scrollLayout("edArnoldLayout", **scrollArgs) cmds.columnLayout(adjustableColumn=True) #================================================================ cmds.formLayout("arnoldHeader") cmds.columnLayout("btnSetShaderCont", adjustableColumn=True) cmds.button("edShaderBtnGet", label="Select Shader", height=30, c=lambda *x: uiFunc.setShadingForm("get")) cmds.button("edShaderBtnUnset", label="Unset Shader", height=30, backgroundColor=[0.2, 0.2, 0.2], vis=False, c=lambda *x: uiFunc.setShadingForm("reset")) cmds.setParent("..") # columnLayout cmds.columnLayout("btnShaderSaveCont", adjustableColumn=True) cmds.button(l="SAVE", h=30, c=lambda *x: uiFunc.setShadingForm("set")) cmds.setParent("..") # columnLayout cmds.setParent("..") # formLayout uiFunc.formLayoutSet("arnoldHeader", [("btnSetShaderCont", 40), ("btnShaderSaveCont", 60)], padding=3) cmds.columnLayout(adjustableColumn=True, columnAttach=["both", 10], columnAlign="left") cmds.button('edShaderLabel', label="...", c=lambda *x: uiFunc.selectShader()) cmds.setParent("..") # columnLayout #================================================================ cmds.separator(h=6, st="none") cmds.separator(h=2, st="in") cmds.separator(h=5, st="none") cmds.columnLayout(adjustableColumn=True, columnAttach=["both", 5]) cmds.rowLayout(numberOfColumns=5, columnWidth5=(10, marginCheck, marginCheck, marginCheck, marginCheck), adjustableColumn=1, columnAlign=(1, 'left')) cmds.columnLayout(adjustableColumn=True, columnAttach=["both", 10]) cmds.button(l='Select Shading Node', c=lambda *x: uiFunc.selectShadingDummyNode()) cmds.setParent("..") cmds.text(label='Raw') cmds.text(label='Alph') cmds.text(label='Filt') cmds.text(label='Bias') cmds.setParent("..") cmds.separator(h=5, st="none") #------------------------------------------------------------------------------------------------------------------------------- edShadingUICreateRow() #------------------------------------------------------------------------------------------------------------------------------- cmds.setParent("..") cmds.separator(h=10, st="none") #================================================================ cmds.frameLayout(label='Normals/Bump', **frameArgs) cmds.rowLayout(numberOfColumns=2, columnWidth2=(70, 50), adjustableColumn=2, columnAlign=(1, 'right'), columnAttach=[1, "both", 5]) cmds.columnLayout(adjustableColumn=True) cmds.radioCollection("edShadingNormalsOrder") cmds.radioButton('edShadinOptBump', label='N > B', select=True) cmds.separator(h=4, st="none") cmds.radioButton('edShadinOptNormals', label='B > N') cmds.setParent("..") cmds.columnLayout(adjustableColumn=True) cmds.button(l="Select Bump", c=lambda *x: uiFunc.selectBump()) cmds.separator(h=4, st="none") cmds.button(l="Select Normal", c=lambda *x: uiFunc.selectNormal()) cmds.setParent("..") cmds.setParent("..") # RowLayout cmds.columnLayout(adjustableColumn=True) cmds.floatSliderGrp("edShadingNormalVal", label='Normal: ', field=True, columnWidth3=(70, 60, 50), minValue=0, maxValue=5, value=1, adjustableColumn=3, sliderStep=0.005, precision=3) cmds.floatSliderGrp("edShadingBumpVal", label='Bump: ', field=True, columnWidth3=(70, 60, 50), minValue=-1, maxValue=1, value=0.1, adjustableColumn=3, sliderStep=0.005, precision=3) cmds.setParent("..") cmds.setParent("..") # FrameLayout #================================================================ cmds.frameLayout(label='Displacement', **frameArgs) cmds.rowLayout(numberOfColumns=2, columnWidth2=(70, 5), adjustableColumn=2, columnAlign2=['right', 'left'], columnAttach=[2, "left", 4]) cmds.button(l=" Sel Shape ", c=lambda *x: uiFunc.selectShapes()) cmds.text("edShadingShapeSelected", l="...") cmds.setParent("..") cmds.rowLayout(numberOfColumns=3, columnWidth3=(70, 45, 60), adjustableColumn=3, columnAlign3=['right', 'left', 'left'], columnAttach=[2, "left", 4]) cmds.button(l="Shape List ", c=lambda *x: uiFunc.showShapesDisplacementSheet()) cmds.radioCollection("edShadingShapesChange") cmds.radioButton( 'edShadinAllShapes', label='All', select=True, onCommand=lambda *x: uiFunc.changeShapesSelection("all")) cmds.radioButton( 'edShadinOnlySelectedShape', label='Selected', onCommand=lambda *x: uiFunc.changeShapesSelection("selected")) cmds.setParent("..") #-------------------------------------------------- cmds.columnLayout(adjustableColumn=True) cmds.optionMenuGrp("edShadingSubdivisionType", label='DivType: ', columnWidth2=(70, 10), adjustableColumn=2, columnAttach=[1, "right", 0]) cmds.menuItem("edShadingSubTypeNone", label='None') cmds.menuItem("edShadingSubTypeNoneCatclark", label='Catclark') cmds.menuItem("edShadingSubTypeNoneLinear", label='Linear') cmds.intSliderGrp("edShadingDivisionsCount", label='Iterations: ', field=True, columnWidth3=(70, 60, 50), minValue=0, maxValue=8, value=0, adjustableColumn=3) cmds.floatSliderGrp("edShadingDisplacementHeight", label='Height: ', field=True, columnWidth3=(70, 60, 50), minValue=-5, maxValue=5, value=1, adjustableColumn=3, sliderStep=0.005, precision=3) cmds.checkBoxGrp("edShadingAutoBumpDisp", numberOfCheckBoxes=1, label='AutoBump: ', value1=False, columnWidth2=(70, 10), adjustableColumn=2, columnAttach=[2, "left", 2]) cmds.setParent("..") #-------------------------------------------------- cmds.setParent("..") # FrameLayout #================================================================ cmds.frameLayout(label='Ambient Oclussion', **frameArgs) cmds.floatSliderButtonGrp("edShadingAOMultiply", label='Multiply: ', field=True, columnAttach=[4, "left", 10], columnWidth4=(70, 60, 50, 60), minValue=0, maxValue=2, value=1, adjustableColumn=3, sliderStep=0.005, precision=3, buttonLabel='Sel AO', bc=lambda *x: uiFunc.selectAO()) cmds.setParent("..") #================================================================ cmds.separator(h=2, st="in") cmds.setParent("..") # formLayout ArnoldOptions cmds.setParent("..") #scrollLayout # Deleting the Shading Dummy cmds.delete("edTools")
def mainWin(): global num, drv, stt, end, cb1, cb2, cb3, cb4, rc1, rb1, rb2, rc2, rb3, rb4 if mc.window('GMR', ex=True) == True: mc.deleteUI('GMR', window=True) win = mc.window('GMR', t='GMrigGimmick', widthHeight=(300, 765)) mc.window('GMR', e=True, widthHeight=(300, 765)) #skinJoint----------------------------------------------------------------------------------- mc.columnLayout(adj=True) mc.frameLayout(l='duplicateSkinJoint', cll=True) mc.button(l='skinJoint', w=300, h=30, c=give_duplicate_skinJnt) mc.setParent('..') #---------------------------------------------------------------------------------------------- mc.separator(h=10) #Bend Twist---------------------------------------------------------------------------------- mc.frameLayout(l='Create Gimmick Joint', cll=True) mc.rowLayout(nc=2) mc.button(l='Bend->Twist', w=150, h=30, c=give_BendTwist_createJoint) mc.button(l='Twist->Bend', w=150, h=30, c=give_TwistBend_createJoint) mc.setParent('..') mc.button(l='Connect Gimmick Node', w=300, h=30, c=gimmick) mc.setParent('..') #---------------------------------------------------------------------------------------------- mc.separator(h=10) #CreateWeighted-------------------------------------------------------------------------------- mc.frameLayout(l='createWeighted', cll=True) mc.frameLayout(l='weighted') mc.rowLayout(nc=2, cat=[(1, 'left', 4), (2, 'left', 5)]) mc.text(' Create many weighted : ') num = mc.intField('num', w=136) mc.setParent('..') mc.rowLayout(nc=3, cat=[(1, 'left', 4), (2, 'left', 5)]) mc.text(' set drover :') drv = mc.textField('drv', w=165) mc.button(l='set', w=45, h=20, c=set_drv) mc.setParent('..') mc.setParent('..') mc.frameLayout(l='Range to create weighted') mc.rowLayout(nc=3, cat=[(1, 'left', 40), (2, 'left', 5)]) mc.text('start :') stt = mc.textField('stt', w=165) mc.button(l='set', w=45, h=20, c=stt_set) mc.setParent('..') mc.rowLayout(nc=3, cat=[(1, 'left', 47), (2, 'left', 5)]) mc.text('end :') end = mc.textField('end', w=165) mc.button(l='set', w=45, h=20, c=end_set) mc.setParent('..') mc.setParent('..') mc.rowLayout(nc=2, w=300) mc.button(l='weighted', w=150, h=30, c=give_weighted) mc.button(l='mirror', w=150, h=30, c=give_CreateWeighted) mc.setParent('..') mc.setParent('..') #---------------------------------------------------------------------------------------------- mc.separator(h=10) #AngleDriver----------------------------------------------------------------------------------- mc.frameLayout(l='setAngleDriver', cll=True) mc.button(l='setAngleDriver', c=give_AngleDriver) mc.setParent('..') #---------------------------------------------------------------------------------------------- mc.separator(h=10) #createExpand---------------------------------------------------------------------------------- mc.frameLayout(l='createExpand', cll=True) mc.rowLayout(nc=4, cat=[(1, 'left', 17), (2, 'left', 35), (3, 'left', 35), (4, 'left', 35)]) cb1 = mc.checkBox('cb1', l='+Y') cb2 = mc.checkBox('cb2', l='-Y') cb3 = mc.checkBox('cb3', l='+Z') cb4 = mc.checkBox('cb4', l='-Z') mc.setParent('..') mc.button(l='createExpand', c=give_Expand) mc.setParent('..') #---------------------------------------------------------------------------------------------- mc.separator(h=10) #CreateSpacer---------------------------------------------------------------------------------- mc.frameLayout(l='CreateSpacer', cll=True) mc.frameLayout(l='Type Select') mc.rowLayout(nc=2, cat=[(1, 'left', 50), (2, 'left', 65)]) rc1 = mc.radioCollection() rb1 = mc.radioButton('selb', l='select', select=True) rb2 = mc.radioButton('hieb', l='hierachy') mc.setParent('..') mc.setParent('..') mc.frameLayout(label='Node Select') mc.rowLayout(nc=2, cat=[(1, 'left', 50), (2, 'left', 40)]) rc2 = mc.radioCollection() rb3 = mc.radioButton('trsb', l='Transform', select=True) rb4 = mc.radioButton('jntb', l='joint') mc.setParent('..') mc.setParent('..') mc.button(l='create', c=give_Spacer) mc.setParent('..') #---------------------------------------------------------------------------------------------- mc.separator(h=10) mc.frameLayout(l='reload module') mc.button(l='reload', c=develop) mc.showWindow(win)
def edFixLayout(self): fixTab = cmds.scrollLayout("edFixLayout", **scrollArgs) #--------------------------------- # Save Layout Button & WIZARD Installation #--------------------------------- cmds.formLayout("edBtnMainWizard") edBtnWizard = cmds.button(label="WIZARD INSTALL", height=40, c=uiFunc.edWizardInstallation) edBtnSaveLayout = cmds.button(label="SAVE LAYOUT", height=40, c=uiFunc.edFixSaveLayout) cmds.setParent("..") # formLayout uiFunc.formLayoutSet("edBtnMainWizard", [(edBtnWizard, 50), (edBtnSaveLayout, 50)], padding=5) #--------------------------------- # Set AutoLoad EdTools #--------------------------------- cmds.frameLayout(label='EdTools AutoStart') cmds.rowLayout(height=50, numberOfColumns=2, columnWidth2=(10, 120), adjustableColumn=1, columnAlign=(1, 'left'), columnAttach=[(1, 'both', 20), (2, 'both', 0)]) cmds.columnLayout() cmds.radioCollection("edToolsAutoloadEnabler") cmds.radioButton('edToolsAutoloadEnablerYes', label='Yes', select=True) cmds.radioButton('edToolsAutoloadEnablerNo', label='No') cmds.setParent('..') cmds.columnLayout() cmds.button(l="Enable Auto Load", c=uiFunc.edFixAutoload) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') #--------------------------------- # Install ScriptJobs #--------------------------------- cmds.frameLayout(label='Install ScriptJobs') cmds.rowLayout(height=50, numberOfColumns=2, columnWidth2=(10, 120), adjustableColumn=1, columnAlign=(1, 'left'), columnAttach=[(1, 'both', 20), (2, 'both', 0)]) cmds.columnLayout() cmds.radioCollection("edToolsScriptJobEnabler") cmds.radioButton('edToolsScriptJobEnablerYes', label='Yes', select=True) cmds.radioButton('edToolsScriptJobEnablerNo', label='No') cmds.setParent('..') cmds.columnLayout() cmds.button(l="Enable Script Jobs", c=uiFunc.edFixScriptJobs) cmds.setParent('..') cmds.setParent('..') cmds.setParent('..') #--------------------------------- # Maya Init Configuration #--------------------------------- cmds.frameLayout(label='Maya Init configuration', collapse=True, **frameArgs) msg = "Disable WorkSpace AutoSave\n" msg += "Drag when creates a Polygon/Nurb\n" msg += "Enable Legacy Render Layers\n" msg += "Maya DPI to 125%" cmds.text(align="left", l=msg) cmds.setParent("..") # frameLayout cmds.frameLayout(**frameArgsPadding) cmds.button(label="Set Init Conf", c=uiFunc.edFixSetInitConf) cmds.setParent("..") # frameLayout #--------------------------------- # Hotkeys Installer #--------------------------------- cmds.frameLayout(label='HotKeys Installer', collapse=False, **frameArgs) cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 180), (2, 40)], columnAttach=[1, "right", 10]) cmds.text(l='Show in AttributeEditor:') cmds.text(l='a') cmds.text(l='') cmds.separator() cmds.text(l='Center All Pivots:') cmds.text(l='c') cmds.text(l='Move Pivot to Objects:') cmds.text(l='Alt + c') cmds.text(l='') cmds.separator() cmds.text(l='Context Object:') cmds.text(l='Alt + q') cmds.text(l='Context World:') cmds.text(l='Alt + w') cmds.text(l='Context Custom:') cmds.text(l='Alt + e') cmds.text(l='Context to Self Comp:') cmds.text(l='Alt + r') cmds.text(l='Context to Other Obj Comps:') cmds.text(l='Alt + d') cmds.text(l='Context to Other Obj:') cmds.text(l='Alt + f') cmds.setParent("..") cmds.setParent("..") # frameLayout cmds.frameLayout(**frameArgsPadding) cmds.button(label="Install Hotkeys", c=uiFunc.edFixInstallHotkeys) cmds.setParent("..") # frameLayout cmds.setParent("..") # ScrollLayout
def tkSpeedometer(): colRed = [0.44, 0.2, 0.2] colGreen = [0.28, 0.44, 0.28] colGreen2 = [0.18, 0.30, 0.18] colDark = [0.08, 0.09, 0.10] colDark2 = [0.02, 0.21, 0.22] ver = '1.3' windowStartHeight = 50 windowStartWidth = 480 if (cmds.window('win_tkSpeedometer', exists=1)): cmds.deleteUI('win_tkSpeedometer') myWindow = cmds.window('win_tkSpeedometer', t=('win_tkSpeedometer ' + ver), s=1) cmds.columnLayout(adj=1, bgc=(colDark[0], colDark[1], colDark[2])) cmds.rowColumnLayout(nc=3, cw=[(1, 240), (2, 180), (3, 120)]) cmds.button(l='Create Speedometer on Selected Object', c=partial(cCreateSpeedometer), bgc=(colGreen[0], colGreen[1], colGreen[2])) cmds.button(l='HUD', c=partial(cSpeedHud, 1), bgc=(colGreen2[0], colGreen2[1], colGreen2[2])) cmds.button(l='Clear HUD', c=partial(cSpeedHud, 0), bgc=(colRed[0], colRed[1], colRed[2])) # cmds.button(l='Delete Expressions', c=partial(cDelExpression), bgc=(colRed[0], colRed[1], colRed[2])) cmds.setParent('..') cmds.columnLayout(adj=1, bgc=(colDark[0], colDark[1], colDark[2])) cmds.rowColumnLayout(nc=6, cw=[(1, 240), (2, 60), (3, 60), (4, 60), (5, 60), (6, 60)]) cmds.text('Position Top') cmds.radioCollection('rcPosition') cmds.radioButton('rb1', l='T 1', bgc=(colDark2[0], colDark2[1], colDark2[2])) cmds.radioButton('rb2', l='T 2') cmds.radioButton('rb3', l='T 3', sl=1, bgc=(colDark2[0], colDark2[1], colDark2[2])) cmds.radioButton('rb4', l='T 4') cmds.radioButton('rb5', l='T 5', bgc=(colDark2[0], colDark2[1], colDark2[2])) cmds.text('Position Bottom') cmds.radioButton('rb6', l='B 1', bgc=(colDark2[0], colDark2[1], colDark2[2])) cmds.radioButton('rb7', l='B 2') cmds.radioButton('rb8', l='B 3', bgc=(colDark2[0], colDark2[1], colDark2[2])) cmds.radioButton('rb9', l='B 4') cmds.radioButton('rb10', l='B 5', bgc=(colDark2[0], colDark2[1], colDark2[2])) cmds.setParent('..') # cmds.rowColumnLayout(nc=3, cw=[(1, 240), (2, 60), (3,240)]) cmds.rowColumnLayout(nc=4, cw=[(1, 240), (2, 60), (3, 180), (4, 60)]) cmds.text('Maya Scene Scale', bgc=(colGreen2[0], colGreen2[1], colGreen2[2])) cmds.floatField('fSceneScale', v=1, pre=2, min=.00001, cc=partial(cAdjustAttr, 'fSceneScale', 'sceneScale'), bgc=(colGreen[0], colGreen[1], colGreen[2])) cmds.text('Decimals', bgc=(colGreen2[0], colGreen2[1], colGreen2[2])) cmds.intField('iDecimals', min=0, max=2, v=1, cc=partial(cAdjustAttr, 'iDecimals', 'decimals'), bgc=(colGreen[0], colGreen[1], colGreen[2])) cmds.setParent('..') cmds.button(l='Help', c=partial(cHelp), bgc=(colDark[0], colDark[1], colDark[2])) cmds.showWindow(myWindow)
def createWindow(name, callback): # check if the window exists already if cmds.window("mayaExporterReady", exists=True): cmds.deleteUI("mayaExporterReady") _win = cmds.window("mayaExporterReady", title=name) cmds.rowColumnLayout("global", adjustableColumn=True, columnOffset=[1, "both", storage.globalColumnOffset]) cmds.shelfTabLayout('mainShelfTab', w=storage.shelfWidth) # GENERAL PANEL cmds.columnLayout("General", adj=False, columnOffset=["both", storage.inShelfOffset]) cmds.text(l='<span style="font-size:18px">General options</span>', font="boldLabelFont") cmds.text(l="") cmds.checkBox( "freezeTransform", l="Freeze transformations", ann="Allow the script to freeze the transformation of your selection", v=storage.values.freezeTransform) cmds.checkBox( "deleteHistory", l="Delete history", ann= "Allow the script to delete the construction history of your selection", v=storage.values.deleteHistory) cmds.checkBox( "selectionOnly", l="Selection only", ann= "Restrict the script to process only your selection\nIf false, the all scene will be processed", v=storage.values.selectionOnly) cmds.checkBox("cleanUpMesh", l="Clean up meshes", ann="Allow the script to go through a clean up your meshes", v=storage.values.cleanUpMesh) cmds.checkBox( "checkNonManyfold", l="Check for non-manyfold meshes", ann= "Allow the script to check non-manifold meshes and giving feedback if found", v=storage.values.checkNonManyfold) cmds.text(l="") cmds.setParent('..') # NORMAL PANEL cmds.columnLayout("Normal", adj=False, columnOffset=["both", storage.inShelfOffset]) cmds.text(l='<span style="font-size:18px">Normals options</span>', font="boldLabelFont") cmds.text(l="") cmds.checkBox( "conformNormals", l="Conform normals", ann= "Conform the normals of your meshes.\nSet the normal to the average normal direction", v=storage.values.conformNormals) cmds.checkBox( "rebuildNormals", l="Rebuild normals", ann= "Rebuilds all normals of the mesh with custom angles\nSoft: angle = 30\nHard: angle = 0", v=storage.values.rebuildNormals, cc=enableRebuildOption) cmds.text(label="") cmds.text(label="Rebuild options:", align="left") cmds.radioButtonGrp("rebuildNormalOption", labelArray3=['Soft', 'Hard', 'Custom'], numberOfRadioButtons=3, select=storage.values.rebuildNormalOption, vertical=True, enable=storage.values.rebuildNormals, cc=enableCustomAngle) cmds.intField("customNormalAngle", min=0, max=180, v=storage.values.customNormalAngle, enable=getRebuildOption()) cmds.text(l="") cmds.setParent('..') # PIVOT PANEL cmds.columnLayout("Pivot", adj=False, columnOffset=["both", storage.inShelfOffset]) cmds.text(l='<span style="font-size:18px">Pivot options</span>', font="boldLabelFont") cmds.text(l="") cmds.radioButtonGrp( "pivotOption", labelArray4=[ 'Untouched', 'Mesh center', 'Scene center', 'Base center' ], numberOfRadioButtons=4, an1="Don't modify the pivot parameters", an2="Set the pivot position at the center of every meshes", an3="Set the pivot of every meshes at the center of the scene", an4= "Set the pivot of every meshes at the center of the mesh for XZ coordinates\nand at the lowest vertex position for the Y coordinate", select=storage.values.pivotOption, vertical=True) cmds.text(l="") cmds.setParent('..') # EXPORT PANEL cmds.columnLayout("Export", adj=False, columnOffset=["both", storage.inShelfOffset]) cmds.text(l='<span style="font-size:18px">Export settings</span>', font="boldLabelFont") cmds.text(l="") cmds.checkBox("exportResult", l="Export result", ann="Allow the script to export the result of the process", v=storage.values.exportResult, cc=onEnableExport) cmds.checkBox( "exportAsOneObject", l="Export as one object", ann="The script will export the selection as one only object", v=storage.values.exportAsOneObject, cc=updateExportNameLabel) cmds.text(l="") cmds.text("exportFolderInput", l="Export path:") cmds.rowLayout(adjustableColumn=2, numberOfColumns=2) cmds.textField("exportFolderInput", ann="Path of the folder where the exported files will drop", fi=storage.values.exportFolder, w=300, h=26, cc=checkExportFolder) cmds.button("exportFolderBrowserButton", ann="Open dialog to search an export folder", l="Browse", c=searchExportFolder) cmds.setParent('..') cmds.text(l="") cmds.text("exportNameLabel", l="") cmds.text("exportNameLabel", e=True, l=updateExportNameLabel(storage.values.exportAsOneObject)) storage.scene = cmds.file(q=True, sn=True) storage.sceneName, storage.sceneExt = os.path.splitext( os.path.basename(storage.scene)) # print("sceneName", storage.sceneName) cmds.textField( "exportNameInput", text=storage.values.exportName, ann="Name that will have the folder or the file that will be exported", w=351, h=26, cc=updateExportName, pht=storage.sceneName if storage.sceneName != "" else "untitled") cmds.text(l="") cmds.radioCollection("exportExtension") cmds.text("radioColExtentionLabel", l="Export as") cmds.radioButton("exportFbx", ann="The script will export the meshes as FBX", l="FBX", onCommand=onFbxExtension) cmds.radioButton("exportObj", ann="The script will export the meshes as OBJ", l="OBJ", onCommand=onObjExtension) cmds.radioCollection("exportExtension", e=True, select=storage.values.exportExtension) onEnableExport(cmds.checkBox("exportResult", q=True, v=True)) cmds.text(l="") cmds.setParent('..') # REFERENCE PANEL cmds.columnLayout("References", adj=False, columnOffset=["both", storage.inShelfOffset]) cmds.text( l='<span style="font-size:18px">Search and import references</span>', font="boldLabelFont") cmds.columnLayout("refWraper") cmds.setParent('..') cmds.rowLayout(adjustableColumn=2, numberOfColumns=2) cmds.button( label="Search", ann="Open dialog to search a folder with\nFBX or OBJ files in it", c=searchRefs, w=150) cmds.button('unityImportRef', l='Import reference', ann="Import the selected reference into the active scene", c=importRef, w=150) cmds.setParent('..') cmds.text(l="") displayRefs(storage.values.unityRefDir) cmds.setParent('..') # SETTINGS PANEL cmds.columnLayout("Settings", adj=False, columnOffset=["both", storage.inShelfOffset]) cmds.text(l='<span style="font-size:18px">Settings options</span>', font="boldLabelFont") cmds.text(l="") cmds.checkBox( "alwaysOverrideExport", l="Override existing export file", ann= "The script will override, by default, the corresponding export file if it exists", v=storage.values.alwaysOverrideExport) cmds.checkBox( "stayInScene", l="Stay in active scene", ann= "True: the script will end on the active scene\nFalse:the script will end on the export file of the active scene", v=storage.values.stayInScene) cmds.checkBox( "displayInfo", l="Display informations", ann= "Allow the script to gives you mass informations on what is happening during the process", v=storage.values.displayInfo) cmds.text(l="") cmds.text(l="Preferences:") cmds.button("saveAsPrefs", l="Save settings", c=savePreferences, w=125) cmds.text(l="") cmds.button("resetToPrefs", l="Reset to preferences", c=resetToPrefs, w=125) cmds.text(l="") cmds.setParent('|') cmds.text(l="") cmds.button(l="Go", c=callback) cmds.rowColumnLayout("global", e=True, rowOffset=[(1, "top", storage.globalRowOffset), (len( cmds.rowColumnLayout("global", q=True, childArray=True)), "bottom", storage.globalRowOffset)]) # Display the window cmds.showWindow(_win) return _win
def getMeshLightAttrsAndShow(): item = cmds.textScrollList('MeshLightList',q=True,si=True)[0] try: if cmds.getAttr(item+'.aiTranslator') == 'polyMesh': cmds.optionMenu('MeshLight_aiTranslator',e=True,sl=1) elif cmds.getAttr(item+'.aiTranslator') == 'mesh_light': cmds.optionMenu('MeshLight_aiTranslator',e=True,sl=2) elif cmds.getAttr(item+'.aiTranslator') == 'procedural': cmds.optionMenu('MeshLight_aiTranslator',e=True,sl=3) elif cmds.getAttr(item+'.aiTranslator') == 'quad': cmds.optionMenu('MeshLight_aiTranslator',e=True,sl=4) elif cmds.getAttr(item+'.aiTranslator') == 'cylinder': cmds.optionMenu('MeshLight_aiTranslator',e=True,sl=5) elif cmds.getAttr(item+'.aiTranslator') == 'disk': cmds.optionMenu('MeshLight_aiTranslator',e=True,sl=6) except: pass try: cmds.colorSliderGrp('MeshLight_aiColor',e=True,rgb=cmds.getAttr(item+'.color')[0]) except: pass try: cmds.floatSliderGrp('MeshLight_aiIntensity',e=True,v=cmds.getAttr(item+'.intensity')) except: pass try: cmds.floatSliderGrp('MeshLight_aiExposure',e=True,v=cmds.getAttr(item+'.aiExposure')) except: pass try: cmds.checkBox('MeshLight_aiUseTemp',e=True,v=cmds.getAttr(item+'.aiUseColorTemperature')) except: pass try: cmds.floatSliderGrp('MeshLight_aiTemperature',e=True,v=cmds.getAttr(item+'.aiColorTemperature')) except: pass try: cmds.checkBox('MeshLight_aiVisible',e=True,v=cmds.getAttr(item+'.lightVisible')) except: pass try: cmds.intFieldGrp('MeshLight_aiSample',e=True,v1=cmds.getAttr(item+'.aiSamples')) except: pass try: cmds.checkBox('MeshLight_aiNormalize',e=True,v=cmds.getAttr(item+'.aiNormalize')) except: pass try: cmds.checkBox('MeshLight_aiCastShadows',e=True,v=cmds.getAttr(item+'.aiCastShadows')) except: pass try: cmds.floatSliderGrp('MeshLight_aiShadowDensity',e=True,v=cmds.getAttr(item+'.aiShadowDensity')) except: pass try: cmds.colorSliderGrp('MeshLight_aiShadowColor',e=True,rgb=cmds.getAttr(item+'.aiShadowColor')[0]) except: pass try: cmds.checkBox('MeshLight_aiCastVolumeShadow',e=True,v=cmds.getAttr(item+'.aiCastVolumetricShadows')) except: pass try: cmds.intFieldGrp('MeshLight_aiVolumeSample',e=True,v1=cmds.getAttr(item+'.aiVolumeSamples')) except: pass try: cmds.textFieldGrp('MeshLight_aiAov',e=True,tx=cmds.getAttr(item+'.aiAov')) except: pass if cmds.radioButton('Single_Check',q=True,sl=True): cmds.select(item,r=True) elif cmds.radioButton('Double_Check',q=True,sl=True): pass refreshCounts()
def populate_ref_remap(namespaces): radio_state = None if cmds.radioCollection('animlib_ref_radio', query=True, exists=True): radio_state = cmds.radioCollection('animlib_ref_radio', query=True, select=True) if cmds.columnLayout('animlib_ref_col', exists=True): cmds.deleteUI('animlib_ref_col') ref_col = cmds.columnLayout('animlib_ref_col', adjustableColumn=True, parent='animlib_ref_frame', columnAttach = ('both',0)) for namespace in namespaces: cmds.setParent('animlib_ref_col') nsp_form = cmds.formLayout('animlib_ref_'+namespace+'_frm', numberOfDivisions=100, width=420) lbl_nsp = cmds.text(label=namespace+' > ', height=20, align='right') cmd = '"{0}"'.format(namespace) txt_nsp = cmds.textField('animlib_ref_'+namespace+'_txt', editable=True, text=namespace, placeholderText='None', changeCommand=lambda x, y=namespace:ref_update(y), enterCommand=lambda x, y=namespace:ref_update(y), receiveFocusCommand=lambda x, y=namespace:ref_update(y),) cmds.popupMenu('animlib_ref_'+namespace+'_menu', postMenuCommand=lambda x, y, z=namespace:ref_menu_update(z), ) mnu_mod = cmds.optionMenu('animlib_ref_'+namespace+'_mode', changeCommand=lambda x, y=namespace:ref_mode_update(x,y) ) cmds.menuItem( label='All Inputs' ) cmds.menuItem( label='Values' ) cmds.menuItem( label='Curves/Values' ) cmds.menuItem( label='Constraints' ) cmds.menuItem( label='No Inputs' ) cmds.formLayout(nsp_form, edit=True, attachForm=[(lbl_nsp, 'top', 3), (mnu_mod, 'top', 3), (mnu_mod, 'right', 5), (txt_nsp, 'right', 120), (txt_nsp, 'top', 3),], attachControl=[ (mnu_mod, 'left', 5, txt_nsp),], attachPosition=[(txt_nsp, 'left', 0, 33), (lbl_nsp, 'right', 5, 33)],) nsp_form = cmds.formLayout('animlib_ref_radioButton_frm', numberOfDivisions=100, parent=ref_col) sep = cmds.separator( height=10, style='in' ) lbl_nsp = cmds.text(label='Bring new referenced rigs into the scene:', height=20, align='right') radcol = cmds.radioCollection('animlib_ref_radio') rad1 = cmds.radioButton('animlib_build_unfound', label='If the rig\'s namespace does not exist yet', collection = radcol) rad2 = cmds.radioButton('animlib_force_build', label='Whether the namespace exists or not', collection = radcol,) rad3 = cmds.radioButton('animlib_no_new', label='Never, only apply to existing namespaces', collection = radcol,) nsp_list = cmds.text('animlib_ref_nsp_list', label='#'.join(namespaces), visible=False) cmds.formLayout(nsp_form, edit=True, attachForm=[(sep, 'top', 3), (sep, 'left', 3), (sep, 'right', 3), (lbl_nsp, 'top', 10), (rad3, 'bottom', 5),], attachControl=[(rad1, 'top', 5, lbl_nsp,), (rad2, 'top', 5, rad1), (rad3, 'top', 5, rad2),], attachPosition=[(lbl_nsp, 'left', -80, 33), (rad1, 'left', 0, 33), (rad2, 'left', 0, 33), (rad3, 'left', 0, 33),],) if radio_state and cmds.radioButton(radio_state, query=True, exists=True): cmds.radioButton(radio_state, edit=True, select=True) else: cmds.radioButton('animlib_build_unfound', edit=True, select=True) for rad in (rad1, rad2, rad3): cmds.radioButton(rad, edit=True, changeCommand = lambda x, y=None:ref_update(y),) ref_update(None)
def createWindow(): if cmds.window('MeshLightSetter',ex=True): cmds.deleteUI('MeshLightSetter') cmds.window('MeshLightSetter',t='MeshLight Setter',w=600,h=800) cmds.rowLayout(nc=2) cmds.frameLayout(l='aiTranslatorAttributes',w=380) cmds.formLayout('MeshLight_FormLayout') f1 = cmds.optionMenu('MeshLight_aiTranslator') cmds.menuItem(l='polymesh',p='MeshLight_aiTranslator') cmds.menuItem(l='mesh_light',p='MeshLight_aiTranslator') cmds.menuItem(l='procedural',p='MeshLight_aiTranslator') cmds.menuItem(l='quad',p='MeshLight_aiTranslator') cmds.menuItem(l='cylinder',p='MeshLight_aiTranslator') cmds.menuItem(l='disk',p='MeshLight_aiTranslator') f2 = cmds.colorSliderGrp('MeshLight_aiColor',l='Color') f3 = cmds.floatSliderGrp('MeshLight_aiIntensity',l='Intensity',field=True) f4 = cmds.floatSliderGrp('MeshLight_aiExposure',l='Exposure',field=True) f5 = cmds.checkBox('MeshLight_aiUseTemp',l='Use Temperature') f6 = cmds.floatSliderGrp('MeshLight_aiTemperature',l='Temperature',minValue=0.0,maxValue=20000.0,field=True) f7 = cmds.checkBox('MeshLight_aiVisible',l='Light Visible') f8 = cmds.intFieldGrp('MeshLight_aiSample',l='Sample') f9 = cmds.checkBox('MeshLight_aiNormalize',l='Normalize') f10 = cmds.checkBox('MeshLight_aiCastShadows',l='Cast Shadows') f11 = cmds.floatSliderGrp('MeshLight_aiShadowDensity',l='ShadowDensity',minValue=0.0,maxValue=1.0,field=True) f12 = cmds.colorSliderGrp('MeshLight_aiShadowColor',l='Shadow Color') f13 = cmds.checkBox('MeshLight_aiCastVolumeShadow',l='Cast Volumeric Shadow') f14 = cmds.intFieldGrp('MeshLight_aiVolumeSample',l='Volume Sample') f15 = cmds.textFieldGrp('MeshLight_aiAov',l='AOV Group') f16 = cmds.rowLayout(nc=2) f17 = cmds.button(l='List LightGroup',c=lambda *args:refreshLightGroupMenu(),w=98) f18 = cmds.button(l='Set LightGroup',c=lambda *args:setLightGroupFromMenu(),w=98) cmds.setParent(u=True) f19 = cmds.textFieldGrp('AOVString',l='AOVs') f20 = cmds.textScrollList('MeshLight_LightGroupList',w=200,h=372) cmds.formLayout('MeshLight_FormLayout',e=True,af = [(f1,'top',0),(f1,'left',100), (f2,'top',22),(f2,'left',-40), (f3,'top',44),(f3,'left',-40), (f4,'top',66),(f4,'left',-40), (f5,'top',88),(f5,'left',90), (f6,'top',110),(f6,'left',-40), (f7,'top',132),(f7,'left',90), (f8,'top',154),(f8,'left',-40), (f9,'top',176),(f9,'left',90), (f10,'top',198),(f10,'left',90), (f11,'top',220),(f11,'left',-40), (f12,'top',242),(f12,'left',-40), (f13,'top',264),(f13,'left',90), (f14,'top',286),(f14,'left',-40), (f15,'top',308),(f15,'left',-40), (f16,'top',333),(f16,'left',90), (f19,'top',360),(f19,'left',-40), (f20,'top',383),(f20,'left',90) ]) cmds.setParent(u=True) cmds.setParent(u=True) cmds.frameLayout(l='Mesh Light List',w=400) cmds.rowLayout(nc=5) cmds.button(l='aiAreaLight',w=80,c=lambda *ars:createAreaLight()) cmds.textField('nodeTypeFilterText',w=130) cmds.popupMenu(p='nodeTypeFilterText') cmds.menuItem(l='getTypeBySelect',c=lambda *args:cmds.textField('nodeTypeFilterText',e=True,tx=cmds.nodeType(cmds.ls(sl=True)[0]))) cmds.button(l='Selected',w=60,c=lambda args:cmds.select(cmds.ls(sl=True,dag=True,ni=True,type=cmds.textField('nodeTypeFilterText',q=True,tx=True)),r=True)) cmds.button(l='Scene',w=60,c=lambda args:cmds.select(cmds.ls(dag=True,ni=True,type=cmds.textField('nodeTypeFilterText',q=True,tx=True)),r=True)) cmds.button(l='Group',w=60,c=lambda args:cmds.select(groupAnalyzer(cmds.ls(dag=True,sl=True,ni=True),cmds.textField('nodeTypeFilterText',q=True,tx=True),'down'),r=True)) cmds.setParent(u=True) cmds.formLayout('MeshLightList_FormLayout') cmds.radioCollection() w1 = cmds.radioButton('AllLightCheck',l='List All Light',sl=True) w2 = cmds.radioButton('SelLightCheck',l='List Sel Light') #w1 = cmds.button(l='ALL MESH light',c=lambda *args:lightListRefresh(True),w=100) #w2 = cmds.button(l='Sel MESH Light',c=lambda *args:lightListRefresh(False),w=100) w3 = cmds.checkBox('List_NormalLight',l='Normal_Light') w4 = cmds.checkBox('List_MeshLight',l='Mesh_Light') w5 = cmds.textFieldGrp('MeshLight_Template',l='Template',w=400) w6 = cmds.button(l='Set Template',c=lambda *args:cmds.textFieldGrp('MeshLight_Template',e=True,tx=cmds.ls(sl=True,dag=True,ni=True)[0]),w=100) w7 = cmds.button(l='Convert!',c=lambda *args:convertMeshToMeshLight(),w=100) w8 = cmds.textScrollList('MeshLightList',w=400,h=700,ams=True) w9 = cmds.text('ListTotalNumber',l='0',w=50,nbg=True) w10 = cmds.text('ListSelectNumber',l='0',w=50,nbg=True) cmds.radioCollection() w11 = cmds.radioButton('Single_Check',l='Single') w12 = cmds.radioButton('Double_Check',l='Double',sl=True) w13 = cmds.button('ListWireframeColor',l='Color Dis',w=70,c=lambda *args:displayLightColorAsWireframe()) cmds.formLayout('MeshLightList_FormLayout',e=True,af = [(w1,'top',3),(w1,'left',0), (w2,'top',3),(w2,'left',101), (w3,'top',3),(w3,'left',205), (w4,'top',3),(w4,'left',320), (w5,'top',27),(w5,'left',-90), (w6,'top',27),(w6,'left',297), (w7,'top',52),(w7,'left',297), (w8,'top',77),(w8,'left',0), (w9,'top',57),(w9,'left',0), (w10,'top',57),(w10,'left',50), (w11,'top',55),(w11,'left',100), (w12,'top',55),(w12,'left',160), (w13,'top',52),(w13,'left',225) ]) cmds.popupMenu('MeshLightListMenu',p='MeshLightList') cmds.menuItem(l='Select...',p='MeshLightListMenu',c=lambda *args:cmds.select([item for item in cmds.textScrollList('MeshLightList',q=True,si=True)])) cmds.showWindow('MeshLightSetter') cmds.textScrollList('MeshLightList',e=True,dcc=lambda *args:cmds.select(cmds.textScrollList('MeshLightList',q=True,si=True),r=True)) cmds.textScrollList('MeshLightList',e=True,sc=lambda *args:getMeshLightAttrsAndShow()) cmds.textScrollList('MeshLight_LightGroupList',e=True,ams=True,sc=lambda *args:genAovString(),dcc=lambda *args:selectLightByGroupName()) cmds.optionMenu(f1,e=True,cc=lambda *args:setMeshLightAttrsAndShow('translator')) cmds.colorSliderGrp(f2,e=True,cc=lambda *args:setMeshLightAttrsAndShow('color')) cmds.floatSliderGrp(f3,e=True,cc=lambda *args:setMeshLightAttrsAndShow('intensity')) cmds.floatSliderGrp(f4,e=True,cc=lambda *args:setMeshLightAttrsAndShow('exposure')) cmds.checkBox(f5,e=True,cc=lambda *args:setMeshLightAttrsAndShow('useTemp')) cmds.floatSliderGrp(f6,e=True,cc=lambda *args:setMeshLightAttrsAndShow('temp')) cmds.checkBox(f7,e=True,cc=lambda *args:setMeshLightAttrsAndShow('visible')) cmds.intFieldGrp(f8,e=True,cc=lambda *args:setMeshLightAttrsAndShow('sample')) cmds.checkBox(f9,e=True,cc=lambda *args:setMeshLightAttrsAndShow('normalize')) cmds.checkBox(f10,e=True,cc=lambda *args:setMeshLightAttrsAndShow('castShadows')) cmds.floatSliderGrp(f11,e=True,cc=lambda *args:setMeshLightAttrsAndShow('shadowDensity')) cmds.colorSliderGrp(f12,e=True,cc=lambda *args:setMeshLightAttrsAndShow('shadowColor')) cmds.checkBox(f13,e=True,cc=lambda *args:setMeshLightAttrsAndShow('castVolumeShadow')) cmds.intFieldGrp(f14,e=True,cc=lambda *args:setMeshLightAttrsAndShow('volumeSample')) cmds.textFieldGrp(f15,e=True,cc=lambda *args:setMeshLightAttrsAndShow('aiAov')) cmds.radioButton('AllLightCheck',e=True,cc=lambda *args:lightListRefresh()) cmds.radioButton('SelLightCheck',e=True,cc=lambda *args:lightListRefresh()) cmds.checkBox('List_NormalLight',e=True,cc=lambda *args:lightListRefresh()) cmds.checkBox('List_MeshLight',e=True,cc=lambda *args:lightListRefresh())
def __init__(self): # Default values on init self.selObjs = None self.objIDOn = 0 self.objIDVal = None self.useAttrOn = 0 self.useAttrVal = None self.matIDOn = 0 self.matIDVal = None self.matIDCol = None if mc.window('vrayAttr', exists=True): mc.deleteUI('vrayAttr') mc.window('vrayAttr', t="Set Vray Attribute", iconName='Vray Attrs', w=220) mc.rowColumnLayout(nc=1, cal=[1, 'left'], rs=[1, 7], cs=[1, 20], cw=[1, 180]) mc.separator(st='none', h=17) # Set Selected Objects to selObjs variable mc.button(l='Select Objects', c=self.selectObjects, w=50) mc.separator(h=25, st='in') # Enable and set Vray ObjectID self.guiObjIDOn = mc.checkBox(l='Object ID') mc.text(l='Object ID Value') self.guiObjIDVal = mc.textField() mc.separator(h=25, st='in') # Enable and set Vray User Attributes self.guiUseAttrOn = mc.checkBox(l='User attributes') mc.text(l='Enter User attributes') self.guiUseAttrVal = mc.textField() mc.separator(h=25, st='in') # Enable and set Vray Material ID self.guiMatIDOn = mc.checkBox(l='Material ID') mc.text(l='Multimatte ID') self.guiMatIDVal = mc.textField() mc.text(l='Material ID') self.guiMatIDCol = mc.radioCollection() mc.radioButton('red', label='Red') mc.radioButton('green', label='Green') mc.radioButton('blue', label='Blue') mc.radioButton('white', label='White') mc.radioButton('black', label='Black') mc.separator(h=25, st='in') # Activate on Geo or Material mc.button(l='Apply Settings to Geometry', c=self.vrayMeshAttrSet, w=50) mc.separator(st='none') mc.button(l='Apply Settings to Materials', c=self.vrayMtrlIDSet, w=50) mc.separator(st='none', h=17) mc.showWindow()
def mirrorModule_UI(self): #print self.modules self.moduleNames = [] for module in self.modules: self.moduleNames.append(module.partition("__")[2]) self.sameMirrorSettingsForAll = False if len(self.modules) > 1: result = cmds.confirmDialog( title="Mirror Multiple Modules", message=str(len(self.modules)) + " modules selected for mirror.\n How would you like to apply mirroring? ", button=["Same for All", "Individually", "Cancel"], defaultButton="Same for All", cancelButton="Cancel", dismissString="Cancel") if result == "Cancel": return if result == "Same for All": self.sameMirrorSettingsForAll = True print self.sameMirrorSettingsForAll self.UIElements = {} if cmds.window("mirrorModule_UI_window", exists=True): cmds.deleteUI("mirrorModule_UI_window") windowWidth = 300 windowHeight = 400 self.UIElements["window"] = cmds.window("mirrorModule_UI_window", width=windowWidth, height=windowHeight, title="Mirror Module(s)", sizeable=False) self.UIElements["scrollLayout"] = cmds.scrollLayout(hst=0) self.UIElements["topColumnLayout"] = cmds.columnLayout(adj=True, rs=3) scrollWidth = windowWidth - 30 mirrorPlane_textWidth = 80 mirrorPlane_columnWidth = (scrollWidth - mirrorPlane_textWidth) / 3 self.UIElements["mirrorPlane_rowColumn"] = cmds.rowColumnLayout( nc=4, columnAttach=(1, "right", 0), columnWidth=[(1, mirrorPlane_textWidth), (2, mirrorPlane_columnWidth), (3, mirrorPlane_columnWidth), (4, mirrorPlane_columnWidth)]) cmds.text(label="Mirror Plane: ") self.UIElements["mirrorPlane_radioCollection"] = cmds.radioCollection() cmds.radioButton("XY", label="XY", select=False) cmds.radioButton("YZ", label="YZ", select=True) cmds.radioButton("XZ", label="XZ", select=False) cmds.setParent(self.UIElements["topColumnLayout"]) cmds.separator() cmds.text(label="mirrored Name(s): ") columnWidth = scrollWidth / 2 self.UIElements["moduleName_rowColumn"] = cmds.rowColumnLayout( nc=2, columnAttach=(1, "right", 0), columnWidth=[(1, columnWidth), (2, columnWidth)]) for module in self.moduleNames: cmds.text(label=module + ">>") self.UIElements["moduleName_" + module] = cmds.textField( enable=True, text=module + "_mirror") cmds.setParent(self.UIElements["topColumnLayout"]) cmds.separator() if self.sameMirrorSettingsForAll: self.generateMirrorFunctionControls(None, scrollWidth) else: for module in self.moduleNames: cmds.setParent(self.UIElements["topColumnLayout"]) self.generateMirrorFunctionControls(module, scrollWidth) cmds.setParent(self.UIElements["topColumnLayout"]) cmds.separator() self.UIElements["button_row"] = cmds.rowLayout(nc=2, columnWidth=[ (1, columnWidth), (2, columnWidth) ], cat=[(1, "both", 10), (2, "both", 10)], columnAlign=[ (1, "center"), (2, "center") ]) cmds.button(label="Accept", c=self.acceptWindow) cmds.button(label="Cancel", c=self.cancelWindow) cmds.showWindow(self.UIElements["window"])
def build_control_selection(window, main_layout): control_frame = cmds.frameLayout( label='Control Selection', width=total_width, height=175, collapsable=True, parent=main_layout, collapseCommand=lambda: collapse_cmd(window, control_frame, 175), expandCommand=lambda: collapse_cmd( window, control_frame, 175, expand=True)) rcl = Col_Layout(control_frame) #parent Control cmds.text(label='Parent Control', align='left', parent=rcl) cmds.text(label='', align='left', parent=rcl) parent_control_text = cmds.textField(height=20, parent=rcl) parent_load = cmds.button(label='Load', height=20, width=20, command=lambda x: load_sel(parent_control_text)) #child Control cmds.text(label='Child Control', align='left', parent=rcl) cmds.text(label='', align='left', parent=rcl) child_control_text = cmds.textField(height=20, parent=rcl) child_load = cmds.button(label='Load', height=20, width=20, command=lambda x: load_sel(child_control_text)) # seperator cmds.separator(parent=control_frame) prcl = cmds.rowColumnLayout(numberOfColumns=1, columnWidth=[(1, total_width)], parent=control_frame) #connected Attribute cmds.text(label='Connected Axis', align='center', parent=prcl) #radio buttons check_box = cmds.checkBox(label='Reverse Axis', parent=prcl) rad_cl = cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, total_width // 3 - 10), (2, total_width // 3 - 10), (3, total_width // 3 - 10)], columnOffset=[(1, 'both', 5), (2, 'both', 5), (3, 'both', 5)], parent=prcl) pa_col = cmds.radioCollection(numberOfCollectionItems=3, parent=prcl) px = cmds.radioButton(label='X', parent=rad_cl) py = cmds.radioButton(label='Y', parent=rad_cl) pz = cmds.radioButton(label='Z', parent=rad_cl) #setting default value cmds.radioCollection(pa_col, edit=True, select=px) return_dict = { 'parent_TF': parent_control_text, 'child_TF': child_control_text, 'axis_RC': pa_col, 'reverse_axis_CB': check_box } return return_dict
def convertMeshToMeshLight(): meshList = cmds.ls(sl=True,dag=True,ni=True) if len(meshList) > 0: for mesh in meshList: try: cmds.setAttr(mesh+'.aiTranslator','mesh_light',type='string') except: pass if len(cmds.textFieldGrp('MeshLight_Template',q=True,tx=True))>0: attrs = getTemplateAttrs() try: cmds.setAttr(mesh+'.color',attrs[1][0][0],attrs[1][0][1],attrs[1][0][2],type='double3') except: pass try: cmds.setAttr(mesh+'.intensity',attrs[2]) except: pass try: cmds.setAttr(mesh+'.aiExposure',attrs[3]) except: pass try: cmds.setAttr(mesh+'.aiUseColorTemperature',attrs[4]) except: pass try: cmds.setAttr(mesh+'.aiColorTemperature',attrs[5]) except: pass try: cmds.setAttr(mesh+'.lightVisible',attrs[6]) except: pass try: cmds.setAttr(mesh+'.aiSamples',attrs[7]) except: pass try: cmds.setAttr(mesh+'.aiNormalize',attrs[8]) except: pass try: cmds.setAttr(mesh+'.aiCastShadows',attrs[9]) except: pass try: cmds.setAttr(mesh+'.aiShadowDensity',attrs[10]) except: pass try: cmds.setAttr(mesh+'.aiShadowColor',attrs[11][0][1],attrs[11][0][1],attrs[11][0][2],type='double3') except: pass try: cmds.setAttr(mesh+'.aiCastVolumetricShadows',attrs[12]) except: pass try: cmds.setAttr(mesh+'.aiVolumeSamples',attrs[13]) except: pass try: cmds.setAttr(mesh+'.aiAov',attrs[14],type='string') except: pass cmds.radioButton('SelLightCheck',e=True,sl=True) cmds.checkBox('List_NormalLight',e=True,v=1) cmds.checkBox('List_MeshLight',e=True,v=1) lightListRefresh()