Ejemplo n.º 1
0
def origScale(*args):
	"""scales the object by the inverse of the currentScale (as measured by the tracker floatfield). So if everything was reset when you started it will
	undo all subsequent scaling operations"""

	currScale = cmds.floatFieldGrp(widgets["trackerFFG"], q=True, v1=True)
	scaleVal = 100/currScale
	# print "%s = factor"%factor
	# scaleVal = currScale * factor/100
	cmds.floatFieldGrp(widgets["trackerFFG"], e=True, v1=scaleVal*currScale)

	sel = cmds.ls(sl=True, type="transform")
	if sel:
		for obj in sel:
			#decide on object type
			objShape = cmds.listRelatives(obj, s=True)
			shapeType = cmds.objectType(objShape)

			cmds.select(cl=True)
			if shapeType == "nurbsSurface" or shapeType == "nurbsCurve":
				#get the components
				cvs = cmds.select((obj + ".cv[*]"))
				cmds.scale(scaleVal, scaleVal, scaleVal)
			elif shapeType == "mesh":
				#get the components
				cvs = cmds.select((obj + ".vtx[*]"))
				cmds.scale(scaleVal, scaleVal, scaleVal)
			else:
				cmds.warning("%s isn't a nurbs or poly object, so it was skipped")

	#clear and reselect all
	if sel:
		cmds.select(cl=True)
		cmds.select(sel)
		cmds.floatFieldGrp(widgets["scaleFFG"], e=True, v1=scaleVal*100)
Ejemplo n.º 2
0
 def customUI(self):
     self.widgets["ribbonNameTFG"] = cmds.textFieldGrp(l="Ribbon Rig Name",
                                                       cal=[(1, "left"),
                                                            (2, "left")],
                                                       cw=[(1, 100),
                                                           (2, 200)],
                                                       tx="ribbon")
     cmds.separator(h=10, style="single")
     self.widgets["jointsIFG"] = cmds.intFieldGrp(
         l="Number of Jnts (3 min)",
         cal=([1, "left"]),
         cw=([1, 125], [2, 100]),
         v1=5)
     #self.widgets["axis"] = cmds.radioButtonGrp(l="Ribbon Ctrl Axis", nrb=3, l1="x", l2="y", l3="z", cal=([1,"left"]), cw=([1, 125], [2,50], [3,50]), sl=2, en=True)
     #self.widgets["fkSetupCB"] = cmds.checkBox(l="Setup FK Controls", v=1)
     self.widgets["heightFFG"] = cmds.floatFieldGrp(l="Ribbon Height",
                                                    cal=[(1, "left"),
                                                         (2, "left")],
                                                    cw=[(1, 125), (2, 100)],
                                                    v1=10.0)
     self.widgets["ratioFFG"] = cmds.floatFieldGrp(l="Heigth/width Ratio",
                                                   cal=[(1, "left"),
                                                        (2, "left")],
                                                   cw=[(1, 125), (2, 100)],
                                                   v1=5)
Ejemplo n.º 3
0
def setPointValue(FFG, point=''):
    """
    Set the value of a floatFieldGrp with the position value of a specifeid point
    @param FFG: FloatFieldgrp to set values for
    @type FFG: str
    @param point: Point to get position from
    @type point: str
    """
    # Check point
    if point and not cmds.objExists(point):
        raise Exception('Point object "' + point + '" does not exist!')

    # Get object selection
    sel = cmds.ls(sl=1)
    if not point and not sel:
        raise Exception('No point specified for floatFieldGrp values!')

    # Get point
    if point:
        pos = glTools.utils.base.getPosition(point)
    else:
        pos = glTools.utils.base.getPosition(sel[0])

    # Set float field values
    cmds.floatFieldGrp(FFG, e=True, v1=pos[0], v2=pos[1], v3=pos[2])
Ejemplo n.º 4
0
	def __init__(self) :

		#check to see if the window exists:
		if cmds.window("Box2DTool", exists = True):
			cmds.deleteUI("Box2DTool")

		#create the window:
		window = cmds.window("Box2DTool", title = 'Box2D Tool', sizeable = False)

		#create the main layout:
		cmds.columnLayout(columnWidth = 300, adjustableColumn = False, columnAttach = ('both', 10))

		#make dockable:
		allowedAreas = ['right', 'left']
		cmds.dockControl( 'Box2D Tool', area='left', content=window, allowedArea=allowedAreas )

		self.dim=cmds.floatFieldGrp('dim', numberOfFields=2, label='Dimension', extraLabel='pixel', value1=5, value2=1  )
		self.dim=cmds.floatFieldGrp('friction', numberOfFields=1, label='Friction',  value1=0.2 )
		self.dim=cmds.floatFieldGrp('restitution', numberOfFields=1, label='restitution',  value1=0.0 )
		self.dim=cmds.floatFieldGrp('density', numberOfFields=1, label='density',  value1=0.0 )
		cmds.separator()
		self.dim=cmds.floatFieldGrp('rotation', numberOfFields=1, label='rotation',  value1=0.0 )
		cmds.separator()
		cmds.optionMenuGrp( "bodyType",l='Body Type' )
		cmds.menuItem(label='b2_staticBody');
		cmds.menuItem(label='b2_kinematicBody');
		cmds.menuItem(label='b2_dynamicBody');


		cmds.button(label = "PlaceBlock", w = 100, h = 25, c = self.placeBlock)
		cmds.separator()
		cmds.button( label='Export', command=self.export )
Ejemplo n.º 5
0
 def addMirrorMeshCmd(self, logicalIndex, *args ):
     
     items = cmds.textScrollList( globalInfo.meshInfoInst._selMeshList, q=1, ai=1 )
     
     if not items: return None
     
     nodeName = amCmd.getBlendAndFixedShapeNode( items[0] )
     targetName, driverInfo, returnIndex = amCmd.addMirrorTarget( items[0], logicalIndex )
     
     cmds.setParent( self._scrollLay )
     cmds.rowColumnLayout( nc=3, cw=[(1,25),(2,self._mainWidthList[0]-30),(3,self._mainWidthList[1]-30) ] )
     cmds.button( l="X", c= partial( self.removeBlendMeshInfoElement, nodeName, logicalIndex ) )
     meshNameField = cmds.textField( tx=targetName.replace( items[0]+'_', '' ), cc=partial( self.meshNameChangeCmd, nodeName, returnIndex ) )
     self._meshNameList.append( meshNameField )
     cmds.popupMenu( markingMenu = 1 )
     cmds.menuItem( l='Edit Anim Curve', rp='W', c=partial( self.editAnimCurveCmd, nodeName, returnIndex ) )
     cmds.menuItem( l='Edit Mesh',rp='N', c=partial( self.editAssigned, returnIndex) )
     cmds.menuItem( l='Add Mirror Mesh',rp='E', c=partial( self.addMirrorMeshCmd, returnIndex) )
     cmds.menuItem( l='Select Delta Points', rp='S', c=partial( self.selectDeltaPointsCmd, items[0], logicalIndex ) )
     widthList = uifnc.setWidthByPerList( [50,50], self._mainWidthList[1] )
     cmds.rowColumnLayout( nc=2, cw=[(1,widthList[0]),(2,widthList[1]-30)] )
     for element in driverInfo:
         engleName, value1, value2, value3= element
         cmds.text( l= engleName )
         cmds.floatFieldGrp( precision=2, nf=3, cw3=[50,50,50], v1=value1, v2=value2, v3=value3 )
     cmds.setParent( '..' )
Ejemplo n.º 6
0
	def genOptUI(self, name, parent, collapse=False):
		""" Create panel UI controls.
		"""
		mc.frameLayout(width=400, collapsable=False, cl=collapse, borderStyle="etchedIn", label=name.replace("_", " "))
		mc.columnLayout(name, enable=False)
		mc.separator(height=4, style="none")

		mc.rowLayout(numberOfColumns=1, columnAttach1="left", columnAlign1="both", columnOffset1=142)
		mc.checkBox("crop", label="Crop region", value=0, changeCommand=lambda *args: self.toggleCrop(), annotation="Crop to the specified region.\nEdit the values directly here, or manipulate the 'crop_area' object in the viewport.\nWhen done, press the 'Update' button to update the values.\nTo reset, delete the 'crop_area' object.")
		mc.setParent(name)
		mc.floatFieldGrp("cropX", numberOfFields=2, label="X min, max: ", value=[0, 0, 0, 0], changeCommand=lambda *args: self.updateCrop(), enable=False)
		mc.floatFieldGrp("cropY", numberOfFields=2, label="Y min, max: ", value=[0, 0, 0, 0], changeCommand=lambda *args: self.updateCrop(), enable=False)
		mc.setParent(name)
		mc.rowLayout(numberOfColumns=1, columnAttach1="left", columnOffset1=142)
		mc.button("btnUpdateCrop", width=116, label="Update", command=lambda *args: self.toggleCrop(), enable=False)
		mc.setParent(name)

		mc.separator(width=396, height=12, style="none")

		mc.rowLayout(numberOfColumns=1, columnAttach1="left", columnAlign1="both", columnOffset1=142)
		mc.checkBox("tileSplit", label="Split into tiles", value=1, changeCommand=lambda *args: self.updateTileInfo(), annotation="Split the region into tiles.\nThe dimensions specified here are in world units.")
		mc.setParent(name)
		mc.intFieldGrp("tileSize", numberOfFields=2, label="Tile size: ", value=[1000, 1000, 0, 0], changeCommand=lambda *args: self.updateTileInfo())
		mc.textFieldGrp("tileInfo", label="Tiles to create: ", text="", editable=False)
		mc.setParent(name)

		mc.separator(height=8, style="none")
		mc.setParent(parent)
Ejemplo n.º 7
0
 def prefPut(self):
     cmds.checkBox(self.c2, e=True, v=self.prefs['BkRmvCon'])
     cmds.checkBox(self.c3, e=True, v=self.prefs['BkTmRng'])
     cmds.checkBox(self.c4, e=True, v=self.prefs['BkAllFrms'])
     cmds.checkBox(self.c7, e=True, v=self.prefs['LocTrns'])
     cmds.checkBox(self.c8, e=True, v=self.prefs['LocRot'])
     cmds.checkBox(self.c12, e=True, v=self.prefs['LocAllFrms'])
     cmds.checkBox(self.c17, e=True, v=self.prefs['PrntRgPosOnly'])
     cmds.checkBox(self.c15, e=True, v=self.prefs['AimRgNegAim'])
     cmds.radioButtonGrp(self.aimGrp, e=True, select=self.prefs['AimRgAim'])
     cmds.checkBox(self.c16, e=True, v=self.prefs['AimRgNegUp'])
     cmds.radioButtonGrp(self.upGrp, e=True, select=self.prefs['AimRgUp'])
     cmds.checkBox(self.c18, e=True, v=self.prefs['PvtRgNegAim'])
     cmds.radioButtonGrp(self.aimPivotGrp, e=True, select=self.prefs['PvtRgAim'])
     cmds.checkBox(self.c19, e=True, v=self.prefs['PvtRgNegUp'])
     cmds.radioButtonGrp(self.upPivotGrp, e=True, select=self.prefs['PvtRgUp'])
     cmds.checkBox(self.c21, e=True, v=self.prefs['PvtRgMstr'])
     cmds.radioButtonGrp(self.masterGrp, e=True, select=self.prefs['PvtRgMstrSl'])
     cmds.radioButtonGrp(self.masterGrp, e=True, en=self.prefs['PvtRgMstrEnbl'])
     cmds.checkBox(self.c22, e=True, v=self.prefs['PvtRgAutoDstnc'])
     cmds.floatSliderGrp(self.sl1, e=True, v=self.prefs['PvtRgDstnc'])
     cmds.floatSliderGrp(self.sl1, e=True, en=self.prefs['PvtRgDstncEnbl'])
     cmds.checkBox(self.c21, e=True, v=self.prefs['LcAllFrms'])
     cmds.checkBox(self.c5, e=True, v=self.prefs['PlcCon'])
     cmds.radioButtonGrp(self.conGrp, e=True, select=self.prefs['PlcConTo'])
     cmds.radioButtonGrp(self.conGrp, e=True, en=self.prefs['PlcConToEnbl'])
     cmds.checkBox(self.c13, e=True, v=self.prefs['PlcMtchKys'])
     cmds.checkBox(self.c9, e=True, v=self.prefs['ConOffst'])
     cmds.checkBox(self.c10, e=True, v=self.prefs['ConTrns'])
     cmds.checkBox(self.c11, e=True, v=self.prefs['ConRot'])
     cmds.intField(self.actionField1, e=True, v=self.prefs['DstKys'])
     cmds.checkBox(self.c14, e=True, v=self.prefs['DstKysDstrct'])
     cmds.floatFieldGrp(self.floatGroup1, e=True, v=self.prefs['ObjctSpaceOffst'])
Ejemplo n.º 8
0
        def importCharacter(*args):

            selItems = cmds.textScrollList(FolderUIInfo._scrollListUI,
                                           q=1,
                                           si=1)
            if not selItems:
                cmds.formLayout(BakeUIInfo._form, e=1, en=0)

            self.setImportEnable()
            self.setImportWeight()

            if selItems[0][-6:] == '.cpose':
                flip = cmds.checkBox(ImportUIInfo._flipCheck, q=1, v=1)
                self._importData.retargetPose(flip)
                cmds.formLayout(BakeUIInfo._form, e=1, en=0)
            elif selItems[0][-6:] == '.canim':
                flip = cmds.checkBox(ImportUIInfo._flipCheck, q=1, v=1)
                value1 = cmds.floatFieldGrp(ImportUIInfo._frameField,
                                            q=1,
                                            value1=1)
                value2 = cmds.floatFieldGrp(ImportUIInfo._frameField,
                                            q=1,
                                            value2=1)
                speed = cmds.floatFieldGrp(ImportUIInfo._speedField,
                                           q=1,
                                           value1=1)
                offset = cmds.floatFieldGrp(ImportUIInfo._speedField,
                                            q=1,
                                            value2=1)
                self._importData.setFrameRange(value1, value2)
                self._importData.setSpeed(speed)
                self._importData.setOffset(offset)
                self._importData.retargetAnim(flip)
                cmds.formLayout(BakeUIInfo._form, e=1, en=1)
def doOptions(input_width, input_divisionsType, input_divisions, input_divisionsPerUnit, input_taper, input_frontTwist, input_lengthTwist, input_upVector, input_uvScale, input_uvScaleType, input_uvPinLocation):
	"""This is the function called when the apply or create button is clicked"""
	try:
		utils.dg.validateSelection(type='transform', min=1)
		curves = utils.dg.getFilteredRelatives(cmds.ls(sl=True), 'nurbsCurve', False)
		if len(curves) is 0: raise Exception('None of the objects you have selected are NURBS curves.')
				
		# call the command
		if cmds.radioButtonGrp(input_divisionsType, q=True, select=True) == 1:
			cmds.am_ribbon(
				width = cmds.floatSliderGrp(input_width, q=True, v=True),
				divisions = cmds.floatSliderGrp(input_divisions, q=True, v=True),
				taper = cmds.floatSliderGrp(input_taper, q=True, v=True),
				twistBase = cmds.floatSliderGrp(input_frontTwist, q=True, v=True),
				twistLength = cmds.floatSliderGrp(input_lengthTwist, q=True, v=True),
				upVector = cmds.floatFieldGrp(input_upVector, q=True, v=True),
				uvScale = cmds.floatSliderGrp(input_uvScale, q=True, v=True),
				uvGroupScale = cmds.radioButtonGrp(input_uvScaleType, q=True, select=True) - 1,
				uvPin = cmds.radioButtonGrp(input_uvPinLocation, q=True, select=True) - 1)
		else:
			cmds.am_ribbon(
				width = cmds.floatSliderGrp(input_width, q=True, v=True),
				divisionsPerUnit = cmds.floatSliderGrp(input_divisionsPerUnit, q=True, v=True),
				taper = cmds.floatSliderGrp(input_taper, q=True, v=True),
				twistBase = cmds.floatSliderGrp(input_frontTwist, q=True, v=True),
				twistLength = cmds.floatSliderGrp(input_lengthTwist, q=True, v=True),
				upVector = cmds.floatFieldGrp(input_upVector, q=True, v=True),
				uvScale = cmds.floatSliderGrp(input_uvScale, q=True, v=True),
				uvGroupScale = cmds.radioButtonGrp(input_uvScaleType, q=True, select=True) - 1,
				uvPin = cmds.radioButtonGrp(input_uvPinLocation, q=True, select=True) - 1)
	except: raise
    def displayOptions(self):

        self.objType = mc.radioButtonGrp(label="Object Type:",
                                         label1="House",
                                         numberOfRadioButtons=1,
                                         select=1)

        self.xformGrp = mc.frameLayout(label="Mesh Object Generator",
                                       collapsable=True)
        mc.formLayout(self.optionsForm,
                      e=True,
                      attachControl=([self.xformGrp, "top", 2, self.objType]),
                      attachForm=([self.xformGrp, "left",
                                   0], [self.xformGrp, "right", 0]))

        self.xformCol = mc.columnLayout()
        self.position = mc.floatFieldGrp(label="Range of Translation:",
                                         numberOfFields=3,
                                         value=[10.0, 10.0, 10.0, 10.0])
        self.rotation = mc.floatFieldGrp(label="Range of Rotations:",
                                         numberOfFields=3,
                                         value=[180.0, 180.0, 180.0, 180.0])
        self.scale = mc.floatFieldGrp(label="Range of Scale:",
                                      numberOfFields=3,
                                      value=[3.0, 3.0, 3.0, 3.0])
        self.num = mc.intFieldGrp(label="Number of Houses",
                                  numberOfFields=1,
                                  value1=5)
        mc.setParent(self.optionsForm)
def doOptions(input_referenceObject, input_rotateOrder, input_axis, input_referenceAxis, input_normalizeAxes):
	"""This is the function called when the apply or create button is clicked"""
	try:
		# validate selection
		utils.dg.validateSelection(type='transform', exact=1)
		
		# validate reference object
		referenceObject = cmds.textFieldGrp(input_referenceObject, q=True, tx=True)
		if len(referenceObject) > 0: utils.dg.verifyNode(referenceObject)
		
		# call the command
		if len(referenceObject) > 0:
			cmds.am_exposeTransform(
				ref=referenceObject, 
				ro=utils.kRotateOrderMapping[cmds.optionMenuGrp(input_rotateOrder, q=True, v=True)], 
				a=cmds.floatFieldGrp(input_axis, q=True, v=True), 
				ra=cmds.floatFieldGrp(input_referenceAxis, q=True, v=True), 
				na=cmds.checkBoxGrp(input_normalizeAxes, q=True, v1=True))
		else:
			cmds.am_exposeTransform(
				ro=utils.kRotateOrderMapping[cmds.optionMenuGrp(input_rotateOrder, q=True, v=True)], 
				a=cmds.floatFieldGrp(input_axis, q=True, v=True), 
				ra=cmds.floatFieldGrp(input_referenceAxis, q=True, v=True), 
				na=cmds.checkBoxGrp(input_normalizeAxes, q=True, v1=True))
	except: raise
Ejemplo n.º 12
0
def doOptions(input_suffix, input_numberTwistJoints, input_pelvis, input_hipAimAxis, input_hipFrontAxis, input_pelvisAimAxis, input_pelvisFrontAxis):
	"""Specifies the function called when the apply or create button is clicked"""
	try:
		# validate selection
		selection = utils.dg.validateSelection(type='transform', name='knee joint objects', min=1)
		
		# validate suffix
		suffix = cmds.textFieldGrp(input_suffix, q=True, tx=True)
		utils.dg.validateAffix(suffix)
		
		# validate pelvis
		pelvis = cmds.textFieldGrp(input_pelvis, q=True, tx=True)
		utils.dg.verifyNode(pelvis)
		
		# set up the hip
		numberTwistJoints = cmds.intSliderGrp(input_numberTwistJoints, q=True, v=True)
		newSelection = []
		# perform setup for each knee in the selection
		for knee in selection:
			hip = cmds.listRelatives(knee, p=True, f=True)
			hipShort = cmds.listRelatives(knee, p=True)
			newJoints = doSetup(
				hipShort[0] + suffix, 
				numberTwistJoints, 
				knee, 
				hip[0], 
				pelvis, 
				cmds.floatFieldGrp(input_hipAimAxis, q=True, v=True), 
				cmds.floatFieldGrp(input_hipFrontAxis, q=True, v=True), 
				cmds.floatFieldGrp(input_pelvisAimAxis, q=True, v=True), 
				cmds.floatFieldGrp(input_pelvisFrontAxis, q=True, v=True))
			newSelection += newJoints
		# select the newly created joints for easy editing
		cmds.select(newSelection)
	except: raise
Ejemplo n.º 13
0
def manualScale(*args):
	"""uses the float field group to manually scale the object by that amount"""
	origScale = cmds.floatFieldGrp(widgets["trackerFFG"], q=True, v1=True)

	#get value from field
	scalePer = cmds.floatFieldGrp(widgets["scaleFFG"] , q=True, v1=True)
	scaleVal = scalePer/100
	#scaleShapes
	sel = cmds.ls(sl=True, type="transform")
	if sel:
		for obj in sel:
			#decide on object type
			objShape = cmds.listRelatives(obj, s=True)
			shapeType = cmds.objectType(objShape)

			cmds.select(cl=True)
			if shapeType == "nurbsSurface" or shapeType == "nurbsCurve":
				#get the components
				cvs = cmds.select((obj + ".cv[*]"))
				cmds.scale(scaleVal, scaleVal, scaleVal)
			elif shapeType == "mesh":
				#get the components
				cvs = cmds.select((obj + ".vtx[*]"))
				cmds.scale(scaleVal, scaleVal, scaleVal)
			else:
				cmds.warning("%s isn't a nurbs or poly object, so it was skipped")

	#clear and reselect all
	if sel:
		cmds.select(cl=True)
		cmds.select(sel)
		newScale = origScale * scaleVal
		cmds.floatFieldGrp(widgets["trackerFFG"], e=True, v1=newScale)
Ejemplo n.º 14
0
def attachToCurveFromUI(close=False):
    """
    Execute attachToCurve() from UI
    """
    # Window
    window = 'attachToCurveUI'
    if not cmds.window(window, q=True, ex=1): raise UIError('AttachToCurve UI does not exist!!')
    # Get UI data
    curve = cmds.textFieldGrp('attachToCurveTFB', q=True, text=True)
    transform = cmds.textFieldGrp('attachToCurveTransformTFB', q=True, text=True)
    prefix = cmds.textFieldGrp('attachToCurvePrefixTFG', q=True, text=True)
    closestPoint = cmds.checkBoxGrp('attachToCurveClosestPointCBG', q=True, v1=True)
    param = cmds.floatSliderGrp('attachToCurveParamFSG', q=True, v=True)
    paramAttr = cmds.textFieldGrp('attachToCurveParamAttrTFG', q=True, text=True)
    orient = cmds.checkBoxGrp('attachToCurveOrientCBG', q=True, v1=True)
    upVec = (cmds.floatFieldGrp('attachToCurveUpVecFFG', q=True, v1=True),
             cmds.floatFieldGrp('attachToCurveUpVecFFG', q=True, v2=True),
             cmds.floatFieldGrp('attachToCurveUpVecFFG', q=True, v3=True))
    upVecObj = cmds.textFieldButtonGrp('attachToCurveUpVecObjTFG', q=True, text=True)
    # Check curve
    if not glTools.utils.curve.isCurve(curve):
        raise UserInputError('Object "' + curve + '" is not a valid nurbs curve!!')
    glTools.utils.attach.attachToCurve(curve=curve, transform=transform, uValue=param, useClosestPoint=closestPoint,
                                       orient=orient, upVector=upVec, worldUpObject=upVecObj, uAttr=paramAttr,
                                       prefix=prefix)
    # Cleanup
    if close: cmds.deleteUI(window)
Ejemplo n.º 15
0
def camerapipwdUI():
	if  cmds.window('k_dengtao',exists=True):
	    cmds.deleteUI('k_dengtao',window=True)
	cmds.window('k_dengtao',title="拍摄相机流程辅助面板_k")
	
	cmds.columnLayout(adjustableColumn=1)
	cmds.text(label='')
	cmds.button(label='为人物修改颜色',h=40,command='fb.fx.matren()')
	cmds.button(label='为道具修改颜色',h=40,command='fb.fx.matdj()')
	cmds.button(label='为群众修改颜色',h=40,command='fb.fx.matqz()')
	cmds.text(label='')
	
	cmds.floatFieldGrp('k_gaodu',label='离地高度:',pre=5,extraLabel='',enable=True)
	
	cmds.button(label='选择相机_first',h=50,command='fb.fx.k_selcam()')
	
	cmds.button(label='选择测量物体_first',h=50,command='fb.fx.k_selwuti()')
	
	
	
	cmds.button(label='转移至坐标原点_first',h=50,command='fb.fx.k_move()')
	cmds.text(label='')
	cmds.button(label='选择相机_end',h=50,command='fb.fx.k_selcam2()')
	
	cmds.button(label='选择测量物体_end',h=50,command='fb.fx.k_selwuti2()')
	
	cmds.button(label='转移至坐标原点_end',h=50,command='fb.fx.k_move2()')
	
	cmds.text(label='')
	cmds.button(label='创建Locator的坐标',h=50,command='fb.fx.k_ann()')
	cmds.text(label='')
	cmds.button(label='创建相机显示窗口',h=50,command='fb.fx.k_camwin()')
	cmds.showWindow('k_dengtao')
def doOptions(input_suffix, input_numberTwistJoints, input_elbowAimAxis,
              input_elbowFrontAxis, input_handFrontAxis):
    """Specifies the function called when the apply or create button is clicked"""
    try:
        # validate selection
        selection = utils.dg.validateSelection(type='transform',
                                               name='wrist joint objects',
                                               min=1)

        # validate suffix
        suffix = cmds.textFieldGrp(input_suffix, q=True, tx=True)
        utils.dg.validateAffix(suffix)

        # set up the forearms
        numberTwistJoints = cmds.intSliderGrp(input_numberTwistJoints,
                                              q=True,
                                              v=True)
        newSelection = []
        # perform setup for each wrist in the selection
        for wrist in selection:
            elbow = cmds.listRelatives(wrist, p=True, f=True)
            elbowShort = cmds.listRelatives(wrist, p=True)
            newJoints = doSetup(
                elbowShort[0] + suffix, numberTwistJoints, wrist, elbow[0],
                cmds.floatFieldGrp(input_elbowAimAxis, q=True, v=True),
                cmds.floatFieldGrp(input_elbowFrontAxis, q=True, v=True),
                cmds.floatFieldGrp(input_handFrontAxis, q=True, v=True))
            newSelection += newJoints
        # select the newly created joints for easy editing
        cmds.select(newSelection)
    except:
        raise
Ejemplo n.º 17
0
def doOptions(input_pelvis, input_hipAimAxis, input_hipFrontAxis,
              input_pelvisAimAxis, input_pelvisFrontAxis):
    """Specifies the function called when the apply or create button is clicked"""
    try:
        # validate selection
        selection = utils.dg.validateSelection(
            type='transform',
            msg=
            'Please select your hip object and then the twist object to constrain.',
            exact=2)

        # validate pelvis
        pelvis = cmds.textFieldGrp(input_pelvis, q=True, tx=True)
        utils.dg.verifyNode(pelvis)

        # create the hip constraint
        cmds.am_hipConstraint(selection[1],
                              pelvisObject=pelvis,
                              hipObject=selection[0],
                              ha=cmds.floatFieldGrp(input_hipAimAxis,
                                                    q=True,
                                                    v=True),
                              hf=cmds.floatFieldGrp(input_hipFrontAxis,
                                                    q=True,
                                                    v=True),
                              pa=cmds.floatFieldGrp(input_pelvisAimAxis,
                                                    q=True,
                                                    v=True),
                              pf=cmds.floatFieldGrp(input_pelvisFrontAxis,
                                                    q=True,
                                                    v=True))
    except:
        raise
Ejemplo n.º 18
0
def setClipUI(*args):
    """ UI for the whole thing"""

    if cmds.window("SCPwin", exists=True):
        cmds.deleteUI("SCPwin")
    cmds.window("SCPwin", t="Set Clip Planes", w=200, h=100)
    cmds.columnLayout("colLO")
    cmds.radioButtonGrp("camRBG",
                        l="Cameras:",
                        nrb=2,
                        l1="All",
                        l2="Selected",
                        sl=1,
                        cal=[(1, "left"), (2, "left"), (3, "left")],
                        cw=[(1, 70), (2, 50), (3, 50)])
    cmds.floatFieldGrp("nearFFG",
                       l="nearClip",
                       v1=1,
                       cal=([1, "left"], [2, "left"]),
                       cw=([1, 50], [2, 150]))
    cmds.floatFieldGrp("farFFG",
                       l="farClip",
                       v1=100000,
                       cal=([1, "left"], [2, "left"]),
                       cw=([1, 50], [2, 150]))
    cmds.separator(h=10, style="single")
    cmds.button("button",
                l="Set Clip Planes",
                h=50,
                w=200,
                bgc=(.8, .6, .6),
                c=setPlanes)

    cmds.showWindow("SCPwin")
    cmds.window("SCPwin", e=True, w=200, h=100)
Ejemplo n.º 19
0
def getSVFSsetting():
    posX = 0
    posY = 0
    posZ = 0
    if mc.checkBoxGrp("cBG_plus", q=True, value1=True):
        posX = 1
    elif mc.checkBoxGrp("cBG_minus", q=True, value1=True):
        posX = -1
    elif mc.checkBox("cB_Extra", q=True, value=True):
        posX = mc.floatFieldGrp("fFG_Extra", q=True, value1=True)

    if mc.checkBoxGrp("cBG_plus", q=True, value2=True):
        posY = 1
    elif mc.checkBoxGrp("cBG_minus", q=True, value2=True):
        posY = -1
    elif mc.checkBox("cB_Extra", q=True, value=True):
        posY = mc.floatFieldGrp("fFG_Extra", q=True, value2=True)

    if mc.checkBoxGrp("cBG_plus", q=True, value3=True):
        posZ = 1
    elif mc.checkBoxGrp("cBG_minus", q=True, value3=True):
        posZ = -1
    elif mc.checkBox("cB_Extra", q=True, value=True):
        posZ = mc.floatFieldGrp("fFG_Extra", q=True, value3=True)

    kmSelectVtxFromSide(mc.ls(sl=True, fl=True), [posX, posY, posZ])
    return
Ejemplo n.º 20
0
def extendUI(*args):
    """UI for the script"""
    #UI
    if cmds.window("curbWin", exists=True):
        cmds.deleteUI("curbWin")

    cmds.window("curbWin", t="zbw_polyExtender", w=200, h=200)
    cmds.columnLayout("colLO")
    cmds.frameLayout("topFrame", l="Covert Edge", cll=True, bgc=(.2,.2,.2))
    cmds.text("Select poly edge to convert")
    cmds.button("convertBut", l="Convert!", w=200, h=30, bgc=(.8, .8,.6), c=convertEdge)
    cmds.separator(h=5)

    cmds.setParent("colLO")

    cmds.frameLayout("midFrame", l="Create Poly", cll=True, bgc=(.2,.2,.2))
    cmds.text("Select curve")
    cmds.separator(h=5)
    cmds.textFieldGrp("name", l="Name", w=200, cw=[(1,30), (2,170)], tx="newPoly")
    cmds.checkBox("curbCB", l="Positive Direction", v=True)
    # cmds.checkBox("bumpCB", l="Add vertical hump?", v=True)
    cmds.floatFieldGrp("curbFFG", l="Curb Width", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=10)
    cmds.intFieldGrp("UDivIFG", l="Width Subdivisions", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=1)
    cmds.intFieldGrp("VDivIFG", l="Length Subdivisions", cal=((1, "left"),(2,"left")), cw=([1,75],[2,50]), v1=1)
    cmds.checkBox("polyHistory", l="Keep history on final poly?", v=False)
    cmds.checkBox("history", l="Keep history objects?", v=True, cc=enableHistory)

    cmds.separator(h=5)
    cmds.button("curbBut", l="Create Curb", h=40, w=200, bgc=(.6, .8, .6), c=extendPoly)

    cmds.showWindow("curbWin")
    cmds.window("curbWin", e=True, h=150, w=200)
Ejemplo n.º 21
0
def softDeformerUI():
    """UI for the whole thing"""

    if cmds.window("softModWin", exists = True):
        cmds.deleteUI("softModWin")
    widgets["window"] = cmds.window("softModWin", t="zbw_softDeformer", w=300, h=130)
    widgets["tabLO"] = cmds.tabLayout()
    widgets["smCLO"] = cmds.columnLayout("SoftModDeformer", w=300)

    cmds.separator(h=10)
    widgets["smdTFG"] = cmds.textFieldGrp(l="Deformer Name", w=300, cw=[(1,100),(2,190)], cal=[(1,"left"), (2, "left")], tx="softMod_DEF")
    widgets["firstVertCBG"] = cmds.checkBoxGrp(l="Use only 1st vert (vs. avg pos)", v1=0, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
    widgets["parentCBG"] = cmds.checkBoxGrp(l="Parent Ctrl Under Geo?", v1=0, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
    widgets["incrCBG"] = cmds.checkBoxGrp(l="Increment name after creation?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
    widgets["checkCBG"] = cmds.checkBoxGrp(l="AutoCheck if there are deformers?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
    widgets["scaleFFG"] = cmds.floatFieldGrp(l="Control Scale", v1=1, pre=2, cw=[(1,100),(2,50)], cal=[(1,"left"),(2,"left")])

    cmds.separator(h=10, style="single")
    widgets["button"] = cmds.button(l="Create Deformer", w=300, h=40, bgc=(.6,.8,.6), c=softModDeformerDo)

    #second tab to softselect deformer
    cmds.setParent(widgets["tabLO"])
    widgets["ssCLO"] = cmds.columnLayout("SoftSelectDeformer", w=300)
    widgets["ssdTFG"] = cmds.textFieldGrp(l="Deformer Name", w=300, cw=[(1,100),(2,190)], cal=[(1,"left"), (2, "left")], tx="softSelect_DEF")
    widgets["ssCPOMCBG"] = cmds.checkBoxGrp(l="Control to closest point on mesh?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
    widgets["ssParentCBG"] = cmds.checkBoxGrp(l="Parent Ctrl Under Geo?", v1=0, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
    widgets["ssIncrCBG"] = cmds.checkBoxGrp(l="Increment name after creation?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
    widgets["ssCheckCBG"] = cmds.checkBoxGrp(l="AutoCheck if there are deformers?", v1=1, cw=[(1,200)], cal=[(1,"left"), (2,"left")])
    widgets["ssScaleFFG"] = cmds.floatFieldGrp(l="Control Scale", v1=1, pre=2, cw=[(1,100),(2,50)], cal=[(1,"left"),(2,"left")])
    cmds.separator(h=10, style="single")
    widgets["button"] = cmds.button(l="Create Deformer", w=300, h=40, bgc=(.6,.8,.6), c=softSelectDef)


    cmds.showWindow(widgets["window"])
Ejemplo n.º 22
0
def import2dTrackUI():
    """
    """
    # Build UI Window
    window = 'import2dTrackUI'
    if cmds.window(window, q=True, ex=True): cmds.deleteUI(window)
    window = cmds.window(window, title='Import 2D Track', wh=[500, 350])

    # Build UI Elements
    cmds.columnLayout(adjustableColumn=True)
    perspCamListTSL = cmds.textScrollList('importTrack_camListTSL', numberOfRows=8, ams=False)
    fileTFB = cmds.textFieldButtonGrp('importTrack_fileTFB', label='2D Track File', buttonLabel='Browse')
    cmds.textFieldButtonGrp(fileTFB, e=True, bc='glTools.ui.utils.loadFilePath("' + fileTFB + '",fileFilter="*.*")')
    cmds.textFieldGrp('importTrack_nameTFG', label="Point Name", text='trackPoint1')
    cmds.floatFieldGrp('importTrack_widthFFG', numberOfFields=1, label='Source Pixel Width', value1=2348)
    cmds.floatFieldGrp('importTrack_heightFFG', numberOfFields=1, label='Source Pixel Height', value1=1566)
    cmds.button(label='Import Track',
              c='import glTools.tools.import2dTrack;reload(glTools.tools.import2dTrack);glTools.tools.import2dTrack.import2dTrack()')
    cmds.button(label='Close', c='cmds.deleteUI("' + window + '")')

    # Build Camera List
    camList = cmds.listCameras(p=True)
    for cam in camList: cmds.textScrollList(perspCamListTSL, e=True, a=cam)

    # Show Window
    cmds.showWindow(window)
Ejemplo n.º 23
0
def setPointValue(FFG, point=''):
    """
    Set the value of a floatFieldGrp with the position value of a specifeid point
    @param FFG: FloatFieldgrp to set values for
    @type FFG: str
    @param point: Point to get position from
    @type point: str
    """
    # Check point
    if point and not cmds.objExists(point):
        raise Exception('Point object "' + point + '" does not exist!')

    # Get object selection
    sel = cmds.ls(sl=1)
    if not point and not sel:
        raise Exception('No point specified for floatFieldGrp values!')

    # Get point
    if point:
        pos = glTools.utils.base.getPosition(point)
    else:
        pos = glTools.utils.base.getPosition(sel[0])

    # Set float field values
    cmds.floatFieldGrp(FFG, e=True, v1=pos[0], v2=pos[1], v3=pos[2])
def doOptions(input_suffix, input_numberTwistJoints, input_elbowAimAxis, input_elbowFrontAxis, input_handFrontAxis):
	"""Specifies the function called when the apply or create button is clicked"""
	try:
		# validate selection
		selection = utils.dg.validateSelection(type='transform', name='wrist joint objects', min=1)
		
		# validate suffix
		suffix = cmds.textFieldGrp(input_suffix, q=True, tx=True)
		utils.dg.validateAffix(suffix)
		
		# set up the forearms
		numberTwistJoints = cmds.intSliderGrp(input_numberTwistJoints, q=True, v=True)
		newSelection = []
		# perform setup for each wrist in the selection
		for wrist in selection:
			elbow = cmds.listRelatives(wrist, p=True, f=True)
			elbowShort = cmds.listRelatives(wrist, p=True)
			newJoints = doSetup(
				elbowShort[0] + suffix, 
				numberTwistJoints, 
				wrist, 
				elbow[0], 
				cmds.floatFieldGrp(input_elbowAimAxis, q=True, v=True), 
				cmds.floatFieldGrp(input_elbowFrontAxis, q=True, v=True), 
				cmds.floatFieldGrp(input_handFrontAxis, q=True, v=True))
			newSelection += newJoints
		# select the newly created joints for easy editing
		cmds.select(newSelection)
	except: raise
Ejemplo n.º 25
0
    def randomizer(self):
        # make the Selection an array
        self.sel = cmds.ls(sl=True)
        print self.sel
        # the fields from the window entered as these.
        self.MaxNumEnter = cmds.floatFieldGrp('MaximumField', q=True,
                                              v=True)[0]
        self.MinNumEnter = cmds.floatFieldGrp('MinimumField', q=True,
                                              v=True)[0]

        #self.numRandom = random.randrange(self.MinNumEnter, self.MaxNumEnter)
        #print self.numRandom

        for Object in self.sel:
            self.numRandom = random.randrange(self.MinNumEnter,
                                              self.MaxNumEnter)
            cmds.setAttr(Object + '.translateX', self.numRandom)

            self.numRandom = random.randrange(self.MinNumEnter,
                                              self.MaxNumEnter)
            cmds.setAttr(Object + '.translateY', self.numRandom)

            self.numRandom = random.randrange(self.MinNumEnter,
                                              self.MaxNumEnter)
            cmds.setAttr(Object + '.translateZ', self.numRandom)
Ejemplo n.º 26
0
def jpmAW_writeNewFile():
    ##fill the needed variables
    path = cmds.optionVar(q="jpmAWpath")  ## + "/"
    currentSort = cmds.optionVar(q="jpmAWalpha")
    selectedTab = cmds.tabLayout("jpmAW_tabs", q=1, st=1)
    refReTarget = cmds.checkBox("jpmAW_refReTargetCheck", q=1, v=1)
    nodeNames = cmds.radioButtonGrp("jpmAW_nodeNamesRadio", q=1, sl=1)
    thisName = cmds.textFieldGrp("jpmAW_nameGrp", q=1, tx=1)
    selected = cmds.ls(sl=1)

    fullname = path + "/" + thisName
    print fullname

    try:
        ##figure out which tab and which file is selected
        if selectedTab == "animFileForm":
            min = cmds.floatFieldGrp("jpmAW_animRange", q=1, v1=1)
            max = cmds.floatFieldGrp("jpmAW_animRange", q=1, v2=1)
            keyableAttrs = [""]
            fullname = fullname + ".nm8"
            saveType = ""
            saveFile.jpmSaveAnimationToFile(fullname, min, max, saveType,
                                            selected, keyableAttrs,
                                            refReTarget)
        if selectedTab == "poseFileForm":
            keyableAttrs = [""]
            fullname = fullname + ".psz"
            saveFile.jpmSavePoseToFile(fullname, selected, keyableAttrs,
                                       refReTarget)
        if selectedTab == "selFileForm":
            fullname = fullname + ".slc"
            saveFile.jpmSaveSelectionToFile(fullname, selected, refReTarget)
        jpmAW_populateFileList(currentSort)
    except TypeError:
        print "Uhh,... something has gone horribly wrong. Oh god, all the blood..."
Ejemplo n.º 27
0
def executeFromUI():
    '''
	'''
    # Set Default Values
    minValue = 0.0
    maxValue = 1.0

    # Get UI input values
    driveAttr = mc.textFieldGrp('tdb_driveAttrTFG', q=True, text=True)
    blendShape = mc.textFieldGrp('tdb_blendShapeTFG', q=True, text=True)
    target1 = mc.textFieldGrp('tdb_target1TFG', q=True, text=True)
    target2 = mc.textFieldGrp('tdb_target1TFG', q=True, text=True)
    weight1 = mc.floatFieldGrp('tdb_weight1FFG', q=True, v1=True)
    weight2 = mc.floatFieldGrp('tdb_weight2FFG', q=True, v1=True)
    overlap = mc.floatFieldGrp('tdb_overlapFFG', q=True, v1=True)
    prefix = mc.textFieldGrp('tdb_prefixTFG', q=True, text=True)

    # Check Arguments
    if not blendShape: raise Exception('No blendShape specified!')
    if not target1: raise Exception('Target 1 not specified!')
    if target1 and target2:
        minValue = weight1
        maxValue = weight2
    else:
        maxValue = weight1

    # Execute Command
    if target1 and target2:
        glTools.tools.transformDrivenBlend.drive2Shapes(
            blendShape, target1, target2, driveAttr, minValue, maxValue,
            overlap, prefix)
    else:
        glTools.tools.transformDrivenBlend.driveShape(blendShape, target,
                                                      driveAttr, minValue,
                                                      maxValue, prefix)
Ejemplo n.º 28
0
def shapeScaleUI():
	"""UI for the script"""

	if (cmds.window("ssWin", exists=True)):
		cmds.deleteUI("ssWin", window=True)
		#cmds.winPref("shapeScaleWin", remove=True)

	widgets["win"] = cmds.window("ssWin", t="zbw_shapeScale", w=400, h=75, s=False)

	widgets["colLo"] = cmds.columnLayout("mainCLO", w=400, h=75)
	widgets["formLO"] = cmds.formLayout(nd=100, w=400)
	cmds.separator(h=10)
	widgets["slider"] = cmds.floatSliderGrp("slider", f=False, l="Scale", min=0.01, max=2, pre=3, v=1, adj=3, cal=([1, "left"], [2, "left"], [3, "left"]), cw=([1, 50], [2,220]), cc= shapeScaleExecute)
	cmds.separator(h=10)
	widgets["scaleFFG"] = cmds.floatFieldGrp(v1=100, pre= 1, l="Scale %", en1=True, w=110, cw=([1,50],[2,50]), cal=([1,"left"], [2,"left"]))
	widgets["scaleDoBut"] = cmds.button(l="Scale", w= 160, h=25, bgc=(.2,.4,.2), c=manualScale)
	widgets["trackerFFG"] = cmds.floatFieldGrp(l="Change", w=100, v1=100, pre=1, en1=False, cw=([1,45],[2,50]), cal=([1,"left"], [2,"right"]), bgc=(.2,.2,.2))
	widgets["clearBut"] = cmds.button(l="RESET", w=45, bgc=(.2,.2,.2), c=resetScale)

	widgets["origBut"] = cmds.button(l="ORIG", w=45, bgc=(.2,.2,.2), c=origScale)

	#attach to form layout
	cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["slider"], 'top', 5), (widgets["slider"], 'left', 5)])
	cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["scaleFFG"], 'top', 34), (widgets["scaleFFG"], 'left', 5)])
	cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["scaleDoBut"], 'top', 34), (widgets["scaleDoBut"], 'left', 120)])
	cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["clearBut"], 'top', 34), (widgets["clearBut"], 'left', 344)])
	cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["trackerFFG"], 'top', 5), (widgets["trackerFFG"], 'left', 290)])
	cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["origBut"], 'top', 34), (widgets["origBut"], 'left', 290)])

	cmds.showWindow(widgets["win"])
	cmds.window(widgets["win"], e=True, w=400, h=75)
Ejemplo n.º 29
0
def addMultiAttr():
    #Create a variable for the window name
    winName = 'blend'
    winTitle = 'rh_addMultiAttr'
    #Delete the window if it exists
    if cmds.window(winName, exists=True):
        cmds.deleteUI(winName, window=True)
    #Build the main window
    cmds.window(winName, title=winTitle, sizeable=True)
    cmds.textFieldButtonGrp('Obj',label='Object :', text='', ed = False,buttonLabel='Load Sel',bc = 'sel()')
    cmds.columnLayout(adjustableColumn=True)    
    cmds.textFieldGrp('Attr',l='Attribute:',text='')   

    cmds.columnLayout(adjustableColumn=True)  
    cmds.floatFieldGrp('minAttr', numberOfFields=1, label='Min Value', value1=0) 
       
    cmds.columnLayout(adjustableColumn=True) 
    cmds.floatFieldGrp('maxAttr', numberOfFields=1, label='Max Value', value1=0)
    
    cmds.columnLayout(adjustableColumn=True)        
    cmds.button(label='Contact', command='Connect()')
    cmds.columnLayout(adjustableColumn=True)
    #Show the window
    cmds.showWindow(winName)
    cmds.window(winName, edit=True, width=300, height=120)
Ejemplo n.º 30
0
def hsvColorKeyframeWindow():
    if cmds.window('HSV_Keyframe_Window',ex=True):
        cmds.deleteUI('HSV_Keyframe_Window')
    cmds.window('HSV_Keyframe_Window',t='Color_KeyframeWindow',w=800,h=400)

    cmds.columnLayout(bgc=[0.027,0.027,0.027])
    cmds.frameLayout(l='Color Settings',w=370,li=265,cll=True,bgc=[0.0,0.2,0.4])
    cmds.separator(w=370,h=1,bgc=[0,0.25,0.55],style='none')
    cmds.colorInputWidgetGrp('Color_Sets',cc=lambda *args:colorSliderAction())
    cmds.setParent(u=True)
    cmds.separator(w=370,h=1,bgc=[0,0.25,0.55],style='none')
    cmds.setParent(u=True)
    
    cmds.frameLayout(l='Color Range Keyframe',w=370,li=220,cll=True,bgc=[0.0,0.3,0.65])
    cmds.separator(w=370,h=1,bgc=[0,0.4,0.75],style='none')

    cmds.columnLayout()
    cmds.colorInputWidgetGrp('Color_From',l='From Color')
    cmds.colorInputWidgetGrp('Color_To',l='To Color')

    cmds.separator(w=370,h=20,bgc=[0,0.4,0.8],style='none')
    cmds.rowLayout(nc=2)
    cmds.columnLayout()
    cmds.intFieldGrp('HSV_Color_StartTime',l='Start Frame')
    cmds.intFieldGrp('HSV_Color_EndTime',l='End Frame')
    cmds.floatFieldGrp('HSV_Color_Step',l='Steps',v1=1.0)
    cmds.setParent(u=True)
    cmds.columnLayout()
    
    cmds.button(l='Set Keys',w=120,h=50,c='hsvColorKeyframeAction()',bgc=[0.0,0.1,0.36])
    cmds.setParent(u=True)

    cmds.showWindow('HSV_Keyframe_Window')
Ejemplo n.º 31
0
    def RandomValues(self):
        self.delete()

        self.MaxAndMinWin = cmds.window('MaxAndMinWin')
        self.colLayout = cmds.columnLayout()
        cmds.floatFieldGrp('MaximumField', label='Max', Parent=self.colLayout)
        cmds.floatFieldGrp('MinimumField', label='Min', Parent=self.colLayout)
        cmds.button(label="Randomize Translate All Axis'",
                    Parent=self.colLayout,
                    command=lambda *args: randomizer())
        cmds.button(label="Randomize Translate X",
                    Parent=self.colLayout,
                    command=lambda *args: randomizerX())
        cmds.button(label="Randomize Translate Y",
                    Parent=self.colLayout,
                    command=lambda *args: randomizerY())
        cmds.button(label="Randomize Translate Z",
                    Parent=self.colLayout,
                    command=lambda *args: randomizerZ())

        cmds.button(label="Randomize Rotation",
                    Parent=self.colLayout,
                    command=lambda *args: randomizerRotate())
        cmds.button(label="Reset Rotation",
                    Parent=self.colLayout,
                    command=lambda *args: resetRotate())
        cmds.intFieldGrp('ScaleNumber',
                         label='Max Scale',
                         Parent=self.colLayout)
        cmds.button(label="Randomize Scale",
                    Parent=self.colLayout,
                    command=lambda *args: randomizerScale())
        cmds.showWindow(self.MaxAndMinWin)
Ejemplo n.º 32
0
def manualScale(*args):
    """uses the float field group to manually scale the object by that amount"""
    origScale = cmds.floatFieldGrp(widgets["trackerFFG"], q=True, v1=True)

    #get value from field
    scalePer = cmds.floatFieldGrp(widgets["scaleFFG"] , q=True, v1=True)
    scaleVal = scalePer/100
    #scaleShapes
    sel = cmds.ls(sl=True, type="transform")
    if sel:
        for obj in sel:
            #decide on object type
            objShape = cmds.listRelatives(obj, s=True)
            shapeType = cmds.objectType(objShape)

            cmds.select(cl=True)
            if shapeType == "nurbsSurface" or shapeType == "nurbsCurve":
                #get the components
                cvs = cmds.select((obj + ".cv[*]"))
                cmds.scale(scaleVal, scaleVal, scaleVal)
            elif shapeType == "mesh":
                #get the components
                cvs = cmds.select((obj + ".vtx[*]"))
                cmds.scale(scaleVal, scaleVal, scaleVal)
            else:
                cmds.warning("%s isn't a nurbs or poly object, so it was skipped")

    #clear and reselect all
    if sel:
        cmds.select(cl=True)
        cmds.select(sel)
        newScale = origScale * scaleVal
        cmds.floatFieldGrp(widgets["trackerFFG"], e=True, v1=newScale)
Ejemplo n.º 33
0
def origScale(*args):
    """scales the object by the inverse of the currentScale (as measured by the tracker floatfield). So if everything was reset when you started it will
    undo all subsequent scaling operations"""

    currScale = cmds.floatFieldGrp(widgets["trackerFFG"], q=True, v1=True)
    scaleVal = 100/currScale
    # print "%s = factor"%factor
    # scaleVal = currScale * factor/100
    cmds.floatFieldGrp(widgets["trackerFFG"], e=True, v1=scaleVal*currScale)

    sel = cmds.ls(sl=True, type="transform")
    if sel:
        for obj in sel:
            #decide on object type
            objShape = cmds.listRelatives(obj, s=True)
            shapeType = cmds.objectType(objShape)

            cmds.select(cl=True)
            if shapeType == "nurbsSurface" or shapeType == "nurbsCurve":
                #get the components
                cvs = cmds.select((obj + ".cv[*]"))
                cmds.scale(scaleVal, scaleVal, scaleVal)
            elif shapeType == "mesh":
                #get the components
                cvs = cmds.select((obj + ".vtx[*]"))
                cmds.scale(scaleVal, scaleVal, scaleVal)
            else:
                cmds.warning("%s isn't a nurbs or poly object, so it was skipped")

    #clear and reselect all
    if sel:
        cmds.select(cl=True)
        cmds.select(sel)
        cmds.floatFieldGrp(widgets["scaleFFG"], e=True, v1=scaleVal*100)
Ejemplo n.º 34
0
def ui():
	'''
	'''
	# Window
	window = 'transformDrivenBlendUI'
	if mc.window(window,q=True,ex=1): mc.deleteUI(window)
	window = mc.window(window,t='Transform Driven Blend')
	
	# Layout
	cl = mc.columnLayout()
	
	# UI Elements
	driveAttrTFG = mc.textFieldGrp('tdb_driveAttrTFG',label='Drive Attr', text='')
	blendShapeTFG = mc.textFieldGrp('tdb_blendShapeTFG',label='BlendShape', text='')
	target1TFG = mc.textFieldGrp('tdb_target1TFG',label='Target 1', text='',cc='glTools.ui.transformDrivenBlend.refreshUI()')
	target2TFG = mc.textFieldGrp('tdb_target2TFG',label='Target 2', text='',cc='glTools.ui.transformDrivenBlend.refreshUI()')
	weight1FFG = mc.floatFieldGrp('tdb_weight1FFG',numberOfFields=1,label='Weight 1',v1=1.0)
	weight2FFG = mc.floatFieldGrp('tdb_weight2FFG',numberOfFields=1,label='Weight 2',v1=-1.0)
	overlapFFG = mc.floatFieldGrp('tdb_overlapFFG',numberOfFields=1,label='Overlap',v1=0.0)
	prefixTFG = mc.textFieldGrp('tdb_prefixTFG',label='Prefix', text='')
	createB = mc.button('tdb_createB',label='Create',c='glTools.ui.transformDrivenBlend.executeFromUI()')
	refreshB = mc.button('tdb_refreshB',label='Refresh',c='glTools.ui.transformDrivenBlend.refreshUI()')
	cancelB = mc.button('tdb_cancelB',label='Cancel',c='mc.deleteUI('+window+')')
	
	# Popup Menus
	mc.popupMenu('tdb_blendShapePUM',p=blendShapeTFG)
	mc.popupMenu('tdb_target1PUM',p=target1TFG)
	mc.popupMenu('tdb_target2PUM',p=target2TFG)
	mc.popupMenu('tdb_driveAttrPUM',p=driveAttrTFG)
	mc.menuItem(label='Set from selected',c='glTools.ui.utils.loadChannelBoxSel("'+driveAttrTFG+'")')
	
	# Show Window
	refreshUI()
	mc.showWindow(window)
Ejemplo n.º 35
0
def setPlanes(*args):
    """sets clipping planes for cameras based on float fields in UI. Depending on radio button, it will either do all camera or only selected"""

    all = cmds.radioButtonGrp("camRBG", q=True, sl=True)
    far = cmds.floatFieldGrp("farFFG", q=True, v1=True)
    near = cmds.floatFieldGrp("nearFFG", q=True, v1=True)

    cams = []
    if all==1:
        cams.extend(cmds.ls(type="camera"))
    elif all==2:
        transf = cmds.ls(sl=True, type="transform")
        for each in transf:
            shape = cmds.listRelatives(each, s=True)
            if shape:
                if cmds.objectType(shape) == "camera":
                    cams.extend(shape)
    #for each, set shape.farClipPlane 100000
    if cams:
        print cams
        for cam in cams:
            try:
                cmds.setAttr("%s.farClipPlane"%cam, far)
                cmds.setAttr("%s.nearClipPlane"%cam, near)

            except:
                cmds.warning("Couldn't change the farClipPlane of %s"%cam)
Ejemplo n.º 36
0
def wiggle_window():

    editedWindow = create_window("Wiggle")
    cmds.window(editedWindow,
                edit=True,
                title="Wiggle",
                widthHeight=(850, 200))
    intro = cmds.rowColumnLayout(nc=1,
                                 rs=[(1, 10), (2, 10)],
                                 rat=[(1, "top", 10), (2, "top", 10)],
                                 ro=[(1, "top", 20)],
                                 cal=[(1, "center")],
                                 columnWidth=[(1, 800)],
                                 cat=[(1, "both", 10)])
    cmds.text(label="Use the WIGGLE slider to move the selected object.")
    cmds.text(
        label=
        "Type minimum and maximum value to set the RANGE of the wiggle movement."
    )
    floatSlider = cmds.floatSliderGrp(label="Wiggle",
                                      minValue=0,
                                      maxValue=1,
                                      dc=do_move,
                                      value=0)
    cmds.text(label="Value Range")
    cmds.floatFieldGrp('minValueRange', label="Min Value", value1=1)
    cmds.floatFieldGrp('maxValueRange', label="Max Value", value1=1.1)
Ejemplo n.º 37
0
    def create(self):
        cmds.window(self.winName, title=self.winTitle)
        cmds.columnLayout(rs=3, cat=("left", 5))
        self.timeFacField = cmds.floatFieldGrp(label="Time Factor : ",
                                               value1=1.0,
                                               cw2=(70, 75),
                                               h=25)
        self.simpCbx = cmds.checkBox(label="Simplify curve", v=True)
        self.channelbCbx = cmds.checkBox(label="From channel box", v=False)

        cmds.separator(style="single", h=25, w=200)
        cmds.button(label="Draw Anim (Translate)",
                    w=150,
                    c=partial(self.run, "translate"))

        cmds.separator(style="single", h=25, w=200)
        self.aimCbx = cmds.checkBox(label="Best Guess", v=False)
        self.aimVecField = cmds.floatFieldGrp(label="Aim Vector : ",
                                              nf=3,
                                              value1=0.0,
                                              value2=1.0,
                                              value3=0.0,
                                              cw4=(70, 60, 60, 60),
                                              h=25)

        cmds.button(label="Draw Anim (Rotate)",
                    w=150,
                    c=partial(self.run, "rotate"))

        cmds.separator(style="single", h=25, w=200)
        cmds.button(label="Draw Anim (Both)",
                    w=150,
                    c=partial(self.run, "translaterotate"))
        cmds.showWindow(self.winName)
        cmds.window(self.winName, edit=True, wh=(300, 290))
Ejemplo n.º 38
0
def attachToSurfaceFromUI(close=True):
    """
    Execute attachToSurface() from UI
    @param close:
    """
    # Window
    window = 'attachToSurfaceUI'
    if not cmds.window(window, q=True, ex=1): raise UIError('AttachToSurface UI does not exist!!')
    # Get UI data
    surf = cmds.textFieldGrp('attachToSurfaceTFB', q=True, text=True)
    # Check surface
    if not glTools.utils.surface.isSurface(surf):
        raise UserInputError('Object "' + surf + '" is not a valid nurbs surface!!')
    trans = cmds.textFieldGrp('attachToSurfaceTransformTFB', q=True, text=True)
    pre = cmds.textFieldGrp('attachToSurfacePrefixTFG', q=True, text=True)
    uParam = cmds.floatFieldGrp('attachToSurfaceParamTFB', q=True, v1=True)
    vParam = cmds.floatFieldGrp('attachToSurfaceParamTFB', q=True, v2=True)
    closePnt = cmds.checkBoxGrp('attachToSurfaceClosePntCBG', q=True, v1=True)
    uAttr = cmds.textFieldGrp('attachToSurfaceUAttrTFG', q=True, text=True)
    vAttr = cmds.textFieldGrp('attachToSurfaceVAttrTFG', q=True, text=True)
    # Orient
    orient = cmds.checkBoxGrp('attachToSurfaceOrientCBG', q=True, v1=True)
    # Orient Options
    tanU = str.lower(str(cmds.optionMenuGrp('attachToSurfaceUAxisOMG', q=True, v=True)))
    tanV = str.lower(str(cmds.optionMenuGrp('attachToSurfaceVAxisOMG', q=True, v=True)))
    align = str.lower(str(cmds.optionMenuGrp('attachToSurfaceAlignToOMG', q=True, v=True)))

    # Execute command
    result = glTools.utils.attach.attachToSurface(surface=surf, transform=trans, uValue=uParam, vValue=vParam,
                                                  useClosestPoint=closePnt, orient=orient, uAxis=tanU, vAxis=tanV,
                                                  uAttr=uAttr, vAttr=vAttr, alignTo=align, prefix=pre)

    # Cleanup
    if close: cmds.deleteUI(window)
Ejemplo n.º 39
0
def shapeScaleUI():
    """UI for the script"""

    if (cmds.window("ssWin", exists=True)):
        cmds.deleteUI("ssWin", window=True)
        #cmds.winPref("shapeScaleWin", remove=True)

    widgets["win"] = cmds.window("ssWin", t="zbw_shapeScale", w=400, h=75, s=False)

    widgets["colLo"] = cmds.columnLayout("mainCLO", w=400, h=75)
    widgets["formLO"] = cmds.formLayout(nd=100, w=400)
    cmds.separator(h=10)
    widgets["slider"] = cmds.floatSliderGrp("slider", f=False, l="Scale", min=0.01, max=2, pre=3, v=1, adj=3, cal=([1, "left"], [2, "left"], [3, "left"]), cw=([1, 50], [2,220]), cc= shapeScaleExecute)
    cmds.separator(h=10)
    widgets["scaleFFG"] = cmds.floatFieldGrp(v1=100, pre= 1, l="Scale %", en1=True, w=110, cw=([1,50],[2,50]), cal=([1,"left"], [2,"left"]))
    widgets["scaleDoBut"] = cmds.button(l="Scale", w= 160, h=25, bgc=(.2,.4,.2), c=manualScale)
    widgets["trackerFFG"] = cmds.floatFieldGrp(l="Change", w=100, v1=100, pre=1, en1=False, cw=([1,45],[2,50]), cal=([1,"left"], [2,"right"]), bgc=(.2,.2,.2))
    widgets["clearBut"] = cmds.button(l="RESET", w=45, bgc=(.2,.2,.2), c=resetScale)

    widgets["origBut"] = cmds.button(l="ORIG", w=45, bgc=(.2,.2,.2), c=origScale)

    #attach to form layout
    cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["slider"], 'top', 5), (widgets["slider"], 'left', 5)])
    cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["scaleFFG"], 'top', 34), (widgets["scaleFFG"], 'left', 5)])
    cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["scaleDoBut"], 'top', 34), (widgets["scaleDoBut"], 'left', 120)])
    cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["clearBut"], 'top', 34), (widgets["clearBut"], 'left', 344)])
    cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["trackerFFG"], 'top', 5), (widgets["trackerFFG"], 'left', 290)])
    cmds.formLayout(widgets["formLO"], e=True, attachForm=[(widgets["origBut"], 'top', 34), (widgets["origBut"], 'left', 290)])

    cmds.showWindow(widgets["win"])
    cmds.window(widgets["win"], e=True, w=400, h=75)
Ejemplo n.º 40
0
def ui():
	'''
	'''
	# Window
	window = 'transformDrivenBlendUI'
	if mc.window(window,q=True,ex=1): mc.deleteUI(window)
	window = mc.window(window,t='Transform Driven Blend')

	# Layout
	cl = mc.columnLayout()

	# UI Elements
	driveAttrTFG = mc.textFieldGrp('tdb_driveAttrTFG',label='Drive Attr', text='')
	blendShapeTFG = mc.textFieldGrp('tdb_blendShapeTFG',label='BlendShape', text='')
	target1TFG = mc.textFieldGrp('tdb_target1TFG',label='Target 1', text='',cc='glTools.ui.transformDrivenBlend.refreshUI()')
	target2TFG = mc.textFieldGrp('tdb_target2TFG',label='Target 2', text='',cc='glTools.ui.transformDrivenBlend.refreshUI()')
	weight1FFG = mc.floatFieldGrp('tdb_weight1FFG',numberOfFields=1,label='Weight 1',v1=1.0)
	weight2FFG = mc.floatFieldGrp('tdb_weight2FFG',numberOfFields=1,label='Weight 2',v1=-1.0)
	overlapFFG = mc.floatFieldGrp('tdb_overlapFFG',numberOfFields=1,label='Overlap',v1=0.0)
	prefixTFG = mc.textFieldGrp('tdb_prefixTFG',label='Prefix', text='')
	createB = mc.button('tdb_createB',label='Create',c='glTools.ui.transformDrivenBlend.executeFromUI()')
	refreshB = mc.button('tdb_refreshB',label='Refresh',c='glTools.ui.transformDrivenBlend.refreshUI()')
	cancelB = mc.button('tdb_cancelB',label='Cancel',c='mc.deleteUI('+window+')')

	# Popup Menus
	mc.popupMenu('tdb_blendShapePUM',p=blendShapeTFG)
	mc.popupMenu('tdb_target1PUM',p=target1TFG)
	mc.popupMenu('tdb_target2PUM',p=target2TFG)
	mc.popupMenu('tdb_driveAttrPUM',p=driveAttrTFG)
	mc.menuItem(label='Set from selected',c='glTools.ui.utils.loadChannelBoxSel("'+driveAttrTFG+'")')

	# Show Window
	refreshUI()
	mc.showWindow(window)
Ejemplo n.º 41
0
def createIntegratorFrameMetropolisLightTransport(renderSettings):
    integratorMetropolisLightTransportMaxDepth = cmds.getAttr(
        "%s.%s" %
        (renderSettings, "integratorMetropolisLightTransportMaxDepth"))
    integratorMetropolisLightTransportBootstrapSamples = cmds.getAttr(
        "%s.%s" %
        (renderSettings, "integratorMetropolisLightTransportBootstrapSamples"))
    integratorMetropolisLightTransportChains = cmds.getAttr(
        "%s.%s" % (renderSettings, "integratorMetropolisLightTransportChains"))
    integratorMetropolisLightTransportMutationsPerPixel = cmds.getAttr(
        "%s.%s" % (renderSettings,
                   "integratorMetropolisLightTransportMutationsPerPixel"))
    integratorMetropolisLightTransportLargeStepProbability = cmds.getAttr(
        "%s.%s" % (renderSettings,
                   "integratorMetropolisLightTransportLargeStepProbability"))
    integratorMetropolisLightTransportSigma = cmds.getAttr(
        "%s.%s" % (renderSettings, "integratorMetropolisLightTransportSigma"))

    integratorSettings = cmds.frameLayout(label="Metropolis Light Transport",
                                          cll=True)

    cmds.intFieldGrp(
        numberOfFields=1,
        label="Max Depth",
        value1=integratorMetropolisLightTransportMaxDepth,
        changeCommand=lambda (x): getIntFieldGroup(
            None, "integratorMetropolisLightTransportMaxDepth", x))
    cmds.intFieldGrp(
        numberOfFields=1,
        label="Bootstrap Samples",
        value1=integratorMetropolisLightTransportBootstrapSamples,
        changeCommand=lambda (x): getIntFieldGroup(
            None, "integratorMetropolisLightTransportBootstrapSamples", x))
    cmds.intFieldGrp(numberOfFields=1,
                     label="Chains",
                     value1=integratorMetropolisLightTransportChains,
                     changeCommand=lambda (x): getIntFieldGroup(
                         None, "integratorMetropolisLightTransportChains", x))
    cmds.intFieldGrp(
        numberOfFields=1,
        label="Mutations Per Pixel",
        value1=integratorMetropolisLightTransportMutationsPerPixel,
        changeCommand=lambda (x): getIntFieldGroup(
            None, "integratorMetropolisLightTransportMutationsPerPixel", x))

    cmds.floatFieldGrp(
        numberOfFields=1,
        label="Large Step Probability",
        value1=integratorMetropolisLightTransportLargeStepProbability,
        changeCommand=lambda (x): getFloatFieldGroup(
            None, "integratorMetropolisLightTransportLargeStepProbability", x))
    cmds.floatFieldGrp(numberOfFields=1,
                       label="Sigma",
                       value1=integratorMetropolisLightTransportSigma,
                       changeCommand=lambda (x): getFloatFieldGroup(
                           None, "integratorMetropolisLightTransportSigma", x))

    cmds.setParent('..')

    return integratorSettings
Ejemplo n.º 42
0
def executeFromUI():
    """
    """
    # Set Default Values
    minValue = 0.0
    maxValue = 1.0

    # Get UI input values
    driveAttr = cmds.textFieldGrp('tdb_driveAttrTFG', q=True, text=True)
    blendShape = cmds.textFieldGrp('tdb_blendShapeTFG', q=True, text=True)
    target1 = cmds.textFieldGrp('tdb_target1TFG', q=True, text=True)
    target2 = cmds.textFieldGrp('tdb_target1TFG', q=True, text=True)
    weight1 = cmds.floatFieldGrp('tdb_weight1FFG', q=True, v1=True)
    weight2 = cmds.floatFieldGrp('tdb_weight2FFG', q=True, v1=True)
    overlap = cmds.floatFieldGrp('tdb_overlapFFG', q=True, v1=True)
    prefix = cmds.textFieldGrp('tdb_prefixTFG', q=True, text=True)

    # Check Arguments
    if not blendShape: raise Exception('No blendShape specified!')
    if not target1: raise Exception('Target 1 not specified!')
    if target1 and target2:
        minValue = weight1
        maxValue = weight2
    else:
        maxValue = weight1

    # Execute Command
    if target1 and target2:
        glTools.tools.transformDrivenBlend.drive2Shapes(blendShape, target1, target2, driveAttr, minValue, maxValue,
                                                        overlap, prefix)
    else:
        glTools.tools.transformDrivenBlend.driveShape(blendShape, target, driveAttr, minValue, maxValue, prefix)
Ejemplo n.º 43
0
    def writeNewFile(self, *args):
        ##fill the needed variables
        selectedTab = cmds.tabLayout("tabs", q=1, st=1)
        refReTarget = cmds.checkBox("refReTargetCheck", q=1, v=1)
        nodeNames = cmds.radioButtonGrp("nodeNamesRadio", q=1, sl=1)
        thisName = cmds.textFieldGrp("nameGrp", q=1, tx=1)
        selected = cmds.ls(sl=1)

        fullname = self.path + thisName
        print fullname

        #try:
        ##figure out which tab and which file is selected
        if selectedTab == "animFileForm":
            min = cmds.floatFieldGrp("animRange", q=1, v1=1)
            max = cmds.floatFieldGrp("animRange", q=1, v2=1)
            keyableAttrs = [""]
            fullname = fullname + ".nm8"
            saveType = ""
            saveFile.jpmSaveAnimationToFile(fullname, min, max, saveType,
                                            selected, keyableAttrs,
                                            refReTarget)
        if selectedTab == "poseFileForm":
            keyableAttrs = [""]
            fullname = fullname + ".psz"
            saveType = ""
            saveFile.jpmSavePoseToFile(fullname, saveType, selected,
                                       keyableAttrs, refReTarget)
        if selectedTab == "selFileForm":
            fullname = fullname + ".slc"
            saveFile.jpmSaveSelectionToFile(fullname, selected, refReTarget)
        self.populateFileList(self.currentSort)
Ejemplo n.º 44
0
def createIntegratorFrameStochasticProgressivePhotonMap(renderSettings):
    integratorStochasticProgressivePhotonMapNumIterations = cmds.getAttr(
        "%s.%s" % (renderSettings,
                   "integratorStochasticProgressivePhotonMapNumIterations"))
    integratorStochasticProgressivePhotonMapMaxDepth = cmds.getAttr(
        "%s.%s" %
        (renderSettings, "integratorStochasticProgressivePhotonMapMaxDepth"))
    integratorStochasticProgressivePhotonMapPhotonsPerIteration = cmds.getAttr(
        "%s.%s" %
        (renderSettings,
         "integratorStochasticProgressivePhotonMapPhotonsPerIteration"))
    integratorStochasticProgressivePhotonMapImageWriteFrequency = cmds.getAttr(
        "%s.%s" %
        (renderSettings,
         "integratorStochasticProgressivePhotonMapImageWriteFrequency"))
    integratorStochasticProgressivePhotonMapRadius = cmds.getAttr(
        "%s.%s" %
        (renderSettings, "integratorStochasticProgressivePhotonMapRadius"))

    integratorSettings = cmds.frameLayout(
        label="Stochastic Progressive Photon Map", cll=True)

    cmds.intFieldGrp(
        numberOfFields=1,
        label="Num Iterations",
        value1=integratorStochasticProgressivePhotonMapNumIterations,
        changeCommand=lambda (x): getIntFieldGroup(
            None, "integratorStochasticProgressivePhotonMapNumIterations", x))
    cmds.intFieldGrp(
        numberOfFields=1,
        label="Max Depth",
        value1=integratorStochasticProgressivePhotonMapMaxDepth,
        changeCommand=lambda (x): getIntFieldGroup(
            None, "integratorStochasticProgressivePhotonMapMaxDepth", x))
    cmds.intFieldGrp(
        numberOfFields=1,
        label="Photons Per Iteration",
        value1=integratorStochasticProgressivePhotonMapPhotonsPerIteration,
        changeCommand=lambda (x): getIntFieldGroup(
            None,
            "integratorStochasticProgressivePhotonMapPhotonsPerIteration", x))
    cmds.intFieldGrp(
        numberOfFields=1,
        label="Image Write Frequency",
        value1=integratorStochasticProgressivePhotonMapImageWriteFrequency,
        changeCommand=lambda (x): getIntFieldGroup(
            None,
            "integratorStochasticProgressivePhotonMapImageWriteFrequency", x))

    cmds.floatFieldGrp(
        numberOfFields=1,
        label="Radius",
        value1=integratorStochasticProgressivePhotonMapRadius,
        changeCommand=lambda (x): getFloatFieldGroup(
            None, "integratorStochasticProgressivePhotonMapRadius", x))

    cmds.setParent('..')

    return integratorSettings
Ejemplo n.º 45
0
def get_range(*args):

    valueRange = []
    minValue = cmds.floatFieldGrp('minValueRange', query=True, v1=True)
    valueRange.append(minValue)
    maxValue = cmds.floatFieldGrp('maxValueRange', query=True, v1=True)
    valueRange.append(maxValue)
    return valueRange
Ejemplo n.º 46
0
    def createUI( self, win, index):
# hier muss ich noch das entspr. Attr analysieren und die Min/Max korrekt setzen
        win.cRange.append( mc.floatSliderGrp( label=self.channel, fieldStep=.1, precision=3, field=True, min=0, fieldMinValue=-1000000, max=5, fieldMaxValue=1000000, cc='randomizer.updateChannel( ' + str(index) + ', 1)', dc='randomizer.updateChannel( ' + str(index) + ', 0)' ))
        win.cOffset.append( mc.floatFieldGrp( label='Offset', precision=3, numberOfFields=1, value1=0, cc='randomizer.updateChannel( ' + str(index) + ', 1)', dc='randomizer.updateChannel( ' + str(index) + ', 0)' ))
        for c in mc.layout( win.cOffset[-1], q=1, ca=1)[1:]: mc.floatField( c, e=1, step=.1)
        win.cStep.append( mc.floatFieldGrp( label='Step', precision=3, numberOfFields=1, value1=0, cc='randomizer.updateChannel( ' + str(index) + ', 1)', dc='randomizer.updateChannel( ' + str(index) + ', 0)' ))
        for c in mc.layout( win.cStep[-1], q=1, ca=1)[1:]: mc.floatField( c, e=1, step=.1)
        mc.separator( style="in", h=20)
Ejemplo n.º 47
0
	def clearAll(self, *args):
		"""clears all the fields"""
		fieldNames = ["origTxFFG", "origTyFFG", "origTzFFG", "origSxFFG", "origSyFFG", "origSzFFG", "origRxFFG", "origRyFFG", "origRzFFG", "modTxFFG", "modTyFFG", "modTzFFG", "modRxFFG", "modRyFFG", "modRzFFG", "modSxFFG", "modSyFFG", "modSzFFG", "difTxFFG", "difTyFFG", "difTzFFG", "difRxFFG", "difRyFFG", "difRzFFG", "difSxFFG", "difSyFFG", "difSzFFG"]
		cmds.textFieldGrp(self.widgets["baseTFG"], e=True, tx="")
		for field in fieldNames:
			cmds.floatFieldGrp(self.widgets[field], e=True, v1=0)
		cmds.floatFieldGrp(self.widgets["baseFrameFFG"], e=True, v1=0)
		cmds.text(self.widgets["doneText"], e=True, l="No Status/All Cleared. Select a base object!", bgc=(.5,.5,.5))
Ejemplo n.º 48
0
def floatAttribute(mainSetting, setting):
    cmds.floatFieldGrp(str(setting.keys()[0])+'_attribute',
                    numberOfFields=1,
                    precision=3,
                    label=str(setting.keys()[0]).replace('_', ' '),
                    value1=setting.values()[0],
                    cc="import dmptools.setup.settingsWindow as settingsWindow;settingsWindow.updateFloatAttr('"+mainSetting+"')"
                    )
Ejemplo n.º 49
0
    def initialiseLayout(self):
        # Define Layout
        self.widgets["topLevelColumn"] = cmds.columnLayout(adj=True, rowSpacing=2, columnAttach = ['both', 5])
        
        self.widgets['aimVector_floatFieldGrp'] = cmds.floatFieldGrp(numberOfFields=3, label="Aim Vector", width=self.scrollWidth, value1=1, value2=0, value3=0, columnWidth4=[self.scrollWidth/4,self.scrollWidth/4,self.scrollWidth/4,self.scrollWidth/4])
        self.widgets['upVector_floatFieldGrp'] = cmds.floatFieldGrp(numberOfFields=3, label="Up Vector", width=self.scrollWidth, value1=0, value2=0, value3=1, columnWidth4=[self.scrollWidth/4,self.scrollWidth/4,self.scrollWidth/4,self.scrollWidth/4])

        self.widgets["orientJoint_button"] = cmds.button(label="Orient Joint", width=self.scrollWidth, command=self.orientJointCmd)
Ejemplo n.º 50
0
	def enableRange(self, *args):
		"""toggles the frame range option on/off depending on what's selected in the range radio grp"""
		#get the value of the radio button grp
		sel = cmds.radioButtonGrp(self.widgets["timeRBG"], q=True, sl=True)

		if sel == 3:
			cmds.floatFieldGrp(self.widgets["rangeFFG"], e=True, en=True)
		else:
			cmds.floatFieldGrp(self.widgets["rangeFFG"], e=True, en=False)
def optionsWindow():
	"""This function creates an options window for the am_shoulderConstraint command. 
	When executing it, first select the shoulder to which you are constraining, then 
	add the object to be constrained to your selection."""
	# create the main interface
	if cmds.window(kConstraintOptionsWindow, q=True, ex=True):
		cmds.deleteUI(kConstraintOptionsWindow)
	mainWindow = cmds.window(kConstraintOptionsWindow, title='%s Options'%kToolName, menuBar=True, wh=(545,350))
	
	# build the menu bar
	cmds.menu(label='Help')
	amui.helpMenuItem(kToolName, __file__)
	amui.aboutMenuItem(kToolName, kVersionNumber, kVersionDate)
	
	mainForm = cmds.formLayout(nd=100)
	
	# build the section to get information for the shoulder constraint
	mainFrame = cmds.formLayout(nd=100)
	
	# attempt to guess what the spine is if there is a selection when the GUI is created
	spineText = 'CenterSpine'
	sel = cmds.ls(sl=True, l=True, type='transform')
	if sel and len(sel) > 0: # BUG: in Maya 8.5, a selection of length 0 returns None rather than an empty list
		try:
			collar = cmds.listRelatives(sel[0], p=True, f=True) # the shoulder should be the first object in the selection list
			spine = cmds.listRelatives(collar[0], p=True, f=True)
			spineText = spine[0]
		except: pass
	
	if_spine = cmds.textFieldGrp(label='Spine Object:', tx=spineText)
	if_raisedAngleOffset = cmds.floatSliderGrp(v=45, min=0, max=90, fmn=-180, fmx=180, label='Raised Angle Offset:', field=True)
	if_shoulderAimAxis = cmds.floatFieldGrp(v1=1, v2=0, v3=0, nf=3, pre=4, label='Shoulder Aim Axis:')
	if_shoulderFrontAxis = cmds.floatFieldGrp(v1=0, v2=0, v3=1, nf=3, pre=4, label='Shoulder Front Axis:')
	if_spineAimAxis = cmds.floatFieldGrp(v1=1, v2=0, v3=0, nf=3, pre=4, label='Spine Aim Axis:')
	if_spineFrontAxis = cmds.floatFieldGrp(v1=0, v2=0, v3=1, nf=3, pre=4, label='Spine Front Axis:')
	
	# position the input fields for the shoulder constraint
	cmds.formLayout(mainFrame, edit=True, attachForm=[(if_spine, 'left', 30), (if_spine, 'top', 5)], attachNone=[(if_spine, 'right'), (if_spine, 'bottom')])
	cmds.formLayout(mainFrame, edit=True, attachForm=[(if_raisedAngleOffset, 'left', 30)], attachNone=[(if_raisedAngleOffset, 'right'), (if_raisedAngleOffset, 'bottom')], attachControl=[(if_raisedAngleOffset, 'top', 5, if_spine)])
	cmds.formLayout(mainFrame, edit=True, attachForm=[(if_shoulderAimAxis, 'left', 30)], attachNone=[(if_shoulderAimAxis, 'right'), (if_shoulderAimAxis, 'bottom')], attachControl=[(if_shoulderAimAxis, 'top', 5, if_raisedAngleOffset)])
	cmds.formLayout(mainFrame, edit=True, attachForm=[(if_shoulderFrontAxis, 'left', 30)], attachNone=[(if_shoulderFrontAxis, 'right'), (if_shoulderFrontAxis, 'bottom')], attachControl=[(if_shoulderFrontAxis, 'top', 5, if_shoulderAimAxis)])
	cmds.formLayout(mainFrame, edit=True, attachForm=[(if_spineAimAxis, 'left', 30)], attachNone=[(if_spineAimAxis, 'right'), (if_spineAimAxis, 'bottom')], attachControl=[(if_spineAimAxis, 'top', 5, if_shoulderFrontAxis)])
	cmds.formLayout(mainFrame, edit=True, attachForm=[(if_spineFrontAxis, 'left', 30)], attachNone=[(if_spineFrontAxis, 'right'), (if_spineFrontAxis, 'bottom')], attachControl=[(if_spineFrontAxis, 'top', 5, if_spineAimAxis)])
	
	cmds.setParent('..') # go up to mainFrame
	
	# create the buttons to execute the script
	cmd_create='amTools.rigging.shoulderConstraint.doOptions ("%s", "%s", "%s", "%s", "%s", "%s")'%(
		if_spine, 
		if_raisedAngleOffset, 
		if_shoulderAimAxis, 
		if_shoulderFrontAxis, 
		if_spineAimAxis, 
		if_spineFrontAxis)
	utils.ui.threeButtonLayout(mainForm, mainWindow, cmd_create)
	
	cmds.showWindow(mainWindow)
Ejemplo n.º 52
0
 def exportAnim( *args ):
     self.setExportEnable()
     folderPath = cmds.textField( FolderUIInfo._fieldUI, q=1, tx=1 )
     value1 = cmds.floatFieldGrp( ExportUIInfo._floatField, q=1, value1=1 )
     value2 = cmds.floatFieldGrp( ExportUIInfo._floatField, q=1, value2=1 )
     fileName = function.getNewCAnimName( folderPath )
     exportAnimPath = folderPath + '/' + fileName
     self._exportData.exportAnim( exportAnimPath, value1, value2 )
     cmds.textScrollList( FolderUIInfo._scrollListUI, e=1, a=fileName )
Ejemplo n.º 53
0
def Connect():
    attrVal = cmds.textFieldGrp('Attr',query=True,text=True)
    attrNum = attrVal.count(',') + 1
    attrList = attrVal.split(',')
    minVal = cmds.floatFieldGrp('minAttr', q = True,v = True)
    maxVal = cmds.floatFieldGrp('maxAttr', q = True,v = True)
    obj = cmds.ls(selection=True)    
    
    for attr in range(len(attrList)):          
        cmds.addAttr(obj, ln = attrList[attr], at ="float",min = minVal[0],max = maxVal[0],dv =0,h = False,k = True )
def set_framerange(*args):
    """ Set the scene's framerange.

    :noindex:
    .. note::
        This is utilised by the native MEL UI.
    """
    start_frame = cmds.floatFieldGrp("set_framerange_field", query=True, v1=True)
    end_frame = cmds.floatFieldGrp("set_framerange_field", query=True, v2=True)
    animationflipbook.set_framerange(start_frame, end_frame)
    def createUI( self, win, index):
# min/max of the attr need to be set correcty, not yet
		win.cRange.append( mc.floatSliderGrp( label=self.niceName, fieldStep=.1, precision=3, field=True, min=0, fieldMinValue=-1000000, max=5, fieldMaxValue=1000000, cc='bt_randomizer.updateChannel( ' + str(index) + ', 1)', dc='bt_randomizer.updateChannel( ' + str(index) + ', 0)' ))
# Offset - then modify the stepping of the float field
		win.cOffset.append( mc.floatFieldGrp( label='Offset', precision=3, numberOfFields=1, value1=0, cc='bt_randomizer.updateChannel( ' + str(index) + ', 1)', dc='bt_randomizer.updateChannel( ' + str(index) + ', 0)' ))
		mc.floatField( (win.cOffset[-1] + '|' + mc.layout( win.cOffset[-1], q=1, ca=1)[1]), e=1, step=.1)
# Step - then modify the stepping of the float field
		win.cStep.append( mc.floatFieldGrp( label='Step', precision=3, numberOfFields=1, value1=0, cc='bt_randomizer.updateChannel( ' + str(index) + ', 1)', dc='bt_randomizer.updateChannel( ' + str(index) + ', 0)' ))
		mc.floatField( (win.cStep[-1] + '|' + mc.layout( win.cStep[-1], q=1, ca=1)[1]), e=1, step=.1)
		mc.separator( style="in", h=20)