Ejemplo n.º 1
0
 def sliderReset(self, model):
     #print self.camWH
     allWindow = list(
         set(mc.lsUI(wnd=True)) -
         set(['scriptEditorPanel1Window', 'MayaWindow']))
     #判断字典中是否保存的显示相机窗口,若没有保存在字典中
     for win in allWindow:
         if 'Model_Win' in win:
             if win not in self.camWH.keys():
                 win_H = mc.window(win, q=True, h=True)
                 win_W = mc.window(win, q=True, w=True)
                 self.camWH.update({win: [win_W, win_H]})
     field = mc.floatSliderButtonGrp('Scale', q=True, v=True)
     for key in self.camWH.keys():
         if mc.window(key, ex=True):
             #根据滑调设置窗口大小
             if model == 1:
                 newWin_W = field * self.camWH[key][0]
                 newWin_H = field * self.camWH[key][1]
                 mc.window(key, e=True, wh=[newWin_W, newWin_H])
             #根据按钮重置窗口
             elif model == 0:
                 mc.window(key,
                           e=True,
                           wh=[self.camWH[key][0], self.camWH[key][1]])
                 #print self.camWH
                 mc.floatSliderButtonGrp('Scale', e=True, v=1.0)
         else:
             del self.camWH[key]
Ejemplo n.º 2
0
def makeGui():
	# Make a new window
	cordMakerWindow = cmds.window('cordMaker', title="Hanging Cord Generator", iconName='cordMaker', widthHeight=(350, 100) )
	cmds.columnLayout('uiColWrapper', w = 350, adjustableColumn=False, parent = 'cordMaker' )
	cmds.floatSliderGrp('cordWeightRandomizeGrp', label='Weight Randomization', v = .25, min =0, max = 5, cw2 = [120,200], parent = 'cordMaker' )
	cmds.floatSliderGrp('cordWeightPointRandomization', label='Attach Randomization', v = .2, min =0, max = 5, cw2 = [120,200], parent = 'cordMaker' )
	cmds.floatSliderButtonGrp('cordWeightGrp', label='Cord Weight', field=True, pre = 2,v = .25, min =-10, max = 10, buttonLabel='Generate', cw4 = [75,50,146,5], bc = makeCord, parent = 'cordMaker' )

	cmds.button('backUp', label = "Revert to Selection", parent = 'uiColWrapper', en = 0, width = 334, c = recoverSel)
	
	cmds.showWindow( cordMakerWindow )
Ejemplo n.º 3
0
    def editPivotDriver(self, driver):

        self.pivotDriver = driver

        #get driver range
        node,attr = driver.split('.',1)
        value = mc.getAttr(driver)

        minValue = mc.attributeQuery(attr, node=node, minimum=True)[0]
        maxValue = mc.attributeQuery(attr, node=node, maximum=True)[0]

        #create a ui with a slider
        self.pivotDriverWindow = 'ml_pivot_editPivotDriverUI'

        if mc.window(self.pivotDriverWindow, exists=True):
            mc.deleteUI(self.pivotDriverWindow)
        window = mc.window(self.pivotDriverWindow, width=1, height=1)
        mc.columnLayout()
        self.floatSlider = mc.floatSliderButtonGrp(label=attr,
                                                   field=True,
                                                   value=value,
                                                   buttonLabel='Bake',
                                                   minValue=minValue,
                                                   maxValue=maxValue,
                                                   buttonCommand=self.doEditPivotDriver )
        mc.showWindow( window )
        mc.window(self.pivotDriverWindow, edit=True, width=1, height=1)
Ejemplo n.º 4
0
    def editPivotDriver(self, driver):

        self.pivotDriver = driver

        #get driver range
        node, attr = driver.split('.', 1)
        value = mc.getAttr(driver)

        minValue = mc.attributeQuery(attr, node=node, minimum=True)[0]
        maxValue = mc.attributeQuery(attr, node=node, maximum=True)[0]

        #create a ui with a slider
        self.pivotDriverWindow = 'ml_pivot_editPivotDriverUI'

        if mc.window(self.pivotDriverWindow, exists=True):
            mc.deleteUI(self.pivotDriverWindow)
        window = mc.window(self.pivotDriverWindow, width=1, height=1)
        mc.columnLayout()
        self.floatSlider = mc.floatSliderButtonGrp(
            label=attr,
            field=True,
            value=value,
            buttonLabel='Bake',
            minValue=minValue,
            maxValue=maxValue,
            buttonCommand=self.doEditPivotDriver)
        mc.showWindow(window)
        mc.window(self.pivotDriverWindow, edit=True, width=1, height=1)
Ejemplo n.º 5
0
    def doEditPivotDriver(self, *args):

        newValue = mc.floatSliderButtonGrp(self.floatSlider, query=True, value=True)
        try:
            mc.deleteUI(self.pivotDriverWindow)
        except:
            pass

        currentValue = mc.getAttr(self.pivotDriver)
        if newValue == currentValue:
            return

        oldRP = mc.getAttr(self.node+'.rotatePivot')[0]
        mc.setAttr(self.pivotDriver, newValue)
        newRP = mc.getAttr(self.node+'.rotatePivot')[0]
        mc.setAttr(self.pivotDriver, currentValue)

        parentPosition = mc.group(em=True)
        offsetPosition = mc.group(em=True)
        offsetPosition = mc.parent(offsetPosition, parentPosition)[0]
        mc.setAttr(offsetPosition+'.translate', newRP[0]-oldRP[0], newRP[1]-oldRP[1], newRP[2]-oldRP[2])

        mc.delete(mc.parentConstraint(self.node, parentPosition))

        utl.matchBake(source=[self.node], destination=[parentPosition], bakeOnOnes=True, maintainOffset=False, preserveTangentWeight=False)

        mc.cutKey(self.pivotDriver)
        mc.setAttr(self.pivotDriver, newValue)
        mc.refresh()
        utl.matchBake(source=[offsetPosition], destination=[self.node], bakeOnOnes=True, maintainOffset=False, preserveTangentWeight=False, rotate=False)

        mc.delete(parentPosition)
Ejemplo n.º 6
0
 def initialiseLayout(self):
     # Define Layout
     self.widgets["topLevelColumn"] = cmds.columnLayout(adj=True, rowSpacing=2, columnAttach = ['both', 5])
     
     self.widgets["prefix_textField"] = cmds.textFieldGrp(label="Prefix :", cw2=[50,180] )
     
     cmds.text(label="Select numbers of joint splits", align="left")
     self.widgets["split_slider"] = cmds.floatSliderButtonGrp(buttonLabel = "Split Joint", field = True, pre = 0, min = 2, max = 100, value=2, bc = self.splitJointCmd)
Ejemplo n.º 7
0
	def run(self):
		step = cmds.floatSliderButtonGrp(self.stepSlider,q=True,value=True)
		mesh = cmds.checkBox(self.meshCbx,q=True, value = True)
		radius = cmds.floatSliderGrp(self.bRadSlider,q=True,value=True)
		bmult = cmds.floatSliderGrp(self.baseMultSlider,q=True,value=True)
		taper = cmds.floatSliderGrp(self.taperSlider,q=True,value=True)
		tmult = cmds.floatSliderGrp(self.taperMultSlider,q=True,value=True)
		autoAdd = cmds.checkBox(self.autoAddCbx,q=True, value = True)
		meshDrawCtx(cmds.ls(sl=True,l=True),step,mesh,radius,bmult,taper,tmult,autoAdd).run()
Ejemplo n.º 8
0
def makeGui():
    # Make a new window
    cordMakerWindow = cmds.window('cordMaker',
                                  title="Hanging Cord Generator",
                                  iconName='cordMaker',
                                  widthHeight=(350, 100))
    cmds.columnLayout('uiColWrapper',
                      w=350,
                      adjustableColumn=False,
                      parent='cordMaker')
    cmds.floatSliderGrp('cordWeightRandomizeGrp',
                        label='Weight Randomization',
                        v=.25,
                        min=0,
                        max=5,
                        cw2=[120, 200],
                        parent='cordMaker')
    cmds.floatSliderGrp('cordWeightPointRandomization',
                        label='Attach Randomization',
                        v=.2,
                        min=0,
                        max=5,
                        cw2=[120, 200],
                        parent='cordMaker')
    cmds.floatSliderButtonGrp('cordWeightGrp',
                              label='Cord Weight',
                              field=True,
                              pre=2,
                              v=.25,
                              min=-10,
                              max=10,
                              buttonLabel='Generate',
                              cw4=[75, 50, 146, 5],
                              bc=makeCord,
                              parent='cordMaker')

    cmds.button('backUp',
                label="Revert to Selection",
                parent='uiColWrapper',
                en=0,
                width=334,
                c=recoverSel)

    cmds.showWindow(cordMakerWindow)
Ejemplo n.º 9
0
 def ProductionIterations(self,attr):
     # allObjects=mc.ls(sl=True)
     # print attr
     # updateAttrValue=mc.floatSliderButtonGrp(attr,q=True,v=True)
     # for obj in allObjects:
     #     mc.setAttr("%s.%s"%(obj,attr),updateAttrValue)
     updateAttrValue=mc.floatSliderButtonGrp(attr,q=True,v=True)
     allShapes = mc.ls(selection=True, dagObjects=True, ni=True, shapes=True, rq=True)
     for obj in allShapes:
         mc.setAttr("%s.%s"%(obj,attr),updateAttrValue)
Ejemplo n.º 10
0
    def Cam_Window_Scale(self):
        self.camWH.clear()
        allCamWin = []
        allWindow = list(
            set(mc.lsUI(wnd=True)) -
            set(['scriptEditorPanel1Window', 'MayaWindow']))
        for win in allWindow:
            if 'Model_Win' in win:
                allCamWin.append(win)
                win_H = mc.window(win, q=True, h=True)
                win_W = mc.window(win, q=True, w=True)
                self.camWH.update({win: [win_W, win_H]})

        if not allCamWin:
            mc.confirmDialog(t=u'提示', message=u'没有找到相机窗口!')
            if mc.window('Reset_Cam_Window_Scale1', ex=True):
                mc.deleteUI('Reset_Cam_Window_Scale1')
        else:
            if mc.window('Reset_Cam_Window_Scale1', ex=True):
                mc.deleteUI('Reset_Cam_Window_Scale1')
            mc.window('Reset_Cam_Window_Scale1',
                      t='Reset_Cam_Window_Scale',
                      wh=[100, 60],
                      sizeable=True,
                      rtf=True)
            mc.frameLayout(bs='etchedIn', label=u'重置相机窗口', h=40)
            mc.columnLayout()
            mc.floatSliderButtonGrp(
                'Scale',
                pre=True,
                v=1,
                label='Reset Scale',
                field=True,
                buttonLabel='RESET',
                min=0.3,
                max=3,
                symbolButtonDisplay=False,
                cl4=('left', 'left', 'left', 'left'),
                cw4=(60, 60, 180, 10),
                changeCommand=lambda *args: self.sliderReset(1),
                bc=lambda *args: self.sliderReset(0))
            mc.showWindow('Reset_Cam_Window_Scale1')
Ejemplo n.º 11
0
	def create(self):
		if cmds.window(self.winName,exists=True):
			cmds.deleteUI(self.winName)
		cmds.window(self.winName, title=self.winTitle)
		self.mainColumn = cmds.columnLayout()
		self.meshCbx = cmds.checkBox(label = 'Draw Mesh', value = False)
		self.bRadSlider = cmds.floatSliderGrp( label='Radius : ', field=True, columnWidth=(1, 100), min=0,max=10,value=1, pre = 1, fmn = 0, fmx = 9999 )
		self.baseMultSlider = cmds.floatSliderGrp( label='Base Drag Mult. : ', field=True, columnWidth=(1, 100), min=0,max=100,value=1, pre = 1, fmn = 0, fmx = 9999 )
		self.taperSlider = cmds.floatSliderGrp( label='Taper : ', field=True, columnWidth=(1, 100), min=0,max=1,value=1, pre = 2, fmn = 0, fmx = 9999 )
		self.taperMultSlider = cmds.floatSliderGrp( label='Taper Drag Mult. : ', field=True, columnWidth=(1, 100), min=0,max=100,value=.1, pre = 1, fmn = 0, fmx = 9999 )
		self.autoAddCbx = cmds.checkBox(label = 'Add current to Object list', value = False)
		self.stepSlider = cmds.floatSliderButtonGrp( label='Step : ', field=True, buttonLabel='Run', columnWidth=(1, 100), min=0,max=5,value=0.25, pre = 2, bc=self.run, fmn = 0, fmx = 9999 )
		
		# show window
		cmds.showWindow(self.winName)
Ejemplo n.º 12
0
def updateShaverAttr(isShave,attr):
	targetShave=""
	selectedOrAll=mc.radioButtonGrp("selectOrAll",q=True,sl=True)
	if selectedOrAll==1:
		targetShave=mc.ls(sl=True)
	else:
		targetShave=mc.ls(type="shaveHair")

	if isShave==1:
		updateAttrValue=mc.floatSliderButtonGrp(attr,q=True,v=True,pre=3)
		for Shave in targetShave:
			mc.setAttr("%s.%s"%(Shave,attr),updateAttrValue)
	elif isShave==2:
		updateAttrColor=mc.colorSliderButtonGrp(attr,q=True,rgb=True)
		for Shave in targetShave:
			mc.setAttr("%s.%s"%(Shave,attr),updateAttrColor[0],updateAttrColor[1],updateAttrColor[2])

#update_Shaver_Attr_UI()
Ejemplo n.º 13
0
    def doEditPivotDriver(self, *args):

        newValue = mc.floatSliderButtonGrp(self.floatSlider,
                                           query=True,
                                           value=True)
        try:
            mc.deleteUI(self.pivotDriverWindow)
        except:
            pass

        currentValue = mc.getAttr(self.pivotDriver)
        if newValue == currentValue:
            return

        oldRP = mc.getAttr(self.node + '.rotatePivot')[0]
        mc.setAttr(self.pivotDriver, newValue)
        newRP = mc.getAttr(self.node + '.rotatePivot')[0]
        mc.setAttr(self.pivotDriver, currentValue)

        parentPosition = mc.group(em=True)
        offsetPosition = mc.group(em=True)
        offsetPosition = mc.parent(offsetPosition, parentPosition)[0]
        mc.setAttr(offsetPosition + '.translate', newRP[0] - oldRP[0],
                   newRP[1] - oldRP[1], newRP[2] - oldRP[2])

        mc.delete(mc.parentConstraint(self.node, parentPosition))

        utl.matchBake(source=[self.node],
                      destination=[parentPosition],
                      bakeOnOnes=True,
                      maintainOffset=False,
                      preserveTangentWeight=False)

        mc.cutKey(self.pivotDriver)
        mc.setAttr(self.pivotDriver, newValue)
        mc.refresh()
        utl.matchBake(source=[offsetPosition],
                      destination=[self.node],
                      bakeOnOnes=True,
                      maintainOffset=False,
                      preserveTangentWeight=False,
                      rotate=False)

        mc.delete(parentPosition)
Ejemplo n.º 14
0
    def splitJointCmd (self, *args) :
        # Get Selected Objects
        selection = cmds.ls (sl = True, type="joint")

        # Error Checking
        if len(selection) == 0:
            raise Warning ("No Joint in Selection")
            return
            
        # Get UI Input    
        split = cmds.floatSliderButtonGrp (self.widgets["split_slider"], q= True, v = True)
        prefix = cmds.textFieldGrp (self.widgets["prefix_textField"], q= True, tx = True)

        # Execute
        for joint in selection:

            if prefix == "" :
                prefix = joint
            
            splitJoint (joint, split, prefix)
    def _gui(self):
        self.__locators = mc.ls(type='locator')

        mc.columnLayout(columnAttach=('both', 5), adjustableColumn=True)
        mc.frameLayout(label='Settings', borderStyle='out', h=100)
        self.__control = mc.floatSliderButtonGrp(label='Change Locator Size: ',
                                                 columnWidth=[(1, 150),
                                                              (2, 50), (3, 50),
                                                              (4, 200)],
                                                 field=True,
                                                 minValue=self.MinValue,
                                                 maxValue=self.MaxValue,
                                                 fieldMinValue=self.MinValue,
                                                 fieldMaxValue=self.MaxValue,
                                                 value=self.BestValue,
                                                 step=0.001,
                                                 dragCommand=self._apply,
                                                 buttonLabel='Reset Settings',
                                                 bc=self._resetSettings)

        mc.setParent('..')
        mc.setParent('..')
Ejemplo n.º 16
0
def update_Shaver_Attr_UI():
	if mc.window("update_Shaver_Attr_UI",ex=True):
		mc.deleteUI("update_Shaver_Attr_UI")
	mc.window("update_Shaver_Attr_UI",title=u"更新shaveHair的属性",tlc=[180,200],wh=[460,350])
	mc.scrollLayout("A",hst=0,vst=8)
	mc.rowLayout("defaultRowLayout",numberOfColumns=1,adjustableColumn=1,columnAttach=([1,"both",0],[2,"both",0]),columnWidth2=[400,300])
	mc.frameLayout(borderStyle="etchedIn",label="Shader Multi Editor")
	mc.columnLayout(adjustableColumn=True,rs=5,cal="left")
	mc.separator()
	mc.radioButtonGrp("selectOrAll",nrb=2,l="Target",labelArray2=['selected','All in Scene'],select=1,cw=([1,60],[2,70]))
	mc.separator()
	mc.floatSliderButtonGrp("rootThickness",pre=3,label=u"毛发根部大小(Root Thckness)",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(1,"rootThickness"))
	mc.floatSliderButtonGrp("tipThickness",pre=3,label=u"毛发尖端大小(Tip Thckness)",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(1,"tipThickness"))
	mc.floatSliderButtonGrp("specular",pre=3,label=u"高光(Specular)",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(1,"specular"))
	mc.colorSliderButtonGrp('specularTint2',label=u"二次高光(Secondary Specular)",buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(2,"specularTint2"))
	mc.colorSliderButtonGrp('hairColor',label=u"尖端颜色(Tip Color)",buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(2,"hairColor"))
	mc.colorSliderButtonGrp('rootColor',label=u"根部颜色(RootColor)",buttonLabel="UPDATE",symbolButtonDisplay=False,cw=([1,160],[2,60],[3,145]),image="navButtonUnconnected.xpm",bc=lambda*args:updateShaverAttr(2,"rootColor"))
	mc.showWindow('update_Shaver_Attr_UI')
Ejemplo n.º 17
0
    def __init__(self):

        if cmds.window(self.WINDOW_NAME, exists=True):
            cmds.deleteUI(self.WINDOW_NAME, window=True)

        # super(CtrlEditUI, self).__init__()
        # CurveChange.__init__(self)

        main_window = cmds.window(self.WINDOW_NAME,
                                  title="Curve Edit",
                                  rtf=True,
                                  menuBar=True)
        # main_layout = cmds.formLayout(parent = main_window)

        cmds.menu(label='Help', helpMenu=True)
        cmds.menuItem('Application..."', label='"About')

        cmds.radioButtonGrp("all_select_type",
                            label='select type:',
                            labelArray3=['select', 'hierarchy', 'all'],
                            numberOfRadioButtons=3,
                            columnWidth4=(80, 70, 70, 70),
                            select=1)

        cmds.frameLayout("Scale:",
                         collapsable=True,
                         labelVisible=1,
                         marginWidth=5,
                         marginHeight=5,
                         borderStyle='etchedOut')
        cmds.columnLayout(adj=1)

        cmds.separator(height=10, style='in')

        shrink_button = cmds.button(label="shrink",
                                    h=25,
                                    command="shrinkCon()")

        magnify_button = cmds.button(label="magnify",
                                     h=25,
                                     command="magnifyCon()")

        scale_slider = cmds.floatSliderButtonGrp('scaleFSBG',
                                                 label='curve scale : ',
                                                 field=True,
                                                 minValue=-10,
                                                 maxValue=10,
                                                 fieldMaxValue=10,
                                                 value=1,
                                                 buttonLabel='CurveScale',
                                                 buttonCommand='changScale',
                                                 columnWidth4=(80, 70, 70, 10))

        cmds.separator(height=10, style='in')

        cmds.setParent('..')

        cmds.frameLayout("Translate:",
                         collapsable=True,
                         labelVisible=1,
                         marginWidth=5,
                         marginHeight=5,
                         borderStyle='stchedOut')
        cmds.separator(height=10, style='in')
        tran_x_slider = cmds.floatSliderGrp('tran_x_FSG',
                                            label='X : ',
                                            field=True,
                                            minValue=-10,
                                            maxValue=10,
                                            fieldMaxValue=10,
                                            value=0,
                                            columnWidth3=(20, 50, 10))
        tran_y_slider = cmds.floatSliderGrp('tran_y_FSG',
                                            label='Y : ',
                                            field=True,
                                            minValue=-10,
                                            maxValue=10,
                                            fieldMaxValue=10,
                                            value=0,
                                            columnWidth3=(20, 50, 10))
        tran_z_slider = cmds.floatSliderGrp('tran_z_FSG',
                                            label='Z : ',
                                            field=True,
                                            minValue=-10,
                                            maxValue=10,
                                            fieldMaxValue=10,
                                            value=0,
                                            columnWidth3=(20, 50, 10))
        tran_button = cmds.button(label="move", h=25, command="changeTran()")

        cmds.separator(height=10, style='in')

        cmds.frameLayout("Rotate:",
                         collapsable=True,
                         labelVisible=1,
                         marginWidth=5,
                         marginHeight=5,
                         borderStyle='stchedOut')
        cmds.separator(height=10, style='in')
        rot_x_slider = cmds.floatSliderGrp('rot_x_FSG',
                                           label='X : ',
                                           field=True,
                                           minValue=-10,
                                           maxValue=10,
                                           fieldMaxValue=10,
                                           value=0,
                                           columnWidth3=(20, 50, 10))
        rot_y_slider = cmds.floatSliderGrp('rot_y_FSG',
                                           label='Y : ',
                                           field=True,
                                           minValue=-10,
                                           maxValue=10,
                                           fieldMaxValue=10,
                                           value=0,
                                           columnWidth3=(20, 50, 10))
        rot_z_slider = cmds.floatSliderGrp('rot_z_FSG',
                                           label='Z : ',
                                           field=True,
                                           minValue=-10,
                                           maxValue=10,
                                           fieldMaxValue=10,
                                           value=0,
                                           columnWidth3=(20, 50, 10))
        rot_button = cmds.button(label="rotate",
                                 h=25,
                                 command="changeRotate()")

        cmds.separator(height=10, style='in')

        cmds.frameLayout("Shape:",
                         collapsable=True,
                         labelVisible=1,
                         marginWidth=5,
                         marginHeight=5,
                         borderStyle='stchedOut')
        cmds.separator(height=10, style='in')
        shape_button = cmds.button(label="changeShape",
                                   h=25,
                                   command="changeShape()")
        cmds.separator(height=10, style='in')

        cmds.frameLayout("Color:",
                         collapsable=True,
                         labelVisible=1,
                         marginWidth=5,
                         marginHeight=5,
                         borderStyle='stchedOut')
        cmds.separator(height=10, style='in')
        red_button = cmds.button(label="red", h=25, command="redColorSet()")
        yellow_button = cmds.button(label="yellow",
                                    h=25,
                                    command="yellowColorSet()")
        blue_button = cmds.button(label="blue",
                                  h=25,
                                  command="self.blueColorSet")
        color_slider = cmds.colorIndexSliderGrp('cvColorCISG',
                                                label='curve Color:',
                                                min=1,
                                                max=32,
                                                value=1,
                                                columnWidth3=(80, 50, 10))
        color_button = cmds.button(label="setColor",
                                   h=25,
                                   command="self.changeColor")
        cmds.separator(height=10, style='in')

        cmds.showWindow(main_window)
Ejemplo n.º 18
0
def makeCord():
	
	cordWeight = cmds.floatSliderButtonGrp('cordWeightGrp', q = True, v=True)
	randomWeightValue = cmds.floatSliderGrp('cordWeightRandomizeGrp', q=True, v=True)
	randomAttachValue = cmds.floatSliderGrp('cordWeightPointRandomization', q=True, v=True)

	curSel = cmds.ls(sl = 1, fl = 1)
	global recoverySel
	recoverySel = cmds.ls(sl = 1, fl = 1)
	curRange = range(len(cmds.ls(sl = 1, fl = 1)))
	ptList = []
	curveCode = ""

	for item in curRange:
		print item
		randomAttachPointX = rand.uniform(-randomAttachValue, randomAttachValue)
		randomAttachPointY = rand.uniform(-randomAttachValue, randomAttachValue)
		randomAttachPointZ = rand.uniform(-randomAttachValue, randomAttachValue)
		exec("cmds.select('" + str(curSel[item]) + "', r = 1)")
		exec("pt_" + str(curRange[item]) + " = cmds.xform(q = 1, ws = 1, t = 1)")
		print "pt_" + str(curRange[item])
		exec("print pt_" + str(curRange[item]))
		# exec("ptList.append(pt_" + str(curRange[item]) + ")")
		exec("tmp = " + "pt_" + str(curRange[item]))
		tmp = [(tmp[0] + randomAttachPointX), (tmp[1] + randomAttachPointY), (tmp[2] + randomAttachPointZ)]
		ptList.append(tmp)
		
	print ptList
	curveCode += "cmds.curve(d = 1, n = 'telephoneLine', p = ("
	for item in curRange:
		if (item != (1 - len(curRange))):
			curveCode += str(ptList[item]) + ", "
		else:
			curveCode += str(ptList[item])
	curveCode += "))"

	exec(curveCode)
	#------
	asd = .5
	curSel2 = cmds.ls(sl = 1, fl = 1)
	while(asd < (len(curRange) - 1)):
		cmds.select(curSel2[0], r = 1)
		cmds.insertKnotCurve(p = (asd), nk=1, rpo = 1)
		#cmds.select(curSel2[0], r = 1)
		#cmds.insertKnotCurve(p = (asd + .495), nk=1, rpo = 1)
		#cmds.select(curSel2[0], r = 1)
		#cmds.insertKnotCurve(p = (asd + .505), nk=1, rpo = 1)
		asd += 1

	asd = .5
	counter = 1
	while(asd < (len(curRange) - 1)):
		generatedRandomValue = rand.uniform(randomWeightValue*-1,randomWeightValue)
		# print generatedRandomValue
		exec("pt_before = cmds.xform('" + str(curSel2[0]) + ".cv[" + str(counter - 1) + "]', q = 1, t = 1)")
		exec("pt_after = cmds.xform('" + str(curSel2[0]) + ".cv[" + str(counter + 1) + "]', q = 1, t = 1)")
		distance = math.sqrt((pt_before[0]-pt_after[0])**2  + (pt_before[1]-pt_after[1])**2 + (pt_before[2]-pt_after[2])**2)
		exec("cmds.select('" + str(curSel2[0]) + ".cv[" + str(counter) + "]')")
		cmds.xform(r = 1, os = 1, t = [0,(distance * ((cordWeight + generatedRandomValue) * -1.00)),0])
		cmds.xform
		asd += 1
		counter += 2
		
	asd = .5
	cmds.select(curSel2[0], r = 1)
	while(asd < (len(curRange) - 1)):
		cmds.select(curSel2[0], r = 1)
		cmds.insertKnotCurve(p = (asd + .495), nk=1, rpo = 1)
		cmds.select(curSel2[0], r = 1)
		cmds.insertKnotCurve(p = (asd + .505), nk=1, rpo = 1)
		asd += 1
		
	cmds.select(curSel2[0], r = 1)
	cmds.rebuildCurve(ch=1, rpo=1, rt=0, end=1, kr=1, kcp=1, kep=0, kt=0, s=4, d=3, tol=0.01)
	if(len(recoverySel) < 1):
		cmds.button('backUp',e = 1, en = 0)
	else:
		cmds.button('backUp',e = 1, en = 1)
Ejemplo n.º 19
0
def changScale():
    scale_num = cmds.floatSliderButtonGrp('scaleFSBG', q=True, value=True)
    conScale(scale_num, scale_num, scale_num)
Ejemplo n.º 20
0
def makeCord():

    cordWeight = cmds.floatSliderButtonGrp('cordWeightGrp', q=True, v=True)
    randomWeightValue = cmds.floatSliderGrp('cordWeightRandomizeGrp',
                                            q=True,
                                            v=True)
    randomAttachValue = cmds.floatSliderGrp('cordWeightPointRandomization',
                                            q=True,
                                            v=True)

    curSel = cmds.ls(sl=1, fl=1)
    global recoverySel
    recoverySel = cmds.ls(sl=1, fl=1)
    curRange = range(len(cmds.ls(sl=1, fl=1)))
    ptList = []
    curveCode = ""

    for item in curRange:
        print item
        randomAttachPointX = rand.uniform(-randomAttachValue,
                                          randomAttachValue)
        randomAttachPointY = rand.uniform(-randomAttachValue,
                                          randomAttachValue)
        randomAttachPointZ = rand.uniform(-randomAttachValue,
                                          randomAttachValue)
        exec("cmds.select('" + str(curSel[item]) + "', r = 1)")
        exec("pt_" + str(curRange[item]) +
             " = cmds.xform(q = 1, ws = 1, t = 1)")
        print "pt_" + str(curRange[item])
        exec("print pt_" + str(curRange[item]))
        # exec("ptList.append(pt_" + str(curRange[item]) + ")")
        exec("tmp = " + "pt_" + str(curRange[item]))
        tmp = [(tmp[0] + randomAttachPointX), (tmp[1] + randomAttachPointY),
               (tmp[2] + randomAttachPointZ)]
        ptList.append(tmp)

    print ptList
    curveCode += "cmds.curve(d = 1, n = 'telephoneLine', p = ("
    for item in curRange:
        if (item != (1 - len(curRange))):
            curveCode += str(ptList[item]) + ", "
        else:
            curveCode += str(ptList[item])
    curveCode += "))"

    exec(curveCode)
    #------
    asd = .5
    curSel2 = cmds.ls(sl=1, fl=1)
    while (asd < (len(curRange) - 1)):
        cmds.select(curSel2[0], r=1)
        cmds.insertKnotCurve(p=(asd), nk=1, rpo=1)
        #cmds.select(curSel2[0], r = 1)
        #cmds.insertKnotCurve(p = (asd + .495), nk=1, rpo = 1)
        #cmds.select(curSel2[0], r = 1)
        #cmds.insertKnotCurve(p = (asd + .505), nk=1, rpo = 1)
        asd += 1

    asd = .5
    counter = 1
    while (asd < (len(curRange) - 1)):
        generatedRandomValue = rand.uniform(randomWeightValue * -1,
                                            randomWeightValue)
        # print generatedRandomValue
        exec("pt_before = cmds.xform('" + str(curSel2[0]) + ".cv[" +
             str(counter - 1) + "]', q = 1, t = 1)")
        exec("pt_after = cmds.xform('" + str(curSel2[0]) + ".cv[" +
             str(counter + 1) + "]', q = 1, t = 1)")
        distance = math.sqrt((pt_before[0] - pt_after[0])**2 +
                             (pt_before[1] - pt_after[1])**2 +
                             (pt_before[2] - pt_after[2])**2)
        exec("cmds.select('" + str(curSel2[0]) + ".cv[" + str(counter) + "]')")
        cmds.xform(r=1,
                   os=1,
                   t=[
                       0,
                       (distance *
                        ((cordWeight + generatedRandomValue) * -1.00)), 0
                   ])
        cmds.xform
        asd += 1
        counter += 2

    asd = .5
    cmds.select(curSel2[0], r=1)
    while (asd < (len(curRange) - 1)):
        cmds.select(curSel2[0], r=1)
        cmds.insertKnotCurve(p=(asd + .495), nk=1, rpo=1)
        cmds.select(curSel2[0], r=1)
        cmds.insertKnotCurve(p=(asd + .505), nk=1, rpo=1)
        asd += 1

    cmds.select(curSel2[0], r=1)
    cmds.rebuildCurve(ch=1,
                      rpo=1,
                      rt=0,
                      end=1,
                      kr=1,
                      kcp=1,
                      kep=0,
                      kt=0,
                      s=4,
                      d=3,
                      tol=0.01)
    if (len(recoverySel) < 1):
        cmds.button('backUp', e=1, en=0)
    else:
        cmds.button('backUp', e=1, en=1)
Ejemplo n.º 21
0
cmds.frameLayout(l="Control", cll=True)
cmds.rowLayout(nc=1)
cmds.setParent("..")
cmds.button(l="Default Pose", h=30, c="DefaultPose()")
keysave=cmds.checkBoxGrp(l="Key Save Options : ", ncb=1, cw2=(110,50), l1="Hierachy", v1=True)
cmds.button(l="Key Save", h=30, c="KeySave()")
keymirror = cmds.radioButtonGrp(l="    Key Mirror : ", cw3=(110,80,5), la2=["L->R","R->L"], nrb=2, sl=1, w=295)
cmds.button(l="Key Mirror", h=30, c="KeyMirror()")
cmds.setParent("..")
cmds.rowLayout(nc=1)
cmds.setParent("..")
cmds.separator(h=3)
cmds.separator(h=3)

# Jnt size
jnt=cmds.floatSliderButtonGrp(l="Joint Size ", bl="Set", bc="JointSize()", cw4=(60,50,130,30), f=True, min=0.1, max=1, v=1)

cmds.showWindow(win)

#-------------------------------------- Active Code ------------------------------------#

# Delete All Jnt
def DeleteJoint():
    if cmds.objExists("world_ctrl"):
        cmds.delete("world_ctrl")
        print "Delete Jnts"
    else:
        cmds.warning("Already delete it!")

# Need to fix!
# Go back to Default Jnt Setting
Ejemplo n.º 22
0
 def changScale(self):
     scale_num = cmds.floatSliderButtonGrp('scaleFSBG', q=True, value=True)
     CurveChange().conScale(self, scale_num, scale_num, scale_num)
Ejemplo n.º 23
0
def CtrlEditUI():

    if cmds.window(WINDOW_NAME, exists=True):
        cmds.deleteUI(WINDOW_NAME, window=True)

    # super(CtrlEditUI, ).__init__()
    # CurveChange.__init__()

    main_window = cmds.window(WINDOW_NAME,
                              title="Curve Edit",
                              rtf=True,
                              menuBar=True)
    # main_layout = cmds.formLayout(parent = main_window)

    cmds.menu(label='Help', helpMenu=True)
    cmds.menuItem('Application..."', label='"About')

    cmds.rowLayout(numberOfColumns=3,
                   columnAttach=(1, "right", 2),
                   columnWidth=(1, 100))
    cmds.text(label="mirror temp:   ", w=200)
    cmds.textField("mirTemp", w=150, text="h_")

    cmds.setParent('..')

    cmds.rowLayout(numberOfColumns=3,
                   columnAttach=(1, "both", 2),
                   columnWidth=(50, 100))
    cmds.text(label="镜像控制器:   ", w=200)
    cmds.button(label="左→右", h=20, w=150, command="mirrorCtrlsL_to_R()")
    cmds.button(label="右→左", h=20, w=150, command="mirrorCtrlsR_to_L()")

    cmds.setParent('..')
    cmds.radioButtonGrp("all_select_type",
                        label='Select type:',
                        labelArray3=['select', 'hierarchy', 'all'],
                        numberOfRadioButtons=3,
                        columnWidth4=(80, 70, 70, 70),
                        select=1)

    cmds.setParent('..')
    cmds.frameLayout("Scale:",
                     collapsable=True,
                     labelVisible=1,
                     marginWidth=5,
                     marginHeight=5,
                     borderStyle='etchedOut')
    cmds.columnLayout(adj=1)

    cmds.separator(height=10, style='in')

    shrink_button = cmds.button(label="Shrink", h=25, command="shrinkCon()")

    magnify_button = cmds.button(label="Magnify", h=25, command="magnifyCon()")

    scale_slider = cmds.floatSliderButtonGrp('scaleFSBG',
                                             label='Curve scale : ',
                                             field=True,
                                             minValue=0,
                                             maxValue=10,
                                             fieldMaxValue=10,
                                             value=1,
                                             buttonLabel='CurveScale',
                                             buttonCommand="changScale()",
                                             columnWidth4=(80, 70, 70, 10))

    cmds.separator(height=10, style='in')

    cmds.setParent('..')
    cmds.setParent('..')

    cmds.frameLayout("Translate:",
                     collapsable=True,
                     labelVisible=1,
                     marginWidth=5,
                     marginHeight=5,
                     borderStyle='stchedOut')
    cmds.separator(height=10, style='in')
    tran_x_slider = cmds.floatSliderGrp('tran_x_FSG',
                                        label='X : ',
                                        field=True,
                                        minValue=-10,
                                        maxValue=10,
                                        fieldMaxValue=10,
                                        value=0,
                                        columnWidth3=(20, 50, 10))
    tran_y_slider = cmds.floatSliderGrp('tran_y_FSG',
                                        label='Y : ',
                                        field=True,
                                        minValue=-10,
                                        maxValue=10,
                                        fieldMaxValue=10,
                                        value=0,
                                        columnWidth3=(20, 50, 10))
    tran_z_slider = cmds.floatSliderGrp('tran_z_FSG',
                                        label='Z : ',
                                        field=True,
                                        minValue=-10,
                                        maxValue=10,
                                        fieldMaxValue=10,
                                        value=0,
                                        columnWidth3=(20, 50, 10))
    tran_button = cmds.button(label="Move", h=25, command="changeTran()")

    cmds.separator(height=10, style='in')

    cmds.setParent('..')
    cmds.setParent('..')

    cmds.frameLayout("Rotate:",
                     collapsable=True,
                     labelVisible=1,
                     marginWidth=5,
                     marginHeight=5,
                     borderStyle='stchedOut')
    cmds.separator(height=10, style='in')
    rot_x_slider = cmds.floatSliderGrp('rot_x_FSG',
                                       label='X : ',
                                       field=True,
                                       minValue=-360,
                                       maxValue=360,
                                       fieldMaxValue=360,
                                       value=0,
                                       columnWidth3=(20, 50, 10))
    rot_y_slider = cmds.floatSliderGrp('rot_y_FSG',
                                       label='Y : ',
                                       field=True,
                                       minValue=-360,
                                       maxValue=360,
                                       fieldMaxValue=360,
                                       value=0,
                                       columnWidth3=(20, 50, 10))
    rot_z_slider = cmds.floatSliderGrp('rot_z_FSG',
                                       label='Z : ',
                                       field=True,
                                       minValue=-360,
                                       maxValue=360,
                                       fieldMaxValue=360,
                                       value=0,
                                       columnWidth3=(20, 50, 10))
    rot_button = cmds.button(label="Rotate", h=25, command="changeRotate()")

    cmds.separator(height=10, style='in')
    cmds.frameLayout("Shape:",
                     collapsable=True,
                     labelVisible=1,
                     marginWidth=5,
                     marginHeight=5,
                     borderStyle='stchedOut')
    cmds.separator(height=10, style='in')
    shape_button = cmds.button(label="ChangeShape",
                               h=25,
                               command="changeShape()")
    cmds.separator(height=10, style='in')

    cmds.setParent('..')
    cmds.setParent('..')

    cmds.frameLayout("Color:",
                     collapsable=True,
                     labelVisible=1,
                     marginWidth=5,
                     marginHeight=5,
                     borderStyle='stchedOut')
    cmds.separator(height=10, style='in')
    red_button = cmds.button(label="red", h=25, command="redColorSet()")
    yellow_button = cmds.button(label="Yellow",
                                h=25,
                                command="yellowColorSet()")
    blue_button = cmds.button(label="Blue", h=25, command="blueColorSet()")
    color_slider = cmds.colorIndexSliderGrp('cvColorCISG',
                                            label='Curve Color:',
                                            min=1,
                                            max=32,
                                            value=1,
                                            columnWidth3=(80, 50, 10))
    color_button = cmds.button(label="SetColor", h=25, command="changeColor()")
    cmds.separator(height=10, style='in')

    # cmds.setParent( '..' )
    # cmds.setParent( '..' )
    # cmds.rowLayout(numberOfColumns=3, columnAttach = (1, "right", 2), columnWidth = (1, 100))
    # cmds.text(label="mirror temp:   ", w=200 )
    # cmds.textField("mirTemp", w = 150, text="_h")

    # cmds.setParent( '..' )

    # cmds.rowLayout(numberOfColumns=3, columnAttach = (1, "both", 2), columnWidth = (50, 100))
    # cmds.text(label="镜像控制器:   " , w=200)
    # cmds.button(label="左→右", h = 20, w=150, command = "")
    # cmds.button(label="右→左", h = 20, w=150, command = "")

    cmds.showWindow(main_window)
Ejemplo n.º 24
0
    def arnoldProductionUI(self):
        if mc.window("arnoldProductionUI",ex=True):
            mc.deleteUI("arnoldProductionUI")
        mc.window("arnoldProductionUI",tlc=[180,200],wh=[430,400],menuBar=True,title=u"arnold模型属性修改",sizeable=False)
        mc.scrollLayout("A",hst=0,vst=8)
        mc.columnLayout(adjustableColumn=True)

        mc.rowLayout(nc=2,cw=[(1, 344),(2, 200)])
        mc.checkBox("aiSelfShadows",v=True,label="Self Shadows",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiSelfShadows"))
        mc.setParent("..")
       
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiOpaque",v=True,label="Opaque",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiOpaque"))
        mc.setParent("..")
       
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiVisibleInDiffuse",v=True,label="Visible In Diffuse",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiVisibleInDiffuse"))
        mc.setParent("..")
       

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiVisibleInGlossy",v=True,label="Visible In Glossy",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiVisibleInGlossy"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportTangents",v=True,label="Export Tangents",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportTangents"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportColors",v=True,label="Export Vertex Colors",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportColors"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportRefPoints",v=True,label="Export Reference Points",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefPoints"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportRefNormals",v=True,label="Export Reference Normals",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefNormals"))
        mc.setParent("..")
 
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportRefTangents",v=True,label="Export Reference Tangents",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefTangents"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiExportRefTangents",v=True,label="Export Reference Tangents",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiExportRefTangents"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiMatte",v=True,label="Matte",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiMatte"))
        mc.setParent("..")

        mc.separator()

        mc.text("Subdivision")
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("Type",l="Type",h=20)
        mc.menuItem(l="none")
        mc.menuItem(l="catclart")
        mc.menuItem(l="linear")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("Type"))
        mc.setParent("..")
        mc.floatSliderButtonGrp("aiSubdivIterations",en=True,pre=0,label="Iterations",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)],min=0,max=10,fieldMaxValue=1,bc=lambda *args:self.ProductionIterations("aiSubdivIterations"))
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("AdaptiveMetric",l="Adaptive Metric",h=20)
        mc.menuItem(l = "auto")
        mc.menuItem(l = "edge_length")
        mc.menuItem(l = "flatness")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("AdaptiveMetric"))
        mc.setParent("..")
        mc.floatSliderButtonGrp("aiSubdivPixelError",en=True,pre=3,label="Pixel Error",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)],min=0,max=10,fieldMaxValue=1,bc=lambda *args:self.ProductionIterations("aiSubdivPixelError"))
        
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("aiExportRefTangents",l="UV Smoothing",h=20)
        mc.menuItem(l="pin_corners")
        mc.menuItem(l="pin_borders")
        mc.menuItem(l="linears")
        mc.menuItem(l="smooth")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("aiExportRefTangents"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiSubdivSmoothDerivs",v=True,label="SmoothTangents",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiSubdivSmoothDerivs"))
        mc.setParent("..")

        mc.separator()

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("ArnoldTranslatoer",l="Arnold Translatoer",h=20)
        mc.menuItem(l = "mesh_light")
        mc.menuItem(l = "polymesh")
        mc.menuItem(l = "procedural")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("ArnoldTranslatoer"))
        mc.setParent("..")

        mc.colorSliderButtonGrp('color', l = 'Color', buttonLabel = 'UPDATE', rgb = [0, 0, 0], symbolButtonDisplay = True, cw = [(1, 80), (2, 50), (3, 180)], bc = lambda *args:self.updateColorAttr('color'))
     
        mc.rowLayout(nc = 3,cw=[(1,46),(2,296),(3,200)])
        mc.text(l = "intensity")
        mc.floatField("intensity", precision = 3)
        mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("intensity"))
        mc.setParent("..")

        mc.floatSliderButtonGrp("aiExposure", en=True, pre=0, min = -5, max = 5, label="aiExposure",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiExposure"))
        
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiUseColorTemperature",v=True,label="Use Color Temperature",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiUseColorTemperature"))
        mc.setParent("..")

        mc.floatSliderButtonGrp("aiColorTemperature", en=True, pre=0, min = 1000, max = 15000, label="Temperature",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiColorTemperature"))
       
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("emitDiffuse",v=True,label="Emit Diffuse",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("emitDiffuse"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("emitSpecular",v=True,label="Emit Specular",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("emitSpecular"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.optionMenuGrp("DecayType",l="Decay Type",h=20)
        mc.menuItem(l = "constant")
        mc.menuItem(l = "quadratic")
        mc.button(l="UPDATE",c=lambda *args:self.ProductionType("DecayType"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("lightVisible",v=True,label="Light Visible",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("lightVisible"))
        mc.setParent("..")

        mc.rowLayout(nc = 3,cw=[(1,46),(2,296),(3,200)])
        mc.text(l = "Samples")
        mc.floatField("aiSamples", precision = 0)
        mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiSamples"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiNormalize",v=True,label="Normalize",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiNormalize"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiCastShadows",v=True,label="Cast Shadows",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiCastShadows"))
        mc.setParent("..")

        mc.floatSliderButtonGrp("aiShadowDensity", en=True, pre=3, min = 0, max = 1, label="Shadow Density",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiShadowDensity"))

        mc.colorSliderButtonGrp('aiShadowColor', l = 'Shadow Color', buttonLabel = 'UPDATE', rgb = [0, 0, 0], symbolButtonDisplay = True, cw = [(1, 80), (2, 50), (3, 180)], bc = lambda *args:self.updateColorAttr('aiShadowColor'))
        
        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiAffectVolumetrics",v=True,label="Affect Volumetrics",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiAffectVolumetrics"))
        mc.setParent("..")

        mc.rowLayout(nc=2,cw=[(1,344),(2,200)])
        mc.checkBox("aiCastVolumetricShadows",v=True,label="Cast Volumetric Shadows",align="right")
        mc.button(l="UPDATE",c=lambda *args:self.updateArnoldAttrCheckBox("aiCastVolumetricShadows"))
        mc.setParent("..")

        mc.rowLayout(nc = 3,cw=[(1,86),(2,256),(3,200)])
        mc.text(l = "Volume Samples")
        mc.floatField("aiVolumeSamples", precision = 0)
        mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiVolumeSamples"))
        mc.setParent("..")

        mc.floatSliderButtonGrp("aiDiffuse", en=True, pre=3, min = 0, max = 1, label="Diffuse",field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiDiffuse"))
        mc.floatSliderButtonGrp('aiSpecular', en = True, pre = 3, min = 0, max = 1, label = 'Specular', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiSpecular"))
        mc.floatSliderButtonGrp('aiSss', en = True, pre = 3, min = 0, max = 1, label = 'SSS', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiSss"))
        mc.floatSliderButtonGrp('aiIndirect', en = True, pre = 3, min = 0, max = 1, label = 'Indiret', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiIndirect"))
        mc.floatSliderButtonGrp('aiVolume', en = True, pre = 3, min = 0, max = 1, label = 'Volume', field=True,buttonLabel="UPDATE",symbolButtonDisplay=False,cw=[(1,130),(2,50)], fieldMaxValue = 1, bc = lambda *args:self.ProductionIterations("aiVolume"))
        
        mc.rowLayout(nc = 3,cw=[(1,66),(2,276),(3,200)])
        mc.text(l = "Max Bounces")
        mc.floatField("aiMaxBounces", precision = 0, value = 999)
        mc.button(l= "UPDATE", c=lambda *args:self.updateFloatFieldAttr("aiMaxBounces"))
        mc.setParent("..")

        mc.showWindow("arnoldProductionUI")
Ejemplo n.º 25
0
    cmds.deleteUI(TOOLNAME)

WINDOW = cmds.window(TOOLNAME, t=TOOLTITLE)
tabs = cmds.tabLayout(imh=5, imw=5)
# form = cmds.formLayout()
# cmds.formLayout(form, e=True, attachForm=((tabs,'top',0), (tabs,'left',0), (tabs,'right',0), (tabs,'bottom',0)))

#--------------------------------------------------------------------------------------------#

# 1: Create
ch1 = cmds.rowColumnLayout(w=285, nc=1)


# Joint Size
frame("Joint Size", 0)
jnt = cmds.floatSliderButtonGrp(l="Size   ", bl="Set", bc="jointSize()", cw4=(50,50,70,50), f=True, min=0.1, max=1, v=0.5, h=30)
cmds.setParent("..")


# Create
frame("Create")

btnLayout(2)
cmds.button(l="Loc", c="cmds.CreateLocator()", w=WI02[1], h=25)
cmds.button(l="Curve", c="cmds.EPCurveToolOptions()", w=WI02[2], h=25)
cmds.setParent("..")

createBtn(
    "    Joints : ",
    [["Jnt", "cmds.JointTool()"], ["Insert", "cmds.InsertJointTool()"]]
)
Ejemplo n.º 26
0
    def edArnoldLayout(self):

        #Create the dummy node for testing shader purposes
        uiFunc.createEdDebugSahder()

        marginCheck = 20

        def edShadingUICreateRow():
            list = uiFunc.getEdToolsShadingAttrTemplate()
            for data in list:
                attr = data[0]
                type = data[1]
                connectionDest = "edTools." + attr
                cmds.rowLayout(height=20,
                               numberOfColumns=5,
                               columnWidth5=(10, marginCheck, marginCheck,
                                             marginCheck, marginCheck),
                               adjustableColumn=1,
                               columnAlign=(1, 'left'),
                               columnAttach=[1, "right", 5])
                cmds.attrNavigationControlGrp("ed" + attr.capitalize() +
                                              "Texture",
                                              l=attr,
                                              columnWidth=[1, 60],
                                              columnAttach=[1, "right", 5],
                                              attribute=connectionDest)
                cmds.checkBox("ed" + attr.capitalize() + "Raw",
                              label='',
                              v=data[2])
                cmds.checkBox("ed" + attr.capitalize() + "Alpha",
                              label='',
                              v=data[3])
                cmds.checkBox("ed" + attr.capitalize() + "Filter",
                              label='',
                              v=data[4])
                cmds.checkBox("ed" + attr.capitalize() + "Bias",
                              label='',
                              v=data[5])
                cmds.setParent("..")

        #================================================================

        cmds.scrollLayout("edArnoldLayout", **scrollArgs)
        cmds.columnLayout(adjustableColumn=True)

        #================================================================
        cmds.formLayout("arnoldHeader")

        cmds.columnLayout("btnSetShaderCont", adjustableColumn=True)
        cmds.button("edShaderBtnGet",
                    label="Select Shader",
                    height=30,
                    c=lambda *x: uiFunc.setShadingForm("get"))
        cmds.button("edShaderBtnUnset",
                    label="Unset Shader",
                    height=30,
                    backgroundColor=[0.2, 0.2, 0.2],
                    vis=False,
                    c=lambda *x: uiFunc.setShadingForm("reset"))
        cmds.setParent("..")  # columnLayout

        cmds.columnLayout("btnShaderSaveCont", adjustableColumn=True)
        cmds.button(l="SAVE", h=30, c=lambda *x: uiFunc.setShadingForm("set"))
        cmds.setParent("..")  # columnLayout

        cmds.setParent("..")  # formLayout
        uiFunc.formLayoutSet("arnoldHeader", [("btnSetShaderCont", 40),
                                              ("btnShaderSaveCont", 60)],
                             padding=3)

        cmds.columnLayout(adjustableColumn=True,
                          columnAttach=["both", 10],
                          columnAlign="left")
        cmds.button('edShaderLabel',
                    label="...",
                    c=lambda *x: uiFunc.selectShader())
        cmds.setParent("..")  # columnLayout

        #================================================================
        cmds.separator(h=6, st="none")
        cmds.separator(h=2, st="in")
        cmds.separator(h=5, st="none")

        cmds.columnLayout(adjustableColumn=True, columnAttach=["both", 5])

        cmds.rowLayout(numberOfColumns=5,
                       columnWidth5=(10, marginCheck, marginCheck, marginCheck,
                                     marginCheck),
                       adjustableColumn=1,
                       columnAlign=(1, 'left'))
        cmds.columnLayout(adjustableColumn=True, columnAttach=["both", 10])
        cmds.button(l='Select Shading Node',
                    c=lambda *x: uiFunc.selectShadingDummyNode())
        cmds.setParent("..")
        cmds.text(label='Raw')
        cmds.text(label='Alph')
        cmds.text(label='Filt')
        cmds.text(label='Bias')
        cmds.setParent("..")
        cmds.separator(h=5, st="none")

        #-------------------------------------------------------------------------------------------------------------------------------
        edShadingUICreateRow()
        #-------------------------------------------------------------------------------------------------------------------------------

        cmds.setParent("..")

        cmds.separator(h=10, st="none")

        #================================================================
        cmds.frameLayout(label='Normals/Bump', **frameArgs)
        cmds.rowLayout(numberOfColumns=2,
                       columnWidth2=(70, 50),
                       adjustableColumn=2,
                       columnAlign=(1, 'right'),
                       columnAttach=[1, "both", 5])

        cmds.columnLayout(adjustableColumn=True)
        cmds.radioCollection("edShadingNormalsOrder")
        cmds.radioButton('edShadinOptBump', label='N > B', select=True)
        cmds.separator(h=4, st="none")
        cmds.radioButton('edShadinOptNormals', label='B > N')
        cmds.setParent("..")

        cmds.columnLayout(adjustableColumn=True)
        cmds.button(l="Select Bump", c=lambda *x: uiFunc.selectBump())
        cmds.separator(h=4, st="none")
        cmds.button(l="Select Normal", c=lambda *x: uiFunc.selectNormal())
        cmds.setParent("..")

        cmds.setParent("..")  # RowLayout

        cmds.columnLayout(adjustableColumn=True)
        cmds.floatSliderGrp("edShadingNormalVal",
                            label='Normal:  ',
                            field=True,
                            columnWidth3=(70, 60, 50),
                            minValue=0,
                            maxValue=5,
                            value=1,
                            adjustableColumn=3,
                            sliderStep=0.005,
                            precision=3)
        cmds.floatSliderGrp("edShadingBumpVal",
                            label='Bump:  ',
                            field=True,
                            columnWidth3=(70, 60, 50),
                            minValue=-1,
                            maxValue=1,
                            value=0.1,
                            adjustableColumn=3,
                            sliderStep=0.005,
                            precision=3)
        cmds.setParent("..")

        cmds.setParent("..")  # FrameLayout

        #================================================================
        cmds.frameLayout(label='Displacement', **frameArgs)

        cmds.rowLayout(numberOfColumns=2,
                       columnWidth2=(70, 5),
                       adjustableColumn=2,
                       columnAlign2=['right', 'left'],
                       columnAttach=[2, "left", 4])
        cmds.button(l=" Sel Shape ", c=lambda *x: uiFunc.selectShapes())
        cmds.text("edShadingShapeSelected", l="...")
        cmds.setParent("..")

        cmds.rowLayout(numberOfColumns=3,
                       columnWidth3=(70, 45, 60),
                       adjustableColumn=3,
                       columnAlign3=['right', 'left', 'left'],
                       columnAttach=[2, "left", 4])
        cmds.button(l="Shape List ",
                    c=lambda *x: uiFunc.showShapesDisplacementSheet())
        cmds.radioCollection("edShadingShapesChange")
        cmds.radioButton(
            'edShadinAllShapes',
            label='All',
            select=True,
            onCommand=lambda *x: uiFunc.changeShapesSelection("all"))
        cmds.radioButton(
            'edShadinOnlySelectedShape',
            label='Selected',
            onCommand=lambda *x: uiFunc.changeShapesSelection("selected"))
        cmds.setParent("..")

        #--------------------------------------------------
        cmds.columnLayout(adjustableColumn=True)

        cmds.optionMenuGrp("edShadingSubdivisionType",
                           label='DivType:  ',
                           columnWidth2=(70, 10),
                           adjustableColumn=2,
                           columnAttach=[1, "right", 0])
        cmds.menuItem("edShadingSubTypeNone", label='None')
        cmds.menuItem("edShadingSubTypeNoneCatclark", label='Catclark')
        cmds.menuItem("edShadingSubTypeNoneLinear", label='Linear')
        cmds.intSliderGrp("edShadingDivisionsCount",
                          label='Iterations:  ',
                          field=True,
                          columnWidth3=(70, 60, 50),
                          minValue=0,
                          maxValue=8,
                          value=0,
                          adjustableColumn=3)
        cmds.floatSliderGrp("edShadingDisplacementHeight",
                            label='Height:  ',
                            field=True,
                            columnWidth3=(70, 60, 50),
                            minValue=-5,
                            maxValue=5,
                            value=1,
                            adjustableColumn=3,
                            sliderStep=0.005,
                            precision=3)
        cmds.checkBoxGrp("edShadingAutoBumpDisp",
                         numberOfCheckBoxes=1,
                         label='AutoBump:  ',
                         value1=False,
                         columnWidth2=(70, 10),
                         adjustableColumn=2,
                         columnAttach=[2, "left", 2])

        cmds.setParent("..")
        #--------------------------------------------------
        cmds.setParent("..")  # FrameLayout
        #================================================================

        cmds.frameLayout(label='Ambient Oclussion', **frameArgs)
        cmds.floatSliderButtonGrp("edShadingAOMultiply",
                                  label='Multiply:  ',
                                  field=True,
                                  columnAttach=[4, "left", 10],
                                  columnWidth4=(70, 60, 50, 60),
                                  minValue=0,
                                  maxValue=2,
                                  value=1,
                                  adjustableColumn=3,
                                  sliderStep=0.005,
                                  precision=3,
                                  buttonLabel='Sel AO',
                                  bc=lambda *x: uiFunc.selectAO())
        cmds.setParent("..")
        #================================================================

        cmds.separator(h=2, st="in")

        cmds.setParent("..")  # formLayout ArnoldOptions
        cmds.setParent("..")  #scrollLayout

        # Deleting the Shading Dummy
        cmds.delete("edTools")