示例#1
0
def updateSliderGui(value=None, fromField=None):
    if 'slider' in settings.uiControl and 'sliderField' in settings.uiControl:
        if value == None:
            if fromField == 'sliderField':
                if cmd.intField(settings.uiControl['sliderField'], ex=1):
                    value = cmd.intField(settings.uiControl['sliderField'], q=1, v=1)
            else:
                if cmd.intSlider(settings.uiControl['slider'], ex=1):
                    value = cmd.intSlider(settings.uiControl['slider'], q=1, v=1)

        if cmd.intSlider(settings.uiControl['slider'], ex=1):
            cmd.intSlider(settings.uiControl['slider'], e=1, v=value)
        if cmd.intField(settings.uiControl['sliderField'], ex=1):
            cmd.intField(settings.uiControl['sliderField'], e=1, v=value)
    return value
 def SubdivisionLevelChanged(*args):
     cmds.editRenderLayerGlobals( currentRenderLayer = "defaultRenderLayer")
     for mesh in cmds.listRelatives(cmds.getAttr("CMSettings.ModelName"), allDescendents = True):
         try:
             cmds.setAttr(mesh + "Smooth.divisions", cmds.intSlider("SubdivisionLevel",query = True, value = True))
         except:
             pass    
def	splitJoint	():
	_newBoneNum	= cmds.intSlider	('boneNum',	query	= 1,	value	= 1)
	_bone		= cmds.ls	(selection	= 1,	long	= 1)
	_childJoint	= cmds.listRelatives	(children	= 1)

	if (len (_bone)	> 0) and (type(_childJoint) is not NoneType) \
	and (cmds.nodeType(_bone[0]) == 'joint') and (cmds.nodeType(_childJoint) == 'joint'):
		
		_childTranslateX	=	cmds.getAttr	(	_childJoint[0]	+	'.translateX'	)
		_childTranslateY	=	cmds.getAttr	(	_childJoint[0]	+	'.translateY'	)
		_childTranslateZ	=	cmds.getAttr	(	_childJoint[0]	+	'.translateZ'	)

		_newX				=	_childTranslateX	/	(	_newBoneNum	+	1.0	)
		_newY				=	_childTranslateY	/	(	_newBoneNum	+	1.0	)
		_newZ				=	_childTranslateZ	/	(	_newBoneNum	+	1.0	)

		for	_k	in	range	(	_newBoneNum):
			_bone	=	cmds.insertJoint	(	_bone	)
			cmds.toggle	(localAxis		=1)
			cmds.xform	(_bone	+	'.scalePivot',	_bone	+	'.rotatePivot',
						relative	=	1,	objectSpace	=	1,	translation	=	(	_newX,	_newY,	_newZ	)	)

		for	_k	in	range	(	_newBoneNum	):	cmds.pickWalk	(	direction	=	'up'	)
	
	else:	raiseWarning	(	'select a bone! You can do it!'	)
def	splitJoint	():
	_newBoneNum			=	cmds.intSlider	(	'boneNum',	query	=	1,	value	=	1	)
	_bone				=	cmds.ls	(	selection	=	1,	long	=	1	)
	_childJoint			=	cmds.listRelatives	(	children	=	1	)

	if	len(_bone) > 0:
		if	type(_childJoint)	is	not	NoneType:
#			print; print; print '>>> SO FAR SO GOOD'; print # <<< DEBUG ONLY LINE, CAN BE DELETED <<< ##########
			_bone				=	_bone[0]
			_childJoint			=	_childJoint[0]

			_childTranslateX	=	cmds.getAttr	(	_childJoint	+	'.translateX'	)
			_childTranslateY	=	cmds.getAttr	(	_childJoint	+	'.translateY'	)
			_childTranslateZ	=	cmds.getAttr	(	_childJoint	+	'.translateZ'	)

			_newX				=	_childTranslateX	/	(	_newBoneNum	+	1.0	)
			_newY				=	_childTranslateY	/	(	_newBoneNum	+	1.0	)
			_newZ				=	_childTranslateZ	/	(	_newBoneNum	+	1.0	)

			for	_k	in	range	(	_newBoneNum	):
				_bone	=	cmds.insertJoint	(	_bone	)
				cmds.toggle	(	localAxis		=	1	)
				cmds.xform	(	_bone	+	'.scalePivot',	_bone	+	'.rotatePivot',
								relative	=	1,	objectSpace	=	1,	translation	=	(	_newX,	_newY,	_newZ	)	)

			for	_k	in	range	(	_newBoneNum	):	cmds.pickWalk	(	direction	=	'up'	)
		
		else:	raiseWarning	(	'select the bone, not a single joint'	)
	else:	raiseWarning	(	'select the bone'	)
	def updateColorSets(self):
		# Delete the current set of color sets
		try:
			menuItems = cmds.optionMenu(self.colorSetListCtrl, q=True, itemListLong=True)
			if menuItems != None and menuItems != []:
				cmds.deleteUI(menuItems)
		except:
			pass
		colorSets = cmds.polyColorSet( query=True, allColorSets=True)
		if colorSets :
			for c in colorSets:
				cmds.menuItem(parent=self.colorSetListCtrl, label=c)
		if cmds.checkBox(self.userWeightCheckBoxCtrl, query = True, value=True):
			cmds.optionMenu(self.colorSetListCtrl, edit=True, en=True)	
			cmds.intSlider(self.wmSliderCtrl, edit=True, en=True)				
		else: 
			cmds.optionMenu(self.colorSetListCtrl, edit=True, en=False)	
			cmds.intSlider(self.wmSliderCtrl, edit=True, en=False)	
示例#6
0
 def BindUI(self, ProjectFunctions, RenderingFunctions):
     cmds.button("BrowserButton", edit = True, c = ProjectFunctions[0])
     cmds.button("PrepButton", edit = True, c = ProjectFunctions[1])
     cmds.button("SRTButton", edit = True, c = ProjectFunctions[2])
     cmds.button("CRTButton", edit = True, c = ProjectFunctions[3])
     cmds.button("DescriptionButton", edit = True, c = ProjectFunctions[4])
     cmds.button("ExportButton", edit = True, c = ProjectFunctions[5])
     cmds.button("AboutButton", edit = True, c = ProjectFunctions[6])
     
     cmds.intSlider("SubdivisionLevel", edit = True, cc = RenderingFunctions[0])
     cmds.button("RenderQualityLow" , edit = True,c = RenderingFunctions[1])
     cmds.button("RenderQualityMed" , edit = True,c = RenderingFunctions[2])
     cmds.button("RenderQualityHigh", edit = True,c = RenderingFunctions[3])
     cmds.button("LightingButton", edit = True,c = RenderingFunctions[4])
     cmds.floatField("LightIntensityField", edit = True,cc = RenderingFunctions[5])
     cmds.floatField("HDRIIntensityField", edit = True,cc = RenderingFunctions[6])
     cmds.floatField("EyeLevelField", edit = True,cc = RenderingFunctions[7])
     cmds.button("PlaceText", edit = True,c = RenderingFunctions[8])
     cmds.button("SelectObj", edit = True,c = RenderingFunctions[9])
	def createComponent(self, parentContainer):
		# Add the user weights components
		layout = cmds.frameLayout(parent= parentContainer, l="User weights", collapsable=True)
		cmds.separator(parent= layout, height=1, style="none")
		weightsLayout = cmds.rowLayout (parent= layout, numberOfColumns = 2)
		self.userWeightCheckBoxCtrl = cmds.checkBox(l="Enable", w=150, parent= weightsLayout, onc=userWeightsChanged, ofc=userWeightsChanged)
		self.colorSetListCtrl = cmds.optionMenu(parent= weightsLayout, w=350, en=False)
		cmds.separator(parent= layout, height=1, style="none")
		weightsMulLayout = cmds.rowLayout (parent= layout, numberOfColumns = 2)
		cmds.text(parent= weightsMulLayout, l="Weights multiplier", align="right", w=150)
		self.wmSliderCtrl = cmds.intSlider(min=1, max=8, value=1, step=1, parent= weightsMulLayout, w=350)
		cmds.separator(parent= layout, height=1, style="none")	
		return layout
示例#8
0
 def cmdRangeUpdateMax(self, *arg):
     # get slider value
     v = cmds.intSlider(self.control.sl2, q=True, v=True)
     # edit int field
     cmds.floatField(self.control.int2, edit=True, value=v)
     # lowest value for maximum value of slider 1 has to be 1 higher than minimum value
     if v > cmds.intSlider(self.control.sl1, q=True, min=True):
         cmds.intSlider(self.control.sl1, e=True, max=v)
         cmds.intSlider(self.control.sl1, e=True, en=True)
     elif v == cmds.intSlider(self.control.sl1, q=True, min=True):
         #cmds.intSlider(self.control.sl1, e=True, max=v-1)
         cmds.intSlider(self.control.sl1, e=True, en=False)
     else:
         pass
         # cmds.intSlider(self.control.sl1, e=True, max=v+1)
     # print v, 'lower slider -----    ', cmds.intSlider(self.control.sl1, q=True, min=True), cmds.intSlider(self.control.sl1, q=True, max=True), 'upper range   -----', cmds.intSlider(self.control.sl2, q=True, min=True), cmds.intSlider(self.control.sl2, q=True, max=True), '  lower range'
     e = cmds.floatField(self.control.int2, q=True, value=True)
     s = cmds.floatField(self.control.int1, q=True, value=True)
     cmds.text(self.control.heading13, edit=True, label=str((e - s) + 1))
示例#9
0
    def UpdateRenderingTab(self):
        #Update the smooth slider
        for mesh in cmds.listRelatives(cmds.getAttr("CMSettings.ModelName"), allDescendents = True, type = "mesh"):
            #Try to retrieve smooth level on the current mesh
            try:
                cmds.intSlider("SubdivisionLevel", edit = True, value = cmds.getAttr(mesh + "Smooth.divisions"))
                break
            except:pass
            
        #Update light rig button
        if not cmds.objExists("CMLightRig"):
            cmds.button("LightingButton", edit = True, label = "Create Light Rig", bgc = [0.361, 0.361, 0.361])
        else:
            cmds.button("LightingButton", edit = True, label = "Current rig: " + cmds.getAttr("CMSettings.CurrentRig"),  bgc = [0, 0.361, 0])

        
        if cmds.objExists("CMLightRig"):
            values = [cmds.getAttr("CMLightRig.LightIntensity"), cmds.getAttr("CMLightRig.HDRIIntensity"), cmds.getAttr("CMLightRig.EyeLevel")]
        else:
            values = [1,1,92]
            
        if cmds.objExists("CMLightRig") and (cmds.getAttr("defaultRenderGlobals.currentRenderer") == "vray" or cmds.getAttr("defaultRenderGlobals.currentRenderer") == "mentalRay"):
            visibility = True
        else:
            visibility = False
        
        #3-point light intensity
        cmds.rowLayout("LightControlLayout", edit = True, visible= visibility)
        cmds.floatField("LightIntensityField", edit = True, value = values[0] )
        
        #HDRI light intensity
        cmds.rowLayout("HDRIControlLayout", edit = True, visible= visibility)
        cmds.floatField("HDRIIntensityField", edit = True, value = values[1] )
        
        #Eye Level
        cmds.rowLayout("EyeLevelLayout", edit = True, visible= visibility)
        cmds.floatField("EyeLevelField", edit = True, value = values[2] )
            
示例#10
0
def set_weights():

    slider_value = cmds.intSlider('jt_weight_slider_slider', query=True, v=True) / 100.0
    cmds.textField('weightpercent', e=True, tx=slider_value )
    stored_joints = [cmds.textField('joint_disp_0', q=True, tx=True), cmds.textField('joint_disp_1', q=True, tx=True)]
    stored_joints = filter(None, stored_joints)
    selected_verts = cmds.filterExpand(sm=31)
    skincluster = get_skinCluster(stored_joints[0])
    
    if len(stored_joints) == 1:
        cmds.skinPercent(skincluster, tv=(stored_joints[0], 1 - slider_value))
        cmds.skinPercent(skincluster, pruneWeights=0.01 )
        
    else:
        cmds.skinPercent(skincluster, tv=[(stored_joints[0], 1 - slider_value),(stored_joints[1], slider_value)])
        cmds.skinPercent(skincluster, pruneWeights=0.01 )
示例#11
0
 def setIntensityCmd(self, *args):
     """Function called when Global intensity slider is changed, and updates intensity"""
     intensity = None
     # obtain input as a float
     try:
         ctrlPath = '|'.join(
             [self.window, 'centralwidget', self.intensitySlider]
         )
         intensity = .02 * float(
             cmds.intSlider(ctrlPath, q=True, value=True)
         )
     except:
         raise
     for l in self.lights:
         if (l == 'fillLightShape'):
             adjIntensity = intensity * .6
         elif (l == 'keyLightShape'):
             adjIntensity = intensity
         else:
             adjIntensity = intensity * .9
         cmds.spotLight(l, e=1, i=adjIntensity)
示例#12
0
    def buildAction(self):
        # colors
        grey = [0.5, 0.5, 0.5]
        greyD = [0.2, 0.2, 0.2]
        red = [0.5, 0.2, 0.2]
        redD = [0.4, 0.2, 0.2]
        blue = [0.2, 0.3, 0.5]
        green = [0.2, 0.5, 0.0]
        teal = [0.0, 0.5, 0.5]
        purple = [0.35, 0.35, 0.5]
        purple2 = [0.28, 0.28, 0.39]
        orange = [0.5, 0.35, 0.0]
        # ann
        existing = 'Will only bake on existing frames.\nTurn off to get a key on every frame.'
        time = 'Force timeline range to be baked.\nOtherwise range is gathered in this priority:\n-Use selected range\n-Use range from animation, if any\n-Use range from timeline.'
        simu = 'Step through every frame.'

        # Export
        '''
        self.s0 = cmds.separator(height=self.sepH, style=self.sepStl)
        self.heading0 = cmds.text(self.heading0, label='EXPORT CLIP', al='center')
        self.s1 = cmds.separator(height=self.sepH, style=self.sepStl)
        '''
        # import type
        self.srcGrp = cmds.radioButtonGrp(label='Source:', labelArray2=['me', 'public', ], select=1, numberOfRadioButtons=2, w=self.w, ad3=1, cw3=[50, 50, 50], cl3=['left', 'both', 'right'], ct3=['left', 'both', 'right'])
        self.s4 = cmds.separator(height=self.sepH, style=self.sepStl)

        self.heading1 = cmds.text(self.heading1, label='Name:', al='left', fn=self.fn)
        self.field1 = cmds.textField(self.field1, tx='', pht='None')
        self.heading2 = cmds.text(self.heading2, label='Comment:', al='left', fn=self.fn)
        self.field2 = cmds.textField(self.field2, tx='', pht='None')
        #
        self.typGrpEx = cmds.radioButtonGrp(label='Export Type:', labelArray2=['anim', 'pose', ], select=1, numberOfRadioButtons=2, w=self.w, ad3=1, cw3=[50, 50, 50], cl3=['left', 'both', 'right'], ct3=['left', 'both', 'right'])
        # range
        self.row = cmds.rowLayout(self.row, numberOfColumns=3, columnWidth3=(100, 50, 50), adjustableColumn=1, columnAlign=(1, 'left'), columnAttach=[(1, 'both', 0), (2, 'both', 0), (3, 'both', 0)])
        cmds.text('Range for driven attrs:')
        self.float1 = cmds.floatField(self.float1, value=cmds.playbackOptions(q=True, min=True), pre=2)
        self.float2 = cmds.floatField(self.float2, value=cmds.playbackOptions(q=True, max=True), pre=2)
        cmds.setParent('..')
        self.button1 = cmds.button(self.button1, label='E X P O R T', c=self.cmdAction, bgc=redD,
                                   ann='Export selected controls to a clip file')
        self.s2 = cmds.separator(height=self.sepH, style=self.sepStl)
        #

        # Import
        self.heading3 = cmds.button(self.heading3, label='CLIP LIBRARY', al='center')
        # self.s3 = cmds.separator(height=self.sepH, style=self.sepStl)

        # 2 scroll lists in form: clip, clip version
        self.form1 = cmds.formLayout(self.form1, h=295, w=1)
        self.scroll1 = cmds.textScrollList(self.scroll1, sc=self.cmdAction, allowMultiSelection=False, dcc=self.cmdAction, fn='plainLabelFont', h=200, w=10)
        attachForm = [(self.scroll1, 'left', 0), (self.scroll1, 'right', 50)]
        cmds.formLayout(self.form1, edit=True, attachForm=attachForm)
        self.scroll2 = cmds.textScrollList(self.scroll2, sc=self.cmdAction, allowMultiSelection=False, dcc=self.cmdAction, fn='plainLabelFont', h=200, w=45)
        attachForm = [(self.scroll2, 'right', 0)]
        attachControl = [(self.scroll2, 'left', 5, self.scroll1)]
        cmds.formLayout(self.form1, edit=True, attachForm=attachForm, attachControl=attachControl)
        self.scroll3 = cmds.textScrollList(self.scroll3, sc=self.cmdAction, allowMultiSelection=True, dcc=self.cmdAction, fn='plainLabelFont', h=85, w=10)
        attachForm = [(self.scroll3, 'left', 0), (self.scroll3, 'right', 0)]
        attachControl = [(self.scroll3, 'top', 5, self.scroll1)]
        cmds.formLayout(self.form1, edit=True, attachForm=attachForm, attachControl=attachControl)
        cmds.setParent('..')

        # Clip attrs
        # commenting out and using export field instead
        '''
        self.heading4 = cmds.text(self.heading4, label='Comment:', al='left', fn=self.fn)
        self.heading5 = cmds.textField(self.heading5, pht='None')
        '''
        self.row6 = cmds.rowLayout(self.row6, numberOfColumns=2, adjustableColumn=2, columnAlign=(1, 'left'), columnAttach=[(1, 'left', 0), (2, 'left', 0)])
        self.heading6 = cmds.button(self.heading6, label='Filename:', al='left')
        self.heading7 = cmds.textField(self.heading7, tx='', en=True, pht='None', ed=False)
        cmds.setParent('..')
        self.s0 = cmds.separator(height=self.sepH, style=self.sepStl)
        self.row5 = cmds.rowLayout(self.row5, numberOfColumns=2, adjustableColumn=2, columnAlign=(1, 'left'), columnAttach=[(1, 'left', 0), (2, 'left', 0)])
        self.heading8 = cmds.text(self.heading8, label='User:'******'left', fn=self.fn)
        self.heading9 = cmds.text(self.heading9, label='', al='right', en=True)
        cmds.setParent('..')
        self.row4 = cmds.rowLayout(self.row4, numberOfColumns=2, adjustableColumn=2, columnAlign=(1, 'left'), columnAttach=[(1, 'left', 0), (2, 'left', 0)])
        self.heading10 = cmds.text(self.heading10, label='Date:', al='left', fn=self.fn)
        self.heading11 = cmds.text(self.heading11, label='', al='right', en=True)
        cmds.setParent('..')
        # import type
        self.typGrpIm = cmds.radioButtonGrp(label='Import Type:', labelArray2=['anim', 'pose', ], select=1, numberOfRadioButtons=2, w=self.w, ad3=1, cw3=[50, 50, 50], cl3=['left', 'both', 'right'], ct3=['left', 'both', 'right'])
        self.s4 = cmds.separator(height=self.sepH, style=self.sepStl)
        # range
        self.row3 = cmds.rowLayout(self.row3, numberOfColumns=2, adjustableColumn=2, columnAlign=(1, 'left'), columnAttach=[(1, 'left', 0), (2, 'left', 0)])
        self.heading12 = cmds.text(self.heading12, label='Length:', al='left', fn=self.fn)
        self.heading13 = cmds.text(self.heading13, label='', al='right', en=True)
        cmds.setParent('..')
        # range
        self.col2 = cmds.columnLayout(self.col2, adjustableColumn=True)
        self.row2 = cmds.rowLayout(self.row2, numberOfColumns=5, adjustableColumn=3, columnAlign=(1, 'left'), columnAttach=[(1, 'left', 0), (2, 'left', 0), (3, 'right', 0), (4, 'right', 0), (5, 'right', 0)])
        self.heading24 = cmds.text(self.heading24, l='Start:')
        self.int1 = cmds.floatField(self.int1, en=False, pre=2)
        self.heading25 = cmds.text(' - ')
        self.heading26 = cmds.text(self.heading26, l='End:')
        self.int2 = cmds.floatField(self.int2, en=False, pre=2)
        cmds.setParent('..')
        self.sl1 = cmds.intSlider(self.sl1)
        self.sl2 = cmds.intSlider(self.sl2)
        cmds.setParent('..')
        # self.button2 = cmds.button( self.button2, label='Select objects in clip', c=self.cmdAction, bgc=greyD, h=20 )
        self.c1 = cmds.checkBox(label='Current frame as START frame', v=False, ann='...annotation...')
        self.s4 = cmds.separator(height=self.sepH, style=self.sepStl)
        self.c2 = cmds.checkBox(label='Filter selected objects only', v=True, ann='...annotation...')
        # self.c3 = cmds.checkBox( label='Apply infinity', v=True, ann='...annotation...' )
        # self.c4 = cmds.checkBox( label='Import pose on exported frame', v=True, ann='...annotation...' )
        self.c5 = cmds.checkBox(label='NAMESPACE from selection', v=True, ann='...annotation...')
        self.s5 = cmds.separator(height=self.sepH, style=self.sepStl)
        self.c6 = cmds.checkBox(label='Merge with existing layers', v=True, ann='...annotation...')
        self.c7 = cmds.checkBox(label='Apply layer attributes', v=True, ann='...annotation...')
        self.c8 = cmds.checkBox(label='Base layer as new OVERRIDE layer', v=False, ann='...annotation...')
        # import
        self.button3 = cmds.button(self.button3, label='I M P O R T', c=self.cmdAction, bgc=blue)
示例#13
0
def updateKeys(percent=None):
    global settings
    # Disable undo so setting multiple attributes don't rack up in the
    # undo queue
    disableUndo()

    if percent == None:
        percent = float(cmd.intSlider(settings.uiControl['slider'], q=1, v=1))

    if not settings.absolute and not settings.resetOnApply:
        if percent == 0.0:  # Zero is meant to be a reset of sorts.  On relative mode I don't know why someone would want to move keys by 0,
            settings.lastPercent = 0.0  # so if they try to do this, they're probably attempting to reset things.
        if settings.compoundPercentage:
            # Creates a bell curve between -100 and 100.  The top of the
            # bell curve is probably more of a point, with -100 and 100
            # being asymptotes. It's been awhile since I've done stuff
            # like this.  Quite frustrating.  I'm sure there's a better
            # way to do it.

            if settings.lastPercent == 0.0:
                # Avoid divide by zero messages.
                settings.lastPercent = 100.0

            negative = 0
            if percent < 0:
                negative = 1

            # Avoid divide by zero..
            if percent >= 100:
                percent = 99
            elif percent <= -100:
                percent = -99

            calc = 0
            if negative and 0 < settings.lastPercent < 100 or (not negative and -100 < settings.lastPercent < 0):
                # Inverse function to more and more quickly reverse percentages
                calc = 1
                if abs(percent) == 99:
                    newPercent = 100.0
                else:
                    newPercent = -1 * (settings.lastPercent / (abs(percent) / 100 - 1))

                # If the inverse function overshoots 100%, switch to regular function.
                if abs(newPercent) > 100:
                    calc = 0
            if not calc:
                newPercent = abs(settings.lastPercent) * (1 - abs(percent / 100.0))
                if negative:
                    newPercent = newPercent * - 1

            settings.lastPercent = newPercent
            percent = 1 - abs(newPercent) / 100

            if newPercent < 0:
                percent = percent * -1

        else:
            percent = settings.lastPercent + percent
            settings.lastPercent = percent
            percent = percent / 100.0
    else:
        percent = percent / 100.0

    blendUpPercent = percent
    blendDownPercent = percent
    if percent < 0:
        blendUpPercent = 0
        blendDownPercent *= -1
    else:
        blendDownPercent = 0


    mode = settings.mode
    # Force mode to average if percent is zero and reset on apply is set
    # and it is relative. This forces the key to the middle of the
    # surrounding keys when zero is pressed - like a reset button. Which
    # zero is always supposed to mean.  In my mind.  And tool :D I might
    # take this out if it just doesn't feel consistent enough.
    fakeReset = percent == 0.0 and settings.resetOnApply and not settings.absolute and mode == 'Blend'
    if fakeReset:
        mode = 'Average'

    canShrink = True
    for attr in settings.keys.keys():
        keyVal = blendDownPercent * settings.keys[attr][0]['value'] + blendUpPercent * settings.keys[attr][-1]['value']

        startKey = settings.keys[attr][0]
        endKey = settings.keys[attr][-1]
        for key in range(1, len(settings.keys[attr]) - 1):
            # Skip fake resets on end keys - they won't behave as the user expects (Halving the end key values instead of zeroing them)
            if fakeReset and ((key == 1 and settings.keys[attr][key - 1]['endKey']) or (key == len(settings.keys[attr]) - 2) and settings.keys[attr][key + 1]['endKey']):
                percent = 0
            elif fakeReset:
                percent = 1

            midKey = settings.keys[attr][key]
            if mode == 'Blend':
                keyValFin = midKey['value'] * (1 - abs(percent)) + keyVal
            elif mode == 'Average':
                keyValFin = midKey['value'] * (1 - percent) + ((startKey['value'] + endKey['value']) / 2) * percent
            elif mode == 'Default':
                keyValFin = midKey['value'] * (1 - percent) + midKey['default'] * percent
            elif mode == 'Shrink':
                if midKey['shrink']:
                    keyValFin = midKey['value'] * (1 - percent) + midKey['shrink'] * percent
                else:
                    canShrink = False
                    break
            elif mode == 'Level':
                keyValFin = midKey['value'] * (1 - percent) + midKey['level'] * percent
            elif mode == 'Linear':
                keyValFin = midKey['value'] * (1 - percent) + midKey['linear'] * percent

            cmd.keyframe(attr, a=1, valueChange=keyValFin, index=(midKey['key'], midKey['key']))
            settings.keys[attr][key]['lastValue'] = keyValFin
            if settings.resetOnApply and not settings.absolute:
                settings.keys[attr][key]['value'] = keyValFin
        if not canShrink:
            break

    # Raise warning ONCE if shrink won't work for selection
    if not canShrink and not settings.shrinkWarning:
        om.MGlobal.displayWarning('Shrink will not work for this selection.  Select the same number of keys for every attribute for shrink to work.')
        settings.shrinkWarning = True
def	rigAidGUI	():
# >>> check main GUI element existence <<< ########################
	if	cmds.window		(	'rigAid_window',	exists	=	True	):
		cmds.showWindow	(	'rigAid_window'	)
	
# >>> check template existences <<< ##############################
	else:
		if	cmds.uiTemplate	(	'template_window',	exists	=	True	):
			cmds.deleteUI	(	'template_window',		uiTemplate	=	True	)
		if	cmds.uiTemplate	(	'template_column',	exists	=	True	):
			cmds.deleteUI	(	'template_column',		uiTemplate	=	True	)
		if	cmds.uiTemplate	(	'template_frame',	exists	=	True	):
			cmds.deleteUI	(	'template_frame',		uiTemplate	=	True	)
		if	cmds.uiTemplate	(	'template_button',	exists	=	True	):
			cmds.deleteUI	(	'template_button',		uiTemplate	=	True	)
		if	cmds.uiTemplate	(	'template_radioBtn',exists	=	True	):
			cmds.deleteUI	(	'template_radioBtn',	uiTemplate	=	True	)
		if	cmds.uiTemplate	(	'template_row',		exists	=	True	):
			cmds.deleteUI	(	'template_row',			uiTemplate	=	True	)
		if	cmds.uiTemplate	(	'template_sprtor',		exists	=	True	):
			cmds.deleteUI	(	'template_sprtor',			uiTemplate	=	True	)

# >>> define GUI element templates <<< ##############################
		cmds.uiTemplate		(	'template_window'	)
		cmds.uiTemplate		(	'template_column'	)
		cmds.uiTemplate		(	'template_frame'	)
		cmds.uiTemplate		(	'template_button'	)
		cmds.uiTemplate		(	'template_radioBtn'	)
		cmds.uiTemplate		(	'template_row'		)
		cmds.uiTemplate		(	'template_sprtor'	)
		
		cmds.window			(	defineTemplate		=	'template_window',
								sizeable			=	False,
								toolbox				=	True,
								topLeftCorner		=	(	200,	300	),
								resizeToFitChildren	=	True	)
						
		cmds.columnLayout	(	defineTemplate		=	'template_column',	)
							
		cmds.frameLayout	(	defineTemplate		=	'template_frame',
								borderVisible		=	True,
								borderStyle			=	'etchedOut',
								collapsable			=	True,
								preCollapseCommand	=	'cmds.window ( \'rigAid_window\', edit=1, height=1)'	)
							
		cmds.rowLayout		(	defineTemplate		=	'template_row'	)
							
		cmds.button			(	defineTemplate		=	'template_button',
								width				=	110,
								height				=	20,
								align				=	'left',
								actOnPress			=	True	)
		
		cmds.radioButton	(	defineTemplate		=	'template_radioBtn',
								align				=	'left',
								recomputeSize		=	True	)

		cmds.separator		(	defineTemplate		=	'template_sprtor',
								width	=	110,	height	=	2,	style	=	'in',	horizontal	=	True	)

# >>> GUI layout <<< ####################################################
		cmds.window				(	'rigAid_window',
									title				=	'ford`s rigAid',
									useTemplate			=	'template_window',
									retain				=	True	)
		cmds.columnLayout		(	'master_column',	
									useTemplate			=	'template_column'	)
		cmds.frameLayout		(	'showHide_frame',
									label				=	'showHide',
									borderVisible		=	False,	
									useTemplate			=	'template_frame'	)
		cmds.columnLayout		(	'main_column',		
									useTemplate			=	'template_column'	)
		cmds.frameLayout		(	'frame_creation',	
									label				=	'creation',
									useTemplate			=	'template_frame'	)
		cmds.columnLayout		(	'column_creation',		
									useTemplate			=	'template_column'	)
		cmds.setParent			(	'main_column'		)
		cmds.frameLayout		(	'frame_orientation',	
									label				=	'orientation',
									useTemplate			=	'template_frame'	)
		cmds.columnLayout		(	'column_orientation',		
									useTemplate			=	'template_column'	)
		cmds.separator			(	useTemplate	=	'template_sprtor'	)
		cmds.rowLayout			(	'row_adjustOrient',
									numberOfColumns		=	2,
									columnWidth			=	(	1,	28	),
									useTemplate			=	'template_row'		)
		cmds.columnLayout		(	'column_selectAxis',
									useTemplate			=	'template_column'	)
		cmds.setParent			(	'row_adjustOrient'	)
		cmds.columnLayout		(	'column_orientProperties',
									useTemplate			=	'template_column'	)
		cmds.setParent			(	'main_column'		)
		cmds.frameLayout		(	'frame_control',
									label				=	'control',
									useTemplate			=	'template_frame'	)
		cmds.columnLayout		(	'column_control',
									useTemplate			=	'template_column'	)

# >>> creation buttons <<< #####################################################
		cmds.setUITemplate		(	'template_button',	pushTemplate	=	True	)
		cmds.setParent			(	'column_creation'						)

		cmds.separator			(	useTemplate	=	'template_sprtor'	)
		cmds.button				(	label	=	'arrow #2',	command	=	'fra.create2Arrowhead	()'	)
		cmds.button				(	label	=	'arrow #4',	command	=	'fra.create4Arrowhead	()'	)
		cmds.button				(	label	=	'sphere',	command	=	'fra.createSphere 		()'	)
		cmds.button				(	label	=	'cube',		command	=	'fra.createNURBScube	()'	)
		cmds.button				(	label	=	'circle',	command	=	'fra.createCircle		()'	)
		cmds.button				(	label	=	'spheriaclArrow #4',	command	=	'fra.createSpherical4Arrowhead	()'	)
		cmds.button				(	label	=	'curveLocator',	command	=	'fra.createNURBSlocator	()'	)
		cmds.button				(	label	=	'Locator',	command	=	'fra.createLocator	()'	)
		cmds.button				(	label	=	'piramyd',	command	=	'fra.createPiramyd		()'	)
		cmds.button				(	label	=	'circleArrow #1',	command	=	'fra.createCircle1Arrowhead	()'	)
		cmds.separator			(	useTemplate	=	'template_sprtor'	)
		cmds.button				(	label	=	'convert2control',	command	=	'fra.convertToControl	()'	)
		cmds.separator			(	useTemplate	=	'template_sprtor'	)
		cmds.button				(	label	=	'command4curve',	command	=	'fra.createCurveCommand	()'	)
		
# >>> orientation button / options <<< #####################################################
		cmds.setUITemplate		(	'template_radioBtn',	pushTemplate	=	True	)
		cmds.setParent			(	'column_selectAxis'				)

		cmds.radioCollection	(	'radioCollection_axis'			)
		cmds.radioButton		(	'axisX',		label	=	'x',		select	=	True	)
		cmds.radioButton		(	'axisY',		label	=	'y'	)
		cmds.radioButton		(	'axisZ',		label	=	'z'	)
		
		cmds.setParent			(	'column_orientProperties'		)
		cmds.checkBox			(	'check_keepShape',	label	=	'keepShape',	align	=	'left'	)
		
		cmds.separator			(	useTemplate	=	'template_sprtor',	width	=	70	)
		
		cmds.radioCollection	(	'radioCollection_direction'		)
		cmds.radioButton		(	'plus',			label	=	'+',		select	=	True	)
		cmds.radioButton		(	'minus',		label	=	'-'	)
		
		cmds.setUITemplate		(	'template_button',				pushTemplate	=	True	)
		cmds.setParent			(	'column_orientation'			)
		cmds.separator			(	useTemplate	=	'template_sprtor'	)
		cmds.button				(					label	=	'do orient',	command	=	'fra.smartOrient	()'	)
		
# >>> control buttons <<< #####################################################
		cmds.setUITemplate		(	'template_button',				pushTemplate	=	True	)
		cmds.setParent			(	'column_control'				)
		cmds.separator			(	useTemplate	=	'template_sprtor'	)
		cmds.intSlider			(	'boneNum',
									width		=	110,	
									minValue	=	1,
									maxValue	=	10,
									value		=	1,
									dragCommand	=	'''cmds.button	(	'button_boneBreaker',
																		edit	=	True,
																		label	=	'bone breaker #' 
																		+ str	(	cmds.intSlider ('boneNum', 
																					query=1, value=1)	),
																					width	=	110)''')
																					
		cmds.button				(	'button_boneBreaker',	
									label	=	'bone breaker #' + str	(	cmds.intSlider ('boneNum', query=1, value=1)	),
									command	=	'fra.splitJoint		()'	)
		cmds.separator			(	useTemplate	=	'template_sprtor'	)
		cmds.button				(	label			=	'zero all',		command	=	'fra.resetControls	()'	)
		cmds.button				(	label			=	'select LRA',	command	=	'fra.selectLRA		()'	)
		cmds.button				(	label			=	'hide LRA',		command	=	'fra.hideLRA		()'	)

# >>> show GUI <<< #########################################################
		cmds.showWindow			(	'rigAid_window'	)
示例#15
0
import maya.cmds as cmds

cmds.window()

cmds.columnLayout()

cmds.rowColumnLayout( numberOfColumns=1)
cmds.intSliderGrp( field=True, label='Radius', 
                   min=1, max=10, step=1,
                   columnWidth3=[50, 50, 100],
                    columnAlign3=['left', 'left', 'left'],
                    adjustableColumn3=3)
cmds.intSliderGrp( field=True, label='Height', 
                    min=1, max=100, value=3, step=1, 
                    columnWidth3=[50, 50, 100],
                    columnAlign3=['left', 'left', 'left'],
                    adjustableColumn3=3)

cmds.rowColumnLayout( numberOfColumns=2, 
                      columnSpacing=[(2, 77)], 
                      columnWidth=[(2, 100)])
cmds.text(label='Users')
cmds.intSlider()

cmds.showWindow()
示例#16
0
 def populateRange(self):
     # self.control.heading5
     if self.clip.start != None:
         if (self.clip.end - self.clip.start) > 0.0:
             # sliders
             cmds.intSlider(self.control.sl1, edit=True, min=self.clip.start, max=self.clip.end, value=self.clip.start, step=1, dc=self.cmdRangeUpdateMin, en=True)
             cmds.intSlider(self.control.sl2, edit=True, min=self.clip.start, max=self.clip.end, value=self.clip.end, step=1, dc=self.cmdRangeUpdateMax, en=True)
             # fields
             cmds.floatField(self.control.int1, edit=True, min=self.clip.start, max=self.clip.end, value=self.clip.start, step=0.1, en=False)
             cmds.floatField(self.control.int2, edit=True, min=self.clip.start, max=self.clip.end, value=self.clip.end, step=0.1, en=False)
         else:
             # sliders
             cmds.intSlider(self.control.sl1, edit=True, min=0, max=10, value=0, step=1, en=False)
             cmds.intSlider(self.control.sl2, edit=True, min=0, max=10, value=0, step=1, en=False)
             # fields
             cmds.floatField(self.control.int1, edit=True, min=self.clip.start, max=self.clip.end, value=self.clip.start, step=0.1, en=True)
             cmds.floatField(self.control.int2, edit=True, min=self.clip.start, max=self.clip.end, value=self.clip.end, step=0.1, en=True)
     else:
         # sliders
         cmds.intSlider(self.control.sl1, edit=True, min=0, max=10, value=0, step=1, en=False)
         cmds.intSlider(self.control.sl2, edit=True, min=0, max=10, value=0, step=1, en=False)
         # fields
         cmds.floatField(self.control.int1, edit=True, min=0, max=10, value=0, step=0.1, en=False)
         cmds.floatField(self.control.int2, edit=True, min=0, max=10, value=0, step=0.1, en=False)
示例#17
0
 def reset(self, *args):
     self.gear = None
     cmds.intSlider(self.slider, e=True, value=10)
     cmds.text(self.label, e=True, label=10)
示例#18
0
 def cmdLoadingHintToggle(self, on=False, info=True, options=True, range=True, clear=True):
     '''
     disables some ui elements for clarity
     '''
     if not on:
         if info:
             cmds.textScrollList(self.control.scroll2, e=True, en=False)
             cmds.textScrollList(self.control.scroll3, e=True, en=False)
             cmds.textField(self.control.heading7, e=True, en=False)
             cmds.button(self.control.heading6, e=True, en=False)
             cmds.rowLayout(self.control.row5, e=True, en=False)
             cmds.text(self.control.heading9, e=True)
             cmds.rowLayout(self.control.row4, e=True, en=False)
             cmds.radioButtonGrp(self.control.typGrpIm, edit=True, en=False)
             if clear:
                 cmds.text(self.control.heading9, e=True, l='')
                 cmds.text(self.control.heading11, e=True, l='')
                 cmds.textField(self.control.heading7, e=True, tx='off')
         if options:
             cmds.checkBox(self.control.c1, e=True, en=False)
             cmds.checkBox(self.control.c2, e=True, en=False)
             cmds.checkBox(self.control.c5, e=True, en=False)
             cmds.checkBox(self.control.c6, e=True, en=False)
             cmds.checkBox(self.control.c7, e=True, en=False)
             cmds.checkBox(self.control.c8, e=True, en=False)
         if range:
             # headings
             cmds.text(self.control.heading12, e=True, en=False)
             cmds.text(self.control.heading13, e=True, en=False)
             cmds.text(self.control.heading24, e=True, en=False)
             cmds.text(self.control.heading26, e=True, en=False)
             # sliders
             cmds.intSlider(self.control.sl1, edit=True, en=False)
             cmds.intSlider(self.control.sl2, edit=True, en=False)
             # fields
             cmds.floatField(self.control.int1, edit=True, en=False)
             cmds.floatField(self.control.int2, edit=True, en=False)
             if clear:
                 # headings
                 cmds.text(self.control.heading13, e=True, l='')
                 # sliders
                 cmds.intSlider(self.control.sl1, edit=True, min=0, max=10, value=0, step=1)
                 cmds.intSlider(self.control.sl2, edit=True, min=0, max=10, value=0, step=1)
                 # fields
                 cmds.floatField(self.control.int1, edit=True, min=0, max=10, value=0, step=0.1)
                 cmds.floatField(self.control.int2, edit=True, min=0, max=10, value=0, step=0.1)
     else:
         if info:
             cmds.textScrollList(self.control.scroll2, e=True, en=True)
             cmds.textScrollList(self.control.scroll3, e=True, en=True)
             cmds.textField(self.control.heading7, e=True, en=True)
             cmds.button(self.control.heading6, e=True, en=True)
             cmds.rowLayout(self.control.row5, e=True, en=True)
             cmds.text(self.control.heading9, e=True)
             cmds.rowLayout(self.control.row4, e=True, en=True)
             cmds.text(self.control.heading11, e=True)
             cmds.radioButtonGrp(self.control.typGrpIm, edit=True, en=True)
         if options:
             cmds.checkBox(self.control.c1, e=True, en=True)
             cmds.checkBox(self.control.c2, e=True, en=True)
             cmds.checkBox(self.control.c5, e=True, en=True)
             cmds.checkBox(self.control.c6, e=True, en=True)
             cmds.checkBox(self.control.c7, e=True, en=True)
             cmds.checkBox(self.control.c8, e=True, en=True)
         if range:
             # headings
             cmds.text(self.control.heading12, e=True, en=True)
             cmds.text(self.control.heading13, e=True, en=True)
             cmds.text(self.control.heading24, e=True, en=True)
             cmds.text(self.control.heading26, e=True, en=True)
def generateTerrain():
    print "Generating terrain..."
    
    cmds.intSlider(UI_Widgets['FeatureSizeSlider'], query=True, v=True)
def createUI( pWindowTitle , cloud):
	
	windowID = 'myWindowID'
	
	if cmds.window(windowID , exists = True):
		cmds.deleteUI(windowID)
		
	cmds.window(windowID , title = pWindowTitle , sizeable = False , resizeToFitChildren = True)
	
	cmds.rowColumnLayout( numberOfColumns = 3 , columnWidth =[(1,200) , (2,200) , (3 ,200)] , columnOffset = (1 , 'right' , 5))
	
	cmds.separator ( h = 20 , style = 'none')
	cmds.button(label = 'Generate Cloud' , command = cloud.createCloud )
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 30 , style = 'none')
	cmds.separator ( h = 30 , style = 'none')
	cmds.separator ( h = 30 , style = 'none')
	
	cmds.separator ( h = 30 , style = 'none')
	cmds.text(label = 'Set The Size of the Clouds')
	cmds.separator ( h = 30 , style = 'none')
	
	cmds.text(label = 'Set Width')
	
	cmds.intSlider(min = 0 , max = 100 , value = 20 , step = 1 , w = 200 , dragCommand = lambda w : cloud.setW(w))
	
	cmds.separator ( h = 10 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	
	cmds.text(label = 'Set Height')
	
	cmds.intSlider(min = 0 , max = 100 , value = 20 , step = 1 , w = 200 , dragCommand = lambda h : cloud.setH(h))
	
	cmds.separator ( h = 10 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	
	
	cmds.text(label = 'Set Depth')
	
	cmds.intSlider(min = 0 , max = 100 , value = 20 , step = 1 , w = 200 , dragCommand = lambda d : cloud.setD(d))
	
	cmds.separator ( h = 10 , style = 'none')
	cmds.separator ( h = 50 , style = 'none')
	cmds.separator ( h = 50 , style = 'none')
	cmds.separator ( h = 50 , style = 'none')
	
	cmds.separator ( h = 30 , style = 'none')
	cmds.text(label = 'Set How the Clouds Look')
	cmds.separator ( h = 30 , style = 'none')
	
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	
	
	cmds.text(label = 'Density of Clouds')
	
	cmds.floatSlider(min = 0 , max = 1 , value = 0.125 , step = 0.001, w = 200 , dragCommand = lambda t : cloud.setTransparency(t))
	
	cmds.separator ( h = 10 , style = 'none')
	
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	
	cmds.text(label = 'Increase to Centralize Clouds')
	
	cmds.floatSlider(min = 0 , max = 1 , value = 0.165 , step = 0.001, w = 200 , dragCommand = lambda ed : cloud.setEdgeDropoff(ed))
	
	cmds.separator ( h = 10 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	
	cmds.text(label = 'Set Size of Clouds ( reduces Number ) ')
	
	cmds.floatSlider(min = 0 , max = 5 , value = 4.126 , step = 0.01, w = 200 , dragCommand = lambda fr : cloud.setFrequency(fr))
	
	cmds.separator ( h = 10 , style = 'none')	
	
	
	cmds.separator ( h = 50 , style = 'none')
	cmds.text(label = 'Select the Time of the Day')
	cmds.separator ( h = 50 , style = 'none')
	
	cmds.radioCollection()
	
	cmds.radioButton( label='Day', align='center' , onCommand = cloud.day )
	cmds.radioButton( label='Sunset', align='right' , onCommand = cloud.sunset )
	cmds.radioButton( label='Night', align='center' , onCommand = cloud.night )
	
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	cmds.separator ( h = 20 , style = 'none')
	
	cmds.separator ( h = 20 , style = 'none')
	cmds.button(label = 'Reset To Default' , command = cloud.createCloud )
	cmds.separator ( h = 20 , style = 'none')	
		
	cmds.showWindow()
示例#21
0
def UI(pWindowTitle, makeCoral):
    """
    Creating the user Interface to input various paramters to create a coral fan
    """
    windowID = 'Coral Fan'

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

    #UI window
    cmds.window(windowID,
                title=pWindowTitle,
                sizeable=True,
                resizeToFitChildren=True)
    cmds.rowColumnLayout(numberOfColumns=3,
                         columnWidth=[(1, 100), (2, 200), (3, 200)],
                         columnOffset=[(1, 'right', 3)])

    #input fields
    cmds.separator(h=10, style='none')

    cmds.text(label='# Subdivisions X: ')
    Base_sub_x = cmds.intSlider(min=3, max=20, value=3, step=1)
    cmds.separator(h=10, style='none')

    cmds.text(label='# Subdivisions Y: ')
    Base_sub_y = cmds.intSlider(min=3, max=20, value=3, step=1)
    cmds.separator(h=10, style='none')

    cmds.text(label='Center Base Radius: ')
    Base_radius = cmds.floatField()
    cmds.separator(h=10, style='none')

    cmds.text(label='Center Base Hieght Factor: ')
    Base_hieght = cmds.intSlider(min=30, max=100, value=30, step=1)
    cmds.separator(h=10, style='none')

    cmds.text(label='Bottom Base Radius Factor: ')
    Bottom_base_factor_r = cmds.floatField()
    cmds.separator(h=10, style='none')

    cmds.text(label='Bottom Base Height Factor: ')
    Bottom_base_factor_h = cmds.floatField()
    cmds.separator(h=10, style='none')

    cmds.text(label='Max Branches: ')
    Max = cmds.intSlider(min=1, max=10, value=1, step=1)
    cmds.separator(h=10, style='none')

    cmds.text(label='Branch Angle: ')
    Branch_angle = cmds.intSlider(min=1, max=30, value=1, step=1)
    cmds.separator(h=10, style='none')

    cmds.text(label='Branch Height Start Factor: ')
    Branch_start_height_factor = cmds.floatSlider(min=0,
                                                  max=0.5,
                                                  value=0,
                                                  step=0.1)
    cmds.separator(h=10, style='none')

    cmds.text(label='Branch Height Decrease Factor: ')
    Branch_decrease_factor_h = cmds.floatSlider(min=1,
                                                max=2,
                                                value=1,
                                                step=0.1)
    cmds.separator(h=10, style='none')

    cmds.text(label='Branch Radius Decrease Factor: ')
    Branch_decrease_factor_r = cmds.floatSlider(min=1,
                                                max=2,
                                                value=1,
                                                step=0.1)
    cmds.separator(h=10, style='none')

    cmds.text(label='Include Criss-Cross? ')
    Include_right = cmds.optionMenu(w=100)
    cmds.menuItem(label='True')
    cmds.menuItem(label='False')
    cmds.separator(h=10, style='none')

    #apply button calls makeCoral
    cmds.button(label='Apply',
                command=functools.partial(
                    makeCoral, Base_sub_x, Base_sub_y, Base_radius,
                    Base_hieght, Bottom_base_factor_r, Bottom_base_factor_h,
                    Max, Branch_angle, Include_right,
                    Branch_start_height_factor, Branch_decrease_factor_h,
                    Branch_decrease_factor_r))

    def cancelCallback(*pArgs):
        if cmds.window(windowID, exists=True):
            cmds.deleteUI(windowID)

    cmds.button(label='Cancel', command=cancelCallback)
    cmds.showWindow()
示例#22
0
cmds.window()

cmds.columnLayout()

cmds.rowColumnLayout(numberOfColumns=1)
cmds.intSliderGrp(field=True,
                  label='Radius',
                  min=1,
                  max=10,
                  step=1,
                  columnWidth3=[50, 50, 100],
                  columnAlign3=['left', 'left', 'left'],
                  adjustableColumn3=3)
cmds.intSliderGrp(field=True,
                  label='Height',
                  min=1,
                  max=100,
                  value=3,
                  step=1,
                  columnWidth3=[50, 50, 100],
                  columnAlign3=['left', 'left', 'left'],
                  adjustableColumn3=3)

cmds.rowColumnLayout(numberOfColumns=2,
                     columnSpacing=[(2, 77)],
                     columnWidth=[(2, 100)])
cmds.text(label='Users')
cmds.intSlider()

cmds.showWindow()
示例#23
0
    def makeGear(self, *args):
        teeth = cmds.intSlider(self.slider, q=True, value=True)

        self.gear = Gear()
        self.gear.create_gear(teeth=teeth)
示例#24
0
def ui():
    """Slides the middle keys between three or more keys to the values of the
    first and last key. Works on multiple attributes and objects at once."""

    global settings

    sliderFieldLabel = 'jh_sak_sliderFieldLabel'
    modeDrop = 'jh_sak_modeDropDown'
    manualReload = 'jh_sak_manualReloadButton'
    maxLabel = 'jh_sak_maxLabel'
    maxField = 'jh_sak_maxField'
    applyButton = 'jh_sak_applyButton'
    quickPickButton = ['jh_sak_quickPickButton%s' % x for x in range(len(settings.quickPickNums))]
    quickPickInvert = 'jh_sak_quickPickInvert'

    if cmd.window('slideAnimationKeysWin', exists=1):
        cmd.deleteUI('slideAnimationKeysWin')

    # cmd.windowPref('slideAnimationKeysWin', remove = 1)
    cmd.window('slideAnimationKeysWin', w=380, h=100, s=1, tb=1, menuBar=1, t='Slide Animation Keys - v%s' % __version__)

    cmd.menu(label='Options')
    cmd.menuItem(label='Settings', c=settingsWin)
    cmd.menu(label='Help', helpMenu=1)
    cmd.menuItem(label='Usage', c=usageWin)
    cmd.menuItem(label='About', c=aboutWin)

    cmd.formLayout('jh_sak_formLay', numberOfDivisions=100)

    lastMode = cmd.optionVar(q='jh_sak_mode')

    cmd.optionMenu(
        modeDrop,
        label='',
        cc=setMode)

    for mode in settings.modes:
        cmd.menuItem(label=mode)

    # Set mode dropdown to previous mode.
    cmd.optionMenu(
        modeDrop,
        e=1,
        sl=settings.modes.index(lastMode) + 1)

    cmd.button(
        manualReload,
        label='Reload Keys',
        vis=settings.manualReload,
        c=lambda *args: loadKeys(1))

    cmd.text(
        sliderFieldLabel,
        vis=settings.showSliderField,
        label='Custom Strength')

    settings.uiControl['sliderField'] = cmd.intField(
        'jh_sak_sliderField',
        minValue=-1 * settings.maxSlider,
        maxValue=settings.maxSlider,
        value=0,
        vis=settings.showSliderField,
        cc=setSlide)

    for x in range(len(quickPickButton)):
        cmd.button(
            quickPickButton[x],
            vis=settings.showQuickPick,
            c=partial(setSlide, settings.quickPickNums[x], qp=1),
            label='%s%%' % settings.quickPickNums[x])

    settings.uiControl['slider'] = cmd.intSlider(
        'jh_sak_sliderSlider',
        minValue=-1 * settings.maxSlider,
        maxValue=settings.maxSlider,
        value=0,
        vis=settings.showSlider,
        dc=lambda *args: startSlide(int(args[0])),  # Certain versions of Maya apparently pass INTslider values as UNICODE.  WTF
        cc=endSlide)

    # Apply button is on if it's not realtime in absolute mode and if
    # either the slider or the strength field are also on.
    cmd.button(
        applyButton,
        vis=(1 - settings.realtime * settings.absolute) * (1 - (1 - settings.showSlider) * (1 - settings.showSliderField)),
        c = partial(setSlide, apply=1),
        label = "Apply")

    #
    # Format the layout

    layout = {'af': [], 'ap': [], 'ac': []}

    layout['af'].append((modeDrop, 'top', 5))
    layout['af'].append((modeDrop, 'left', 5))
    layout['ap'].append((modeDrop, 'right', 5, 25))

    reloadWidth = 65
    if not settings.showSliderField:
        reloadWidth = 100
    elif not settings.manualReload:
        reloadWidth = 50

    layout['af'].append((manualReload, 'top', 5))
    layout['ap'].append((manualReload, 'left', 5, 25))
    layout['ap'].append((manualReload, 'right', 5, reloadWidth))

    layout['af'].append((sliderFieldLabel, 'top', 8))
    layout['ap'].append((sliderFieldLabel, 'left', 5, reloadWidth))

    layout['af'].append((settings.uiControl['sliderField'], 'top', 5))
    layout['ac'].append((settings.uiControl['sliderField'], 'left', 5, sliderFieldLabel))
    layout['af'].append((settings.uiControl['sliderField'], 'right', 5))

    # Position quick picks
    totalDivisor = len(quickPickButton)
    moveAmount = 100.0 / totalDivisor
    middleAmount = 0
    if totalDivisor % 2 and totalDivisor > 1:
        middleAmount = moveAmount / 3.0
        moveAmount = (100.0 - moveAmount - middleAmount) / (totalDivisor - 1)

    moveBy = 0
    for x in range(len(quickPickButton)):
        startBuffer = 1
        if x == 0:
            startBuffer = 5
        layout['ac'].append((quickPickButton[x], 'top', 5, modeDrop))
        layout['ap'].append((quickPickButton[x], 'left', startBuffer, (moveBy)))
        moveBy = moveBy + moveAmount
        if x == len(quickPickButton) / 2:
            moveBy = moveBy + middleAmount
        layout['ap'].append((quickPickButton[x], 'right', 1, moveBy))

    above = modeDrop
    if settings.showQuickPick:
        above = quickPickButton[0]

    layout['ac'].append((settings.uiControl['slider'], 'top', 5, above))
    layout['af'].append((settings.uiControl['slider'], 'left', 5))
    layout['af'].append((settings.uiControl['slider'], 'right', 5))

    if settings.showSlider:
        above = settings.uiControl['slider']

    layout['ac'].append((applyButton, 'top', 5, above))
    layout['af'].append((applyButton, 'left', 5))
    layout['af'].append((applyButton, 'right', 5))


    cmd.formLayout(
        'jh_sak_formLay',
        e=1,
        **layout)
    cmd.showWindow('slideAnimationKeysWin')
	def getWeightMultiplier(self):
		return cmds.intSlider(self.wmSliderCtrl, query=True, value=True)
示例#26
0
 def reset_t(self, *args):
     self.num_teeth = 10
     cmds.intSlider(self.num_teeth_slider_id, edit=True, value=self.num_teeth)
     cmds.text(self.num_teeth_label_id, edit=True, label=self.num_teeth_txt.format(self.num_teeth))
     pass
示例#27
0
    def uiCreate(self):

        self.onCloseClicked()

        self.window = m.window(
            WIN_NAME,
            title='Maya Window',
            maximizeButton=False
        )

        uiLAY_mainForm = m.formLayout()

        self.uiLAY_mainScroll = m.scrollLayout(childResizable=True)

        mainColumn = m.columnLayout(adjustableColumn=True)  # main column layout with frames

        # --------
        self.uiLAY_frameCheckBoxes = self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiCHK_test1 = m.checkBox('uiCHK_test1', label='test1')
        self.uiCHK_test2 = m.checkBox('uiCHK_test2', label='test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameCheckBoxGroups = self.uiCreateFrame('uiLAY_frameCheckBoxGroups',
                                                            'Check Box Groups (PMCheckBoxGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiCHKGRP_test1 = m.checkBoxGrp(
            'uiCHKGRP_test1',
            numberOfCheckBoxes=1,
            label='PMCheckBoxGrp1',
            label1='test1'
        )
        self.uiCHKGRP_test2 = m.checkBoxGrp(
            'uiCHKGRP_test2',
            numberOfCheckBoxes=2,
            label='PMCheckBoxGrp2',
            labelArray2=('test1', 'test2')
        )
        self.uiCHKGRP_test3 = m.checkBoxGrp(
            'uiCHKGRP_test3',
            numberOfCheckBoxes=3,
            label='PMCheckBoxGrp3',
            labelArray3=('test1', 'test2', 'test3')
        )
        self.uiCHKGRP_test4 = m.checkBoxGrp(
            'uiCHKGRP_test4',
            numberOfCheckBoxes=4,
            label='PMCheckBoxGrp4',
            labelArray4=('test1', 'test2', 'test3', 'test4')
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameColorSliders = self.uiCreateFrame('uiLAY_frameColorSliders',
                                                          'Color Slider Groups (PMColorSliderGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiCLRGRP_test1 = m.colorSliderGrp(
            'uiCLRGRP_test1',
            label='test1'
        )
        self.uiCLRGRP_test2 = m.colorSliderGrp(
            'uiCLRGRP_test2',
            label='test2'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatFields = self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)
        m.separator(width=140, style='none')
        self.uiFLF_test1 = m.floatField('uiFLF_test1')
        self.uiFLF_test2 = m.floatField('uiFLF_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatFieldGroups = self.uiCreateFrame('uiLAY_frameFloatFieldGroups',
                                                              'Float Field Groups (PMFloatFieldGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiFLFGRP_test1 = m.floatFieldGrp(
            'uiFLFGRP_test1',
            numberOfFields=1,
            label='PMFloatFieldGrp1'
        )
        self.uiFLFGRP_test2 = m.floatFieldGrp(
            'uiFLFGRP_test2',
            numberOfFields=2,
            label='PMFloatFieldGrp2'
        )
        self.uiFLFGRP_test3 = m.floatFieldGrp(
            'uiFLFGRP_test3',
            numberOfFields=3,
            label='PMFloatFieldGrp3'
        )
        self.uiFLFGRP_test4 = m.floatFieldGrp(
            'uiFLFGRP_test4',
            numberOfFields=4,
            label='PMFloatFieldGrp4'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatScrollBars = self.uiCreateFrame('uiLAY_frameFloatScrollBars',
                                                             'Float Scroll Bars (PMFloatScrollBar)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiFLSCRL_test1 = m.floatScrollBar('uiFLSCRL_test1')
        self.uiFLSCRL_test2 = m.floatScrollBar('uiFLSCRL_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatSliders = self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiFLTSLD_test1 = m.floatSlider('uiFLTSLD_test1')
        self.uiFLTSLD_test2 = m.floatSlider('uiFLTSLD_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatSliderGroups = self.uiCreateFrame('uiLAY_frameFloatSliderGroups',
                                                               'Float Slider Groups (PMFloatSliderGrp)')
        m.columnLayout()
        m.separator(style='none', height=2)
        self.uiFLSGRP_test1 = m.floatSliderGrp(
            'uiFLSGRP_test1',
            label='test1',
            field=True
        )
        self.uiFLSGRP_test2 = m.floatSliderGrp(
            'uiFLSGRP_test2',
            label='test2',
            field=True
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextCheckBoxes = self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes',
                                                                'Icon Text Check Boxes (PMIconTextCheckBox)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiITCHK_test1 = m.iconTextCheckBox(
            'uiITCHK_test1',
            style='iconAndTextHorizontal',
            label='cube',
            image1='cube'
        )
        self.uiITCHK_test2 = m.iconTextCheckBox(
            'uiITCHK_test2',
            style='iconAndTextHorizontal',
            label='cone',
            image1='cone'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextRadioButtons = self.uiCreateFrame('uiLAY_frameIconTextRadioButtons',
                                                                  'Icon Text Radio Buttons (PMIconTextRadioButton)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=4)

        m.separator(style='none', width=140)
        m.iconTextRadioCollection()
        self.uiITRAD_test1 = m.iconTextRadioButton(
            'uiITRAD_test1',
            style='iconAndTextHorizontal',
            label='cube',
            image1='cube'
        )
        self.uiITRAD_test2 = m.iconTextRadioButton(
            'uiITRAD_test2',
            style='iconAndTextHorizontal',
            label='cone',
            image1='cone'
        )
        self.uiITRAD_test3 = m.iconTextRadioButton(
            'uiITRAD_test3',
            style='iconAndTextHorizontal',
            label='torus',
            image1='torus'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextScrollLists = self.uiCreateFrame('uiLAY_frameIconTextScrollLists',
                                                                 'Icon Text Scroll Lists (PMIconTextScrollList)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiITSLST_test1 = m.iconTextScrollList(
            'uiITSLST_test1',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
        )
        self.uiITSLST_test2 = m.iconTextScrollList(
            'uiITSLST_test2',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntFields = self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiINF_test1 = m.intField('uiINF_test1')
        self.uiINF_test2 = m.intField('uiINF_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntFieldGroups = self.uiCreateFrame('uiLAY_frameIntFieldGroups',
                                                            'Int Field Groups (PMIntFieldGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiINFGRP_test1 = m.intFieldGrp(
            'uiINFGRP_test1',
            numberOfFields=1,
            label='PMIntFieldGrp1'
        )
        self.uiINFGRP_test2 = m.intFieldGrp(
            'uiINFGRP_test2',
            numberOfFields=2,
            label='PMIntFieldGrp2'
        )
        self.uiINFGRP_test3 = m.intFieldGrp(
            'uiINFGRP_test3',
            numberOfFields=3,
            label='PMIntFieldGrp3'
        )
        self.uiINFGRP_test4 = m.intFieldGrp(
            'uiINFGRP_test4',
            numberOfFields=4,
            label='PMIntFieldGrp4'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntScrollBars = self.uiCreateFrame('uiLAY_frameIntScrollBars',
                                                           'Int Scroll Bars (PMIntScrollBar)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiINSCRL_test1 = m.intScrollBar('uiINSCRL_test1')
        self.uiINSCRL_test2 = m.intScrollBar('uiINSCRL_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntSliders = self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiINTSLD_test1 = m.intSlider('uiINTSLD_test1')
        self.uiINTSLD_test2 = m.intSlider('uiINTSLD_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntSliderGroups = self.uiCreateFrame('uiLAY_frameIntSliderGroups',
                                                             'Int Slider Groups (PMIntSliderGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiINSGRP_test1 = m.intSliderGrp(
            'uiINSGRP_test1',
            label='test1',
            field=True
        )
        self.uiINSGRP_test2 = m.intSliderGrp(
            'uiINSGRP_test2',
            label='test2',
            field=True
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameOptionMenus = self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=110, style='none')
        self.uiOPTMNU_test1 = m.optionMenu('uiOPTMNU_test1', label='test1')
        m.menuItem(label='one')
        m.menuItem(label='two')
        m.menuItem(label='three')
        self.uiOPTMNU_test2 = m.optionMenu('uiOPTMNU_test2', label='test2')
        m.menuItem(label='four')
        m.menuItem(label='five')
        m.menuItem(label='six')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameOptionMenuGroups = self.uiCreateFrame('uiLAY_frameOptionMenuGroups',
                                                              'Option Menus Groups (PMOptionMenuGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiOPMGRP_test1 = m.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel')
        m.menuItem(label='one')
        m.menuItem(label='two')
        m.menuItem(label='three')
        self.uiOPMGRP_test2 = m.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel')
        m.menuItem(label='four')
        m.menuItem(label='five')
        m.menuItem(label='six')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameRadioButtons = self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=4)

        m.separator(style='none', width=140)
        m.radioCollection()
        self.uiRAD_test1 = m.radioButton('uiRAD_test1', label='test1')
        self.uiRAD_test2 = m.radioButton('uiRAD_test2', label='test2')
        self.uiRAD_test3 = m.radioButton('uiRAD_test3', label='test3')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameRadioButtonGroups = self.uiCreateFrame('uiLAY_frameRadioButtonGroups',
                                                               'Radio Button Groups (PMRadioButtonGrp#)')

        m.columnLayout()
        m.separator(style='none', height=2)
        self.uiRADGRP_test1 = m.radioButtonGrp(
            'uiRADGRP_test1',
            numberOfRadioButtons=1,
            label='PMRadioButtonGrp1',
            label1='test1'
        )
        self.uiRADGRP_test2 = m.radioButtonGrp(
            'uiRADGRP_test2',
            numberOfRadioButtons=2,
            label='PMRadioButtonGrp2',
            labelArray2=('test1', 'test2')
        )
        self.uiRADGRP_test3 = m.radioButtonGrp(
            'uiRADGRP_test3',
            numberOfRadioButtons=3,
            label='PMRadioButtonGrp3',
            labelArray3=('test1', 'test2', 'test3')
        )
        self.uiRADGRP_test4 = m.radioButtonGrp(
            'uiRADGRP_test4',
            numberOfRadioButtons=4,
            label='PMRadioButtonGrp4',
            labelArray4=('test1', 'test2', 'test3', 'test4')
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameSymbolCheckBoxes = self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes',
                                                              'Symbol Check Boxes (PMSymbolCheckBox)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSYMCHK_test1 = m.symbolCheckBox(
            'uiSYMCHK_test1',
            image='polyCube'
        )
        self.uiSYMCHK_test2 = m.symbolCheckBox(
            'uiSYMCHK_test2',
            image='polyCone'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameScriptTables = self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSCRTBL_test1 = m.scriptTable(
            'uiSCRTBL_test1',
            selectionMode=3,
            rows=4,
            columns=2
        )
        self.uiSCRTBL_test2 = m.scriptTable(
            'uiSCRTBL_test2',
            selectionMode=3,
            rows=4,
            columns=2
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameScrollField = self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSCRFLD_test1 = m.scrollField(
            'uiSCRFLD_test1',
            wordWrap=True
        )
        self.uiSCRFLD_test2 = m.scrollField(
            'uiSCRFLD_test2',
            wordWrap=True
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameShelfTabLayout = self.uiCreateFrame('uiLAY_frameShelfTabLayout',
                                                            'Shelf Tab Layout (PMShelfTabLayout)')

        m.columnLayout(adjustableColumn=True)

        self.uiSHLTAB_test1 = m.shelfTabLayout()

        m.shelfLayout('test1')
        m.setParent('..')
        m.shelfLayout('test2')
        m.setParent('..')
        m.shelfLayout('test3')
        m.setParent('..')

        m.setParent('..')

        self.uiSHLTAB_test2 = m.shelfTabLayout()

        m.shelfLayout('test4')
        m.setParent('..')
        m.shelfLayout('test5')
        m.setParent('..')
        m.shelfLayout('test6')
        m.setParent('..')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTabLayout = self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)')

        m.columnLayout(adjustableColumn=True)

        self.uiTAB_test1 = m.tabLayout()

        uiLAY_tabRow1 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow2 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow3 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')

        m.setParent('..')

        m.tabLayout(
            self.uiTAB_test1,
            edit=True,
            tabLabel=((uiLAY_tabRow1, 'test1'), (uiLAY_tabRow2, 'test2'), (uiLAY_tabRow3, 'test3'),)
        )

        self.uiTAB_test2 = m.tabLayout()

        uiLAY_tabRow4 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow5 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow6 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')

        m.setParent('..')

        m.tabLayout(
            self.uiTAB_test2,
            edit=True,
            tabLabel=((uiLAY_tabRow4, 'test4'), (uiLAY_tabRow5, 'test5'), (uiLAY_tabRow6, 'test6'),)
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFields = self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiTXT_test1 = m.textField('uiTXT_test1')
        self.uiTXT_test2 = m.textField('uiTXT_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFieldButtonGroups = self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups',
                                                                   'Text Field Button Groups (PMTextFieldButtonGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiTXBTGR_test1 = m.textFieldButtonGrp(
            'uiTXBTGR_test1',
            label='test1',
            buttonLabel='button1'
        )
        self.uiTXBTGR_test2 = m.textFieldButtonGrp(
            'uiTXBTGR_test2',
            label='test2',
            buttonLabel='button2'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFieldGroups = self.uiCreateFrame('uiLAY_frameTextFieldGroups',
                                                             'Text Field Groups (PMTextFieldGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiTXTGRP_test1 = m.textFieldGrp(
            'uiTXTGRP_test1',
            label='test1'
        )
        self.uiTXTGRP_test2 = m.textFieldGrp(
            'uiTXTGRP_test2',
            label='test2'
        )

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextScrollLists = self.uiCreateFrame('uiLAY_frameTextScrollLists',
                                                             'Text Scroll Lists (PMTextScrollList)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiTXTLST_test1 = m.textScrollList(
            'uiTXTLST_test1',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
        )
        self.uiTXTLST_test2 = m.textScrollList(
            'uiTXTLST_test2',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
        )

        # --------
        m.setParent(uiLAY_mainForm)

        self.uiBTN_savePrefs = m.button(
            label='Save Prefs',
            height=MAIN_BUTTONS_HEIGHT,
            command=self.onSavePrefsClicked
        )

        self.uiBTN_loadPrefs = m.button(
            label='Load Prefs',
            height=MAIN_BUTTONS_HEIGHT,
            command=self.onLoadPrefsClicked
        )

        self.uiBTN_resetPrefs = m.button(
            label='Reset Prefs',
            height=MAIN_BUTTONS_HEIGHT,
            command=self.onResetPrefsClicked
        )

        m.setParent('..')  # -> window

        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'top', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'left', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiLAY_mainScroll, 'right', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachControl=[(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)])

        m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_savePrefs, 'top')])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'left', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_savePrefs, 'right', 2, 33)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_savePrefs, 'bottom', 2)])

        m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_loadPrefs, 'top')])
        m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'left', 2, 33)])
        m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_loadPrefs, 'right', 2, 66)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_loadPrefs, 'bottom', 2)])

        m.formLayout(uiLAY_mainForm, e=True, attachNone=[(self.uiBTN_resetPrefs, 'top')])
        m.formLayout(uiLAY_mainForm, e=True, attachPosition=[(self.uiBTN_resetPrefs, 'left', 2, 66)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'right', 2)])
        m.formLayout(uiLAY_mainForm, e=True, attachForm=[(self.uiBTN_resetPrefs, 'bottom', 2)])

        m.showWindow(self.window)
	def enable(self, enabled):
		#Only enable the color set selector if user weights are enabled
		cmds.checkBox(self.userWeightCheckBoxCtrl, edit=True, en=enabled)
		useUserWeights = cmds.checkBox(self.userWeightCheckBoxCtrl, query = True, value=True)
		cmds.optionMenu(self.colorSetListCtrl, edit=True, en=enabled and useUserWeights)
		cmds.intSlider(self.wmSliderCtrl, edit=True, en=enabled and useUserWeights)				
示例#29
0
def	main	():
	# GUI variables
	symBtnWidth			=	36
	btnHeight			=	20
	gridCols			=	3
	winWidth			=	symBtnWidth	*	gridCols

	# check main GUI element existence
	if	cmds.window	('rigAid_window',	exists	=	True):	cmds.showWindow	('rigAid_window')
	
	else:
		# check template existences
		if	cmds.uiTemplate	('template_window',		exists	=	True):	cmds.deleteUI	('template_window',		uiTemplate	=	True)
		if	cmds.uiTemplate	('template_column',		exists	=	True):	cmds.deleteUI	('template_column',		uiTemplate	=	True)
		if	cmds.uiTemplate	('template_frame',		exists	=	True):	cmds.deleteUI	('template_frame',		uiTemplate	=	True)
		if	cmds.uiTemplate	('template_button',		exists	=	True):	cmds.deleteUI	('template_button',		uiTemplate	=	True)
		if	cmds.uiTemplate	('template_radioBtn',	exists	=	True):	cmds.deleteUI	('template_radioBtn',	uiTemplate	=	True)
		if	cmds.uiTemplate	('template_row',		exists	=	True):	cmds.deleteUI	('template_row',		uiTemplate	=	True)
		if	cmds.uiTemplate	('template_grid',		exists	=	True):	cmds.deleteUI	('template_grid',		uiTemplate	=	True)
		if	cmds.uiTemplate	('template_symButton',	exists	=	True):	cmds.deleteUI	('template_symButton',	uiTemplate	=	True)
		if	cmds.uiTemplate	('template_separator',	exists	=	True):	cmds.deleteUI	('template_separator',	uiTemplate	=	True)

		# create GUI templates
		cmds.uiTemplate		('template_window')
		cmds.uiTemplate		('template_column')
		cmds.uiTemplate		('template_frame')
		cmds.uiTemplate		('template_button')
		cmds.uiTemplate		('template_radioBtn')
		cmds.uiTemplate		('template_row')
		cmds.uiTemplate		('template_grid')
		cmds.uiTemplate		('template_symButton')
		cmds.uiTemplate		('template_separator')
		
		# define GUI templates
		cmds.window			(defineTemplate	=	'template_window',	sizeable	=	False,	toolbox	=	True,	resizeToFitChildren	=	True)
		cmds.columnLayout	(defineTemplate	=	'template_column')
		cmds.frameLayout	(defineTemplate	=	'template_frame',	borderVisible	=	True,	borderStyle	=	'etchedOut',
							collapsable	=	True,	preCollapseCommand	=	'cmds.window ( \'rigAid_window\', edit=1, height=1)')
		cmds.rowLayout		(defineTemplate	=	'template_row')
		cmds.gridLayout		(defineTemplate	=	'template_grid')
		cmds.symbolButton	(defineTemplate	=	'template_symButton',	width	=	symBtnWidth,
							height	=	symBtnWidth,	image	=	'ford_riggingAid__shelf.xpm')
		cmds.button			(defineTemplate	=	'template_button',	width	=	winWidth,	height	=	btnHeight,	align	=	'left',
							actOnPress	=	True)
		cmds.radioButton	(defineTemplate	=	'template_radioBtn',	align	=	'left',	recomputeSize	=	True)
		cmds.separator		(defineTemplate	=	'template_separator',	width	=	winWidth,
							height	=	2,	style	=	'in',	horizontal	=	True)

		# GUI layout
		cmds.window			('rigAid_window',	title	=	'ford`s rigAid',	useTemplate	=	'template_window',	retain	=	True)
		cmds.columnLayout	('master_column',	useTemplate	=	'template_column')
		cmds.frameLayout	('showHide_frame',	label	=	'showHide',	borderVisible	=	False,	useTemplate	=	'template_frame')
		cmds.columnLayout	('main_column',	useTemplate	=	'template_column')
		cmds.frameLayout	('frame_creation',	label	=	'creation',	useTemplate	=	'template_frame')
		cmds.columnLayout	('column_creation',	useTemplate	=	'template_column')
		cmds.gridLayout		('grid_creation',	useTemplate	=	'template_grid',	numberOfColumns	=	gridCols,
												cellWidthHeight	=	(symBtnWidth,	symBtnWidth))
		cmds.setParent		('main_column')
		cmds.frameLayout	('frame_orientation',	label	=	'orientation',	useTemplate	=	'template_frame')
		cmds.columnLayout	('column_orientation',	useTemplate	=	'template_column')
		cmds.gridLayout		('grid_orientButtons',	useTemplate	=	'template_grid',	numberOfColumns	=	2,
													cellWidthHeight	=	(winWidth	/	2,	symBtnWidth))
		cmds.setParent		('column_orientation')
		cmds.gridLayout		('grid_selectAxis',	useTemplate	=	'template_grid',	numberOfColumns	=	3,
												cellWidthHeight	=	(winWidth	/	3,	20))
		cmds.setParent		('main_column')
		cmds.frameLayout	('frame_control',	label	=	'control',	useTemplate	=	'template_frame')
		cmds.columnLayout	('column_control',	useTemplate	=	'template_column')
		cmds.setParent		('main_column')
		cmds.frameLayout	('frame_setup',	label	=	'setup',	useTemplate	=	'template_frame')
		cmds.columnLayout	('column_setup',	useTemplate	=	'template_column')

# >>> creation buttons <<< _______________________________________________________________________________________
		cmds.separator		(useTemplate	=	'template_separator'	)
		
		cmds.setParent		('grid_creation'	)
		cmds.setUITemplate	('template_symButton',	pushTemplate	=	True	)

		cmds.symbolButton	(command	='fra.create2Arrowhead()',			image	=	'ford_riggingAid__create2Arrowhead.xpm'	)
		cmds.symbolButton	(command	='fra.create4Arrowhead()',			image	=	'ford_riggingAid__create4Arrowhead.xpm'	)
		cmds.symbolButton	(command	='fra.createSphere()',				image	=	'ford_riggingAid__createSphere.xpm'	)
		cmds.symbolButton	(command	='fra.createNURBScube()',			image	=	'ford_riggingAid__createNURBScube.xpm'	)
		cmds.symbolButton	(command	='fra.createCircle()',				image	=	'ford_riggingAid__createCircle.xpm'	)
		cmds.symbolButton	(command	='fra.createSpherical4Arrowhead()',	image	=	'ford_riggingAid__createSpherical4Arrowhead.xpm')
		cmds.symbolButton	(command	='fra.createNURBSlocator()',		image	=	'ford_riggingAid__createNURBSlocator.xpm')
		cmds.symbolButton	(command	='fra.createLocator()',				image	=	'ford_riggingAid__createLocator.xpm'	)
		cmds.symbolButton	(command	='fra.createPiramyd()',				image	=	'ford_riggingAid__createPiramyd.xpm'	)
		cmds.symbolButton	(command	='fra.createCircle1Arrowhead()',	image	=	'ford_riggingAid__createCircle1Arrowhead.xpm')
		
		#
		cmds.setParent		(	'column_creation'	)
		cmds.setUITemplate	(	'template_button',	pushTemplate	=	True	)
		cmds.separator		(	useTemplate	=	'template_separator'	)
		cmds.button			(	label		=	'   convert2control',	command	=	'fra.convertToControl	()'	)
		cmds.separator		(	useTemplate	=	'template_separator'	)
		cmds.button			(	label		=	'   command4curve',		command	=	'fra.createCurveCommand	()'	)
		
# >>> orientation button / options <<< ________________________________________________________________________________

		#
		cmds.setParent		(	'grid_orientButtons'	)
		cmds.setUITemplate	(	'template_symButton',	pushTemplate	=	True	)
		cmds.symbolButton	(	'orientMinusButton',	command	=	'fra.smartOrient	(\'minus\')',	width	=	winWidth	/	2,
								image	=	'ford_riggingAid__orientXminus.xpm'	)
		cmds.symbolButton	(	'orientPlusButton',		command	=	'fra.smartOrient	(\'plus\')',	width	=	winWidth	/	2,
								image	=	'ford_riggingAid__orientXplus.xpm'	)

		#
		cmds.setParent		(	'grid_selectAxis'	)
		cmds.setUITemplate	(	'template_radioBtn',	pushTemplate	=	True	)
		
		cmds.radioCollection(	'radioCollection_axis'			)
		cmds.radioButton	(	'X',		label	=	'X',		select	=	True,
								onCommand	=	'fra.setButtonIcon	()'	)
		cmds.radioButton	(	'Y',		label	=	'Y',		
								onCommand	=	'fra.setButtonIcon	()'	)
		cmds.radioButton	(	'Z',		label	=	'Z',
								onCommand	=	'fra.setButtonIcon	()'	)
		
		#
		cmds.setParent		(	'column_orientation'	)
		cmds.separator		(	useTemplate	=	'template_separator'	)
		cmds.checkBox		(	'check_keepShape',	label	=	'keepShape',	align	=	'left',	changeCommand	=	'fra.setButtonIcon	()'	)

# >>> control buttons <<< ________________________________________________________________________________________
		cmds.setUITemplate		(	'template_button',				pushTemplate	=	True	)
		cmds.setParent			(	'column_control'				)
		cmds.separator			(	useTemplate	=	'template_separator'	)
		cmds.intSlider			(	'boneNum',
									width		=	winWidth,
									minValue	=	1,
									maxValue	=	10,
									value		=	1,
									dragCommand	=	
									'''cmds.button	(	'button_boneBreaker',
														edit	=	True,
														label	=	'bone breaker #'	+
																	str	(	cmds.intSlider (	'boneNum',	
																								query=1, 
																								value=1)	),
														width	=	'''	+	str	(	winWidth	)	+	''')'''	)
																					
		cmds.button				(	'button_boneBreaker',	
									label	=	'   bone breaker #' + str	(	cmds.intSlider ('boneNum', query=1, value=1)	),
									command	=	'fra.splitJoint		()'	)
		cmds.separator			(	useTemplate	=	'template_separator'	)
		cmds.button				(	label			=	'   zero all',		command	=	'fra.resetControls	()'	)
		cmds.button				(	label			=	'   select LRA',	command	=	'fra.selectLRA		()'	)
		cmds.button				(	label			=	'   hide LRA',		command	=	'fra.hideLRA		()'	)

# >>> control buttons <<< ________________________________________________________________________________________
		cmds.setParent			(	'column_setup'						)

		cmds.separator			(	useTemplate	=	'template_separator'	)
		cmds.button				(	label	=	'   ribbon',	command	=	'fra.setupRibbon	()'	)
		cmds.button				(	label	=	'   strechy',	command	=	'fra.setupStrechy	()'	)
		

# >>> show GUI <<< _______________________________________________________________________________________________
		cmds.showWindow			(	'rigAid_window'	)
示例#30
0
    def uiCreate(self):

        self.onCloseClicked()

        self.window = m.window(WIN_NAME,
                               title='Maya Window',
                               maximizeButton=False)

        uiLAY_mainForm = m.formLayout()

        self.uiLAY_mainScroll = m.scrollLayout(childResizable=True)

        mainColumn = m.columnLayout(
            adjustableColumn=True)  # main column layout with frames

        # --------
        self.uiLAY_frameCheckBoxes = self.uiCreateFrame(
            'uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiCHK_test1 = m.checkBox('uiCHK_test1', label='test1')
        self.uiCHK_test2 = m.checkBox('uiCHK_test2', label='test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameCheckBoxGroups = self.uiCreateFrame(
            'uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiCHKGRP_test1 = m.checkBoxGrp('uiCHKGRP_test1',
                                            numberOfCheckBoxes=1,
                                            label='PMCheckBoxGrp1',
                                            label1='test1')
        self.uiCHKGRP_test2 = m.checkBoxGrp('uiCHKGRP_test2',
                                            numberOfCheckBoxes=2,
                                            label='PMCheckBoxGrp2',
                                            labelArray2=('test1', 'test2'))
        self.uiCHKGRP_test3 = m.checkBoxGrp('uiCHKGRP_test3',
                                            numberOfCheckBoxes=3,
                                            label='PMCheckBoxGrp3',
                                            labelArray3=('test1', 'test2',
                                                         'test3'))
        self.uiCHKGRP_test4 = m.checkBoxGrp('uiCHKGRP_test4',
                                            numberOfCheckBoxes=4,
                                            label='PMCheckBoxGrp4',
                                            labelArray4=('test1', 'test2',
                                                         'test3', 'test4'))

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameColorSliders = self.uiCreateFrame(
            'uiLAY_frameColorSliders',
            'Color Slider Groups (PMColorSliderGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiCLRGRP_test1 = m.colorSliderGrp('uiCLRGRP_test1', label='test1')
        self.uiCLRGRP_test2 = m.colorSliderGrp('uiCLRGRP_test2', label='test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatFields = self.uiCreateFrame(
            'uiLAY_frameFloatFields', 'Float Fields (PMFloatField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)
        m.separator(width=140, style='none')
        self.uiFLF_test1 = m.floatField('uiFLF_test1')
        self.uiFLF_test2 = m.floatField('uiFLF_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatFieldGroups = self.uiCreateFrame(
            'uiLAY_frameFloatFieldGroups',
            'Float Field Groups (PMFloatFieldGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiFLFGRP_test1 = m.floatFieldGrp('uiFLFGRP_test1',
                                              numberOfFields=1,
                                              label='PMFloatFieldGrp1')
        self.uiFLFGRP_test2 = m.floatFieldGrp('uiFLFGRP_test2',
                                              numberOfFields=2,
                                              label='PMFloatFieldGrp2')
        self.uiFLFGRP_test3 = m.floatFieldGrp('uiFLFGRP_test3',
                                              numberOfFields=3,
                                              label='PMFloatFieldGrp3')
        self.uiFLFGRP_test4 = m.floatFieldGrp('uiFLFGRP_test4',
                                              numberOfFields=4,
                                              label='PMFloatFieldGrp4')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatScrollBars = self.uiCreateFrame(
            'uiLAY_frameFloatScrollBars',
            'Float Scroll Bars (PMFloatScrollBar)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiFLSCRL_test1 = m.floatScrollBar('uiFLSCRL_test1')
        self.uiFLSCRL_test2 = m.floatScrollBar('uiFLSCRL_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatSliders = self.uiCreateFrame(
            'uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiFLTSLD_test1 = m.floatSlider('uiFLTSLD_test1')
        self.uiFLTSLD_test2 = m.floatSlider('uiFLTSLD_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameFloatSliderGroups = self.uiCreateFrame(
            'uiLAY_frameFloatSliderGroups',
            'Float Slider Groups (PMFloatSliderGrp)')
        m.columnLayout()
        m.separator(style='none', height=2)
        self.uiFLSGRP_test1 = m.floatSliderGrp('uiFLSGRP_test1',
                                               label='test1',
                                               field=True)
        self.uiFLSGRP_test2 = m.floatSliderGrp('uiFLSGRP_test2',
                                               label='test2',
                                               field=True)

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextCheckBoxes = self.uiCreateFrame(
            'uiLAY_frameIconTextCheckBoxes',
            'Icon Text Check Boxes (PMIconTextCheckBox)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiITCHK_test1 = m.iconTextCheckBox('uiITCHK_test1',
                                                style='iconAndTextHorizontal',
                                                label='cube',
                                                image1='cube')
        self.uiITCHK_test2 = m.iconTextCheckBox('uiITCHK_test2',
                                                style='iconAndTextHorizontal',
                                                label='cone',
                                                image1='cone')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextRadioButtons = self.uiCreateFrame(
            'uiLAY_frameIconTextRadioButtons',
            'Icon Text Radio Buttons (PMIconTextRadioButton)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=4)

        m.separator(style='none', width=140)
        m.iconTextRadioCollection()
        self.uiITRAD_test1 = m.iconTextRadioButton(
            'uiITRAD_test1',
            style='iconAndTextHorizontal',
            label='cube',
            image1='cube')
        self.uiITRAD_test2 = m.iconTextRadioButton(
            'uiITRAD_test2',
            style='iconAndTextHorizontal',
            label='cone',
            image1='cone')
        self.uiITRAD_test3 = m.iconTextRadioButton(
            'uiITRAD_test3',
            style='iconAndTextHorizontal',
            label='torus',
            image1='torus')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIconTextScrollLists = self.uiCreateFrame(
            'uiLAY_frameIconTextScrollLists',
            'Icon Text Scroll Lists (PMIconTextScrollList)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiITSLST_test1 = m.iconTextScrollList(
            'uiITSLST_test1',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven',
                    'eight', 'nine', 'ten'))
        self.uiITSLST_test2 = m.iconTextScrollList(
            'uiITSLST_test2',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven',
                    'eight', 'nine', 'ten'))

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntFields = self.uiCreateFrame(
            'uiLAY_frameIntFields', 'Int Fields (PMIntField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiINF_test1 = m.intField('uiINF_test1')
        self.uiINF_test2 = m.intField('uiINF_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntFieldGroups = self.uiCreateFrame(
            'uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiINFGRP_test1 = m.intFieldGrp('uiINFGRP_test1',
                                            numberOfFields=1,
                                            label='PMIntFieldGrp1')
        self.uiINFGRP_test2 = m.intFieldGrp('uiINFGRP_test2',
                                            numberOfFields=2,
                                            label='PMIntFieldGrp2')
        self.uiINFGRP_test3 = m.intFieldGrp('uiINFGRP_test3',
                                            numberOfFields=3,
                                            label='PMIntFieldGrp3')
        self.uiINFGRP_test4 = m.intFieldGrp('uiINFGRP_test4',
                                            numberOfFields=4,
                                            label='PMIntFieldGrp4')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntScrollBars = self.uiCreateFrame(
            'uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiINSCRL_test1 = m.intScrollBar('uiINSCRL_test1')
        self.uiINSCRL_test2 = m.intScrollBar('uiINSCRL_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntSliders = self.uiCreateFrame(
            'uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)')

        m.columnLayout(adjustableColumn=True)

        m.separator(style='none', height=2)
        self.uiINTSLD_test1 = m.intSlider('uiINTSLD_test1')
        self.uiINTSLD_test2 = m.intSlider('uiINTSLD_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameIntSliderGroups = self.uiCreateFrame(
            'uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiINSGRP_test1 = m.intSliderGrp('uiINSGRP_test1',
                                             label='test1',
                                             field=True)
        self.uiINSGRP_test2 = m.intSliderGrp('uiINSGRP_test2',
                                             label='test2',
                                             field=True)

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameOptionMenus = self.uiCreateFrame(
            'uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=110, style='none')
        self.uiOPTMNU_test1 = m.optionMenu('uiOPTMNU_test1', label='test1')
        m.menuItem(label='one')
        m.menuItem(label='two')
        m.menuItem(label='three')
        self.uiOPTMNU_test2 = m.optionMenu('uiOPTMNU_test2', label='test2')
        m.menuItem(label='four')
        m.menuItem(label='five')
        m.menuItem(label='six')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameOptionMenuGroups = self.uiCreateFrame(
            'uiLAY_frameOptionMenuGroups',
            'Option Menus Groups (PMOptionMenuGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiOPMGRP_test1 = m.optionMenuGrp('uiOPMGRP_test1',
                                              label='test1',
                                              extraLabel='extraLabel')
        m.menuItem(label='one')
        m.menuItem(label='two')
        m.menuItem(label='three')
        self.uiOPMGRP_test2 = m.optionMenuGrp('uiOPMGRP_test2',
                                              label='test2',
                                              extraLabel='extraLabel')
        m.menuItem(label='four')
        m.menuItem(label='five')
        m.menuItem(label='six')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameRadioButtons = self.uiCreateFrame(
            'uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=4)

        m.separator(style='none', width=140)
        m.radioCollection()
        self.uiRAD_test1 = m.radioButton('uiRAD_test1', label='test1')
        self.uiRAD_test2 = m.radioButton('uiRAD_test2', label='test2')
        self.uiRAD_test3 = m.radioButton('uiRAD_test3', label='test3')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameRadioButtonGroups = self.uiCreateFrame(
            'uiLAY_frameRadioButtonGroups',
            'Radio Button Groups (PMRadioButtonGrp#)')

        m.columnLayout()
        m.separator(style='none', height=2)
        self.uiRADGRP_test1 = m.radioButtonGrp('uiRADGRP_test1',
                                               numberOfRadioButtons=1,
                                               label='PMRadioButtonGrp1',
                                               label1='test1')
        self.uiRADGRP_test2 = m.radioButtonGrp('uiRADGRP_test2',
                                               numberOfRadioButtons=2,
                                               label='PMRadioButtonGrp2',
                                               labelArray2=('test1', 'test2'))
        self.uiRADGRP_test3 = m.radioButtonGrp('uiRADGRP_test3',
                                               numberOfRadioButtons=3,
                                               label='PMRadioButtonGrp3',
                                               labelArray3=('test1', 'test2',
                                                            'test3'))
        self.uiRADGRP_test4 = m.radioButtonGrp('uiRADGRP_test4',
                                               numberOfRadioButtons=4,
                                               label='PMRadioButtonGrp4',
                                               labelArray4=('test1', 'test2',
                                                            'test3', 'test4'))

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameSymbolCheckBoxes = self.uiCreateFrame(
            'uiLAY_frameSymbolCheckBoxes',
            'Symbol Check Boxes (PMSymbolCheckBox)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSYMCHK_test1 = m.symbolCheckBox('uiSYMCHK_test1',
                                               image='polyCube')
        self.uiSYMCHK_test2 = m.symbolCheckBox('uiSYMCHK_test2',
                                               image='polyCone')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameScriptTables = self.uiCreateFrame(
            'uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSCRTBL_test1 = m.scriptTable('uiSCRTBL_test1',
                                            selectionMode=3,
                                            rows=4,
                                            columns=2)
        self.uiSCRTBL_test2 = m.scriptTable('uiSCRTBL_test2',
                                            selectionMode=3,
                                            rows=4,
                                            columns=2)

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameScrollField = self.uiCreateFrame(
            'uiLAY_frameScrollField', 'Scroll Field (PMScrollField)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiSCRFLD_test1 = m.scrollField('uiSCRFLD_test1', wordWrap=True)
        self.uiSCRFLD_test2 = m.scrollField('uiSCRFLD_test2', wordWrap=True)

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameShelfTabLayout = self.uiCreateFrame(
            'uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)')

        m.columnLayout(adjustableColumn=True)

        self.uiSHLTAB_test1 = m.shelfTabLayout()

        m.shelfLayout('test1')
        m.setParent('..')
        m.shelfLayout('test2')
        m.setParent('..')
        m.shelfLayout('test3')
        m.setParent('..')

        m.setParent('..')

        self.uiSHLTAB_test2 = m.shelfTabLayout()

        m.shelfLayout('test4')
        m.setParent('..')
        m.shelfLayout('test5')
        m.setParent('..')
        m.shelfLayout('test6')
        m.setParent('..')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTabLayout = self.uiCreateFrame(
            'uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)')

        m.columnLayout(adjustableColumn=True)

        self.uiTAB_test1 = m.tabLayout()

        uiLAY_tabRow1 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow2 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow3 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')

        m.setParent('..')

        m.tabLayout(self.uiTAB_test1,
                    edit=True,
                    tabLabel=(
                        (uiLAY_tabRow1, 'test1'),
                        (uiLAY_tabRow2, 'test2'),
                        (uiLAY_tabRow3, 'test3'),
                    ))

        self.uiTAB_test2 = m.tabLayout()

        uiLAY_tabRow4 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow5 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')
        uiLAY_tabRow6 = m.rowLayout(numberOfColumns=1)
        m.setParent('..')

        m.setParent('..')

        m.tabLayout(self.uiTAB_test2,
                    edit=True,
                    tabLabel=(
                        (uiLAY_tabRow4, 'test4'),
                        (uiLAY_tabRow5, 'test5'),
                        (uiLAY_tabRow6, 'test6'),
                    ))

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFields = self.uiCreateFrame(
            'uiLAY_frameTextFields', 'Text Fields (PMTextField)')

        m.columnLayout()

        m.separator(style='none', height=2)

        m.rowLayout(numberOfColumns=3)

        m.separator(width=140, style='none')
        self.uiTXT_test1 = m.textField('uiTXT_test1')
        self.uiTXT_test2 = m.textField('uiTXT_test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFieldButtonGroups = self.uiCreateFrame(
            'uiLAY_frameTextFieldButtonGroups',
            'Text Field Button Groups (PMTextFieldButtonGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiTXBTGR_test1 = m.textFieldButtonGrp('uiTXBTGR_test1',
                                                   label='test1',
                                                   buttonLabel='button1')
        self.uiTXBTGR_test2 = m.textFieldButtonGrp('uiTXBTGR_test2',
                                                   label='test2',
                                                   buttonLabel='button2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextFieldGroups = self.uiCreateFrame(
            'uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)')

        m.columnLayout()

        m.separator(style='none', height=2)
        self.uiTXTGRP_test1 = m.textFieldGrp('uiTXTGRP_test1', label='test1')
        self.uiTXTGRP_test2 = m.textFieldGrp('uiTXTGRP_test2', label='test2')

        m.setParent(mainColumn)

        # --------
        self.uiLAY_frameTextScrollLists = self.uiCreateFrame(
            'uiLAY_frameTextScrollLists',
            'Text Scroll Lists (PMTextScrollList)')

        m.columnLayout()

        m.rowLayout(numberOfColumns=3)

        m.separator(style='none', width=140)
        self.uiTXTLST_test1 = m.textScrollList(
            'uiTXTLST_test1',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven',
                    'eight', 'nine', 'ten'))
        self.uiTXTLST_test2 = m.textScrollList(
            'uiTXTLST_test2',
            allowMultiSelection=True,
            append=('one', 'two', 'three', 'four', 'five', 'six', 'seven',
                    'eight', 'nine', 'ten'))

        # --------
        m.setParent(uiLAY_mainForm)

        self.uiBTN_savePrefs = m.button(label='Save Prefs',
                                        height=MAIN_BUTTONS_HEIGHT,
                                        command=self.onSavePrefsClicked)

        self.uiBTN_loadPrefs = m.button(label='Load Prefs',
                                        height=MAIN_BUTTONS_HEIGHT,
                                        command=self.onLoadPrefsClicked)

        self.uiBTN_resetPrefs = m.button(label='Reset Prefs',
                                         height=MAIN_BUTTONS_HEIGHT,
                                         command=self.onResetPrefsClicked)

        m.setParent('..')  # -> window

        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachForm=[(self.uiLAY_mainScroll, 'top', 2)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachForm=[(self.uiLAY_mainScroll, 'left', 2)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachForm=[(self.uiLAY_mainScroll, 'right', 2)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachControl=[(self.uiLAY_mainScroll, 'bottom', 2,
                                     self.uiBTN_savePrefs)])

        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachNone=[(self.uiBTN_savePrefs, 'top')])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachForm=[(self.uiBTN_savePrefs, 'left', 2)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachPosition=[(self.uiBTN_savePrefs, 'right', 2, 33)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachForm=[(self.uiBTN_savePrefs, 'bottom', 2)])

        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachNone=[(self.uiBTN_loadPrefs, 'top')])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachPosition=[(self.uiBTN_loadPrefs, 'left', 2, 33)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachPosition=[(self.uiBTN_loadPrefs, 'right', 2, 66)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachForm=[(self.uiBTN_loadPrefs, 'bottom', 2)])

        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachNone=[(self.uiBTN_resetPrefs, 'top')])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachPosition=[(self.uiBTN_resetPrefs, 'left', 2, 66)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachForm=[(self.uiBTN_resetPrefs, 'right', 2)])
        m.formLayout(uiLAY_mainForm,
                     e=True,
                     attachForm=[(self.uiBTN_resetPrefs, 'bottom', 2)])

        m.showWindow(self.window)
示例#31
0
 def CreateRenderingTab(self):
     print "Creating the rendering tab"
     cmds.formLayout( "BatchRendererCounterLayout", p = "TabLayout", numberOfDivisions=100)
     cmds.scrollLayout( "BatchRendererScrollLayout", p = "BatchRendererCounterLayout")
     cmds.columnLayout( "BatchRendererLayout", p = "BatchRendererScrollLayout", adjustableColumn = True )
     cmds.text("BatchRendererCounter", p = "BatchRendererCounterLayout", bgc = [0.361, 0.361, 0.361], label = "Image to render = 0"  , w = 309, h = 20, font = "boldLabelFont")
     cmds.formLayout( "BatchRendererCounterLayout", edit=True, attachForm=[("BatchRendererScrollLayout", 'top', 5), ("BatchRendererScrollLayout", 'left', 5), ("BatchRendererScrollLayout", 'right', 5), ("BatchRendererCounter", 'left', 5), ("BatchRendererCounter", 'bottom', 5), ("BatchRendererCounter", 'right', 5) ], attachControl=[("BatchRendererScrollLayout", 'bottom', 5, "BatchRendererCounter")], attachNone=("BatchRendererCounter", 'top') )
     
     #Rendering Presets heading
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 15, style = "single", hr = True)
     cmds.text(p = "BatchRendererLayout", label = "Settings",font = "boldLabelFont")
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 15, style = "single", hr = True)
     
     #Quality preset button
     
     cmds.text(p = "BatchRendererLayout", label = "Subdivision level")
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 10, style = "none")
     cmds.intSlider("SubdivisionLevel", p = "BatchRendererLayout", minValue = 0, maxValue = 2, value = 0)
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 10, style = "none")
     
     cmds.text("RenderQualityText",p = "BatchRendererLayout", label = "Rendering quality presets")
     cmds.separator("RenderQualitySep1",p = "BatchRendererLayout", w = 309, h = 10, style = "none")
     
     cmds.rowLayout("RenderQualityLayout", nc = 5, p = "BatchRendererLayout")
     cmds.button("RenderQualityLow", label = "Low", p = "RenderQualityLayout" , w = 100, h = 25, bgc = [0.361, 0.361, 0.361] )
     cmds.button("RenderQualityMed", label = "Medium", p = "RenderQualityLayout", w = 100, h = 25, bgc = [0.361, 0.361, 0.361] )
     cmds.button("RenderQualityHigh", label = "High", p = "RenderQualityLayout" , w = 100, h = 25, bgc = [0.361, 0.361, 0.361] )
     cmds.separator("RenderQualitySep",p = "BatchRendererLayout", w = 309, h = 10, style = "none")
     
     #Lighting Presets heading
     cmds.separator("LightSep1",p = "BatchRendererLayout", w = 309, h = 15, style = "single", hr = True)
     cmds.text("LightText1", p = "BatchRendererLayout", label = "Lighting Presets",font = "boldLabelFont")
     cmds.separator("LightSep2", p = "BatchRendererLayout", w = 309, h = 15, style = "single", hr = True)
     
     #Light rig scrolllist
     RigTypes = ["Product Shot", "Outdoors MidDay", "Automotive Classic", "Character", "Food"]
     cmds.text("LightText2", p = "BatchRendererLayout", label = "Select Light Rig",font = "boldLabelFont")
     cmds.separator("LightSep3", h = 10, style = "none",p = "BatchRendererLayout")
     cmds.textScrollList("CB_ScrollList", p = "BatchRendererLayout",  numberOfRows = 5, allowMultiSelection = False, h = 70,
         append = RigTypes,
         selectItem = RigTypes[0], showIndexedItem=4 )
     
     #Create light rig button
     cmds.button("LightingButton", p = "BatchRendererLayout", label = "Create Light Rig", h = 25)    
     
     if cmds.objExists("CMLightRig") and cmds.objExists("CMSettings"):
         if cmds.getAttr("CMSettings.CurrentRig") != None:
             cmds.button("LightingButton", edit = True, label = "Current rig: " + cmds.getAttr("CMSettings.CurrentRig"),  bgc = [0, 0.361, 0])        
     
     if cmds.getAttr("defaultRenderGlobals.currentRenderer") != "vray" and cmds.getAttr("defaultRenderGlobals.currentRenderer") != "mentalRay":
         self.RigUIVisibility(False)
     
     if cmds.objExists("CMLightRig"):
         values = [cmds.getAttr("CMLightRig.LightIntensity"), cmds.getAttr("CMLightRig.HDRIIntensity"), cmds.getAttr("CMLightRig.EyeLevel")]
     else:
         values = [1,1,92]
         
     if cmds.objExists("CMLightRig") and (cmds.getAttr("defaultRenderGlobals.currentRenderer") == "vray" or cmds.getAttr("defaultRenderGlobals.currentRenderer") == "mentalRay"):
         visibility = True
     else:
         visibility = False
     
     #create row layout
     cmds.rowLayout("LightControlLayout", nc = 3, p = "BatchRendererLayout", visible= visibility)
         
     #3-point light intensity
     cmds.text(p = "LightControlLayout", label = "Light Intensity multiplier  ",font = "boldLabelFont")
     cmds.floatField("LightIntensityField", minValue = 0, p = "LightControlLayout", value = values[0] )
     
     #create row layout
     cmds.rowLayout("HDRIControlLayout", nc = 3, p = "BatchRendererLayout", visible= visibility)
     
     #HDRI light intensity
     cmds.text(p = "HDRIControlLayout", label = "HDRI Intensity multiplier  ",font = "boldLabelFont")
     cmds.floatField("HDRIIntensityField", minValue = 0, p = "HDRIControlLayout", value = values[1] )
     
     #create row layout
     cmds.rowLayout("EyeLevelLayout", nc = 3, p = "BatchRendererLayout", visible= visibility)
     
     #Eye Level
     cmds.text(p = "EyeLevelLayout", label = "Character Eye Level  ",font = "boldLabelFont")
     cmds.floatField("EyeLevelField", minValue = 0, p = "EyeLevelLayout", value = values[2] )
     
     #Subdivision Placement heading
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 15, style = "single", hr = True)
     cmds.text("CB_Heading_hsub", p = "BatchRendererLayout", label = "Wireframe settings",font = "boldLabelFont")
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 15, style = "single", hr = True)
     
     #modify subdivisions button
     cmds.button("PlaceText", label = "Subdivision text placement", p = "BatchRendererLayout" , w = 309, h = 25, bgc = [0, 0.361, 0] )
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 10, style = "none")
     
     #Rendering UVs heading
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 15, style = "single", hr = True)
     cmds.text("CB_Heading_hUV", p = "BatchRendererLayout", label = "Rendering UVs",font = "boldLabelFont")
     cmds.separator(p = "BatchRendererLayout", w = 309, h = 15, style = "single", hr = True)
     
     #UV select button
     cmds.button("SelectObj", label = "Render UV templates", p = "BatchRendererLayout" , w = 309, h = 25, bgc = [0, 0.361, 0] )
     
     if cmds.getAttr("defaultRenderGlobals.currentRenderer") != "vray" and cmds.getAttr("defaultRenderGlobals.currentRenderer") != "mentalRay":
         cmds.separator("BottomSPace", p = "BatchRendererLayout", w = 309, h = 300, style = "none")
     else:
         cmds.separator("BottomSPace", p = "BatchRendererLayout", w = 309, h = 200, style = "none")
     print "Created the rendering tab"
示例#32
0
    "bbbOptimizerIntField",
    min=1,
    max=50,
    value=5,
    step=1,
    enable=False,
    changeCommand="cmds.intSlider('bbbOptimizerIntSlider', e = True, value = cmds.intField('bbbOptimizerIntField', q = True, value = True))",
)

cmds.text(label="")
cmds.text(label="")
cmds.intSlider(
    "bbbOptimizerIntSlider",
    min=1,
    max=50,
    value=5,
    step=1,
    enable=False,
    changeCommand="cmds.intField('bbbOptimizerIntField', e = True, value = cmds.intSlider('bbbOptimizerIntSlider', q = True, value = True))",
)

cmds.text(label="")
cmds.text(label="")
cmds.separator(height=5, style="in")

cmds.text(label="Camera extend", align="right")
cmds.text(label="")
cmds.floatField(
    "bbbOptimizerFloatField",
    min=1,
    max=1000,
示例#33
0
def sceneOptimizerCheckbox():
    cmds.intField("bbbOptimizerIntField", e=True, enable=not cmds.checkBox("bbbOptimizerStillCB", q=True, value=True))
    cmds.intSlider("bbbOptimizerIntSlider", e=True, enable=not cmds.checkBox("bbbOptimizerStillCB", q=True, value=True))
示例#34
0
def makeCoral(Base_sub_x, Base_sub_y, Base_radius, Base_hieght,
              Bottom_base_factor_r, Bottom_base_factor_h, Max, Branch_angle,
              Include_right, Branch_start_height_factor,
              Branch_decrease_factor_h, Branch_decrease_factor_r, *pArgs):

    base_sub_x = cmds.intSlider(Base_sub_x, query=True, value=True)
    base_sub_y = cmds.intSlider(Base_sub_y, query=True, value=True)
    base_radius = cmds.floatField(Base_radius, query=True, value=True)
    base_hieght = cmds.intSlider(Base_hieght, query=True, value=True)
    bottom_base_factor_r = cmds.floatField(Bottom_base_factor_r,
                                           query=True,
                                           value=True)
    bottom_base_factor_h = cmds.floatField(Bottom_base_factor_h,
                                           query=True,
                                           value=True)
    max = cmds.intSlider(Max, query=True, value=True)
    branch_angle = cmds.intSlider(Branch_angle, query=True, value=True)
    include_right = cmds.optionMenu(Include_right, query=True, value=True)
    branch_start_height_factor = cmds.floatSlider(Branch_start_height_factor,
                                                  query=True,
                                                  value=True)
    branch_decrease_factor_h = cmds.floatSlider(Branch_decrease_factor_h,
                                                query=True,
                                                value=True)
    branch_decrease_factor_r = cmds.floatSlider(Branch_decrease_factor_r,
                                                query=True,
                                                value=True)

    if include_right == "True":
        include_right = True
    else:
        include_right = False

    branch_decrease_factor_r = branch_decrease_factor_r + 2 * branch_start_height_factor
    base_hieght = base_radius * base_hieght

    left_sub_x = base_sub_x
    left_sub_y = base_sub_y
    left_radius = base_radius / branch_decrease_factor_r
    left_hieght = base_hieght / branch_decrease_factor_h

    right_sub_x = base_sub_x
    right_sub_y = base_sub_y
    right_radius = base_radius / branch_decrease_factor_r
    right_hieght = base_hieght / branch_decrease_factor_h
    right_branch_angle = 360 - branch_angle

    bot_base_sub_x = base_sub_x
    bot_base_sub_y = base_sub_y
    bot_base_radius = base_radius * bottom_base_factor_r
    bot_base_hieght = base_hieght / bottom_base_factor_h

    bottom_base = cmds.polyCone(n='bottom_base',
                                sx=bot_base_sub_x,
                                sy=bot_base_sub_y,
                                r=bot_base_radius,
                                h=bot_base_hieght)
    base_inst = cmds.polyCone(n='base',
                              sx=base_sub_x,
                              sy=base_sub_y,
                              r=base_radius,
                              h=base_hieght)

    base_move = base_hieght / 2
    cmds.move(0, base_move, 0, base_inst[0])
    bottom_base_move = bot_base_hieght / 2
    cmds.move(0, bottom_base_move, 0, bottom_base[0])

    coral_base = cmds.group(empty=True, name="Coral Fan")
    cmds.parent(bottom_base, coral_base)
    cmds.parent(base_inst, coral_base)

    left_branch(base_hieght, 0, 0, 0, 0, 0, left_hieght, branch_angle,
                branch_start_height_factor, max, left_sub_x, left_sub_y,
                left_radius, branch_decrease_factor_r,
                branch_decrease_factor_h, include_right, coral_base)