Esempio n. 1
0
def UI():
    defUI = pm.window(t = "rig companion", w = 200)
    pm.columnLayout(adjustableColumn=True)
    
    pm.button(l = "create X circle (anim)!", c = lambda *args: SmartRig_createHelpers.createCircle([1,0,0]))
    pm.button(l = "create Y circle (anim)!", c = lambda *args: SmartRig_createHelpers.createCircle([0,1,0]))
    pm.button(l = "create Z circle (anim)!", c = lambda *args: SmartRig_createHelpers.createCircle([0,0,1]))
    pm.text(l = "-------------")
    pm.button(l = "create locator 1!", c = lambda *args: SmartRig_createHelpers.createLoc(1) )
    pm.button(l = "create locator 0.5 !", c = lambda *args: SmartRig_createHelpers.createLoc(0.5) )
    pm.button(l = "create locator 0.2 !", c = lambda *args: SmartRig_createHelpers.createLoc(0.2) )
    pm.text(l = "-------------")
    pm.button(l = "create zero !", c = lambda *args: SmartRig_createHelpers.createZero())
    pm.text(l = "-------------")
    pm.button(l = "create dimension !", c = lambda *args: SmartRig_createHelpers.creatDist() )
    pm.text(l = "-------------")
    pm.button(l = "add IK attributes", c = lambda *args: smartRig_AddAttr.addAttrIK())
    pm.button(l = "add switch attributes", c = lambda *args: smartRig_AddAttr.addAttrSwitch() )
    pm.text(l = "-------------")
    pm.button(l = "create plane", c = lambda *args: smartRig_makeRibbon.createPlane())
    pm.button(l = "make ribbon", c = lambda *args: smartRig_makeRibbon.makeRibbon())
    pm.text(l = "-------------")
    # pm.button(l = "reset position", c = lambda *args: smartAnim.resetPosRot() )
    pm.text(l = "-------------")
    pm.button(l = "add curve info", c = lambda *args: smartRig_ikCurve.curveInfo() )
        
    pm.showWindow(defUI)
Esempio n. 2
0
def gui():
    """
    open window.
    """
    dialog = pm.loadUI(
        uiFile='/Users/ryo/Dropbox/dev/STU/mpm/src/qtui/mainwindow.ui')
    pm.showWindow(dialog)
Esempio n. 3
0
 def __init__(self):
     """Global constructor"""
     
     # Dictionnary containing all the UI elements
     self.globalWidgets = {}
     # Dictionnary containing all the UI elements for the shaders list
     self.sListWidgets = {}
     # Dictionnary containing all the UI elements for the shaders attributes
     self.sAttrWidgets = {}
     
     # Dictionnary containing all dynamic buttons
     self.dynamicButtons = {}
     
     # Dictionnary containing all secondary UI
     # - List existing nodes UI
     self.listNodesWidgets = {}
     
     # Check if MtoA is loaded
     pluginsRunning = pc.pluginInfo(query=True, listPlugins=True)
     if 'mtoa' not in pluginsRunning:
         raise Exception("MtoA is not loaded! Please load it first then restart the script.")
     
     # Build the UI
     self.UI_Build()
     
     # Populate the shader list
     self.UI_refreshShaders()
     
     # Displays main window
     pc.showWindow(self.globalWidgets['window'])
Esempio n. 4
0
def UI():
	# find ui files
	ehm_uiPath = pm.internalVar( uad=True ) + 'scripts/ehm_tools/ui/'
	
	# delete window if exists
	if pm.window( 'offsetBlends.ui', q=True,  exists=True ):
		pm.deleteUI( 'offsetBlends.ui' )
	
	# load ui
	uiFile = pm.loadUI( uiFile = ehm_uiPath + 'offsetBlends.ui' )

	# connect base button
	pm.button( "ofb_selectBase_btn", edit=True, command = "offsetBlends.addToTextField('ofb_base_tf')" )

	# connect modified button
	pm.button( "ofb_selectModified_btn", edit=True, command = "offsetBlends.addToTextField('ofb_modified_tf')" )

	# connect  object to change buttons
	pm.button( "ofb_selectGeos_btn", edit=True, command = "offsetBlends.addToTextScroll('ofb_geos_tsl')" )

	# connect  apply change buttons
	pm.button( "ofb_apply_btn", edit=True, command = "offsetBlends.OffsetBlends()" )

	# show ui
	pm.showWindow( uiFile )
Esempio n. 5
0
    def __init__(self, template):
        self.template = template
        self.win = "arnold_filter_list_win"
        if pm.window(self.win, exists=True):
            pm.deleteUI(self.win)
    
        pm.window(self.win, title="Add Light Filter",
                    sizeable=False,
                    resizeToFitChildren=True)
        #pm.windowPref(removeAll=True)
        pm.columnLayout(adjustableColumn=True,
                          columnOffset=("both", 10),
                          #columnAttach=('both',1),
                          rowSpacing=10)
    
        self.scrollList = pm.textScrollList('alf_filter_list', nr=4, ams=False)
        pm.textScrollList(self.scrollList,
                            e=True,
                            doubleClickCommand=Callback(self.addFilterAndHide))

        for label, nodeType in self.filters():
            pm.textScrollList(self.scrollList, edit=True, append=label)

        pm.rowLayout(numberOfColumns=2, columnAlign2=("center", "center"))
        pm.button(width=100, label="Add", command=Callback(self.addFilterAndHide))
        pm.button(width=100, label="Cancel", command=Callback(pm.deleteUI, self.win, window=True))
    
        pm.setParent('..')
        pm.setParent('..')

        pm.showWindow(self.win)
Esempio n. 6
0
 def __init__(self):
     winName = 'SineRigWin333'
     if pm.window(winName, exists=1):
         pm.deleteUI(winName,window=1)
     win = pm.window(winName, t='SineRig')
     
     pm.columnLayout(adj=1)
     pm.text('X Axis should be joint chain aim axis.')
     # Control
     self.cnt_fld = pm.textFieldButtonGrp(l='Control',bl='Load')
     pm.textFieldButtonGrp( self.cnt_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.cnt_fld,e=1,text=pm.ls(sl=1)[0]) )
     
     # Name
     self.name_fld = pm.textFieldGrp(l='Name')
     
     # Base jnt
     self.base_fld = pm.textFieldButtonGrp(l='Base Joint',bl='Load')
     pm.textFieldButtonGrp( self.base_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.base_fld,e=1,text=pm.ls(sl=1)[0]) ) 
     
     # Tip jnt
     self.tip_fld = pm.textFieldButtonGrp(l='Tip Joint',bl='Load')
     pm.textFieldButtonGrp( self.tip_fld, e=1, bc=lambda: pm.textFieldButtonGrp(self.tip_fld,e=1,text=pm.ls(sl=1)[0]) )        
     
     # Create button
     pm.button(l="Create",c=self.createRig)
     
     ##### Development Aide
     pm.textFieldButtonGrp(self.cnt_fld,e=1,text='TopFin_Base_ctrlA')
     pm.textFieldGrp(self.name_fld,e=1,text='Fin')
     pm.textFieldButtonGrp(self.base_fld,e=1,text='TopFinA_jnt_1')        
     pm.textFieldButtonGrp(self.tip_fld,e=1,text='TopFinA_jnt_12')        
     
     pm.showWindow(win)
Esempio n. 7
0
def createUI():
    global m2uwin
    if m2uwin is not None:
        pm.deleteUI(m2uwin, window=True)
    
    v = m2u.getVersion()
    m2uwin = pm.window( title="m2u "+v+" (maya)", iconName='m2u',
                        widthHeight=(150, 300) )
    pm.columnLayout()
    pm.rowLayout(numberOfColumns = 2)
    pm.button( label='Connect', c=cbConnect )
    pm.button( label='Setup Cameras', c=cbSetupCamera )
    pm.setParent('..')
    pm.checkBox( label='Sync Camera', onc = cbSyncCamera,
                 ofc = cbSyncCameraOff, v = False)
    pm.checkBox( label='Sync Objects', onc = cbSyncObjects,
                 ofc = cbSyncObjectsOff, v = False)
    pm.checkBox( label='Sync Visibility', onc = cbSyncVisibility,
                 ofc = cbSyncVisibilityOff, v = False)
    pm.separator()
    pm.button( label='Fetch Selected', c = cbFetchSelected)
    pm.button( label='Send Selected To Editor', c = cbSendSelectedToEd)
    #pm.button( label='Import Content Test', c = cbUDKImportContent)
    pm.setParent( '..' )
    pm.showWindow( m2uwin )
def createUI( SWindowTitle, pApplyCallback ):
    
    windowID = 'vcgnWindowID'
    
    # If Window is Already Open, Delete it and Open a New One
    if pm.window( windowID, exists=True ):
        pm.deleteUI( windowID )
        
    # Init Window
    pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True )
        
    pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 75), (2, 75), (3,75) ], columnOffset=[ (1,'right', 3) ])
        
    pm.text( label='Min Value:' )
        
    # Minimum Value Field, Default = 0.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MinValueField = pm.floatField( value=0.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Minimum Value, It Can't Go below 0.0 or above 1.0" )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Max Value:' )
        
    # Maximum Value Field, Default = 1.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MaxValueField = pm.floatField( value=1.0, minValue=0.0, maxValue=1.0, step=0.01, annotation="This is the Maximum Value, It Can't Go below 0.0 or above 1.0" )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )     
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Noise Type:' )
    
    # Noise Options - Enabled in 2.0    
    NoiseOption = pm.optionMenu( 'NoiseFunctions', enable=True, annotation="Select Alternate Distributions and Generation Functions Here" )
    pm.menuItem( label='Simple', parent='NoiseFunctions', annotation="A Simple Psuedo Random Noise Function that generates Random Values Between Min and Max" )
    pm.menuItem( label='Perlin', parent='NoiseFunctions', annotation="Try Moving the Object Around for More Variety with Perlin Noise" )
    pm.menuItem( label='3D Weighted', parent='NoiseFunctions', annotation="This Function Uses a Mixed Up Vertex List Randomly Adjust the Appearance of a Psuedo Random Number Generation" )
    pm.menuItem( label='Triangular', parent='NoiseFunctions', annotation="This Function Uses a Psuedo Random Number Generator with a Triangular Distribution" )
    pm.menuItem( label='Gamma', parent='NoiseFunctions', annotation="This Function Uses the Gamma Distribution, Does Not Work Well with Low Min Values, Suggestion Minimum 0.1" )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    
    # Buttons 
    pm.separator( h=10, style='none' )   
    pm.button( label='Apply', command=functools.partial(pApplyCallback,
                                                        NoiseOption,
                                                        MaxValueField,
                                                        MinValueField) )
        
    def cancelCallback( *Args ):
        if pm.window( windowID, exists=True ):
            pm.deleteUI( windowID )
        
    pm.button( label='Cancel', command=cancelCallback )
        
    pm.showWindow()       
def ui_fixComponentShading(*args):
    ### UI setup
    global UI_name

    UI_name = [ 'chk_find', 'chk_fix', 'chk_layer', 'btn_run' ]

    if pm.window( 'fix_component_shading', exists=True ):
        pm.deleteUI( 'fix_component_shading', window=True )
        
    ui_layout['window'] = pm.window( 'fix_component_shading', title='Fix Component Shading', sizeable=False, h=200, w=200 )
    ui_layout['mainLayout'] = pm.columnLayout( columnAlign='left', columnAttach=['left', 0] )

    pm.checkBox( UI_name[0], label=' Find Component Shading Object', value=1, w=200, p=ui_layout['mainLayout'] )
    pm.checkBox( UI_name[1], label=' Fix Component Shading Object', w=200, p=ui_layout['mainLayout'] )
    pm.checkBox( UI_name[2], label=' Fix Ecah Render Layer', w=200, p=ui_layout['mainLayout'] )

    ui_layout['ui_sub1'] = pm.formLayout(p=ui_layout['mainLayout'] )
    btn = pm.button( UI_name[3] ,label=' Execute !', command=pm.Callback( doExecution ), w=100, p=ui_layout['ui_sub1'] )
    pm.formLayout( ui_layout['ui_sub1'], e=True, attachForm=[ (btn, 'left', 50 ) ] )
    
    pm.separator( h=8, w=200, style='single', p=ui_layout['mainLayout'] )
    
    ui_layout['ui_sub2'] = pm.columnLayout(p=ui_layout['mainLayout'] )
    pm.text(label=' --- This script will keep the material \n in the CURRENT render layer, so \n it better to run it in MASTER layer! --- ', bgc=[0.05, 0.05, 0.05], align='left', p=ui_layout['ui_sub2'] )
    
    pm.showWindow( ui_layout['window'] )
Esempio n. 10
0
def createTrail():
    if pm.window('trailUI',ex=1):
        pm.deleteUI('trailUI')
    
    pm.window('trailUI')
    pm.columnLayout(adj=1)
    fsSample = pm.floatSliderGrp('sampleSlider', label='Sample by', cw=(1,70), adj=1, en=1,minValue=0.01, maxValue=100, fieldMinValue=0.01, fieldMaxValue=100,pre=2, field=1, v=1)
    pm.separator (height=4,style="in")
    startFrame = pm.playbackOptions(q=1,min=1)
    currentFrame = pm.currentTime(q=1)
    if currentFrame > startFrame:
        startFrame = currentFrame
    pm.intSliderGrp('startFrameSlider', label='Start frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame)
    pm.popupMenu(button=3,pmc = functools.partial(setTime,'start'))
    pm.intSliderGrp('endFrameSlider', label='End frame', cw=(1,70), adj=1, en=1,minValue=0, maxValue=100, fieldMinValue=0, fieldMaxValue=10000, field=1, v=startFrame+30)
    pm.popupMenu(button=3,pmc = functools.partial(setTime,'end'))
    pm.intSliderGrp('trailDivisions', label='Trail divisions', cw=(1,70), adj=1, en=1,minValue=1, maxValue=100, fieldMinValue=1, fieldMaxValue=10000, field=1, v=40)
    pm.separator (height=4,style="in")
    cbUvDistorted = pm.checkBox('cbUV',l='UV distorted',v=1)
    pm.separator (height=4,style="in")
    
    rowBtn = pm.rowColumnLayout(numberOfRows=1)
    pm.button(l='Create Trail',command=functools.partial(createTrailMesh))
    pm.button(l='Rebuil uvs',c=functools.partial(createTrailUv,''))
    pm.button(l='ELP !!!',c=openHelpPage)
    pm.showWindow('trailUI')
Esempio n. 11
0
 def __init_window__(self):
     self.window = pm.window(menuBar=False, widthHeight=[200, 100], title="PYMHUD by Daniel S�nchez Quir�s")
     self.columna = pm.columnLayout(adjustableColumn=True)
     # Name row
     self.row1 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna)
     pm.text("Name:", al="left", parent=self.row1)
     self.nameQ = pm.textField(parent=self.row1)
     pm.checkBox(
         label="", parent=self.row1, offCommand=Callback(self.nameHud, False), onCommand=Callback(self.nameHud, True)
     )
     # Scene row
     self.row2 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna)
     pm.text("Scene Name:", al="left")
     self.sceneNameQ = pm.textField(parent=self.row2)
     pm.checkBox(
         label="",
         parent=self.row2,
         offCommand=Callback(self.sceneHud, False),
         onCommand=Callback(self.sceneHud, True),
     )
     # Date row
     self.row3 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna)
     pm.text("Date:", al="left")
     pm.checkBox(
         label="", parent=self.row3, offCommand=Callback(self.dateHud, False), onCommand=Callback(self.dateHud, True)
     )
     # rame counter row
     self.row4 = pm.rowLayout(numberOfColumns=3, adjustableColumn=True, parent=self.columna)
     pm.text("Frame Counter:", al="left")
     pm.checkBox(label="", parent=self.row4, offCommand=Callback(self.frameHud), onCommand=Callback(self.frameHud))
     pm.showWindow(self.window)
Esempio n. 12
0
	def show(self):
		self.window = pm.window(self.name, wh=(self.w, self.h), title=self.name)
		self.fl = pm.formLayout(nd=100)

		#create the main form layout of the window
		self.frame_layout = pm.frameLayout(bgc=(.3,.1,.25), li=self.w/4, la='center', fn='boldLabelFont', 
										label='AW Binary Proxy Tools', borderStyle='in', mh=self.h/12,h=self.h-40)
		self.cl = pm.columnLayout(adj=True, cal='left', cat=['both',0], rs=5)
		pm.text(label='mip_renderProxy Creation', al='center')
		pm.button (label='Create Render Proxies', bgc=(.4,.5,.2),
			command= lambda *args: self._createRenderProxy( pm.ls(sl=True) ))
		pm.separator(st='doubleDash', h=25)
		pm.text(label='mip_renderProxy Assignment', al='center')
		self.fileInput = TextFieldBrowserInput( width=300, name='Proxy Input', option_name='Proxy Browse Type', options=['from file', 'from folder'], button_name='Browse', parent=self.cl )
		pm.button (label='Assign Render Proxies', bgc=(.4,.5,.2), 
				   command= lambda *args: self._attachRenderProxy( pm.ls(sl=True) ))
		pm.button (label='DELETE ALL BINARY PROXIES', bgc=(.4, .2, .2), command=self._removeAllBipx)
		pm.setParent('..')
		pm.setParent('..')
		#add the close window button
		self.close_btn = pm.button (w=self.bw, label='Close', bgc = (.4, .2, .2), command=self.close_UI)
		#finalize form layout
		pm.formLayout(self.fl, edit=True,
				   attachForm = [(self.frame_layout, 'top', 0),
								 (self.frame_layout, 'left', 0),
								 (self.frame_layout, 'right', 0),
								 (self.close_btn, 'bottom', 10),
								 (self.close_btn, 'right', 10)])
		pm.showWindow(self.window)
Esempio n. 13
0
    def __init__(self):

        self.moduleInstance = None

        self.UIwidgets = {}
        self.windowName = "createRigUI"
        self.windowTitle = "jhAutoRig Window"
        self.widthHeight = [475, 550]

        if pm.window(self.windowName, exists=True):
            pm.deleteUI(self.windowName)

        self.UIwidgets["window"] = pm.window(
            self.windowName,
            title=self.windowTitle,
            w=self.widthHeight[0],
            h=self.widthHeight[1],
            mxb=False,
            mnb=False,
            sizeable=False,
        )

        self.UIwidgets["ui_main_layout"] = pm.columnLayout(adj=True)

        self.initialize_modulesSettings()
        self.initialize_buildButton()

        pm.showWindow(self.windowName)

        self.createScriptJob()
Esempio n. 14
0
    def __init__(self):
        self.window = 'sdkflip'
        self.title = 'ec Set Driven Key Utility'
        self.width_height = (312, 289)

        if py.window(self.window, exists=True):
            py.deleteUI(self.window)
        py.window(self.window, title=self.title, wh=self.width_height, sizeable=False)
        py.scrollLayout(horizontalScrollBarThickness=16, verticalScrollBarThickness=16)
        py.rowLayout("objRow", numberOfColumns=4, columnAlign2=("left", "right"), p="sdkflip")
        py.columnLayout("objCol", p="objRow")
        self.source_field = py.textField("sourceText", tx="Source Driver", p="objCol")
        py.columnLayout("objbutCol", p="objRow")
        py.button(label="<<", width=30, height=20, p="objbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "sourcetxt"))
        py.columnLayout("tarCol", p="objRow")
        self.target_field = py.textField("targetText", tx="Target Driver", p="tarCol")
        py.columnLayout("tarbutCol", p="objRow")
        py.button(label="<<", width=30, height=20, p="tarbutCol", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_gui_fun, "targettxt"))
        py.frameLayout("scrollFrame", label="Driver Attributes", cll=False, borderStyle="etchedIn", p="sdkflip")
        py.rowLayout("scrollRow", p="scrollFrame")
        self.scroll_list = py.textScrollList("attrList", w=300, h=200, numberOfRows=8, allowMultiSelection=True, p="scrollRow")
        py.rowLayout("comRow", numberOfColumns=4, p="sdkflip")
        py.text("preText", l="Target Prefix", p="comRow")
        self.prefix_field = py.textField("prefixText", tx="rt", w=70, p="comRow")
        py.button(label="Mirror", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, True))
        py.button(label="Copy", width=80, height=30, p="comRow", bgc=(0.8, 0.8, 0.8), command=py.Callback(self.ec_sdk_flip, False))

        py.showWindow(self.window)
Esempio n. 15
0
def rh_dynamicJoint():
    #Create a variable for the window name
    winName = 'DynamicJoint'
    winTitle = 'rh_DynamicJoint_prototype_v0.23'
    #Delete the window if it exists
    if pm.window(winName, exists = True):
        pm.deleteUI(winName, window = True)
    #Build the main window
    pm.window(winName, title = winTitle, sizeable = True)
    #name field
    pm.textFieldGrp('NameTFG',label = 'Set up name:', text = 'Ribbon45hp', ed = True)
    pm.columnLayout(adjustableColumn = True)
    #side
    pm.radioButtonGrp('ColSel',nrb = 3,label = 'Side:',la3 = ['l','m','r'],sl = 1)    
    pm.columnLayout(adjustableColumn = True)
    #axis
    pm.radioButtonGrp('AxisSel',nrb = 3,label = 'Axis:',la3 = ['x','y','z'],sl = 1)    
    pm.columnLayout(adjustableColumn = True)
    #ccSize
    pm.floatSliderGrp('Cc_Size',label = 'Control Size:',f = True,min = 1,max = 10,fmn = 1,fmx = 100,v = 1)
    pm.columnLayout(adjustableColumn = True)
    #joint number
    pm.intSliderGrp('Joint_Num',label = 'Number Of Joints:',f = True,min = 4,max = 49,fmn = 1,fmx = 100,v = 4)
    pm.columnLayout(adjustableColumn = True)
    
    #inbound
    pm.button(label = 'Ready For Tasking', command = 'inbound()')
    pm.columnLayout(adjustableColumn = True)
    #bringTheRain
    pm.button(label = 'Target Acquire', command = 'bringTheRain()')
    pm.columnLayout(adjustableColumn = True)    
    
    #Show the window
    pm.showWindow(winName)
    pm.window(winName, edit = True, width = 378, height = 210)
Esempio n. 16
0
    def __init__ (self,title,steps):
        self.window = pymel.window(title, sizeable=False)
        pymel.columnLayout()

        self.progressControls = []
        self.progressbar = pymel.progressBar(maxValue=steps, width=300)
        pymel.showWindow( self.window )
        self.progressbar.step(0)
Esempio n. 17
0
def joint_gui():
    invalid_joints = joint_rotation(pm.ls(type='joint'))
    pm.window()
    pm.columnLayout()
    pm.text(l='Invalid Rotations', w=150)
    for joint in invalid_joints:
        pm.button(l=joint, w=150, c=pm.Callback(select_obj, joint))
    pm.showWindow()
Esempio n. 18
0
	def UI(self):
		
		# create window
		if pm.window( 'ehm_ReverseShape_UI', exists=True ):
			pm.deleteUI( 'ehm_ReverseShape_UI' )
		pm.window( 'ehm_ReverseShape_UI', title='Reverse shape', w=300, h=80, mxb=False, mnb=True, sizeable=True )

		
		# main layout
		#mainLayout = pm.rowColumnLayout()
		formLayout = pm.formLayout(w=300, h=80)
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)
		pm.setParent( formLayout )
		
		# radio buttons
		self.AxisText = pm.text(label='Axis: ', align='right')
		self.AxisRC = pm.radioCollection()
		self.xRB = pm.radioButton(label="x", select=True )
		self.yRB = pm.radioButton(label="y")
		self.zRB = pm.radioButton(label="z")

		
		# buttons
		self.applyButton = pm.button( label='Apply',  h=30,  c= partial( self.reverseShape, None, 'x'  ) )
		
		
		# place frame layout
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'left', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'right', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'top', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'bottom', 38) )


		# place radio buttons
		#pm.formLayout( formLayout, edit=True, attachPosition=(self.AxisText,'left', 5, 0) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.AxisText,'right', 0 , 25) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.AxisText,'top', 17) )
		
		#pm.formLayout( formLayout, edit=True, attachPosition=(self.xRB,'left', 5, 25) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.xRB,'right', 10 , 50) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.xRB,'top', 15) )		

		#pm.formLayout( formLayout, edit=True, attachPosition=(self.yRB,'left', 5, 50) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.yRB,'right', 10, 75) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.yRB,'top', 15) )	

		#pm.formLayout( formLayout, edit=True, attachPosition=(self.zRB,'left', 5, 75) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.zRB,'right', 20 , 100) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.zRB,'top', 15) )	

		# place buttons
		pm.formLayout( formLayout, edit=True, attachPosition=(self.applyButton,'left', 4, 25) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.applyButton,'right', 2 , 75) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.applyButton,'bottom', 5) )
				
				
		# show window
		pm.showWindow( 'ehm_ReverseShape_UI' )
Esempio n. 19
0
	def UI(self):
		
		# create window
		if pm.window( 'ehm_BakeAnimation_UI', exists=True ):
			pm.deleteUI( 'ehm_BakeAnimation_UI' )
		pm.window( 'ehm_BakeAnimation_UI', title='Bake Animation', w=400, h=80, mxb=False, mnb=True, sizeable=True )
		
		# main layout
		#mainLayout = pm.rowColumnLayout()
		formLayout = pm.formLayout(w=400, h=80)
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)
		pm.setParent( formLayout )
		
		# radio buttons
		self.bakeModeText = pm.text(label='Bake Mode: ', align='right')
		self.bakeModeRC = pm.radioCollection()
		self.newLocRB = pm.radioButton(label="Bake On New Locator", select=True )
		self.objItselfRB = pm.radioButton(label="Bake On Object Itself")
		
		
		# buttons
		self.BakeTransformbutton = pm.button( label='Bake Transform', h=30, backgroundColor=[0.5,0.7,0.4],  c=self.BakeTransform  )
		self.BakeGeometryButton = pm.button( label='Bake Geometry', h=30, backgroundColor=[0.7,0.5,0.3],  c= self.BakeGeometry )
		
		
		# place frame layout
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'left', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'right', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'top', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'bottom', 38) )


		# place radio buttons
		#pm.formLayout( formLayout, edit=True, attachPosition=(self.bakeModeText,'left', 5, 0) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.bakeModeText,'right', 0 , 20) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.bakeModeText,'top', 17) )
		
		#pm.formLayout( formLayout, edit=True, attachPosition=(self.newLocRB,'left', 5, 25) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.newLocRB,'right', 10 , 60) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.newLocRB,'top', 15) )		

		#pm.formLayout( formLayout, edit=True, attachPosition=(self.objItselfRB,'left', 5, 50) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.objItselfRB,'right', 10, 97) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.objItselfRB,'top', 15) )	


		# place buttons
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BakeTransformbutton,'left', 1, 2) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BakeTransformbutton,'right', 2 , 50) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.BakeTransformbutton,'bottom', 5) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.BakeGeometryButton,'left', 2, 50) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BakeGeometryButton,'right', 1 , 98) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.BakeGeometryButton,'bottom', 5) )		
		
		
		# show window
		pm.showWindow( 'ehm_BakeAnimation_UI' )
def createUI( SWindowTitle, pApplyCallback ):
    
    windowID = 'vcgnWindowID'
    
    # If Window is Already Open, Delete it and Open a New One
    if pm.window( windowID, exists=True ):
        pm.deleteUI( windowID )
        
    # Init Window
    pm.window( windowID, title=SWindowTitle, sizeable=False, resizeToFitChildren=True )
        
    pm.rowColumnLayout( numberOfColumns=3, columnWidth=[ (1, 75), (2, 75), (3,75) ], columnOffset=[ (1,'right', 3) ])
        
    pm.text( label='Min Value:' )
        
    # Minimum Value Field, Default = 0.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MinValueField = pm.floatField( value=0.0, minValue=0.0, maxValue=1.0, step=0.01 )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Max Value:' )
        
    # Maximum Value Field, Default = 1.0, min = 0.0, max = 1.0, invisible slider step = 0.01
    MaxValueField = pm.floatField( value=1.0, minValue=0.0, maxValue=1.0, step=0.01 )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )     
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
        
    pm.text( label='Noise Type:' )
    
    # Noise Options - Disabled For Version 1.0 Will Be Enabled in 2.0    
    NoiseOption = pm.optionMenu( 'NoiseFunctions', enable=False )
    pm.menuItem( label='Simple', parent='NoiseFunctions' )
    pm.menuItem( label='Perlin', parent='NoiseFunctions' )
    pm.menuItem( label='OpenSimplex', parent='NoiseFunctions' )
    pm.separator( h=10, style='none' )
    
    # Formatting
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    pm.separator( h=10, style='none' )
    
    # Buttons 
    pm.separator( h=10, style='none' )   
    pm.button( label='Apply', command=functools.partial(pApplyCallback,
                                                        NoiseOption,
                                                        MaxValueField,
                                                        MinValueField) )
        
    def cancelCallback( *Args ):
        if pm.window( windowID, exists=True ):
            pm.deleteUI( windowID )
        
    pm.button( label='Cancel', command=cancelCallback )
        
    pm.showWindow()       
Esempio n. 21
0
	def UI(self):
		
		# create window
		if pm.window( 'ehm_JntToCrv_UI', exists=True ):
			pm.deleteUI( 'ehm_JntToCrv_UI' )
		pm.window( 'ehm_JntToCrv_UI', title='Create Curve Shape On Joints', w=270, h=100, mxb=False, mnb=False, sizeable=False )
		
		# main layout
		mainLayout = pm.columnLayout(w=270, h=130)
		formLayout = pm.formLayout(w=260, h=120)
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)	
		pm.setParent( formLayout )
		
		# num of joints slider
		self.shapeType = pm.optionMenuGrp(  label='shape type: '
												, h=30
												, columnAttach2=('left','left')
												, columnOffset2=(20,0)
												, columnWidth2=(90,60)	)												
		pm.menuItem(label="sphere")
		pm.menuItem(label="cube")
		pm.menuItem(label="circle")
		
		# size of shapes
		self.sizeSlider = pm.floatSliderGrp( label='shape size: '
												, value=1
												, minValue=0.0
												, maxValue=20
												, fieldMaxValue=10000, h=30, field=True
												, columnAttach3=('left','left','left' )
												, columnOffset3=(20,0,0 )
												, columnWidth3=(80,50,80)   )
	
		# button
		button = pm.button( label='apply', w=100, h=30,  c=partial( self.jntToCrv, None, 1.0 , 'sphere' )  )
		
		# place controls
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'left', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'right', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'top', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'bottom', 38) )
				
		
		pm.formLayout( formLayout, edit=True, attachForm=(self.shapeType,'left', 0) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.shapeType,'top', 8) )
		
		pm.formLayout( formLayout, edit=True, attachForm=(self.sizeSlider,'left', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.sizeSlider,'top', 40) )
				
		
		pm.formLayout( formLayout, edit=True, attachForm=(button,'left', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(button,'right', 5) )
		pm.formLayout( formLayout, edit=True, attachForm=(button,'bottom', 5) )
		
		
		# show window
		pm.showWindow( 'ehm_JntToCrv_UI' )
Esempio n. 22
0
def scriptWindow( document ):
    win = pm.window( title='Sniplet', wh=(700,300))
    pm.frameLayout(labelVisible=False, borderVisible=False)
    # -----------------------------------------------
    
    pm.cmdScrollFieldExecuter( sourceType="python", text=document )
    
    # -----------------------------------------------            
    pm.showWindow(win)
Esempio n. 23
0
	def __init__(self):
		self.windows_name = 'cgru_afanasy_wnd'

		if pm.window(self.windows_name, exists=True):
			pm.deleteUI(self.windows_name)

		self.window = pm.window(self.windows_name, t='Afanasy')

		with pm.columnLayout(adj=True):
			labels_width = 90
			with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
				pm.text(l='Start Frame')
				pm.intField(
					'cgru_afanasy__start_frame',
					v=pm.optionVar.get('cgru_afanasy__start_frame_ov', 1)
				)

			with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
				pm.text(l='End Frame')
				pm.intField(
					'cgru_afanasy__end_frame',
					v=pm.optionVar.get('cgru_afanasy__end_frame_ov', 1)
				)

			with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
				pm.text(l='Frame Per Task')
				pm.intField(
					'cgru_afanasy__frames_per_task',
					v=pm.optionVar.get('cgru_afanasy__frames_per_task_ov', 1)
				)

			with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
				pm.text(l='By Frame')
				pm.intField(
					'cgru_afanasy__by_frame',
					v=pm.optionVar.get('cgru_afanasy__by_frame_ov', 1)
				)

			pm.checkBox('cgru_afanasy__paused', l='Start Paused', v=0)
			pm.checkBox(
				'cgru_afanasy__separate_layers',
				l='Submit Render Layers as Separate Tasks',
				v=1
			)

			pm.button(
				l='LAUNCH',
				c=self.launch
			)

			pm.checkBox(
				'cgru_afanasy__close',
				l='Close After',
				v=1
			)

		pm.showWindow(self.window)
def UI():
    photoUI = pm.window(t="Photometric Light Companion", w=200)
    pm.columnLayout(adj=True)
    pm.button(l="add mia photon map", c=lambda *args: addPhotonMap())
    pm.button(l="on mia photon map", c=lambda *args: onOffPhotoLit(mapList=listPhotoMap(), state=True))
    pm.button(l="off mia photon map", c=lambda *args: onOffPhotoLit(mapList=listPhotoMap(), state=False))
    pm.button(l="active area light", c=lambda *args: areaLight())

    pm.showWindow(photoUI)
Esempio n. 25
0
            def createWindow():
                """ try to get data from shotgun project fields
                    need to get context's project
                                context's shotgun instance
                """
                app = self.parent
                project = app.context.project
                sg = app.context.tank.shotgun
                # set filters and search fields for entity type "Project"
                filters=[["id", "is", project['id']],]
                fields=["sg_width", "sg_height"]
                result=sg.find_one("Project", filters, fields)
                # with result, set parameters accordingly or use default otherwise
                if result:
                    videoWidth = result.get("sg_width", DEFAULT_WIDTH)
                    videoHeight = result.get("sg_height", DEFAULT_HEIGHT)

                # Find first camera matching pattern and set as active camera
                # if not use default current active camera
                camera_name_pattern = app.get_setting( "camera_name_pattern", "persp" )
                cameraList = [c.name() for c in pm.ls(type="camera", r=True) if re.search( camera_name_pattern, c.name() )]
                if not "cam" in MODEL_EDITOR_PARAMS.keys() and cameraList:
                    MODEL_EDITOR_PARAMS["cam"] = cameraList[0]
                    
                # Give Viewport 2.0 renderer only for Maya 2015++
                # mayaVersionString = cmds.about(version=True)
                # mayaVersion = int(mayaVersionString[:4]) if len(mayaVersionString) >= 4 else 0
                # if mayaVersion >= 2015:
                #     params[ "rendererName" ] = "vp2Renderer"

                # Create window
                if pm.windowPref( PLAYBLAST_WINDOW, exists=True ):
                    pm.windowPref( PLAYBLAST_WINDOW, remove=True )
                window = pm.window( PLAYBLAST_WINDOW, titleBar=True, iconify=True,
                                      leftEdge = 100, topEdge = 100,
                                      width = videoWidth, height = videoHeight,
                                      sizeable = False)
                # Create editor area
                layout = pm.formLayout()
                editor = pm.modelEditor( **MODEL_EDITOR_PARAMS )
                pm.setFocus( editor )
                pm.formLayout( layout, edit=True,
                               attachForm = ( ( editor, "left", 0 ),
                                              ( editor, "top", 0 ),
                                              ( editor, "right", 0 ),
                                              ( editor, "bottom", 0 ) ) )
                # Show window
                pm.setFocus( editor )
                pm.showWindow( window )
                pm.refresh()
                try:
                    yield True
                except:
                    traceback.print_exc()
                finally:
                    pm.deleteUI(window)
Esempio n. 26
0
 def __init__(self):
     if pm.window('pyleUI', ex=True):
         self.w = pm.window('pyleUI', q=True)
         pm.showWindow(self.w)
     else:
         self.w = pm.window('pyleUI', t='Pyle_Vector', h=50,w=300)
         pm.columnLayout(adjustableColumn=True)
         pm.text(label='SELECT 3 JOINTS PARENT->CHILDREN ORIENTATION',align='center',rs=True)
         self.button = pm.button(label='DoIt', command = 'pyletool.doit()')
         pm.showWindow(self.w)
Esempio n. 27
0
    def create(self):
        if pm.window(self.window, exists=True):
            pm.deleteUI(self.window)
        pm.window(self.window, t=self.title)

        # source & targets
        pm.rowColumnLayout(nc=3,cal=[(1,'right')], cw=[(1,80),(2,200),(3,100)])
        pm.text(l='Source: ')
        self.sourceObjTf = pm.textField()
        pm.button(l='Select', c=self.selectSource)
        pm.text(l='Target(s): ')
        self.targetObjsTf = pm.textField()
        pm.button(l='Select', c=self.selectTarget)
        pm.setParent('..')

        # number
        pm.rowColumnLayout(w=self.size[0])
        self.copyNum = pm.intSliderGrp(l='Copies: ', v=10, cw3=[80,80,220],
                                       min=1, max=500, fmx=5000, f=True)
        pm.separator(h=10, st='in')

        # rotation
        pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)])
        pm.text(l='Rotation: ')
        self.rotationModeRC = pm.radioCollection()
        self.rotBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.rotBtnAlign = pm.radioButton(l='Align with Target')
        pm.text(l='')
        self.rotBtnRand = pm.radioButton(l='Random',
                                         onc=lambda *args: self.rotationRange.setEnable(True),
                                         ofc=lambda *args: self.rotationRange.setEnable(False))
        pm.setParent('..')
        self.rotationRange = pm.floatFieldGrp(l='Range: ', nf=3, v1=30, v2=30, v3=30,
                                              cw4=[80,100,100,100], en=False)
        pm.separator(h=10, st='in')

        # scale
        pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)])
        pm.text(l='Scale: ')
        self.scaleModeRC = pm.radioCollection()
        self.scaleBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.scaleBtnRand = pm.radioButton(l='Random',
                                           onc=lambda *args: self.scaleRange.setEnable(True),
                                           ofc=lambda *args: self.scaleRange.setEnable(False))
        pm.setParent( '..' )
        self.scaleRange = pm.floatFieldGrp(l='Min Max: ', nf=2, v1=1, v2=1,
                                           cw3=[80,100,100], en=False)
        pm.separator(h=10, st='in')

        # disperse button
        pm.button(l='Disperse', c=self.disperse, w=380, al='center')

        pm.showWindow(self.window)
Esempio n. 28
0
	def createProgressbarWindow(self, progressbarSize = 1):
		
		pm.select(cl = True)
		
		#Create ProgressbarUi Window
		self.progressbarWindow = pm.window(title = 'Progress', resizeToFitChildren = True)
		pm.columnLayout()
		self.progressControl = pm.progressBar(maxValue = progressbarSize, width = 300)
		pm.showWindow(self.progressbarWindow)
		
		pm.select(cl = True)
Esempio n. 29
0
def adjustAll(*arg):
    xyz = pm.window(title="XYZ Adjust", s=True, wh=(100, 50))
    with pm.columnLayout(adj=True):
        pm.text(l="Adjust the Min & Max values")
        pm.attrControlGrp(l="X Min", attribute="An_range.oldMinX")
        pm.attrControlGrp(l="X Max", attribute="An_range.oldMaxX")
        pm.attrControlGrp(l="Y Min", attribute="An_range.oldMinY")
        pm.attrControlGrp(l="Y Max", attribute="An_range.oldMaxY")
        pm.attrControlGrp(l="Z Min", attribute="An_range.oldMinZ")
        pm.attrControlGrp(l="Z Max", attribute="An_range.oldMaxZ")
    pm.showWindow(xyz)
Esempio n. 30
0
 def create(self, stationary_count, offset_count):
     '''
     Create the fgshooter window.
     '''
     if pm.window(self.window_name, exists=True):
         pm.deleteUI(self.window_name)
     pm.window(self.window_name, title=self.window_title)
     
     main_form = pm.formLayout(numberOfDivisions=2)
     self.column = pm.columnLayout(adjustableColumn=True)
     
     # Render Camera
     self.render_camera_field = pm.checkBoxGrp(label="Include Render Camera", value1=self.render_camera, changeCommand=self.updateRenderCamera)
     
     # Stationary Cameras
     pm.separator(height=20, style="in")
     
     pm.rowLayout(numberOfColumns=3, columnWidth3=(140, 80, 80), columnAlign=(1, 'right'), columnAttach3=("right", "both", "both"))
     pm.text("Stationary Cameras")
     self.stationary_field = pm.intField(value=stationary_count)
     pm.button(label="Update", height=22, command=self.update)
     pm.setParent('..')
     
     self.stationary = []
     i = 0
     while i < stationary_count:
         self.stationary.append(pm.floatFieldGrp(value1=self.stationary_frames[i], label="frame"))
         i += 1
     
     # Offset Cameras
     pm.separator(height=20, style="in")
     
     pm.rowLayout(numberOfColumns=3, columnWidth3=(140, 80, 80), columnAlign=(1, 'right'), columnAttach3=("right", "both", "both"))
     pm.text("Offset Cameras")
     self.offset_field = pm.intField(value=offset_count)
     pm.button(label="Update", height=22, command=self.update)
     pm.setParent('..')
     
     self.offset = []
     i = 0
     while i < offset_count:
         self.offset.append(pm.intFieldGrp(value1=self.offset_frames[i], label="frame offset"))
         i += 1
     
     pm.setParent('..')
     
     # remove/apply buttons        
     self.remove_button = pm.button(label="Remove All", height=30, command=self.remove)
     self.apply_button = pm.button(label="Apply / Refresh", height=30, command=self.apply)
     
     pm.formLayout(main_form, edit=True, attachForm=[(self.column, "top", 2),(self.column, "left", 2),(self.column, "right", 2), (self.remove_button, "bottom", 2), (self.remove_button, "left", 2), (self.apply_button, "bottom", 2), (self.apply_button, "right", 2)], attachControl=(self.remove_button, "right", 1, self.apply_button), attachPosition=[ (self.remove_button, "right", 0, 1), (self.apply_button, "left", 1, 1)] )
     
     pm.setParent('..')
     pm.showWindow()
Esempio n. 31
0
 def createWindow(self):
     self._window = pm.window(t=self.title)
     pm.columnLayout()
     self._progressControl = pm.progressBar(maxValue=self.maxValue, width=self.width)
     pm.showWindow(self._window)
Esempio n. 32
0
    def ui(self):
        """the ui
        """
        import functools
        width = 300
        height = 380

        if pm.window("skinTools_window", q=1, ex=1):
            pm.deleteUI("skinTools_window", window=1)

        self.window = pm.window("skinTools_window",
                                w=width,
                                h=height,
                                t="skinTools")

        self.form_layout1 = pm.formLayout("skinTools_formLayout1", nd=100)
        with self.form_layout1:

            self.column_layout1 = \
                pm.columnLayout("skinTools_columnLayout1", adj=1, cal="center")
            with self.column_layout1:
                pm.button(l="Set Mesh", c=self.set_mesh_button_proc)

                with pm.rowLayout("skinTools_mesh_name_row_layout", nc=2):
                    pm.text(l="mesh name: ")
                    self.mesh_name_text = pm.text(l="")

                with pm.rowLayout("skinTools_skin_cluster_row_layout", nc=2):
                    pm.text(l="skinCluster: ")
                    self.skin_cluster_text = pm.text(l="")

                pm.button(l="update", c=lambda x: self.update_list())

            self.influence_list_text_scroll_list = \
                pm.textScrollList(numberOfRows=20, sc=self.select)
            pm.popupMenu(parent=self.influence_list_text_scroll_list)
            pm.menuItem(l="switch hold", c=self.switch_hold)

            self.column_layout3 = pm.columnLayout(adj=1, cal="center")
            with self.column_layout3:
                pm.button(l="find influenced Vertices",
                          c=self.find_influenced_vertices_button_proc)

                def set_joint_weight_callback(weight, *args):
                    selection = pm.ls(sl=1)
                    joints = \
                        filter(lambda x: isinstance(x, pm.nt.Joint), selection)
                    vertices = \
                        filter(
                            lambda x: isinstance(x, pm.MeshVertex),
                            selection
                        )
                    for joint in joints:
                        self.skin_tools.set_joint_weight(
                            joint, vertices, weight)

                self.remove_selected_button = \
                    pm.button(
                        l="remove selected",
                        c=functools.partial(set_joint_weight_callback, 0)
                    )
                self.add_selected_button = \
                    pm.button(
                        l="add selected",
                        c=functools.partial(set_joint_weight_callback, 1)
                    )

        pm.formLayout("skinTools_formLayout1",
                      e=1,
                      af=[
                          [self.column_layout1, "left", 0],
                          [self.column_layout1, "right", 0],
                          [self.column_layout1, "top", 0],
                          [self.influence_list_text_scroll_list, "left", 0],
                          [self.influence_list_text_scroll_list, "right", 0],
                          [self.column_layout3, "left", 0],
                          [self.column_layout3, "right", 0],
                          [self.column_layout3, "bottom", 0],
                      ],
                      an=[
                          [self.column_layout1, "bottom"],
                          [self.column_layout3, "top"],
                      ],
                      ac=[
                          [
                              self.influence_list_text_scroll_list, "top", 0,
                              self.column_layout1
                          ],
                          [
                              self.influence_list_text_scroll_list, "bottom",
                              0, self.column_layout3
                          ],
                      ])

        pm.showWindow(self.window)
        pm.window(self.window, e=1, w=width, h=height)
Esempio n. 33
0
def move_all_anim_curves():
    def check_overlapping(anim_curves, choice, current_time, offset_val):
        for anim_curve in anim_curves:
            key_cnt = anim_curve.numKeys()
            message = 'Some Keys are overlapping within Offset Value\n'
            message += 'Do you want continue on Moving other Keys ?\n'
            for i in range(0, key_cnt):
                key_time = anim_curve.getTime(i)
                if choice == 'forward':
                    if key_time <= current_time + offset_val:
                        range_dialog = pm.confirmDialog(title='Error',
                                                        message=message,
                                                        button=['Yes', 'No'],
                                                        cancelButton='No',
                                                        dismissString='No')
                        if range_dialog == 'Yes':
                            return 1
                        else:
                            raise RuntimeError(
                                'Move Keys process interrupted by User.')

                if choice == 'back':
                    if key_time >= current_time + offset_val:
                        range_dialog = pm.confirmDialog(title='Error',
                                                        message=message,
                                                        button=['Yes', 'No'],
                                                        cancelButton='No',
                                                        dismissString='No')
                        if range_dialog == 'Yes':
                            return 1
                        else:
                            raise RuntimeError(
                                'Move Keys process interrupted by User.')

    def move_all_keys(choice):
        offset_val = offset_intfield.getValue()

        if offset_val < 1:
            raise RuntimeError('Enter an Offset Value greater than 0.')

        if choice == 'back':
            offset_val = offset_intfield.getValue() * -1

        unlock_val = unlock_state.getValue1()

        current_time = pm.currentTime()

        anim_curves = pm.ls(type='animCurve')
        non_moved_curves = []

        if choice == 'back':
            check_overlapping(anim_curves, choice, current_time, offset_val)

        for anim_curve in anim_curves:
            try:
                if unlock_val is True and anim_curve.isLocked():
                    anim_curve.setLocked(0)

                key_cnt = anim_curve.numKeys()
                for i in range(1, key_cnt + 1):

                    if choice == 'forward':
                        ind = key_cnt - i
                    if choice == 'back':
                        ind = i - 1

                    if anim_curve.getTime(ind) >= current_time:
                        pm.keyframe(anim_curve,
                                    index=ind,
                                    iub=False,
                                    animation='objects',
                                    relative=True,
                                    option='move',
                                    tc=offset_val)
            except:
                if anim_curve not in non_moved_curves:
                    non_moved_curves.append(anim_curve)
                continue

        if not non_moved_curves:
            pm.confirmDialog(title='Info',
                             message='Keys Moved Successfully.',
                             button='OK')
        else:
            message = 'Anim Curves can NOT be moved:\r\n'
            message += '\r'
            for i in range(0, len(non_moved_curves)):
                message += '%s\n' % non_moved_curves[i]
                if i > 30:
                    message += '+ More...\n'
                    break
            print non_moved_curves
            pm.confirmDialog(title='Error', message=message, button='OK')

        # pdm.close()

    window_name = 'move_keys_window'

    if pm.window(window_name, q=True, ex=True):
        pm.deleteUI(window_name, wnd=True)

    move_keys_win = pm.window(window_name, title='Move Keys', s=0, rtf=1)

    with pm.columnLayout(rs=5, cal='center'):
        pm.text(l='                      MOVE ALL KEYS')
        pm.text(l='             relatively from currentTime')
        pm.text(l='    (overlapping Keys will NOT be moved)')
        with pm.rowColumnLayout(nc=3, cw=[(1, 70), (2, 70), (3, 70)]):

            def exec_move_all_keys_back(*args):
                move_all_keys('back')

            pm.button(l='-', c=exec_move_all_keys_back)
            offset_intfield = pm.intField()

            def exec_move_all_keys_forward(*args):
                move_all_keys('forward')

            pm.button(l='+', c=exec_move_all_keys_forward)

    with pm.columnLayout():
        unlock_state = pm.checkBoxGrp(l='Unlock & Move', v1=1)

    pm.showWindow(move_keys_win)
Esempio n. 34
0
    def list_shots(*args):
        shot_num = pm.intFieldGrp('shotNum', q=1, v1=1)
        start_frame = pm.intFieldGrp('startFrame', q=1, v1=1)
        shot_count = pm.intFieldGrp('shotCount', q=1, v1=1)

        if len(str(shot_num)) < 2:
            raise RuntimeError('First Shot Number must be at east 2 digits.')

        for shot in pm.ls(type='shot'):
            try:
                cam = shot.get_camera()
                if cam.name() not in ['persp', 'top', 'front', 'side']:
                    pm.delete(cam)
            except:
                pm.delete(shot)

        for shot in pm.ls(type='shot'):
            pm.delete(shot)

        window_name = 'shot_creator_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        window_name = 'shot_list_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        shot_list_win = pm.window(window_name,
                                  title='Shot Creator',
                                  s=0,
                                  rtf=1)

        with pm.columnLayout():
            with pm.rowColumnLayout(nc=6,
                                    cw=[(1, 20), (2, 70), (3, 70), (4, 70),
                                        (5, 70), (6, 70)]):
                pm.text(l='')
                pm.text(l='Shot Num')
                pm.text(l='Length')
                pm.text(l='Start Frame')
                pm.text(l='End Frame')
                pm.text(l='Shot Name')

                for i in range(0, shot_count):

                    def checkbox_state(*args):
                        check_cnt = 0
                        while pm.checkBox('%s%s' %
                                          ('shotCheckBox', str(check_cnt)),
                                          ex=1):
                            check_cnt += 1

                        for k in range(0, check_cnt):
                            state = pm.checkBox('shotCheckBox%s' % str(k),
                                                q=1,
                                                v=1)
                            if not state:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=0)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=0)
                            else:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=1)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=1)

                    pm.checkBox('shotCheckBox%s' % str(i),
                                onc=checkbox_state,
                                ofc=checkbox_state)

                    shot_number = ''
                    for j in range(0, 4):
                        digit = len(str(shot_num))
                        if digit == 1:
                            shot_number = '000%s' % str(shot_num)
                        if digit == 2:
                            shot_number = '00%s' % str(shot_num)
                        if digit == 3:
                            shot_number = '0%s' % str(shot_num)
                        if digit == 4:
                            shot_number = '%s' % str(shot_num)

                    pm.textField('%s%s' % (shot_num_name, str(i)),
                                 text=str(shot_number),
                                 en=0)
                    shot_num += 10

                    pm.intField('%s%s' % (shot_length_name, str(i)),
                                cc=set_parameters_from_length,
                                v=1)

                    pm.intField('%s%s' % (start_frame_name, str(i)), en=0, v=1)
                    if i == 0:
                        pm.intField('%s%s' % (start_frame_name, str(i)),
                                    e=1,
                                    v=start_frame)

                    pm.intField('%s%s' % (end_frame_name, str(i)), en=0, v=1)

                    shot_node_name = 'shot%s' % str(i + 1)
                    pm.textField('%s%s' % (shot_name_name, str(i)),
                                 text=shot_node_name,
                                 en=0)

        with pm.columnLayout():

            def exec_create_shots(*args):
                state = pm.checkBox('camera_checkbox_name', q=1, v=1)
                if not state:
                    create_shots(False)
                else:
                    create_shots(True)

            pm.button(l='CREATE SHOTS', w=370, c=exec_create_shots)

        with pm.rowColumnLayout(nc=3,
                                cs=(3, 10),
                                cw=[(1, 60), (2, 120), (3, 100)]):
            pm.text(l='camPrefix')
            pm.textField('camera_prefix_name', text='camera__shotExp_', en=0)

            def checkbox_cameras(*args):
                state = pm.textField('camera_prefix_name', q=1, en=1)
                if not state:
                    pm.textField('camera_prefix_name', e=1, en=1)
                else:
                    pm.textField('camera_prefix_name', e=1, en=0)

            pm.checkBox('camera_checkbox_name',
                        l='create Cameras',
                        onc=checkbox_cameras,
                        ofc=checkbox_cameras)

        pm.showWindow(shot_list_win)
Esempio n. 35
0
    def createBrowser(self):
        win = pm.window(w=200)

        form = pm.formLayout(numberOfDivisions=100)
        col2 = pm.columnLayout(p=form, adjustableColumn=True)
        allowedAreas = ['right', 'left']
        pm.dockControl(label='BROWSER',
                       w=200,
                       area='left',
                       content=win,
                       allowedArea=allowedAreas)

        self.projectSelectWidget = ProjectSelectWidget()
        self.projectSelectWidget.createProjectSelect(col2)

        pm.rowLayout(nc=3, adj=1)
        self.typeOpt = pm.optionMenuGrp(label='Item Type',
                                        changeCommand=self.changeTypeCallback,
                                        cat=[[1, 'left', 5], [2, 'left', -80]])
        pm.menuItem(label='asset')
        pm.menuItem(label='shot')
        pm.menuItem(divider=True)
        typesAsset = database.getAllTasks('asset')
        for assetType in typesAsset:
            pm.menuItem(label=assetType)
        pm.menuItem(divider=True)
        typesShot = database.getAllTasks('shot')
        for assetType in typesShot:
            pm.menuItem(label=assetType)

        pm.symbolButton(
            image=r'D:/JOBS/PIPELINE/pipeExemple/scenes/icons/small.png',
            c=lambda x, y=2: self.changeViewCallback(y))
        pm.symbolButton(
            image=r'D:/JOBS/PIPELINE/pipeExemple/scenes/icons/big.png',
            c=lambda x, y=1: self.changeViewCallback(y))

        pane = pm.paneLayout(p=form,
                             configuration='top3',
                             ps=[(1, 20, 80), (2, 80, 80), (3, 100, 20)],
                             shp=0)

        self.folderTreeWidget = FolderTreeWidget('asset')
        self.folderTreeWidget.createFolderTree(pane)
        self.folderTreeWidget.getFolderTree()

        self.itemListWidget = ItemListWidget()
        self.itemListWidget.createList(pane)
        self.itemListWidget.refreshList(path=[], task='asset')

        self.infoWidget = InfoWidget()
        self.infoWidget.createInfo(pane)

        self.folderTreeWidget.itemListWidget = self.itemListWidget
        self.folderTreeWidget.itemListWidget.type = 'asset'
        self.folderTreeWidget.itemListWidget.task = 'asset'
        self.projectSelectWidget.folderTreeWidget = self.folderTreeWidget
        self.projectSelectWidget.itemListWidget = self.itemListWidget
        self.itemListWidget.infoWidget = self.infoWidget

        pm.formLayout(form,
                      edit=True,
                      attachForm=[(pane, 'left', 5), (pane, 'bottom', 5),
                                  (pane, 'right', 5), (col2, 'top', 5),
                                  (col2, 'left', 5), (col2, 'right', 5)],
                      attachControl=[(pane, 'top', 5, col2)],
                      attachPosition=[],
                      attachNone=())

        pm.showWindow()
Esempio n. 36
0
    def __init__(self):
        if window(self.name, ex=True):
            deleteUI(self.name)

        window(self.name)

        ass = formLayout()

        with tabLayout() as tab:
            tabLayout(tab,
                      e=True,
                      sc=lambda *args: setattr(self.settings, 'activeTab',
                                               tab.getSelectTabIndex()))
            with formLayout() as switcher:

                def setMode(modeName):
                    self.settings.mode = modeName

                self.rangeInput = radioButtonGrp(
                    nrb=4,
                    la4=[m.title() for m in self.MODES],
                    on1=Callback(setMode, self.MODES[0]),  # noqa e128
                    on2=Callback(setMode, self.MODES[1]),
                    on3=Callback(setMode, self.MODES[2]),
                    on4=Callback(setMode, self.MODES[3]),
                )

                self.rangeInput.setSelect(
                    self.MODES.index(self.settings.mode) + 1)

                with scrollLayout() as utilities:
                    with columnLayout(adj=True):

                        # Fk / Ik Switching
                        with frameLayout(l='Ik/Fk Switching',
                                         cll=True) as ikFkFrame:
                            self.settings.frameLayoutSetup(
                                ikFkFrame, 'ikfkCollapsed')
                            with rowColumnLayout(nc=3,
                                                 cw=[(1, 200), (2, 50),
                                                     (3, 50)]):
                                for card in fossil.find.blueprintCards():
                                    for side in ['Center', 'Left', 'Right']:
                                        try:
                                            ik = card.getSide(side).ik
                                            fk = card.getSide(side).fk

                                            if ik and fk:
                                                text(l=ik.shortName())
                                                button(l='Ik',
                                                       c=Callback(
                                                           self.doIkFkSwitch,
                                                           fk, True))
                                                button(l='Fk',
                                                       c=Callback(
                                                           self.doIkFkSwitch,
                                                           ik, False))

                                        except Exception:
                                            print(traceback.format_exc())

                        # Space Switching
                        with frameLayout(l='Space Switching',
                                         cll=True) as spaceFrame:
                            self.settings.frameLayoutSetup(
                                spaceFrame, 'spaceCollapsed')
                            with columnLayout() as self.main:
                                with rowColumnLayout(nc=2):

                                    button(l='Switch', c=Callback(self.switch))

                                text(l='Control')
                                self.targets = textScrollList(h=200)
                                scriptJob(e=('SelectionChanged',
                                             Callback(self.update)),
                                          p=self.main)

                                text(l='')

                                self.presetFileChooser = optionMenu(
                                    l='Presets', cc=Callback(self.loadSpace))
                                self.presetFiles = []
                                for folder in spacePresets.SpacePresets.presetLocations:
                                    folder = os.path.expandvars(folder)

                                    if not os.path.exists(folder):
                                        continue

                                    for f in os.listdir(folder):
                                        if f.lower().endswith('.json'):
                                            cmds.menuItem(l=f[:-5])
                                            self.presetFiles.append(folder +
                                                                    '/' + f)

                                self.spacePresetList = textScrollList(h=100)
                                button(l='Apply',
                                       c=Callback(self.applySpacePreset))

                                self.update()
                        """
                        # Main zeroing
                        with frameLayout(l='Zero Main Controller', cll=True) as zeroFrame:
                            self.settings.frameLayoutSetup(zeroFrame, 'zeroMainCollapsed')
                            with rowColumnLayout(nc=3):
                                with gridLayout(nrc=(2, 3)):
                                    toggles = []
                                    for attr in [t + a for t in 'tr' for a in 'xyz']:
                                        toggles.append( checkBox(l=attr) )
                                        self.settings.checkBoxSetup(toggles[-1], attr + '0')
                                    
                                    def setVal(val):
                                        for check in toggles:
                                            check.setValue(val)
                                        for attr in [t + a for t in 'tr' for a in 'xyz']:
                                            self.settings[attr + '0'] = val
                                        
                                with columnLayout(adj=True):
                                    button(l='All', c=Callback(setVal, True))
                                    button(l='Clear', c=Callback(setVal, False))

                                with columnLayout(adj=True):
                                    button(l='Apply', c=Callback(self.zeroMain))
                        """

                formLayout(
                    switcher,
                    e=True,
                    af=[  # noqa e128
                        (self.rangeInput, 'left', 0),
                        (self.rangeInput, 'top', 0),
                        (self.rangeInput, 'right', 0),
                        (utilities, 'left', 0),
                        (utilities, 'bottom', 0),
                        (utilities, 'right', 0),
                    ],
                    ac=(utilities, 'top', 0, self.rangeInput),
                )

            with formLayout() as spaceTab:
                self.spacePresetsGui, self.qtui = spacePresets.SpacePresets.asMelGui(
                )

                formLayout(spaceTab,
                           e=True,
                           af=[
                               (self.spacePresetsGui, 'top', 0),
                               (self.spacePresetsGui, 'bottom', 0),
                               (self.spacePresetsGui, 'right', 0),
                               (self.spacePresetsGui, 'left', 0),
                           ])

                #button(save, e=True, c=Callback(space.save))
                #button(load, e=True, c=Callback(space.load))

        tabLayout(tab,
                  e=True,
                  tl=[(switcher, 'Switching'), (spaceTab, 'Spaces')])
        #tabLayout(tab, e=True, tl=[(switcher, 'Switching')] )

        tabLayout(tab, e=True, sti=self.settings.activeTab)

        formLayout(
            ass,
            e=True,
            af=[  # noqa e128
                (tab, 'top', 0),
                (tab, 'left', 0),
                (tab, 'right', 0),
                (tab, 'bottom', 0),
            ])

        showWindow()
Esempio n. 37
0
	def checkNodesMain(self , *args):
		amount = 0
		pm.progressWindow( t = '处理中...' , ii = True , progress = amount)
		while True:
			if pm.progressWindow(q = True , isCancelled = True):
				 break 
			
			if pm.progressWindow(q = True , progress = True) >= 100:
				 break 
			
			if pm.window( 'checkWin' , ex = True):
				pm.deleteUI('checkWin' , window = True)
			
			pm.window('checkWin' , t = '节点信息' , wh = [500 , 650])
			pm.columnLayout('QlookLayout' , adj = True)
			
			checkListNum = 16
			eachCheckListLength = 100/checkListNum
			
			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '重命名的节点:')
			
			if self.checkBox_1.isChecked():
				self.addFrm(self.checkOverNameAllObj , '1' , 'QlookLayout' , '重命名的节点:' )

			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '命名不正确的Shape:')
			
			if self.checkBox_2.isChecked():
				LayouName = self.addFrm(self.checkOverNameAllShape , '2' , 'QlookLayout' , '命名不正确的Shape:' )
				pm.button(p = LayouName , l = '修复Shape' ,c = functools.partial(self.renameWrongShape2 , LayouName) )

			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '绑定后不干净的shape:')
			
			if self.checkBox_3.isChecked():
				self.addFrm(self.checkRigShape , '3' , 'QlookLayout' , '绑定后不干净的shape:' )
				
			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '检查是否加smooth节点:')
			
			if self.checkBox_4.isChecked():
				LayouName = self.addFrm(self.checkObjectSmooth , '4' , 'QlookLayout' , 'smooth节点:' )
				pm.button(p = LayouName , l = '设置smooth节点' ,c = functools.partial(self.setObjectSmooth , LayouName) )
				
			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = 'geo组以外的模型是否不可渲染:')
			
			if self.checkBox_6.isChecked():
				LayouName = self.addFrm(self.checkObjectRender , '5' , 'QlookLayout' , '检查geo组以外的模型是否lambert材质不可渲染' )
				pm.button(p = LayouName , l = '设置geo组以外的模型为lambert材质不可渲染' ,c = functools.partial(self.setCheckObjectRender , LayouName) )

			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '设置geo组下模型可渲染')
			
			if self.checkBox_7.isChecked():
				self.addFrm(self.setGeoGroupRender , '6' , 'QlookLayout' , '设置geo组下模型可渲染:' , False , [0 , 0.5 , 0] )

			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '驱动,隐藏的物体是否锁定并设置成了不可K帧:')
			
			if self.checkBox_8.isChecked():
				LayouName = self.addFrm(self.checkObjectSetKey , '7' , 'QlookLayout' , '驱动,隐藏的物体是否锁定并设置成了不可K帧:' )
				pm.button(p = LayouName , l = '锁定不可K帧' ,c = functools.partial(self.setObjectSetKey , LayouName) )
				
			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '总控制器属性,颜色,关联显隐:')
			
			if self.checkBox_9.isChecked():
				LayouName = self.addFrm(self.checkMainCtrl , '8' , 'QlookLayout' , '总控制器属性,颜色,关联显隐:'  , False)
				if self.Box_9_v :
					pm.button(p = LayouName , l = '设置关联显隐' ,c = functools.partial(self.setCheckMainCtrl , LayouName) )

			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = 'RIG层级检查:')
			
			if self.checkBox_10.isChecked():
				self.addFrm(self.checkInterbedded , '9' , 'QlookLayout' , 'RIG层级检查:' , False )

			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '毛发检查:')
			
			if self.checkBox_11.isChecked():
				LayouName = self.addFrm(self.checkHair , '10' , 'QlookLayout' , '毛发检查:' )
				pm.button(p = LayouName , l = '设置毛发' ,c = functools.partial(self.setCheckHair , LayouName) )
				
			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '检查头和手臂的Global属性:')
			
			if self.checkBox_12.isChecked():
				LayouName = self.addFrm(self.checkGlobalAttr , '11' , 'QlookLayout' , '检查头和手臂的Global属性:' , False )
				pm.button(p = LayouName , l = '设置头和手臂的Global属性' ,c = functools.partial(self.setCheckGlobalAttr , LayouName) )
				
			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '清理多余的层:')
			
			if self.checkBox_13.isChecked():
				self.addFrm(self.cleanUp_SpilthLayer , '12' , 'QlookLayout' , '清理多余的层:' , False , [0 , 0.5 , 0] )

			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '清理未知节点:' )
			
			if self.checkBox_14.isChecked():
				self.addFrm(self.cleanUnknowNode , '13' , 'QlookLayout' , '清理未知节点:' , False , [0 , 0.5 , 0] )
				
			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '清理多余蒙皮节点:')
			
			if self.checkBox_15.isChecked():
				self.addFrm(self.cleanUnusedSkinNode , '14' , 'QlookLayout' , '清理多余蒙皮节点:' , False , [0 , 0.5 , 0] )

			amount += eachCheckListLength
			pm.progressWindow(e = True , progress = amount , status = '清理多余蒙皮影响:')
			
			if self.checkBox_16.isChecked():
				self.addFrm(self.cleanUnsedInfluence , '15' , 'QlookLayout' , '清理多余蒙皮影响:' , False , [0 , 0.5 , 0] )

			#amount += eachCheckListLength
			#pm.progressWindow(e = True , progress = amount , status = '手动清理暗面模型')
			"""
			if self.checkBox_17.isChecked():
				self.addFrm(self.cleanFaceFixedshader , '16' , 'QlookLayout' , '手动清理暗面模型' )
			"""
	

			pm.progressWindow(e = True , progress = amount , status = '完成:')
			
			break
							
		pm.showWindow('checkWin')
			
		pm.progressWindow(endProgress=1)
Esempio n. 38
0
    def createWindow(self):
        if self.QuadrupedWindow:
            pm.deleteUI(self.QuadrupedWindow)

        self.QuadrupedWindow = pm.window(title='VZ Quadruped RIG',
                                         iconName='quadrupedRig')
        self.tabs = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5)

        self.basicForm = pm.columnLayout(adj=True)

        pm.text(label='VZ Quadruped RIG', fn='boldLabelFont')
        pm.text(label='BASIC OPTIONS', fn='plainLabelFont')

        self.characterNameTextField = pm.textFieldGrp(label='Character Name:',
                                                      w=200,
                                                      h=18,
                                                      ed=True,
                                                      tx='character',
                                                      cw=[[1, 130], [2, 200]],
                                                      cat=[(1, 'left', 5),
                                                           (2, 'left', 0)])
        self.leftSidePrefixTextField = pm.textFieldGrp(
            label='Left Side Prefix:',
            w=60,
            h=18,
            ed=True,
            tx='L',
            cw=[[1, 130], [2, 60]],
            cat=[(1, 'left', 5), (2, 'left', 0)])
        self.rightSidePrefixTextField = pm.textFieldGrp(
            label='Right Side Prefix:',
            w=60,
            h=18,
            ed=True,
            tx='R',
            cw=[[1, 130], [2, 60]],
            cat=[(1, 'left', 5), (2, 'left', 0)])

        pm.separator(hr=True, h=30, st='single')

        self.fingerNames = ['Thumb', 'Index', 'Middle', 'Ring', 'Pinky']

        for i, fingerName in enumerate(self.fingerNames):
            pm.rowLayout(nc=3, cw=(1, 180))
            self.handFingersInterface[fingerName] = {}
            self.handFingersInterface[fingerName]['checkBox'] = pm.checkBox(
                v=1, en=1, label=fingerName + ' fr Toe | Phalanx: ')
            self.handFingersInterface[fingerName][
                'radioBtn'] = pm.radioButtonGrp(labelArray2=['2', '3'],
                                                sl=1,
                                                ct2=['left', 'left'],
                                                co2=[0, -65],
                                                numberOfRadioButtons=2)
            pm.setParent('..')

        pm.separator(hr=True, h=30, st='single')

        for i, fingerName in enumerate(self.fingerNames):
            pm.rowLayout(nc=3, cw=(1, 180))
            self.footFingersInterface[fingerName] = {}
            self.footFingersInterface[fingerName]['checkBox'] = pm.checkBox(
                v=1, en=1, label=fingerName + ' bk Toe | Phalanx: ')
            self.footFingersInterface[fingerName][
                'radioBtn'] = pm.radioButtonGrp(labelArray2=['2', '3'],
                                                sl=1,
                                                ct2=['left', 'left'],
                                                co2=[0, -65],
                                                numberOfRadioButtons=2)
            pm.setParent('..')

        pm.separator(hr=True, h=30, st='single')
        pm.rowLayout(nc=2, cw=(1, 180))
        self.hasTailCheckbox = pm.checkBox(v=1,
                                           en=1,
                                           label='Tail | Joints Number:')
        self.tailJointsIntField = pm.intField(w=62, h=18, ed=True, min=1, v=5)

        pm.setParent('..')

        pm.separator(hr=True, h=30, st='single')
        pm.rowLayout(nc=2, cw=(1, 180))
        pm.text(label='      Spine Joints')
        self.spineJointsIntField = pm.intField(w=62, h=18, ed=True, min=1, v=5)

        pm.setParent('..')
        pm.separator(hr=True, h=30, st='single')

        pm.rowLayout(nc=3, cw=(1, 180))

        self.hasArmRibbonsCheckbox = pm.checkBox(
            v=1, en=1, label='Front Leg Ribbons | Joints Number: ')
        self.armRibbonJointsIntField = pm.intField(w=62,
                                                   h=18,
                                                   ed=True,
                                                   min=1,
                                                   v=5)
        self.armRibbonFirstJointOffsetFloatField = pm.floatFieldGrp(
            l='First Joint Offset:',
            nf=1,
            v1=0.0,
            cat=[(1, 'left', 20), (2, 'left', -20)])
        pm.setParent('..')
        pm.rowLayout(nc=3, cw=(1, 180))
        self.hasLegRibbonsCheckbox = pm.checkBox(
            v=1, en=1, label='Back Leg Ribbons | Joints Number:')
        self.legRibbonJointsIntField = pm.intField(w=62,
                                                   h=18,
                                                   ed=True,
                                                   min=1,
                                                   v=5)
        self.legRibbonFirstJointOffsetFloatField = pm.floatFieldGrp(
            l='First Joint Offset:',
            nf=1,
            v1=0.0,
            cat=[(1, 'left', 20), (2, 'left', -20)])
        pm.setParent('..')

        pm.separator(hr=True, h=30, st='single')

        pm.rowLayout(nc=2, cw=(1, 180))
        pm.text(l='Modules connection:', fn='plainLabelFont')
        self.modulesConnectionRadioButton = pm.radioButtonGrp(
            labelArray2=['Hierarchy', 'Constraint'],
            sl=1,
            ct2=['left', 'left'],
            numberOfRadioButtons=2)
        pm.setParent('..')

        pm.separator(hr=True, h=30, st='single')

        self.getFromSceneCheckbox = pm.checkBox(v=1,
                                                en=1,
                                                label='Get Guide From Scene')
        self.reapplySkinCheckbox = pm.checkBox(
            v=0, en=1, label='Reapply skin after rebuilding rig')
        pm.separator(h=30)

        self.createGuideButton = pm.button(w=263,
                                           h=20,
                                           l='Create guide',
                                           c=self.createGuideCallback)
        self.createGuideButton = pm.button(w=263,
                                           h=20,
                                           l='Save Ctrls',
                                           c=self.saveCntrlsCallback)
        self.createGuideButton = pm.button(w=263,
                                           h=20,
                                           l='Load Ctrls',
                                           c=self.loadCntrlsCallback)
        self.toggleGuideButton = pm.button(w=263,
                                           h=20,
                                           l='Toggle Guide Visibility',
                                           c=self.toggleGuidesVizCallback)
        self.createRigButton = pm.button(w=263,
                                         h=30,
                                         l='Create Rig',
                                         c=self.createRigCallback)

        pm.showWindow(self.QuadrupedWindow)
Esempio n. 39
0
    def show(self):
        # some default values
        section_label_height = 30
        labels_width = 140

        if pm.window(self.windows_name, exists=True):
            pm.deleteUI(self.windows_name)

        self.window = pm.window(self.windows_name, t='Afanasy Job Submission')

        with pm.columnLayout(adj=True):

            pm.text(l='<h1><b>Job Parameters<b><h1>', h=section_label_height)
            with pm.rowLayout(nc=4,
                              adj=2,
                              cl4=['right', 'left', 'center', 'center'],
                              cw4=(labels_width, 40, 15, 15)):
                pm.text(l='<div align="right"><b>Start Frame</b></div>')
                start_time_int_field = pm.intField(
                    'cgru_afanasy__start_frame',
                    v=pm.optionVar.get('cgru_afanasy__start_frame_ov', 1))
                pm.button(l='<',
                          ann='Use minimum animation range',
                          c=functools.partial(
                              self.set_field_value, start_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                min=True)))
                pm.button(l='<<',
                          ann='Use minimum playback range',
                          c=functools.partial(
                              self.set_field_value, start_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                ast=True)))

            with pm.rowLayout(nc=4, adj=2, cw4=(labels_width, 40, 15, 15)):
                pm.text(l='<b>End Frame</b>')
                end_time_int_field = pm.intField(
                    'cgru_afanasy__end_frame',
                    v=pm.optionVar.get('cgru_afanasy__end_frame_ov', 1))
                pm.button(l='<',
                          ann='Use maximum animation range',
                          c=functools.partial(
                              self.set_field_value, end_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                max=True)))
                pm.button(l='<<',
                          ann='Use maximum playback range',
                          c=functools.partial(
                              self.set_field_value, end_time_int_field,
                              functools.partial(pm.playbackOptions,
                                                q=True,
                                                aet=True)))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Frame Per Task</b>')
                pm.intField('cgru_afanasy__frames_per_task',
                            v=pm.optionVar.get(
                                'cgru_afanasy__frames_per_task_ov', 1))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>By Frame</b>')
                pm.intField('cgru_afanasy__by_frame',
                            v=pm.optionVar.get('cgru_afanasy__by_frame_ov', 1))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Global Depend Mask</b>')
                pm.textField('cgru_afanasy__depend_mask_global',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__depend_mask_global_ov', ''))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Host Mask</b>')
                pm.textField('cgru_afanasy__hosts_mask',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__hosts_mask_ov', ''))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Host Exclude</b>')
                pm.textField('cgru_afanasy__hosts_exclude',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__hosts_exclude_ov', ''))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Life Time (hours)</b>')
                pm.intField('cgru_afanasy__life_time',
                            v=pm.optionVar.get('cgru_afanasy__life_time_ov',
                                               240))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Annotation</b>')
                pm.textField('cgru_afanasy__annotation',
                             text=pm.optionVar.get(
                                 'cgru_afanasy__annotation_ov', ''))

            pm.separator()
            pm.text(l='<h1><b>Block Parameters<b><h1>', h=section_label_height)
            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Avoid Host</b>')
                pm.intField('cgru_afanasy__errors_avoid_host',
                            v=pm.optionVar.get(
                                'cgru_afanasy__errors_avoid_host_ov', 3),
                            min=0,
                            max=127)

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Retries</b>')
                pm.intField('cgru_afanasy__errors_retries',
                            v=pm.optionVar.get(
                                'cgru_afanasy__errors_retries_ov', 3),
                            min=0,
                            max=127)

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Task Same Host</b>')
                pm.intField('cgru_afanasy__errors_task_same_host',
                            v=pm.optionVar.get(
                                'cgru_afanasy__errors_task_same_host_ov', 3),
                            min=0,
                            max=127)

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                pm.text(l='<b>Errors Forgive Time</b>', ann='in seconds')
                pm.intField('cgru_afanasy__errors_forgive_time',
                            ann='in seconds',
                            v=pm.optionVar.get(
                                'cgru_afanasy__errors_errors_forgive_time_ov',
                                18000),
                            min=0)

            pm.separator()
            pm.text(l='<h1><b>Submission Details<b><h1>',
                    h=section_label_height)
            with pm.rowLayout(nc=2,
                              adj=2,
                              cl2=('right', 'left'),
                              cw2=(labels_width, 50)):
                pm.text(l='<b>Start Paused</b>', al='right')
                pm.checkBox('cgru_afanasy__paused', l='', v=0)

            pm.radioButtonGrp(
                'cgru_afanasy__separate_layers',
                numberOfRadioButtons=3,
                label='<b>Submit Render Layers<br>as Separate:</b>',
                labelArray3=['None', 'Block', 'Job'],
                # adj=1,
                cw4=[labels_width, 50, 50, 50],
                sl=pm.optionVar.get('cgru_afanasy__separate_layers_ov', 2))

            with pm.rowLayout(nc=2, adj=2, cw2=(labels_width, 50)):
                ann = """This is a weird hack! When used in conjunction with
the <b>Skip Existence Frames<b> parameter of the maya render settings and the
Frames Per Task parameters is equal or greater than the number of frames in the
animation range, it allows the Maya scene to be loaded only once per farm
machine. But then to be able to use all farmers there should be at least the
same amount of Jobs that there are farm machines. So with this parameter it is
possible to submit the same job multiple times.. But it is a bad hack.

This system will be updated in Afanasy."""
                pm.text(l='<b>Submit Multiple Times</b>', ann=ann)
                pm.intField('cgru_afanasy__submit_multiple_times',
                            ann=ann,
                            v=pm.optionVar.get(
                                'cgru_afanasy__submit_multiple_times_ov', 1))

            with pm.rowLayout(nc=2,
                              adj=2,
                              cl2=('right', 'left'),
                              cw2=(labels_width, 40)):
                pm.text(l='<b>Close After</b>', al='right')
                pm.checkBox('cgru_afanasy__close', l='', v=1)

            pm.button(l='SUBMIT', c=self.launch)

        pm.showWindow(self.window)
Esempio n. 40
0
    def create(self):
        if pm.window(self.window, exists=True):
            pm.deleteUI(self.window)
        pm.window(self.window, t=self.title)

        # source & targets
        pm.rowColumnLayout(nc=3,
                           cal=[(1, 'right')],
                           cw=[(1, 80), (2, 200), (3, 100)])
        pm.text(l='Source: ')
        self.sourceObjTf = pm.textField()
        pm.button(l='Select', c=self.selectSource)
        pm.text(l='Target(s): ')
        self.targetObjsTf = pm.textField()
        pm.button(l='Select', c=self.selectTarget)
        pm.setParent('..')

        # number
        pm.rowColumnLayout(w=self.size[0])
        self.copyNum = pm.intSliderGrp(l='Copies: ',
                                       v=10,
                                       cw3=[80, 80, 220],
                                       min=1,
                                       max=500,
                                       fmx=5000,
                                       f=True)
        pm.separator(h=10, st='in')

        # rotation
        pm.rowColumnLayout(nc=2, cal=[(1, 'right')], cw=[(1, 80), (2, 300)])
        pm.text(l='Rotation: ')
        self.rotationModeRC = pm.radioCollection()
        self.rotBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.rotBtnAlign = pm.radioButton(l='Align with Target')
        pm.text(l='')
        self.rotBtnRand = pm.radioButton(
            l='Random',
            onc=lambda *args: self.rotationRange.setEnable(True),
            ofc=lambda *args: self.rotationRange.setEnable(False))
        pm.setParent('..')
        self.rotationRange = pm.floatFieldGrp(l='Range: ',
                                              nf=3,
                                              v1=30,
                                              v2=30,
                                              v3=30,
                                              cw4=[80, 100, 100, 100],
                                              en=False)
        pm.separator(h=10, st='in')

        # scale
        pm.rowColumnLayout(nc=2, cal=[(1, 'right')], cw=[(1, 80), (2, 300)])
        pm.text(l='Scale: ')
        self.scaleModeRC = pm.radioCollection()
        self.scaleBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.scaleBtnRand = pm.radioButton(
            l='Random',
            onc=lambda *args: self.scaleRange.setEnable(True),
            ofc=lambda *args: self.scaleRange.setEnable(False))
        pm.setParent('..')
        self.scaleRange = pm.floatFieldGrp(l='Min Max: ',
                                           nf=2,
                                           v1=1,
                                           v2=1,
                                           cw3=[80, 100, 100],
                                           en=False)
        pm.separator(h=10, st='in')

        # disperse button
        pm.button(l='Disperse', c=self.disperse, w=380, al='center')

        pm.showWindow(self.window)
Esempio n. 41
0
    p = sel[len(sel) - 1]  #last item in the list is the parent

    for obj in sel:
        if obj == p:  #if the object is the target
            continue  #skip it
        else:
            const = pm.parentConstraint(p, obj,
                                        mo=mo)  #parent constrain command

    pm.select(sel)


### UI
try:
    pm.deleteUI('mpcwin')
except:
    pass
mpcwin = pm.window('mpcwin',
                   title='Multiple pConstraint:',
                   width=75,
                   tlb=True,
                   rtf=True)
col = pm.verticalLayout(width=75)
but = pm.button('but',
                l='Parent Constrain',
                c=lambda *args: multiParentConstraint(mo=pm.checkBox(
                    'cbox', q=True, v=True)))
cbox = pm.checkBox('cbox', l='Maintain offset ')
col.redistribute(1, 1)
pm.showWindow(mpcwin)
Esempio n. 42
0
def randomizer_createUserInterface():
	"""--------------------------------------------------------------------------
	Create User Interface Procedure
	--------------------------------------------------------------------------"""
	

	pm.window('randomizer_window', s=0, rtf=0, t="randomizer", wh=(300, 700))
	# Create UI elements
	pm.columnLayout('mainColumnLayout', h=930, w=248, columnAlign="center", adjustableColumn=1)
	pm.separator('selectedTransformObjectsSeparator', h=10, w=240, st="none")

	pm.text('selectedTransformObjectsText', fn="boldLabelFont", h=24, l="selected transform Objects", w=240, al="center")
	pm.textScrollList('selectedTransformObjectsTextScrollList', h=80, w=240)
	pm.button('loadObjectsButton', h=28, c=lambda *args: randomizer_loadSelection(0), l="load transform Objects", w=240)
	pm.separator('selectedMaterialsSeparator', h=10, w=240, st="none")

	pm.text('selectedMaterialsText', fn="boldLabelFont", h=24, l="selected Materials", w=240, al="center")
	pm.textScrollList('selectedMaterialsTextScrollList', h=80, w=240)
	pm.button('loadMaterialsButton', h=28, c=lambda *args: randomizer_loadSelection(1), l="load Materials", w=240)
	pm.separator('transformAttributesSeparator', h=10, w=240, st="none")

	pm.text('randomizeAttributesText', fn="boldLabelFont", h=24, l="randomize Attributes", w=240, al="center")
	pm.checkBoxGrp('randomizeAttributesCheckBoxGrp', h=24, l4="Material", l2="Rotate", l3="Scale", w=240, l1="Translate", ncb=4, cw=[(1, 67), (2, 57), (3, 50), (4, 57)])
	pm.separator('translateAttributesSeparator', h=10, w=240, st="none")

	pm.text('translateText', fn="boldLabelFont", h=24, l="Translate", w=240, al="center")
	pm.floatFieldGrp('minMaxXtranslateFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.floatFieldGrp('minMaxYtranslateFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.floatFieldGrp('minMaxZtranslateFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.separator('rotateAttributesSeparator', h=10, w=240, st="none")

	pm.text('rotateText', fn="boldLabelFont", h=24, l="Rotate", w=240, al="center")
	pm.floatFieldGrp('minMaxXrotateFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.floatFieldGrp('minMaxYrotateFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.floatFieldGrp('minMaxZrotateFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=0, v2=0, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.separator('scaleAttributesSeparator', h=10, w=240, st="none")

	pm.text('scaleText', fn="boldLabelFont", h=24, l="Scale", w=240, al="center")
	pm.floatFieldGrp('minMaxXscaleFloatFieldGrp', pre=3, el="max X", bgc=(0.25, 0, 0), h=24, l="min X", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.floatFieldGrp('minMaxYscaleFloatFieldGrp', pre=3, el="max Y", bgc=(0, 0.25, 0), h=24, l="min Y", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.floatFieldGrp('minMaxZscaleFloatFieldGrp', pre=3, el="max Z", bgc=(0, 0, 0.25), h=24, l="min Z", nf=2, v1=1, v2=1, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.separator('randomizeSelectionSeparator', h=10, w=240, st="none")

	pm.button('randomizeAbsoluteButton', h=28, c=lambda *args: randomizer_randomizeSelection(), l="randomize Abolute", w=240)
	pm.button('randomizeRelativeButton', h=28, c=lambda *args: randomizer_randomizeSelection(relative=True), l="randomize Relative", w=240)
	pm.separator('timeAttributesSeparator', h=10, w=240, st="none")

	pm.text('timeText', fn="boldLabelFont", h=24, l="Time", w=240, al="center")
	pm.checkBoxGrp('randomizeKeyframeCheckBoxGrp', h=24, l2="Rotate", l3="Scale", w=240, l1="Translate", v1=1, v2=1, v3=1, ncb=3, cw=[(1, 67), (2, 57), (3, 50)])
	pm.intFieldGrp('minMaxTimeIntFieldGrp', el="max", bgc=(0, 0, 0), h=24, l="min", nf=2, v1=0, v2=10, w=240, cw=[(1, 60), (2, 60), (3, 60), (4, 60)])
	pm.button('setUniformKeyframe', h=28, c=lambda *args: rand_KeyframeUI(objects=None, axis=["X", "Y", "Z"], uniform=True, uniformObject=False, min=-10, max=10, step=1), l="Randomize all Channels together", w=240)
	pm.button('setRandomKeyframe', h=28, c=lambda *args: rand_KeyframeUI(objects=None, axis=["X", "Y", "Z"], uniform=False, uniformObject=False, min=-10, max=10, step=1), l="Randomize each Channel seperately", w=240)
	pm.button('setUniformKeyframeAll', h=28, c=lambda *args: rand_KeyframeUI(objects=None, axis=["X", "Y", "Z"], uniform=False, uniformObject=True, min=-10, max=10, step=1), l="Move all Keyframes together", w=240)
	pm.separator('undoSeparator', h=10, w=240, st="none")

	pm.button('undoButton', h=28, c=lambda *args: pm.undo(), l="undo", w=240)
	#pm.iconTextButton('staschiIconTextButton', h=28, c=lambda *args: randomizer_loadHelpWebsite(), l="www.staschi.com", w=240, st="textOnly")

	pm.setParent('..')
	pm.setParent('..')
	# Display UI
	pm.showWindow('randomizer_window')
Esempio n. 43
0
def showUI():
    
    with pm.window("scaleImageTool", title = u"将选中模型的贴图进行缩放,并存放在本地工程目录") as win:
        with pm.columnLayout():
            pm.floatSliderButtonGrp('fsbg', label = u"长宽缩放比例:", field= 1, buttonLabel = "go", min = 0.1, max = 1.0, v = 0.5, bc = lambda: doScale(pm.floatSliderButtonGrp('fsbg', q=1, v=1)))
    pm.showWindow(win)
Esempio n. 44
0
    def display(cls):
        """
        creates and displays a window

        """
        # window UI
        window_name = cls.WINDOW_NAME
        title = "Images Importer"

        if pm.window(window_name, ex=True):
            pm.deleteUI(window_name)
            pm.windowPref(window_name, remove=1)

        main_window = pm.window(window_name,
                                t=title,
                                iconName='icon_Name',
                                wh=(280, 190),
                                s=1,
                                tb=1)

        form = pm.formLayout(numberOfDivisions=100)

        sep0 = pm.separator(style="in", h=3)
        rows = pm.rowColumnLayout(numberOfColumns=2,
                                  columnWidth=[(1, 110), (2, 130)])
        pm.text(label='Image Card Prefix: ', al="right")
        cls.img_pref_input = pm.textField(tx="img_")
        pm.setParent('..')

        sep1 = pm.separator(style="in", h=3)
        cls.cb_alpha = pm.checkBox(l="Alpah Channel", al="center")
        cls.cb_scale = pm.checkBox(
            l="Scale Ratio",
            al="center",
            changeCommand=
            "from image_card_importer.image_card_importer_tool import window_ui\n"
            "window_ui.cb_scale_toggled()")
        cls.size_mult_input = pm.textField(tx="2", enable=0)
        cls.cb_seq = pm.checkBox(l="Image Sequence", al="center")

        sep2 = pm.separator(style="in", h=3)
        btn_notes_txt = pm.text(
            label='Please select image files to import as cards',
            al="center",
            font="obliqueLabelFont")
        btn_import = pm.button(l="Import Images", al="center", h=30, w=150)
        btn_import.setCommand(
            "from image_card_importer.image_card_importer_tool import window_ui\nwindow_ui.import_button()"
        )

        pm.formLayout(form,
                      edit=True,
                      attachForm=[
                          (sep0, 'left', 5),
                          (sep0, 'right', 5),
                          (sep0, 'top', 0),
                          (rows, 'left', 10),
                          (rows, 'right', 10),
                          (cls.cb_alpha, 'left', 20),
                          (btn_notes_txt, 'left', 40),
                          (cls.cb_scale, 'left', 20),
                          (sep1, 'left', 5),
                          (sep1, 'right', 5),
                          (sep2, 'left', 5),
                          (sep2, 'right', 5),
                          (btn_import, 'left', 65),
                      ],
                      attachControl=[
                          (rows, 'top', 10, sep0),
                          (cls.cb_alpha, 'top', 10, sep1),
                          (cls.cb_seq, 'top', 10, sep1),
                          (cls.cb_seq, 'left', 12, cls.cb_alpha),
                          (cls.cb_scale, 'top', 10, cls.cb_seq),
                          (cls.size_mult_input, 'top', 10, cls.cb_seq),
                          (cls.size_mult_input, 'left', 30, cls.cb_scale),
                          (sep1, 'top', 10, rows),
                          (sep2, 'top', 10, cls.cb_scale),
                          (btn_notes_txt, 'top', 10, sep2),
                          (btn_import, 'top', 10, btn_notes_txt),
                      ])

        pm.showWindow(main_window)

        pm.columnLayout()
Esempio n. 45
0
def makeHairUI():
    shapeType = ['circle', 'triangle', 'square']
    axisType = ['x', 'y', 'z']
    mirrorType = ['world', 'local']
    if pm.window('MakeHairUI', ex=True):
        pm.deleteUI('MakeHairUI', window=True)
        pm.windowPref('MakeHairUI', remove=True)
    pm.window('MakeHairUI', t="MakeHairUI")
    pm.frameLayout(label="Create Hair Parameters")
    pm.columnLayout(adjustableColumn=1)
    pm.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 90), (2, 100)])
    pm.text(label="Name: ", align='right')
    hairNameUI = pm.textField(text="HairMesh#")
    pm.text(label="Material: ", align='right')
    matNameUI = pm.textField(text="SY_mtl_hairSG")
    pm.text(label="CreaseSet: ", align='right')
    hsSetNameUI = pm.textField(text="hairCrease")
    #pm.text(label="PointCreaseSet: ",align='right')
    #hpSetNameUI=pm.textField(text="hairPointCrease")
    pm.text(label="Length Divs: ", align='right')
    LDivsValUI = pm.intField(value=7, min=4)
    pm.text(label="Width Divs: ", align='right')
    WDivsValUI = pm.intField(value=4, min=4)
    pm.text(label="Segments: ", align='right')
    segmentValUI = pm.intField(value=4, min=2)
    pm.text(label="Width: ", align='right')
    segmentWidthUI = pm.floatField(value=1, min=0.01)
    pm.text(label="Delete Curves: ", align='right')
    DelCurveUI = pm.checkBox(label="   ", value=False)
    pm.text(label="Reverse: ", align='right')
    RevCurveUI = pm.checkBox(label="   ", value=False)
    pm.text(label="Control Type: ", align='right')
    cShapeOpUI = pm.optionMenu()
    for st in shapeType:
        pm.menuItem(label=st)
    pm.text(label="Mirror Type: ", align='right')
    mirrorOpUI = pm.optionMenu()
    for mt in mirrorType:
        pm.menuItem(label=mt)
    pm.text(label="Mirror Axis: ", align='right')
    axisOpUI = pm.optionMenu()
    for ax in axisType:
        pm.menuItem(label=ax)
    colorUI = pm.colorSliderGrp(label='',
                                rgb=(0, 0, 1),
                                co3=(0, 0, 0),
                                cw3=(30, 60, 60),
                                cl3=('left', 'center', 'right'))
    pm.button(label="Set", c=lambda *arg: setColor(colorUI.getRgbValue()))
    pm.button(label="SelectCtr", c=lambda *arg: selHair())
    pm.popupMenu()
    pm.menuItem(label='Set pivot to root',
                c=lambda *arg: selHair(setPivot=True))
    pm.menuItem(label='Set pivot to tip',
                c=lambda *arg: selHair(pivot=-1, setPivot=True))
    pm.menuItem(label='Show all controls',
                c=lambda *arg: ToggleHairCtrlVis(state='show'))
    pm.menuItem(label='Hide all controls',
                c=lambda *arg: ToggleHairCtrlVis(state='hide'))
    pm.button(label="Create",
              c=lambda *arg: makeHairMesh(name=hairNameUI.getText(),
                                          mat=matNameUI.getText(),
                                          cSet=hsSetNameUI.getText(),
                                          reverse=RevCurveUI.getValue(),
                                          lengthDivs=LDivsValUI.getValue(),
                                          widthDivs=WDivsValUI.getValue(),
                                          Segments=segmentValUI.getValue(),
                                          width=segmentWidthUI.getValue(),
                                          curveDel=DelCurveUI.getValue(),
                                          cShape=cShapeOpUI.getValue()))
    pm.popupMenu()
    pm.menuItem(
        label='Rebuild',
        c=lambda *arg: selHair(
            rebuild=[True, LDivsValUI.getValue(),
                     WDivsValUI.getValue()]))
    pm.menuItem(
        label='Rebuild also controls',
        c=lambda *arg: selHair(
            rebuild=[True, LDivsValUI.getValue(),
                     WDivsValUI.getValue()],
            cShape=(True, cShapeOpUI.getValue(), segmentWidthUI.getValue())))
    pm.button(label="Duplicate", c=lambda *arg: dupHairMesh())
    pm.popupMenu()
    pm.menuItem(label='Mirror',
                c=lambda *arg: dupHairMesh(mirror=True,
                                           axis=axisOpUI.getValue(),
                                           space=mirrorOpUI.getValue()))
    pm.button(label="RemoveHair", c=lambda *arg: delHair())
    pm.popupMenu()
    pm.menuItem(label='RemoveControl', c=lambda *arg: delHair(keepHair=True))
    pm.menuItem(label='RemoveAllControl', c=lambda *arg: cleanHairMesh())
    pm.setParent('..')
    pm.showWindow()
Esempio n. 46
0
def PrismTools_UI():
    #PrismTools UI dimension
    winWidth = 250
    winHeight = 500

    # checking for duplicate windows
    windowID = 'PrismTools'
    if pm.window(windowID, exists=True):
        pm.deleteUI(windowID)
    # re-adjusting UI if UI is not correct
    try:
        if pm.windowPref(windowID, q=True, height=True) != winHeight or pm.windowPref(windowID, q=True,
                                                                                              width=True) != winWidth:
            pm.windowPref(windowID, remove=True)
    except:
        pass

    # creating window
    pm.window(windowID, title=u'Prism Tools | Ver 2018 / 06 / 06', widthHeight=(winWidth, winHeight))
    col = pm.columnLayout('MainColumn', width=400)
    # buttons for 2nd row
    AdvSke = pm.frameLayout(label=u'Advanced Skeleton', labelIndent=5, width=450, marginHeight=5, parent=col)
    ASRow = pm.rowLayout('row2', nc=5, width=450, parent = AdvSke)
    pm.text(label = '', width = 5, parent = ASRow)
    AS_button = partial(mel.eval, 'AdvancedSkeleton5')
    pm.iconTextButton(style = 'iconAndTextVertical',
                      image1 = r'\\p.sv\Tool\PrismTools\AdvancedSkeleton5Files\icons\AS5.png',
                      label = 'Adv Skeleton',
                      parent = ASRow,
                      command = AS_button,
                      width = 75)
    picker_button = partial(mel.eval, 'source "//p.sv/Tool/PrismTools/AdvancedSkeleton5Files/Selector/biped.mel"')
    pm.iconTextButton(style='iconAndTextVertical',
                      image1=r'\\p.sv\Tool\PrismTools\AdvancedSkeleton5Files\icons\asBiped.png', label=u'Picker(仮)',
                      parent=ASRow,
                      command = picker_button,
                      width = 50)
    face_button = partial(mel.eval, 'source "//p.sv/Tool/PrismTools/AdvancedSkeleton5Files/Selector/face.mel"')
    pm.iconTextButton(style='iconAndTextVertical',
                      image1=r'\\p.sv\Tool\PrismTools\AdvancedSkeleton5Files\icons\asFace.png', label=u'Picker(仮)',
                      parent=ASRow,
                      command = face_button,
                      width = 50)
    pm.button('Prism Exporter',
              label = u'出力',
              width = 50,
              height = 50,
              backgroundColor=(0.6, 0.6, 0.6),
              parent = ASRow,
              command = Prism_AdvSkeExporter.ExporterWindow().UI_exporter)


    '''
    animFrame = pm.frameLayout(label=u'モーションツールス', labelIndent=5, width=450, marginHeight=5, parent=col)
    pm.rowLayout('row3', nc=5, width=450)
    pm.button('SER whipmake', label=u'SER 鞭リグ作る', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row3',
              command='whip = SERTools_001.whipMake_001.whipMake()')
    pm.button('SER fingerMirror_r', label=u'SER 指 右→左', width=75, height=20, backgroundColor=(0.6, 0.6, 0.6),
              parent='row3', command=FingerCopyPasta.rightFingerToLeft)
    pm.button('SER fingerMirror_l', label=u'SER 指 左→右', width=75, height=20, backgroundColor=(0.6, 0.6, 0.6),
              parent='row3', command=FingerCopyPasta.leftFingerToRight)
    pm.button('SER selectAll', label=u'SER select all', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6),
              parent='row3',
              command="import pymel.core as pm\npm.select('Character1_Ctrl_HeadEffector', 'Character1_Ctrl_RightShoulderEffector', 'Character1_Ctrl_LeftShoulderEffector', 'Character1_Ctrl_RightElbowEffector', 'Character1_Ctrl_LeftElbowEffector', 'Character1_Ctrl_RightKneeEffector', 'Character1_Ctrl_LeftKneeEffector', 'Character1_Ctrl_RightHipEffector', 'Character1_Ctrl_LeftHipEffector', 'Character1_Ctrl_ChestOriginEffector', 'Character1_Ctrl_ChestEndEffector', 'Character1_Ctrl_HipsEffector', 'Character1_Ctrl_Spine2', 'Character1_Ctrl_Spine1', 'Character1_Ctrl_Spine', 'Character1_Ctrl_RightUpLeg', 'Character1_Ctrl_RightLeg', 'Character1_Ctrl_LeftUpLeg', 'Character1_Ctrl_LeftLeg', 'Character1_Ctrl_RightShoulder', 'Character1_Ctrl_LeftShoulder', 'Character1_Ctrl_RightArm', 'Character1_Ctrl_RightForeArm', 'Character1_Ctrl_LeftArm', 'Character1_Ctrl_LeftForeArm', 'Character1_Ctrl_Neck', 'Character1_Ctrl_RightHandPinkyEffector', 'Character1_Ctrl_RightHandRingEffector', 'Character1_Ctrl_RightHandMiddleEffector', 'Character1_Ctrl_RightHandIndexEffector', 'Character1_Ctrl_RightHandThumbEffector', 'Character1_Ctrl_RightWristEffector', 'Character1_Ctrl_RightHandPinky3', 'Character1_Ctrl_RightHandPinky2', 'Character1_Ctrl_RightHandPinky1', 'Character1_Ctrl_RightHandRing3', 'Character1_Ctrl_RightHandRing2', 'Character1_Ctrl_RightHandRing1', 'Character1_Ctrl_RightHandMiddle3', 'Character1_Ctrl_RightHandMiddle2', 'Character1_Ctrl_RightHandMiddle1', 'Character1_Ctrl_RightHandIndex3', 'Character1_Ctrl_RightHandIndex2', 'Character1_Ctrl_RightHandIndex1', 'Character1_Ctrl_RightHandThumb3', 'Character1_Ctrl_RightHandThumb2', 'Character1_Ctrl_RightHandThumb1', 'Character1_Ctrl_RightHand', 'Character1_Ctrl_LeftHandPinkyEffector', 'Character1_Ctrl_LeftHandRingEffector', 'Character1_Ctrl_LeftHandMiddleEffector', 'Character1_Ctrl_LeftHandIndexEffector', 'Character1_Ctrl_LeftHandThumbEffector', 'Character1_Ctrl_LeftWristEffector', 'Character1_Ctrl_LeftHandPinky3', 'Character1_Ctrl_LeftHandPinky2', 'Character1_Ctrl_LeftHandPinky1', 'Character1_Ctrl_LeftHandRing3', 'Character1_Ctrl_LeftHandRing2', 'Character1_Ctrl_LeftHandRing1', 'Character1_Ctrl_LeftHandMiddle3', 'Character1_Ctrl_LeftHandMiddle2', 'Character1_Ctrl_LeftHandMiddle1', 'Character1_Ctrl_LeftHandIndex3', 'Character1_Ctrl_LeftHandIndex2', 'Character1_Ctrl_LeftHandIndex1', 'Character1_Ctrl_LeftHandThumb3', 'Character1_Ctrl_LeftHandThumb2', 'Character1_Ctrl_LeftHandThumb1', 'Character1_Ctrl_LeftHand', 'Character1_Ctrl_RightFootIndexEffector', 'Character1_Ctrl_RightAnkleEffector', 'Character1_Ctrl_RightFootIndex1', 'Character1_Ctrl_RightFoot', 'Character1_Ctrl_LeftFootIndexEffector', 'Character1_Ctrl_LeftAnkleEffector', 'Character1_Ctrl_LeftFootIndex1', 'Character1_Ctrl_LeftFoot')\npm.select('Helper_Weapon1', 'x', 'y', 'z', add = True)")
    pm.rowLayout('row4', nc=5, width=450, parent=animFrame)
    pm.button('SER WeaponRig', label=u'SER 武器リグ', width=150, height=20, backgroundColor=(0.6, 0.6, 0.6), parent='row4',
              command=Weapon_Rig.rigUI)
    '''
    pm.showWindow()
            def createWindow():
                """ try to get data from shotgun project fields
                    need to get context's project
                                context's shotgun instance
                """
                MODEL_EDITOR_PARAMS["cam"] = data
                app = self.parent
                project = app.context.project
                sg = app.context.tank.shotgun
                # set filters and search fields for entity type "Project"
                filters = [
                    ["id", "is", project['id']],
                ]
                fields = ["sg_width", "sg_height"]
                result = sg.find_one("Project", filters, fields)
                # with result, set parameters accordingly or use default otherwise
                if result:
                    videoWidth = result.get("sg_width", DEFAULT_WIDTH)
                    videoHeight = result.get("sg_height", DEFAULT_HEIGHT)

                # Find first camera matching pattern and set as active camera
                # if not use default current active camera
                camera_name_pattern = app.get_setting("camera_name_pattern",
                                                      "persp")
                cameraList = [
                    c.name() for c in pm.ls(type="camera", r=True)
                    if re.search(camera_name_pattern, c.name())
                ]
                if not "cam" in MODEL_EDITOR_PARAMS.keys() and cameraList:
                    MODEL_EDITOR_PARAMS["cam"] = cameraList[0]

                # Give Viewport 2.0 renderer only for Maya 2015++
                # mayaVersionString = cmds.about(version=True)
                # mayaVersion = int(mayaVersionString[:4]) if len(mayaVersionString) >= 4 else 0
                # if mayaVersion >= 2015:
                #     params[ "rendererName" ] = "vp2Renderer"

                # Create window
                if pm.windowPref(PLAYBLAST_WINDOW, exists=True):
                    pm.windowPref(PLAYBLAST_WINDOW, remove=True)
                window = pm.window(PLAYBLAST_WINDOW,
                                   titleBar=True,
                                   iconify=True,
                                   leftEdge=100,
                                   topEdge=100,
                                   width=videoWidth,
                                   height=videoHeight,
                                   sizeable=False)
                # Create editor area
                layout = pm.formLayout()
                editor = pm.modelEditor(**MODEL_EDITOR_PARAMS)
                pm.setFocus(editor)
                pm.formLayout(layout,
                              edit=True,
                              attachForm=((editor, "left", 0), (editor, "top",
                                                                0),
                                          (editor, "right", 0), (editor,
                                                                 "bottom", 0)))
                # Show window
                pm.setFocus(editor)
                pm.showWindow(window)
                pm.refresh()
                try:
                    yield True
                except:
                    traceback.print_exc()
                finally:
                    pm.deleteUI(window)
Esempio n. 48
0
import pymel.core as pm
import maya.cmds as cmds


def ToggleRenderLayer(*arg):
    renderLayerName = pm.textScrollList('renderLayers',
                                        query=True,
                                        selectItem=True)
    print renderLayerName[0]
    val = cmds.getAttr('%s.renderable' % renderLayerName[0])
    print val

    if val:
        cmds.setAttr('%s.renderable' % renderLayerName[0], 0)
    else:
        cmds.setAttr('%s.renderable' % renderLayerName[0], 1)


pm.window(title='Selecting Rendering Tool', width=200)
pm.columnLayout(adjustableColumn=True)

renderLayerlst = cmds.ls(type='renderLayer')
pm.textScrollList('renderLayers', append=renderLayerlst)

pm.button(label='On / Off Render Layer', command=ToggleRenderLayer)
pm.showWindow()
Esempio n. 49
0
def poseTest():

    #reading index and pose data
    indexPath = r'\\p.sv\Prism\project\SER\user\chew\ref\animPose\index_motion.index'
    indexRead = open(indexPath, 'r')
    index = {}
    for i in indexRead:
        index[i.split()[0]] = i.split(
        )[1]  #create a dictionary where the value of the first digit of the index is the key, which will be driven by the value of the slider
    indexRead.close()
    for i in index:
        dump = open(index[i], 'r')
        index[i] = []
        for j in dump:
            index[i].append(j)
        dump.close()
    #creating hand index
    indexHandPath = r'\\p.sv\Prism\project\SER\user\chew\ref\animPose\index_hand.index'
    indexHandRead = open(indexHandPath, 'r')
    handIndex = {}
    for i in indexHandRead:
        handIndex[i.split()[0]] = i.split(
        )[1]  #create a dictionary where the value of the first digit of the index is the key, which will be driven by the value of the slider
    indexHandRead.close()
    for i in handIndex:
        dump = open(handIndex[i], 'r')
        handIndex[i] = []
        for j in dump:
            handIndex[i].append(j)
        dump.close()
    #reading the number of poses available and setting the limits accordingly
    upperLimit = len(index)
    handUpperLimit = len(handIndex)

    def setPose(_):
        for i in index[str(
                cmds.intSliderGrp(bodySliderGrp, query=True, value=True))]:
            split = i.split()
            try:
                pm.xform(split[0],
                         translation=[split[1], split[2], split[3]],
                         rotation=[split[4], split[5], split[6]])
            except:
                print('xform failed')

    def dummyCommand(_):  #function nested inside
        print(cmds.intSliderGrp(bodySliderGrp, query=True, value=True))

    def setHandPose(_):
        for i in handIndex[str(
                cmds.intSliderGrp(handSliderGrp, query=True, value=True))]:
            split = i.split()
            try:
                pm.xform(split[0],
                         translation=[split[1], split[2], split[3]],
                         rotation=[split[4], split[5], split[6]])
            except:
                print('xform hand failed')

    def dummyCommand(_):  #function nested inside
        print(cmds.intSliderGrp(bodySliderGrp, query=True, value=True))

    def resetChar(_):
        #reading data from pose
        tPose = []
        dummyData = r'\\p.sv\Prism\project\SER\user\chew\ref\animPose\default.pose'
        readFile = open(dummyData, 'r')
        for i in readFile:
            tPose.append(i.rstrip('\n'))
        readFile.close()

        for i in tPose:
            split = i.split()
            pm.xform(split[0],
                     translation=[split[1], split[2], split[3]],
                     rotation=[split[4], split[5], split[6]])

    def resetCharTPose(_):
        #reading data from pose
        tPose = []
        dummyData = r'E:\ChewTools\SER\animPose\defaultPose_controlRig.pose'
        readFile = open(dummyData, 'r')
        for i in readFile:
            tPose.append(i.rstrip('\n'))
        readFile.close()

        for i in tPose:
            split = i.split()
            pm.xform(split[0],
                     translation=[split[1], split[2], split[3]],
                     rotation=[split[4], split[5], split[6]])

    #checking for duplicate windows
    windowID = 'poseTester'
    if pm.window(windowID, exists=True):
        pm.deleteUI(windowID)
        pm.windowPref('poseTester', remove=True)

    #creating window
    pm.window(windowID,
              title='SER Pose Tester | 2018/02/14',
              widthHeight=(600, 400))
    pm.columnLayout('columnLayout01', columnOffset=['left', 4])
    #pm.rowLayout( 'row1', nc = 5 )

    #buttons for first row
    poseFrame = pm.frameLayout(annotation='annotation test',
                               label='ポーズ',
                               labelIndent=5,
                               width=590,
                               parent='columnLayout01',
                               marginHeight=5)
    pm.rowLayout('row1', nc=5, width=400)
    handSliderGrp = pm.intSliderGrp(field=True,
                                    label=u'手ポーズ',
                                    minValue=0,
                                    maxValue=handUpperLimit - 1,
                                    value=0,
                                    adj=3,
                                    columnWidth3=[100, 50, 200],
                                    width=525,
                                    dragCommand=setHandPose)
    #buttons for 2nd row
    pm.rowLayout('row2', nc=2, parent='columnLayout01')
    bodySliderGrp = pm.intSliderGrp(field=True,
                                    label=u'全身ポーズ',
                                    minValue=0,
                                    maxValue=upperLimit - 1,
                                    value=0,
                                    adj=3,
                                    columnWidth3=[100, 50, 200],
                                    width=525,
                                    dragCommand=setPose)

    pm.rowLayout('row3', nc=2, parent='columnLayout01', width=590, height=50)
    pm.columnLayout('col_1', width=100, parent='row3')  #spacer
    pm.columnLayout('col_2', width=390, parent='row3')
    resetButton = pm.button('resetButton',
                            label=u'T ポーズに',
                            width=390,
                            height=20,
                            backgroundColor=(0.6, 0.6, 0.6),
                            parent='col_2',
                            command=resetChar)

    pm.rowLayout('row4', nc=2, parent='columnLayout01', width=590, height=50)
    pm.columnLayout('col_3', width=100, parent='row4')  #spacer
    pm.columnLayout('col_4', width=390, parent='row4')
    resetButton_ctrlRig = pm.button('ctrlRigReset',
                                    label=u'Control Rig T pose',
                                    width=390,
                                    height=20,
                                    backgroundColor=(0.6, 0.6, 0.6),
                                    parent='col_4',
                                    command=resetCharTPose)

    pm.showWindow()
    pm.window(windowID, edit=True, widthHeight=(600, 400))
Esempio n. 50
0
 def runWin(self):
     if pm.window('reNamer',ex=1):
         pm.deleteUI('reNamer') 
     getUi = pm.loadUI(f = allPath)
     pm.showWindow(getUi)
Esempio n. 51
0
def create_shots_from_scratch():
    shot_num_name = 'shotNumName'
    shot_length_name = 'shotLengthName'
    start_frame_name = 'startFrameName'
    end_frame_name = 'endFrameName'
    shot_name_name = 'shotNameName'

    def create_shots(with_cameras):
        cnt = 0
        while pm.textField('%s%s' % (shot_name_name, str(cnt)), ex=1):
            cnt += 1

        seqs = [
            seq for seq in pm.ls(type='sequencer')
            if seq.referenceFile() is None
        ]
        if len(pm.ls(type='sequencer')) != 1:
            raise RuntimeError('There must be 1 sequencer in a scene.')

        seq = seqs[0]
        for i in range(0, cnt):
            shot_node_name = pm.textField('%s%s' % (shot_name_name, str(i)),
                                          q=1,
                                          text=1)
            start_frame = pm.intField('%s%s' % (start_frame_name, str(i)),
                                      q=1,
                                      v=1)
            end_frame = pm.intField('%s%s' % (end_frame_name, str(i)),
                                    q=1,
                                    v=1)
            shot_num = pm.textField('%s%s' % (shot_num_name, str(i)),
                                    q=1,
                                    text=1)
            shot = pm.createNode('shot', n=shot_node_name)
            shot.setAttr('startFrame', start_frame)
            shot.setAttr('sequenceStartFrame', start_frame)
            shot.setAttr('endFrame', end_frame)
            shot.setAttr('shotName', shot_num)

            seq.add_shot(shot)

            if with_cameras:
                camera_name = '%s%s' % (pm.textField(
                    'camera_prefix_name', q=1, text=1), str(i + 1))
                cam = pm.mel.eval('camera -n "%s";' % camera_name)
                pm.PyNode(cam[1]).setAttr('farClipPlane', 1000000)
                pm.PyNode(cam[1]).setAttr('focalLength', 35)
                pm.PyNode(cam[0]).attr('scaleX').lock()
                pm.PyNode(cam[0]).attr('scaleY').lock()
                pm.PyNode(cam[0]).attr('scaleZ').lock()
                shot.set_camera(pm.PyNode(cam[1]))

    def set_parameters_from_length(*args):
        cnt = 0
        while pm.intField('%s%s' % (shot_length_name, str(cnt)), ex=1):
            cnt += 1

        for i in range(0, cnt):
            if i == 0:
                s_frame = pm.intField('%s%s' % (start_frame_name, str(i)),
                                      q=1,
                                      v=1)
                start_length = pm.intField('%s%s' % (shot_length_name, str(i)),
                                           q=1,
                                           v=1)
                pm.intField('%s%s' % (end_frame_name, str(i)),
                            e=1,
                            v=s_frame + start_length)
            else:
                prev_end_frame = pm.intField('%s%s' %
                                             (end_frame_name, str(i - 1)),
                                             q=1,
                                             v=1)
                pm.intField('%s%s' % (start_frame_name, str(i)),
                            e=1,
                            v=prev_end_frame + 1)
                start_length = pm.intField('%s%s' % (shot_length_name, str(i)),
                                           q=1,
                                           v=1)
                pm.intField('%s%s' % (end_frame_name, str(i)),
                            e=1,
                            v=prev_end_frame + 1 + start_length)

    def list_shots(*args):
        shot_num = pm.intFieldGrp('shotNum', q=1, v1=1)
        start_frame = pm.intFieldGrp('startFrame', q=1, v1=1)
        shot_count = pm.intFieldGrp('shotCount', q=1, v1=1)

        if len(str(shot_num)) < 2:
            raise RuntimeError('First Shot Number must be at east 2 digits.')

        for shot in pm.ls(type='shot'):
            try:
                cam = shot.get_camera()
                if cam.name() not in ['persp', 'top', 'front', 'side']:
                    pm.delete(cam)
            except:
                pm.delete(shot)

        for shot in pm.ls(type='shot'):
            pm.delete(shot)

        window_name = 'shot_creator_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        window_name = 'shot_list_window'
        if pm.window(window_name, q=True, ex=True):
            pm.deleteUI(window_name, wnd=True)

        shot_list_win = pm.window(window_name,
                                  title='Shot Creator',
                                  s=0,
                                  rtf=1)

        with pm.columnLayout():
            with pm.rowColumnLayout(nc=6,
                                    cw=[(1, 20), (2, 70), (3, 70), (4, 70),
                                        (5, 70), (6, 70)]):
                pm.text(l='')
                pm.text(l='Shot Num')
                pm.text(l='Length')
                pm.text(l='Start Frame')
                pm.text(l='End Frame')
                pm.text(l='Shot Name')

                for i in range(0, shot_count):

                    def checkbox_state(*args):
                        check_cnt = 0
                        while pm.checkBox('%s%s' %
                                          ('shotCheckBox', str(check_cnt)),
                                          ex=1):
                            check_cnt += 1

                        for k in range(0, check_cnt):
                            state = pm.checkBox('shotCheckBox%s' % str(k),
                                                q=1,
                                                v=1)
                            if not state:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=0)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=0)
                            else:
                                pm.textField('%s%s' % (shot_num_name, str(k)),
                                             e=1,
                                             en=1)
                                pm.textField('%s%s' % (shot_name_name, str(k)),
                                             e=1,
                                             en=1)

                    pm.checkBox('shotCheckBox%s' % str(i),
                                onc=checkbox_state,
                                ofc=checkbox_state)

                    shot_number = ''
                    for j in range(0, 4):
                        digit = len(str(shot_num))
                        if digit == 1:
                            shot_number = '000%s' % str(shot_num)
                        if digit == 2:
                            shot_number = '00%s' % str(shot_num)
                        if digit == 3:
                            shot_number = '0%s' % str(shot_num)
                        if digit == 4:
                            shot_number = '%s' % str(shot_num)

                    pm.textField('%s%s' % (shot_num_name, str(i)),
                                 text=str(shot_number),
                                 en=0)
                    shot_num += 10

                    pm.intField('%s%s' % (shot_length_name, str(i)),
                                cc=set_parameters_from_length,
                                v=1)

                    pm.intField('%s%s' % (start_frame_name, str(i)), en=0, v=1)
                    if i == 0:
                        pm.intField('%s%s' % (start_frame_name, str(i)),
                                    e=1,
                                    v=start_frame)

                    pm.intField('%s%s' % (end_frame_name, str(i)), en=0, v=1)

                    shot_node_name = 'shot%s' % str(i + 1)
                    pm.textField('%s%s' % (shot_name_name, str(i)),
                                 text=shot_node_name,
                                 en=0)

        with pm.columnLayout():

            def exec_create_shots(*args):
                state = pm.checkBox('camera_checkbox_name', q=1, v=1)
                if not state:
                    create_shots(False)
                else:
                    create_shots(True)

            pm.button(l='CREATE SHOTS', w=370, c=exec_create_shots)

        with pm.rowColumnLayout(nc=3,
                                cs=(3, 10),
                                cw=[(1, 60), (2, 120), (3, 100)]):
            pm.text(l='camPrefix')
            pm.textField('camera_prefix_name', text='camera__shotExp_', en=0)

            def checkbox_cameras(*args):
                state = pm.textField('camera_prefix_name', q=1, en=1)
                if not state:
                    pm.textField('camera_prefix_name', e=1, en=1)
                else:
                    pm.textField('camera_prefix_name', e=1, en=0)

            pm.checkBox('camera_checkbox_name',
                        l='create Cameras',
                        onc=checkbox_cameras,
                        ofc=checkbox_cameras)

        pm.showWindow(shot_list_win)

    window_name = 'shot_creator_window'
    if pm.window(window_name, q=True, ex=True):
        pm.deleteUI(window_name, wnd=True)

    window_name1 = 'shot_list_window'
    if pm.window(window_name1, q=True, ex=True):
        pm.deleteUI(window_name1, wnd=True)

    shot_creator_win = pm.window(window_name, title='Shot Creator', s=0, rtf=1)

    with pm.columnLayout():
        pm.intFieldGrp('shotNum', l='First Shot Number', cw2=(120, 80), v1=10)
        pm.intFieldGrp('startFrame', l='Start Frame', cw2=(120, 80), v1=0)
        pm.intFieldGrp('shotCount', l='Shot Count', cw2=(120, 80), v1=10)
        pm.button(l='LIST SHOTS', w=200, c=list_shots)
        pm.text(l='            All Shots will be deleted...')
        pm.text(l='            ...to start from scratch.')

    pm.showWindow(shot_creator_win)
Esempio n. 52
0
def rigUI(mayaFalse=False):
    windowID = 'weaponRig'  # checking if window already exists
    if pm.window(windowID, exists=True):
        pm.deleteUI(windowID)
        pm.windowPref('weaponRig', remove=True)
    pm.window(windowID, title=u'SER 武器RIG')
    masterTab = pm.tabLayout(innerMarginWidth=5, innerMarginHeight=5)

    # rig switching
    rigSwitchcol = pm.columnLayout(u'武器切り替え', width=400, parent=masterTab)
    switchFrame = pm.frameLayout(label=u'片手武器',
                                 labelIndent=5,
                                 marginHeight=5,
                                 parent=rigSwitchcol,
                                 nch=5)
    switchRow = pm.rowLayout('switchRow', nc=5, width=600)
    pm.button('global',
              label=u'→ グローバル',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=switchRow,
              command=weaponGlobal_single)
    pm.button('righthand',
              label=u'→ 右手',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=switchRow,
              command=migi)
    pm.button('lefthand',
              label=u'→ 左手',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=switchRow,
              command=hidari)

    switchFrame2 = pm.frameLayout(label=u'二丁武器',
                                  labelIndent=5,
                                  marginHeight=5,
                                  parent=rigSwitchcol,
                                  nch=5)
    twosword_1 = pm.rowLayout('test', nc=5, width=600, parent=switchFrame2)
    pm.button('global',
              label=u'右 → グローバル',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twosword_1,
              command=right_global)
    pm.button('right-right',
              label=u'右 → 右',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twosword_1,
              command=right_right)
    pm.button('right-left',
              label=u'右 → 左',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twosword_1,
              command=right_left)
    twosword_2 = pm.rowLayout('2hand_2', nc=5, width=600, parent=switchFrame2)
    pm.button('left-global',
              label=u'左 → グローバル',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twosword_2,
              command=left_global)
    pm.button('left-left',
              label=u'左 → 右',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twosword_2,
              command=left_right)
    pm.button('left-right',
              label=u'左 → 左',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twosword_2,
              command=left_left)

    switchFrame3 = pm.frameLayout(label=u'両手武器',
                                  labelIndent=5,
                                  marginHeight=5,
                                  parent=rigSwitchcol,
                                  nch=5)

    twohand_3 = pm.rowLayout('switchRow2h_3',
                             nc=5,
                             width=600,
                             parent=switchFrame3)
    pm.text(label=u'Aux ON/OFF', parent=twohand_3, width=100)
    twohand_3a = pm.rowLayout('switchRow2h_3a',
                              nc=5,
                              width=600,
                              parent=switchFrame3)
    pm.text(label=u'', parent=twohand_3a, width=10)
    pm.text(label=u'Aux のキーはタイムラインに見えないので、気を付けてください。',
            parent=twohand_3a,
            width=500,
            align='left')

    twohand_4 = pm.rowLayout('switchRow2h_4',
                             nc=5,
                             width=600,
                             parent=switchFrame3)
    pm.button('lhAuxOff',
              label=u'右手 → Aux Off',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twohand_4,
              command=auxOffRight)
    pm.button('rhAuxOff',
              label=u'左手 → Aux Off',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twohand_4,
              command=auxOffLeft)

    twohand_5 = pm.rowLayout('switchRow2h_5',
                             nc=5,
                             width=600,
                             parent=switchFrame3)
    pm.button('lhAuxOn',
              label=u'右手 → Aux On',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twohand_5,
              command=auxOnRight)
    pm.button('rhAuxOn',
              label=u'左手 → Aux On',
              width=112.5,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twohand_5,
              command=auxOnLeft)
    # rig creating
    rigMakeCol = pm.columnLayout(u'リグ作り', width=400, parent=masterTab)
    oneHandFrame = pm.frameLayout(label=u'片手武器リグ作り',
                                  labelIndent=5,
                                  marginHeight=5,
                                  parent=rigMakeCol,
                                  nch=5)
    oneHandRow = pm.rowLayout('oneHandRow',
                              nc=5,
                              width=600,
                              parent=oneHandFrame)
    # pm.button( 'locator', label = u'ロケーターを作る', width = 150, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = oneHandRow, command = locatorMake)
    pm.button('rig',
              label=u'リグを作る',
              width=150,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=oneHandRow,
              command=rigMake)

    twoSwordFrame = pm.frameLayout(label=u'二丁武器リグ作り',
                                   labelIndent=5,
                                   marginHeight=5,
                                   parent=rigMakeCol,
                                   nch=5)
    # twoSwordRow1 = pm.rowLayout( 'twoSwordRow1', nc = 5, width = 600, parent = twoSwordFrame)
    # pm.button( 'locatorR', label = u'右ロケーターを作る', width = 150, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = twoSwordRow1, command = locatorMake_R)
    # pm.button( 'locatorL', label = u'左ロケーターを作る', width = 150, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = twoSwordRow1, command = locatorMake_L)
    twoSwordRow2 = pm.rowLayout('twoSwordRow2',
                                nc=5,
                                width=600,
                                parent=twoSwordFrame)
    pm.button('rigR',
              label=u'右リグを作る',
              width=150,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twoSwordRow2,
              command=rigMake_R)
    pm.button('rigL',
              label=u'左リグを作る',
              width=150,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twoSwordRow2,
              command=rigMake_L)

    twoHandFrame = pm.frameLayout(label=u'両手武器リグ作り',
                                  labelIndent=5,
                                  marginHeight=5,
                                  parent=rigMakeCol,
                                  nch=5)
    twoHandRow = pm.rowLayout('twoHandRow',
                              nc=5,
                              width=600,
                              parent=twoHandFrame)
    #pm.button( 'twohandLocator', label = u'ロケーターを作る', width = 150, height = 20, backgroundColor = ( 0.6, 0.6, 0.6), parent = twoHandRow, command = locatorMake)
    pm.button('twoHandRig',
              label=u'リグを作る',
              width=150,
              height=20,
              backgroundColor=(0.6, 0.6, 0.6),
              parent=twoHandRow,
              command=rigMake_2hand)
    pm.showWindow()
    pm.window(windowID, edit=True, widthHeight=(500, 400))
Esempio n. 53
0
    def build_ui(self):
        """builds the ui window"""

        tool_window = pm.window(self.window_id,
                                title="scalist",
                                width=368,
                                height=295,
                                mnb=True,
                                mxb=True,
                                sizeable=True)
        main_layout = pm.rowColumnLayout(w=368, h=295)

        # get the header image from the user's prefs
        imagePath = pm.internalVar(upd=True) + "icons/scalist.png"
        pm.image(w=225, h=75, image=imagePath)

        # scale amount slider
        user_scale = pm.floatSliderGrp(label='Amount',
                                       field=True,
                                       precision=2,
                                       width=363,
                                       minValue=-2.0,
                                       maxValue=5.0,
                                       v=1.0,
                                       fieldMinValue=-10.0,
                                       fieldMaxValue=10.0)

        # scale preset buttons
        btn_layout = pm.rowColumnLayout(nc=11)

        btn_1 = pm.button(label='-1',
                          w=33,
                          bgc=self.rgb([231, 205, 59]),
                          c=pm.Callback(self.update_slider, user_scale, -1))
        btn_2 = pm.button(label='.25',
                          w=33,
                          c=pm.Callback(self.update_slider, user_scale, 0.25))
        btn_3 = pm.button(label='.50',
                          w=33,
                          c=pm.Callback(self.update_slider, user_scale, 0.5))
        btn_4 = pm.button(label='.75',
                          w=33,
                          c=pm.Callback(self.update_slider, user_scale, 0.75))
        btn_5 = pm.button(label='.90',
                          w=33,
                          c=pm.Callback(self.update_slider, user_scale, 0.9))
        btn_6 = pm.button(label='reset',
                          w=33,
                          bgc=self.rgb([231, 205, 59]),
                          c=pm.Callback(self.update_slider, user_scale, 1.0))
        btn_7 = pm.button(label='1.1',
                          w=33,
                          bgc=self.rgb([215, 215, 215]),
                          c=pm.Callback(self.update_slider, user_scale, 1.1))
        btn_8 = pm.button(label='1.25',
                          w=33,
                          bgc=self.rgb([215, 215, 215]),
                          c=pm.Callback(self.update_slider, user_scale, 1.25))
        btn_9 = pm.button(label='1.5',
                          w=33,
                          bgc=self.rgb([215, 215, 215]),
                          c=pm.Callback(self.update_slider, user_scale, 1.5))
        btn_10 = pm.button(label='1.75',
                           w=33,
                           bgc=self.rgb([215, 215, 215]),
                           c=pm.Callback(self.update_slider, user_scale, 1.75))
        btn_11 = pm.button(label='x2',
                           w=33,
                           bgc=self.rgb([231, 205, 59]),
                           c=pm.Callback(self.update_slider, user_scale, 2.0))

        # headers
        pm.setParent(main_layout)
        pm.separator(style='none', h=5)
        categories = pm.rowColumnLayout(nc=3)
        pm.text(label='Value',
                w=177,
                font='boldLabelFont',
                bgc=self.rgb([231, 205, 59]))
        pm.separator(style='single', w=10)
        pm.text(label='Time',
                w=179,
                font='boldLabelFont',
                bgc=self.rgb([20, 20, 20]))
        pm.separator(style='none', h=5)
        pm.separator(style='single', w=10)
        pm.separator(style='none', h=5)

        # pivot buttons
        pm.setParent('..')
        pivot_buttons = pm.rowColumnLayout(nc=5)
        pb1 = pm.button(label='Mid',
                        w=88,
                        annotation='Scaled from midpoint value of curve',
                        bgc=self.rgb([215, 215, 215]),
                        command=pm.Callback(do_scale, 'pivot_middle_value',
                                            user_scale, 'scale_keys_value'))
        pb2 = pm.button(label='Multi',
                        w=89,
                        annotation='Each curve scaled from its own midpoint',
                        bgc=self.rgb([45, 45, 45]),
                        command=pm.Callback(do_scale, 'pivot_middle_value',
                                            user_scale,
                                            'scale_keys_value_multi'))
        pm.separator(style='single', w=10)
        pb3 = pm.button(label='First',
                        w=87,
                        annotation='Scaled from first frame of selection',
                        bgc=self.rgb([120, 120, 120]),
                        command=pm.Callback(do_scale, 'pivot_first_time',
                                            user_scale, 'scale_keys_time'))
        pb4 = pm.button(label='Multi',
                        w=88,
                        annotation='Each curve scaled from its first frame',
                        bgc=self.rgb([45, 45, 45]),
                        command=pm.Callback(do_scale, 'pivot_first_time',
                                            user_scale,
                                            'scale_keys_time_multi'))
        pb5 = pm.button(
            label='Highest',
            w=87,
            annotation='Scaled from the highest key value selected',
            bgc=self.rgb([215, 215, 215]),
            command=pm.Callback(do_scale, 'pivot_highest_value', user_scale,
                                'scale_keys_value'))
        pb6 = pm.button(
            label='Multi',
            w=88,
            annotation='Each curve scaled from its highest selected key',
            bgc=self.rgb([45, 45, 45]),
            command=pm.Callback(do_scale, 'pivot_highest_value', user_scale,
                                'scale_keys_value_multi'))
        pm.separator(style='single', w=10)
        pb7 = pm.button(label='Last',
                        w=89,
                        annotation='Scaled from last frame of selection',
                        bgc=self.rgb([120, 120, 120]),
                        command=pm.Callback(do_scale, 'pivot_last_time',
                                            user_scale, 'scale_keys_time'))
        pb8 = pm.button(label='Multi',
                        w=88,
                        annotation='Each curve scaled from its last frame',
                        bgc=self.rgb([45, 45, 45]),
                        command=pm.Callback(do_scale, 'pivot_last_time',
                                            user_scale,
                                            'scale_keys_time_multi'))
        pb9 = pm.button(label='Lowest',
                        w=87,
                        annotation='Scaled from the lowest key value selected',
                        bgc=self.rgb([215, 215, 215]),
                        command=pm.Callback(do_scale, 'pivot_lowest_value',
                                            user_scale, 'scale_keys_value'))
        pb10 = pm.button(
            label='Multi',
            w=88,
            annotation='Each curve scaled from its lowest selected key',
            bgc=self.rgb([45, 45, 45]),
            command=pm.Callback(do_scale, 'pivot_lowest_value', user_scale,
                                'scale_keys_value_multi'))
        pm.separator(style='single', w=10)
        pb11 = pm.button(
            label='Current',
            w=89,
            annotation='Scaled from the current frame in timerange',
            bgc=self.rgb([120, 120, 120]),
            command=pm.Callback(do_scale, 'pivot_current_time', user_scale,
                                'scale_keys_time'))
        pm.separator(style='none')
        pb12 = pm.button(label='0',
                         w=87,
                         annotation='Scaled from 0',
                         bgc=self.rgb([215, 215, 215]),
                         command=pm.Callback(do_scale, 'pivot_zero_value',
                                             user_scale, 'scale_keys_value'))
        pm.separator(style='none')
        pm.separator(style='single', w=10)
        pb13 = pm.button(
            label='Last Selected',
            w=89,
            annotation='Scaled in time from the last selected key frame',
            bgc=self.rgb([120, 120, 120]),
            command=pm.Callback(do_scale, 'pivot_last_selected_time',
                                user_scale, 'scale_keys_time'))
        pm.separator(style='none')
        pb14 = pm.button(
            label='Last Selected',
            w=87,
            annotation='Scaled in value from the last selected key',
            bgc=self.rgb([215, 215, 215]),
            command=pm.Callback(do_scale, 'pivot_last_selected_value',
                                user_scale, 'scale_keys_value'))
        pm.separator(style='none')
        pm.separator(style='single', w=10)
        pm.separator(style='in')
        pm.separator(style='in')
        pb15 = pm.button(
            label='First',
            w=87,
            annotation='Each curve selected from its earliest selected key',
            bgc=self.rgb([215, 215, 215]),
            command=pm.Callback(do_scale, 'pivot_first_value', user_scale,
                                'scale_keys_value_multi'))
        pm.separator(style='none')
        pm.separator(style='single', w=10)

        pb16 = pm.button(
            label='Flip Mid',
            w=77,
            annotation='Flip each selected curve along its midpoint value',
            bgc=self.rgb([231, 205, 59]),
            command=pm.Callback(do_scale, 'pivot_flip_curve_value', user_scale,
                                'scale_keys_value_multi'))

        pb17 = pm.button(label='Flip 0',
                         w=77,
                         annotation='Flip each selected curve over 0',
                         bgc=self.rgb([231, 205, 59]),
                         command=pm.Callback(do_scale, 'pivot_flip_zero_value',
                                             user_scale, 'scale_keys_value'))

        pm.setParent('..')
        pm.separator(h=10, style='in')

        pm.showWindow(tool_window)
Esempio n. 54
0
    def create(self, stationary_count, offset_count):
        '''
        Create the fgshooter window.
        '''
        if pm.window(self.window_name, exists=True):
            pm.deleteUI(self.window_name)
        pm.window(self.window_name, title=self.window_title)

        main_form = pm.formLayout(numberOfDivisions=2)
        self.column = pm.columnLayout(adjustableColumn=True)

        # Render Camera
        self.render_camera_field = pm.checkBoxGrp(
            label="Include Render Camera",
            value1=self.render_camera,
            changeCommand=self.updateRenderCamera)

        # Stationary Cameras
        pm.separator(height=20, style="in")

        pm.rowLayout(numberOfColumns=3,
                     columnWidth3=(140, 80, 80),
                     columnAlign=(1, 'right'),
                     columnAttach3=("right", "both", "both"))
        pm.text("Stationary Cameras")
        self.stationary_field = pm.intField(value=stationary_count)
        pm.button(label="Update", height=22, command=self.update)
        pm.setParent('..')

        self.stationary = []
        i = 0
        while i < stationary_count:
            self.stationary.append(
                pm.floatFieldGrp(value1=self.stationary_frames[i],
                                 label="frame"))
            i += 1

        # Offset Cameras
        pm.separator(height=20, style="in")

        pm.rowLayout(numberOfColumns=3,
                     columnWidth3=(140, 80, 80),
                     columnAlign=(1, 'right'),
                     columnAttach3=("right", "both", "both"))
        pm.text("Offset Cameras")
        self.offset_field = pm.intField(value=offset_count)
        pm.button(label="Update", height=22, command=self.update)
        pm.setParent('..')

        self.offset = []
        i = 0
        while i < offset_count:
            self.offset.append(
                pm.intFieldGrp(value1=self.offset_frames[i],
                               label="frame offset"))
            i += 1

        pm.setParent('..')

        # remove/apply buttons
        self.remove_button = pm.button(label="Remove All",
                                       height=30,
                                       command=self.remove)
        self.apply_button = pm.button(label="Apply / Refresh",
                                      height=30,
                                      command=self.apply)

        pm.formLayout(main_form,
                      edit=True,
                      attachForm=[(self.column, "top", 2),
                                  (self.column, "left", 2),
                                  (self.column, "right", 2),
                                  (self.remove_button, "bottom", 2),
                                  (self.remove_button, "left", 2),
                                  (self.apply_button, "bottom", 2),
                                  (self.apply_button, "right", 2)],
                      attachControl=(self.remove_button, "right", 1,
                                     self.apply_button),
                      attachPosition=[(self.remove_button, "right", 0, 1),
                                      (self.apply_button, "left", 1, 1)])

        pm.setParent('..')
        pm.showWindow()
Esempio n. 55
0
 def create(self):
     """Main UI function
     @ usage: AO2PRigSetup.ui()
     :return: None
     """
     # check the window exists before creating the new one
     if pm.window(self.window, exists=True):
         pm.deleteUI(self.window, window=True)
     # window UI
     self.window = pm.window(self.window,
                             title=self.title,
                             wh=self.size,
                             s=False)
     # main from is formLayout
     self.main_form = pm.formLayout()
     # first frameLayout for locators panel
     self.locators_frame = pm.frameLayout(label='Locators')
     pm.columnLayout(w=self.size[0] / 2 - 2,
                     h=self.size[1] / 2 - 2,
                     cw=self.size[0] / 2 - 2)
     pm.separator(h=5)
     # start locator panels
     pm.text(label='Start Locator', w=self.size[0] / 2 - 2, h=30)
     self.select_sloc_field = pm.textFieldButtonGrp(
         ed=False,
         w=self.size[0] / 2 - 2,
         h=30,
         bl='Select',
         cl3=['left', 'left', 'left'],
         cw=[1, self.size[0] / 2 - 50],
         bc=self._select_start_loc)
     # end locator panels
     pm.text(label='End Locator', w=self.size[0] / 2 - 2, h=30)
     self.select_eloc_field = pm.textFieldButtonGrp(
         ed=False,
         w=self.size[0] / 2 - 2,
         h=30,
         bl='Select',
         cl3=['left', 'left', 'left'],
         cw=[1, self.size[0] / 2 - 50],
         bc=self._select_end_loc)
     pm.setParent(self.main_form)
     # second part and type frameLayout
     self.part_n_type_frame = pm.frameLayout(label='Part & Type')
     pm.columnLayout(w=self.size[0] / 2 - 2,
                     h=self.size[1] / 2 - 2,
                     cw=self.size[0] / 2 - 2)
     pm.separator(h=5)
     # part radio button panel
     self.part_radio_btn = pm.radioButtonGrp(
         label='Part',
         labelArray3=['Neck', 'Spine', 'Tail'],
         nrb=3,
         vr=True,
         w=self.size[0] / 2 - 2,
         cl2=['center', 'left'],
         cw2=[self.size[0] / 4 - 20, self.size[0] / 4],
         cc=self.get_parts_cmd)
     pm.separator(h=5)
     # type radio button panel
     self.type_radio_btn = pm.radioButtonGrp(
         label='Type',
         labelArray3=['FK', 'IK', 'IK DRIVER'],
         nrb=3,
         vr=True,
         w=self.size[0] / 2 - 2,
         cl2=['center', 'left'],
         cw2=[self.size[0] / 4 - 20, self.size[0] / 4],
         cc=self.get_types_cmd)
     # third ctrl numbers and crv types frameLayout
     pm.setParent(self.main_form)
     self.sub_selection_frame = pm.frameLayout(
         label='Ctrl Numbers & Crv Types')
     pm.columnLayout(adj=True)
     pm.separator(h=5)
     # ctrl numbers menu panel
     self.ctrl_number_menu = pm.optionMenuGrp('Ctrl Numbers Menu',
                                              label='Ctrl Numbers Menu:',
                                              w=self.size[0] - 2,
                                              h=30)
     fill_menu(self.ctrl_nums)
     # ctrl types menu panel
     self.crv_types_menu = pm.optionMenuGrp('Crv Types Menu',
                                            label='Curve Types Menu:',
                                            w=self.size[0] - 2,
                                            h=30)
     fill_menu(self.crv_types)
     pm.separator(h=5)
     # color palette panel
     self.color_palette = pm.palettePort(dim=(16, 2),
                                         t=0,
                                         w=self.size[0] - 2,
                                         h=30,
                                         topDown=True,
                                         ced=True)
     fill_color_palette(self.color_palette)
     pm.separator(h=5)
     # run button
     pm.button(label='Run', w=self.size[0], h=30, c=self.do_selection_cmd)
     pm.separator(h=5)
     # quit button
     pm.button(label='QUIT', w=self.size[0], h=30, c=self.quit_btn_cmd)
     # organize all the layouts together under the mainForm of the window
     ac = []
     af = []
     ac.append([self.part_n_type_frame, 'left', 0, self.locators_frame])
     ac.append([self.locators_frame, 'bottom', 0, self.sub_selection_frame])
     af.append([self.locators_frame, 'left', 0])
     af.append([self.locators_frame, 'top', 0])
     af.append([self.part_n_type_frame, 'right', 0])
     af.append([self.part_n_type_frame, 'top', 0])
     af.append([self.sub_selection_frame, 'left', 0])
     af.append([self.sub_selection_frame, 'right', 0])
     af.append([self.sub_selection_frame, 'bottom', 0])
     pm.formLayout(self.main_form, e=True, attachControl=ac, attachForm=af)
     # create the window
     pm.showWindow(self.window)
     # resize it
     pm.window(self.window, e=True, wh=self.size)
Esempio n. 56
0
def gui():
    if pm.window(new_window, q=True, exists=True):
        pm.deleteUI(new_window)
    if pm.windowPref(new_window, q=True, exists=True):
        pm.windowPref(new_window, r=True)
    main_window = pm.window(new_window, t='Auto Arm Rig', w=200, h=250)
    main_layout = pm.frameLayout("Auto FKIK Arm Tool")
    column_layout = pm.columnLayout()

    # Naming Setup Options
    pm.text("naming_setup_label", l="Step 1: Naming Setup ")
    pm.rowColumnLayout(numberOfColumns=3, cs=[(3, 10)])
    pm.text("appendage_name_label", l="Appendage Name: ")
    pm.textField("appendage_name_input")
    pm.button("appendage_name_info_button",
              l="?",
              w=20,
              command="open_appendage_name_info")
    pm.setParent("..")
    pm.separator("naming_setup_separator", w=250, h=5)

    # Control Options
    pm.text("control_setup_label", l="Step 2: Pick Control Icons: ")
    pm.rowColumnLayout(numberOfColumns=2, cw=[(2, 100)], cs=[(2, 20)])

    pm.text("fk_icon_setup_label", l="FK Icon: ")
    pm.optionMenu("fk_icon_menu")
    pm.menuItem(label="Circle")
    pm.menuItem(label="Turn Arrows")

    pm.text("ik_icon_setup_label", l="IK Icon: ")
    pm.optionMenu("ik_icon_menu")
    pm.menuItem(label="Box")
    pm.menuItem(label="Four Arrows")

    pm.text("pv_icon_setup_label", l="PV Icon: ")
    pm.optionMenu("pv_icon_menu")
    pm.menuItem(label="Wire Sphere")
    pm.menuItem(label="Diamond")

    pm.text("settings_icon_setup_label", l="Settings Icon: ")
    pm.optionMenu("settings_icon_menu")
    pm.menuItem(label="Box")
    pm.menuItem(label="Diamond")

    pm.setParent("..")

    pm.separator("control_setup_separator", w=250, h=5)

    # Color Options
    pm.text("color_setup_label", l="Step 3: Pick Icon Colors: ")
    pm.rowColumnLayout(numberOfColumns=2, cw=[(2, 110)], cs=[(2, 13)])

    pm.text("fk_color_setup_label", l="FK Color: ")
    pm.optionMenu("fk_color_menu")
    pm.menuItem(label="Blue")
    pm.menuItem(label="Red")
    pm.menuItem(label="Yellow")

    pm.text("ik_color_setup_label", l="IK Color: ")
    pm.optionMenu("ik_color_menu")
    pm.menuItem(label="Blue")
    pm.menuItem(label="Red")
    pm.menuItem(label="Yellow")

    pm.text("settings_color_setup_label", l="Settings Color: ")
    pm.optionMenu("settings_color_menu")
    pm.menuItem(label="Blue")
    pm.menuItem(label="Red")
    pm.menuItem(label="Yellow")

    pm.setParent("..")
    pm.button("test_icons_button",
              l="Make Test Icons and Set Scale",
              w=250,
              command="make_test_icons()")

    pm.text("advanced_options_label", l="Step 4: Advanced Options: (WIP)")
    pm.rowColumnLayout(numberOfColumns=3, cw=[(1, 130)], cs=[(2, 13)])
    # TODO Squash Stretch
    pm.text("squash_stretch_label", l="Enable Squash/Stretch: ")
    pm.radioCollection("squash_stretch_radio_collection")
    pm.radioButton(label="On", en=False)
    pm.radioButton(label="Off", en=False)
    # TODO Twist Options
    pm.text("advanced_twist_label", l="Enable Advanced Twist: ")
    pm.radioCollection("advanced_twist_radio_collection")
    pm.radioButton(label="On", en=False)
    pm.radioButton(label="Off", en=False)

    pm.setParent("..")
    pm.button("finalize_button",
              l="Finalize and Make Arm",
              w=250,
              command="create_ik_fk_arm()")
    pm.showWindow()