def _showUI(self):
     if cmds.window(self.win, exists=True):
         cmds.deleteUI(self.win, window=True)
     cmds.window(self.win, title=self.win, widthHeight=(400, 220))
     cmds.columnLayout('uicl_audioMain',adjustableColumn=True)
     cmds.separator(h=15, style='none')
     cmds.text(l='Select Audio to Offset')
     cmds.separator(h=15, style='in')
     cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)])
     cmds.button(label='<< Offset',
                 ann='Nudge selected Audio Backwards',
                 command=partial(self.offsetSelectedBy,'negative'))
     cmds.floatField('AudioOffsetBy', value=10)
     cmds.button(label='Offset >>',
                 ann='Nudge selected Audio Forwards',
                 command=partial(self.offsetSelectedBy,'positive'))
     cmds.setParent('..')
     cmds.separator(h=15, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)])
     cmds.button(label='Offset Range to Start at:',
                 ann='offset the selected range of audionodes such that they start at the given frame',
                 command=self.offsetSelectedTo)
     cmds.floatField('AudioOffsetToo', value=10)
     cmds.setParent('..')
     cmds.separator(h=15, style='in')
     cmds.button(label='Ripple selected',
                 ann="Ripple offset the selected audio nodes so they're timed one after another",
                 command=self.offsetRipple)
     cmds.separator(h=15, style='none')
     cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp',
                          c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200)
     cmds.showWindow(self.win)
     cmds.window(self.win, e=True, widthHeight=(290, 190))
 def create(self):
     
     form = cmds.formLayout()
     text1 = cmds.text( l= self.label1, w=self.width1, h=self.height, al='right' )
     text2 = cmds.text( l= self.label2, w=self.width1, h=self.height, al='right' )
     text3 = cmds.text( l= self.label3, w=self.width1-10, h=self.height, al='right' )
     field1 = cmds.floatField( w=self.width2, h=self.height, step=0.25, pre=2 )
     field2 = cmds.floatField( w=self.width2, h=self.height, step=0.25, pre=2 )
     field3 = cmds.floatField( w=self.width2, h=self.height, step=0.25, pre=2, v=1 )
     cmds.setParent( '..' )
     
     cmds.formLayout( form, e=1, 
                      af=[( text1, 'top', 0 ), ( text1, 'left', 0 ),
                          ( text2, 'top', 0 ), 
                          ( text3, 'top', 0 )],
                      ac=[( field1, 'left', 0, text1 ), ( text2, 'left', 0, field1 ),
                          ( field2, 'left', 0, text2 ), ( text3, 'left', 0, field2 ),
                          ( field3, 'left', 0, text3 )])
     
     WinA_Global.fld_startFrame = field1
     WinA_Global.fld_endFrame   = field2
     WinA_Global.fld_step       = field3
     
     self.form = form
     return form
    def syncAttribute(self, attr, control, valueField, positionField):
        attr = self.nodeAttr('aiShutterCurve')
        values = cmds.gradientControlNoAttr( control, query=True, asString=True) 
        valuesSplit = values.split(',')

        points = []

        for i in range(0,len(valuesSplit)/3):
            points.append([valuesSplit[i*3+1],valuesSplit[i*3],0])
            
        current = cmds.gradientControlNoAttr( control, query=True, currentKey=True) 
        cmds.floatField(valueField, edit=True, value=float(points[current][1]))
        cmds.floatField(positionField, edit=True, value=float(points[current][0]))
        points[current][2] = 1
        points.sort()
        
        size = cmds.getAttr(attr, size=True)
        for i in range(0,size):
            cmds.removeMultiInstance(attr+'['+str(i)+']')
        
        curveString = ""
        for i in range(0,len(points)):
            cmds.setAttr(attr+'['+str(i)+'].aiShutterCurveX',float(points[i][0]))
            cmds.setAttr(attr+'['+str(i)+'].aiShutterCurveY',float(points[i][1]))
            if i is 0:
                curveString += points[i][1] +"," + points[i][0] +",1"
            else:
                curveString += ","+points[i][1] +"," + points[i][0] +",1"
            
        # We save the curve points sorted in the attribute, so we will also resort the points in
        #  the gradient control
        current = [x[2] for x in points].index(1)
        cmds.gradientControlNoAttr( control, edit=True, currentKey=current, asString=curveString) 
def clip_plane_creator(*args):
    gui = 'clipPlaneCreator'
    
    if cmds.window(gui, q=1, ex=1):
        cmds.deleteUI(gui)

    cmds.window(gui,t="Clip Plane Creator v1.0")
    cmds.columnLayout(adjustableColumn = True)
    
    # Get perspective camera (Not orthographic)
    cms = cmds.ls(typ="camera")
    cm_list = []
    cmt = lambda x:cmds.listRelatives(x, p=True)    # get camera's transform node
    cm_list = filter(lambda x:not(cmds.getAttr(x+".orthographic")), cms)    # if orthographic is true, doesn't append "cm_list var"
    cm_list = cmt(cm_list)
    
   
    cmds.button('cam_list', l = "Camera List", h = 30,bgc=(0.4,0.4,1), c=clip_plane_creator )
    cmds.textScrollList('cam_sel',append = cm_list,ams=False , h = 180)
    cmds.separator()
    cmds.rowColumnLayout(numberOfColumns = 4)
    cmds.text("Near Dist:",w = 60)
    cmds.floatField('vNear', v = 10,width = 60)
    cmds.text("Far Dist:", w= 60)
    cmds.floatField('vFar',  v = 100, w= 60)
    cmds.setParent("..")
    
    cmds.button('bCreatePlane', label = "Create Clip Plane", width = 200, c = c_plane)
    cmds.window(gui, e=1, width=240, height = 120)
    cmds.showWindow(gui)
Exemple #5
0
 def arcDoubCurveUI(self,state):
     '''
     Creates the UI containing options to create an Archimedes spiral that spirals out then in again
     
     Initialises the following variables
     self.loops    : Number of complete rotations the spiral should have
     self.gap      : Size of the gaps between successive turnings
     self.height   : The vertical height of the spiral
     self.spiralIn : The direction of the generated curve
     '''
     if state == 1:
         self.tempFrame3 = cmds.rowColumnLayout(numberOfColumns=1,parent=self.curveOptionsFrame)
         cmds.frameLayout(label='Spiral',cll=1)
         cmds.rowColumnLayout(numberOfColumns=2,cs=[(1,5),(2,5)],cw=[(1,350),(2,118)],cal=[(1,'right'),(2,'left')])
         
         cmds.text(label='Number of Loops')
         self.loops = cmds.floatField(minValue=0,width=60,pre=1,v=2)
         cmds.text(label='Gap Between Rings')
         self.gap = cmds.floatField(minValue=0,width=60,pre=3,v=1)
         cmds.text(label='Height')
         self.height = cmds.floatField(width=60,pre=3,v=8)
         cmds.text(label='Curve Direction')
         self.spiralIn = 0
         cmds.checkBox(label='Downwards',v=0,cc=self.spiralToggle)
         cmds.setParent('..')
         cmds.setParent('..')
         cmds.button(label='Generate',width=100,c=self.runArcDoubCurve)
         cmds.setParent('..')
     else:
         cmds.deleteUI(self.tempFrame3)
Exemple #6
0
 def runHypCurve(self,state):
     '''
     Executes the code to make a hyperbolic spiral using the variables defined in snowflakeUI.hypCurveUI
     '''
     curves.hyperbolic(cmds.floatField(self.loops,v=1,q=1),
                              self.spiralIn,
                              cmds.floatField(self.height,v=1,q=1))
Exemple #7
0
 def logCurveUI(self,state):
     '''
     Creates the UI containing options to create a logarithmic spiral
     
     Initialises the following variables
     self.loops    : Number of complete rotations the spiral should have
     self.growth   : Growth factor 
     self.height   : The vertical height of the spiral
     self.spiralIn : The direction of the generated curve
     '''
     if state == 1:
         self.tempFrame1 = cmds.rowColumnLayout(numberOfColumns=1,parent=self.curveOptionsFrame)
         cmds.frameLayout(label='Spiral',cll=1)
         cmds.rowColumnLayout(numberOfColumns=2,cs=[(1,5),(2,5)],cw=[(1,350),(2,118)],cal=[(1,'right'),(2,'left')])
         
         cmds.text(label='Number of Loops')
         self.loops = cmds.floatField(minValue=0,width=60,pre=1,v=2)
         cmds.text(label='Growth Factor')
         self.growth = cmds.floatField(minValue=0,width=60,pre=3,v=0.4)
         cmds.text(label='Height')
         self.height = cmds.floatField(width=60,pre=3)
         cmds.text(label='Curve Direction')
         self.spiralIn = 1
         cmds.checkBox(label='Inwards',v=1,cc=self.spiralToggle)
         cmds.setParent('..')
         cmds.setParent('..')
         cmds.button(label='Generate',width=100,c=self.runLogCurve)
         cmds.setParent('..')
     else:
         cmds.deleteUI(self.tempFrame1)
    def export( *args ):

        import sgBExcute_data
        import sgBFunction_fileAndPath
        
        WinA_Cmd.write_windowInfo()
        path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
        
        if not os.path.exists( path ):
            try:
                sgBFunction_fileAndPath.makeFolder( path ) 
            except:
                cmds.error( '"%s" is not exist path' % path )
                return None
        
        if not os.path.isdir( path ):
            cmds.error( '"%s" is not Directory' % path )
            return None

        path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
        startFrame = cmds.floatField( WinA_Global.fld_startFrame, q=1, v=1 )
        endFrame   = cmds.floatField( WinA_Global.fld_endFrame, q=1, v=1 )
        step       = cmds.floatField( WinA_Global.fld_step, q=1, v=1 )
        exportTargets = sgBFunction_selection.getDeformedObjectsFromGroup( WinA_Cmd.getExportTargets() )
        cacheTypeIndex = cmds.optionMenu( WinA_Global.om_cacheType, q=1, sl=1 )-1
        pointsSpaceIndex = cmds.optionMenu( WinA_Global.om_pointsSpace, q=1, sl=1 )-1
        
        cacheType = ['mcc', 'mcx']
        pointsSpace = ['world', 'local']
        
        if not exportTargets:
            cmds.error( 'Target is not exists' )
        else:
            sgBExcute_data.exportCacheData( exportTargets, startFrame, endFrame, step, path, cacheType[cacheTypeIndex], pointsSpace[pointsSpaceIndex] )
Exemple #9
0
	def show( self ) :
		
		oSrch = 'LFT'
		oRep = 'RGT'
		oMul = 0
		
		if mc.window( self.win , exists=True ) :
			oSrch = mc.textField( '%sSrchTF'%self.ui , q=True , tx=True )
			oRep = mc.textField( '%sRepTF'%self.ui , q=True , tx=True )
			oMul = mc.floatField( '%sMultFF'%self.ui , q=True , v=True )
			mc.deleteUI( self.win )
		
		mc.window( self.win , t='pkWeightPuller' , rtf=True )
		
		mc.columnLayout( '%sMainCL'%self.ui , adj=True )
		
		mc.text( l='Search for' , align='center' )
		mc.textField( '%sSrchTF'%self.ui , tx=oSrch )
		mc.text( l='Replace with' , align='center' )
		mc.textField( '%sRepTF'%self.ui , tx=oRep )
		mc.button( '%sSwapBUT'%self.ui , l='Swap' , c=partial( self.swap ) )
		mc.floatField( '%sMultFF'%self.ui , minValue=0 , maxValue=1 , v=oMul )
		mc.button( '%sBUT'%self.ui , l='Pull' , c=partial( self.pull ) )
		
		mc.showWindow( self.win )
		mc.window( self.win , e=True , w=180 )
		mc.window( self.win , e=True , h=180 )
def loadAttrVal( fld, val, mult ):
	'''
	Load the value of the selected attr into the floatField
	'''
	
	try:	# run code, but catch errors
		
		# list first selected item into variable
		selItem = cmds.ls( sl=True )
			
		# list first selected attribute into variable
		selAttr = cmds.channelBox( 'mainChannelBox', q=True, sma=True )
		
		# query value of selected attr in channelBox
		attrVal = cmds.getAttr("%s.%s" %(selItem[0], selAttr[0]) )
		
		# edit the floatField to the attr value, multiplied by 1 or -1
		cmds.floatField( '%sFltFld%s' %( fld, val ), e=True, v=attrVal*mult )
	
	except TypeError:
		
		OpenMaya.MGlobal.displayWarning( "Please select an attribute from the channel box." )
		
	except IndexError:
		
		OpenMaya.MGlobal.displayWarning( "Please select an attribute from the channel box." )
    def export( *args ):

        import sgBExcute_data
        import sgBFunction_fileAndPath
        
        WinA_Cmd.write_windowInfo()
        path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
        
        if not os.path.exists( path ):
            try:
                sgBFunction_fileAndPath.makeFolder( path ) 
            except:
                cmds.error( '"%s" is not exist path' % path )
                return None
        
        if not os.path.isdir( path ):
            cmds.error( '"%s" is not Directory' % path )
            return None

        path = cmds.textField( WinA_Global.exportPath_txf, q=1, tx=1 )
        startFrame = cmds.floatField( WinA_Global.fld_startFrame, q=1, v=1 )
        endFrame   = cmds.floatField( WinA_Global.fld_endFrame, q=1, v=1 )
        step       = cmds.floatField( WinA_Global.fld_step, q=1, v=1 )
        exportTargets = WinA_Cmd.getExportTargets()
        exportByMatrix = cmds.checkBox( WinA_Global.chk_exportByMatrix, q=1, v=1 )
        if not exportTargets:
            cmds.error( 'Target is not exists' )
        else:
            sgBExcute_data.exportSgKeyData( exportTargets, startFrame, endFrame, step, path, exportByMatrix )
def updateCurrentValue():
   """
   Function to update the UI float field to the current translation value whenever the field becomes active 
   """
   if(cmds.ls(sl=True)):   
      selection = cmds.ls(sl=True)
      cmds.floatField('current', edit=True, value=cmds.getAttr(selection[0]+'.'+axis[chosenAxis-1]))
Exemple #13
0
 def refreshFloatField(self, *args ):
     
     timeControl = cmds.textScrollList( self._timeControl, q=1, si=1 )
     
     if not timeControl: return None
     
     timeControl = timeControl[-1]
     
     weight = cmds.getAttr( timeControl+'.weight' )
     offset = cmds.getAttr( timeControl+'.offset' )
     mult = cmds.getAttr( timeControl+'.mult' )
     limitAble = cmds.getAttr( timeControl+'.limitAble' )
     minTime = cmds.getAttr( timeControl+'.minTime' )
     maxTime = cmds.getAttr( timeControl+'.maxTime' )
     
     cmds.floatField( self._weight, e=1, v=weight )
     cmds.floatField( self._offset, e=1, v=offset )
     cmds.floatField( self._mult, e=1, v=mult )
     cmds.checkBox( self._limitAble, e=1, v=limitAble )
     cmds.floatField( self._minTime, e=1, v=minTime )
     cmds.floatField( self._maxTime, e=1, v=maxTime )
     
     if cmds.checkBox( self._limitAble, q=1, v=1 ):
         cmds.rowColumnLayout( self._limitAbleLay, e=1, en=1 )
     else:
         cmds.rowColumnLayout( self._limitAbleLay, e=1, en=0 )
         
     for popup in self._popupList:
         popup.updateCondition()
def stabilizer ():
	global _camera_
	_point = cmds.ls (selection = True)
	
	if cmds.objExists ('stabilizator_expression') == False and len(_point) > 0:
		_camera_	= Camera()
		_point		= _point[0]

		if (cmds.nodeType (_point) == 'mesh' or cmds.nodeType (_point) == 'transform') and _camera_.transform != 'empty':
			_expression	=	r'''
$pos=`python "fmmu.get_normalized_screen_position(\"'''	+	_point	+	r'''\")"`;
setAttr "'''	+	_camera_.shape	+	r'''.horizontalFilmOffset" $pos[2];
setAttr "'''	+	_camera_.shape	+	r'''.verticalFilmOffset" $pos[3];'''

			print "=================================="
			print _expression
			cmds.expression		(name = 'stabilizator_expression', string = _expression)
			cmds.frameLayout	('adjustCam_frml', edit = True, visible = True)
			cmds.symbolButton	('button_stabilizer', edit = True, image = 'ford_matchMoveUtilities__deStabilize.xpm', annotation = 'deStabilizer')
			cmds.floatField		('field_overscan', edit = True, value = _camera_.overscan)

	else:
		if cmds.objExists ('stabilizator_expression') == True:
			cmds.delete ('stabilizator_expression')
		
		cmds.symbolButton	('button_stabilizer', edit = True, image = 'ford_matchMoveUtilities__stabilize.xpm', annotation = 'deStabilizer')
		cmds.frameLayout	('adjustCam_frml', edit = True, collapse = True, visible = False)
		
		try:
			_camera_.reset_camera()
		except:
			pass
Exemple #15
0
    def create(self):
        
        if cmds.window( self.winName, ex=1 ):
            cmds.deleteUI( self.winName, wnd=1 )
        cmds.window( self.winName, title=self.title )

        cmds.columnLayout()
        
        cmds.rowColumnLayout( nc=1, cw=(1,305))
        cmds.text( l='', h=5  )
        cmds.button( l='Create Pattern Base', h=28, c= WinA_Cmd.cmdCreatePatternBase )
        cmds.text( l='', h=5  )
        cmds.setParent( '..' )
        
        cmds.rowColumnLayout( nc=4, cw=[(1,100), (2,50), (3,100), (4,50)])
        cmds.text( l='  Pattern Size : ' )
        WinA_Global.ff_patternSize = cmds.floatField( v=0.5, min=0.1 )
        cmds.text( l='  Offset Mult : ' )
        WinA_Global.ff_offsetMult = cmds.floatField( v=0.64, min=0.25 )
        cmds.setParent( '..' )
        
        cmds.rowColumnLayout( nc=1, cw=(1,305))
        cmds.text( l='', h=10  )
        cmds.button( l='Create Pattern( pattern base, surface )', h=28, c= WinA_Cmd.cmdCreatePattern )
        cmds.text( l='', h=2  )
        cmds.setParent( '..' )
        
        cmds.rowColumnLayout( nc=1, cw=(1,305))
        cmds.button( l='Update Pattern( pattern base )', h=28, c= WinA_Cmd.cmdUpdatePattern )
        cmds.text( l='', h=5  )
        cmds.setParent( '..' )
        
        cmds.window( self.winName, e=1, wh=[ WinA_Global.width, WinA_Global.height ])
        cmds.showWindow( self.winName )
Exemple #16
0
def extractGeo(obj):
	'''
	Extract the selected faces.
	'''
	# Grab elements from the textScrollList.
	orgSelected = cmds.textScrollList("mecFEXTSL", q=True, ai=True)
	curSel = obj
	faces = []
	for sel in orgSelected:
		temp = sel.split(".")
		#print( curSel[0] + "." + temp[-1] )
		faces.append( curSel + "." + temp[-1] )
	
	cmds.select(faces, r=True)
	mel.eval('doMenuComponentSelection("%s", "facet")' %curSel)
	
	cmds.ExtractFace()
	extSel = cmds.ls(sl=True)
	cmds.delete(extSel[0])
	cmds.delete(ch=1)
	
	# Grab transform values from the interface.
	tx = cmds.floatField("mecFEXTX", q=True, v=True)
	ty = cmds.floatField("mecFEXTY", q=True, v=True)
	tz = cmds.floatField("mecFEXTZ", q=True, v=True)
	
	# Center Pivot and move the geometry
	cmds.xform(extSel[1], cp=True)
	cmds.xform(extSel[1], t=[tx,ty,tz])
Exemple #17
0
    def __init__(self, attrName, width ):
        
        width = width
        deltaName = cmds.getAttr( attrName+'.deltaName' )
        value = cmds.getAttr( attrName+'.weight' )
        
        nameWidth  = 140
        fieldWidth = 70
        sliderWidth = width - nameWidth - fieldWidth 
        self._row  = cmds.rowColumnLayout( nc=3, cw=[(1,nameWidth),(2,fieldWidth),(3,sliderWidth)], 
                                           co=[(1,'left',8 ), (2,'right',5)], h=30 )
        self._textRow = cmds.rowColumnLayout( nc=1, cw=[(1,nameWidth-15)] )
        self._textRowPopup = cmds.popupMenu( mm=1 )
        self._text = cmds.text( al='left', h=20 )
        cmds.setParent( '..' )
        self._field = cmds.floatField( min=0.0, max=1.0 )
        self._fieldPopup = cmds.popupMenu()
        self._slider = cmds.floatSlider( min=0.0, max=1.0 )
        cmds.setParent( '..' )
        
        cmds.text( self._text, e=1, l=deltaName )
        cmds.floatField( self._field, e=1, v=value )
        cmds.floatSlider( self._slider, e=1, v=value )

        self._dragStart = False
        self._keepValue = 0.0
        self._attrName = attrName
        
        cmds.menuItem( l='Select Anim Curve', rp='W', c= self.selectAnimCurveCmd, p=self._textRowPopup )
        cmds.menuItem( l='Change Name', rp='E', c= self.changeNameMoveCmd, p=self._textRowPopup )
        cmds.menuItem( l='Delete Shape', rp='S', c= self.deleteShapeCmd, p=self._textRowPopup )
        #cmds.menuItem( l='Edit Mesh', rp='N', c=self.editMeshCmd, p=self._textRowPopup )
        
        cmds.menuItem( l='Set Key', c= self.setKeyCmd, p=self._fieldPopup )
        cmds.menuItem( l='Break Connection', c= self.breakConnectionCmd, p=self._fieldPopup )
Exemple #18
0
 def editHeight( *args ):
     if not cmds.checkBox( Window_global.check_linkWh, q=1, v=1 ): return None
     
     aspectRatio = float( Window_global.imgWidth ) / float( Window_global.imgHeight )
     height = cmds.floatField( Window_global.floatf_planeHeight, q=1, v=1 )
     width = height / aspectRatio
     cmds.floatField( Window_global.floatf_planeWidth, e=1, v=width )
def rsChangeCheck(i_b_state, i_s_floatField):
    if i_s_floatField == "rsMinField":
        i_b_state = cmds.checkBox("rsMinBox", query=True, value=True)
    else:
        i_b_state = cmds.checkBox("rsMaxBox", query=True, value=True)
    l_oSels = rsObjList()
    if i_b_state == True:
        if i_s_floatField == "rsMinField":
            b_minimum = cmds.attributeQuery(l_oSels[1], node=l_oSels[0], minExists=True)
            f_atValue = 0.0
            if b_minimum == 1:
                f_atValue = (cmds.attributeQuery(l_oSels[1], node=l_oSels[0], minimum=True))[0]
            else:
                cmds.addAttr(l_oSels[2], edit=True, hasMinValue=True)
        if i_s_floatField == "rsMaxField":
            b_maximum = cmds.attributeQuery(l_oSels[1], node=l_oSels[0], maxExists=True)
            f_atValue = 1.0
            if b_maximum == 1:
                f_atValue = (cmds.attributeQuery(l_oSels[1], node=l_oSels[0], maximum=True))[0]
            else:
                cmds.addAttr(l_oSels[2], edit=True, hasMaxValue=True)
                cmds.addAttr(l_oSels[2], edit=True, maxValue=f_atValue)
        cmds.floatField(i_s_floatField, edit=True, value=f_atValue, enable=True)
    else:
        cmds.floatField(i_s_floatField, edit=True, value=0, enable=False)
        if i_s_floatField == "rsMinField":
            cmds.addAttr(l_oSels[2], edit=True, hasMinValue=False)
        else:
            cmds.addAttr(l_oSels[2], edit=True, hasMaxValue=False)
    return True
Exemple #20
0
 def runFlakeGen(self,state):
     '''
     Executes the code to generate snowflakes and starts the progress window using the variables defined in snowflakeUI.flakeGenUI and starts the progress window
     '''
     cmds.progressWindow(title='SnowFX',
                                   progress=0,
                                   status='Starting up...')
     try:
         particles=makeSnowflakes.makeSnowflakes(cmds.intField(self.flakeNumber,v=1,q=1),
                                                                   cmds.floatField(self.flakeRadius,v=1,q=1),
                                                                   cmds.intField(self.flakeRadiusVar,v=1,q=1),
                                                                   cmds.canvas(self.colour1,rgb=1,q=1),
                                                                   cmds.canvas(self.colour2,rgb=1,q=1),
                                                                   cmds.floatField(self.transparency,v=1,q=1),
                                                                   cmds.floatField(self.glow,v=1,q=1))
         for i in range(0,len(particles)):
             cmds.move(0,0,cmds.floatField(self.flakeRadius,v=1,q=1)*2*i,particles[i])
         group = cmds.group(em=1,n='snowFX')
         for x in particles:
             cmds.parent(x,group)
         cmds.progressWindow(ep=1)
     except Exception, err:
         sys.stderr.write('ERROR: %s\n' % str(err))
         cmds.progressWindow(ep=1)
         errorPopup('Something went wrong :( \n Check the script editor for detials')
 def _showUI(self):
     if cmds.window(self.win, exists=True):
         cmds.deleteUI(self.win, window=True)
     cmds.window(self.win, title=self.win, widthHeight=(400, 220))
     cmds.columnLayout('uicl_audioMain',adjustableColumn=True)
     cmds.separator(h=15, style='none')
     cmds.separator(h=15, style='in')
     cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1, 100), (2, 90), (3, 100)])
     cmds.button(label='<< Offset',
                 ann='Nudge selected Audio Backwards',
                 command=partial(self.offsetSelectedBy,'negative'))
     cmds.floatField('AudioOffsetBy', value=10)
     cmds.button(label='Offset >>',
                 ann='Nudge selected Audio Forwards',
                 command=partial(self.offsetSelectedBy,'positive'))
     cmds.setParent('..')
     cmds.separator(h=15, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 200), (2, 90)])
     cmds.button(label='Offset Range to Start at:',
                 ann='offset the selected range of audionodes such that they start at the given frame',
                 command=self.offsetSelectedTo)
     cmds.floatField('AudioOffsetToo', value=10)
     cmds.setParent('..')
     cmds.button(label='Ripple selected',
                 ann="Ripple offset the selected audio nodes so they're timed one after another",
                 command=self.offsetRipple)
     cmds.separator(h=15, style='none')
     cmds.frameLayout(label='PRO : Broadcast Wav support', cll=True, cl=False, borderStyle='etchedOut')
     cmds.columnLayout(adjustableColumn=True, en=r9Setup.has_pro_pack())
     cmds.separator(h=5, style='none')
     cmds.text(label="NOTE: These will only run if the audio is\nin the Bwav format and has internal timecode data.")
     cmds.separator(h=10, style='none')
     cmds.button(label='Sync Bwavs to Internal Timecode',
                 ann='Sync audio nodes to their originally recorded internal timecode reference',
                 command=self.sync_bwavs)
     cmds.separator(h=10, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 100)], columnSpacing=[(2,20)])
     cmds.button(label='Set Timecode Ref',
                 ann="Set the audio node to use as the reference timecode so all other become relative to this offset",
                 command=self.__uicb_setReferenceBwavNode)
     cmds.text('bwavRefTC', label='No Reference Set')
     cmds.setParent('..')
     cmds.button(label='Sync Bwavs Relative to Selected',
                 ann="Sync audio nodes via their internal timecodes such that they're relative to that of the given reference",
                 command=self.sync_bwavsRelativeToo)
     cmds.separator(h=10, style='in')
     cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 140),(2,140)])
     cmds.button(label='Timecode HUD : ON',
                 ann="Live monitor internal Timecode - From a selected node with Timecode Attrs",
                 command=self.timecodeHud)
     cmds.button(label='Timecode HUD : Kill',
                 ann="Kill all HUD's",
                 command=r9Meta.hardKillMetaHUD)
     cmds.setParent('uicl_audioMain')
     cmds.separator(h=10, style='none')
     cmds.iconTextButton(style='iconOnly', bgc=(0.7, 0, 0), image1='Rocket9_buttonStrap2.bmp',
                          c=lambda *args: (r9Setup.red9ContactInfo()), h=22, w=200)
     cmds.showWindow(self.win)
     cmds.window(self.win, e=True, widthHeight=(290, 350))
Exemple #22
0
 def runLogCurve(self,state):
     '''
     Executes the code to make a logarithmic spiral using the variables defined in snowflakeUI.logCurveUI
     '''
     curves.logarithmic(cmds.floatField(self.loops,v=1,q=1),
                               self.spiralIn,
                               cmds.floatField(self.growth,v=1,q=1),
                               cmds.floatField(self.height,v=1,q=1))
Exemple #23
0
	def dpaf_setAttrSync(self, attrName, ctrlPrefix, *args):

		layer = cmds.optionMenu('af_layerMenu', q= 1, v= 1)
		if layer == 'No Renderable Layer' or layer.startswith('-'): layer = 'masterLayer'
		layer = 'defaultRenderLayer' if layer == 'masterLayer' else layer
		
		self.dpaf_setOverrideData(attrName, layer, cmds.floatField(ctrlPrefix + 'Ffd', q= 1, v= 1))
		cmds.floatField(ctrlPrefix + 'Ffd', e= 1, v= self.dpaf_getOverrideData(attrName, layer))
Exemple #24
0
 def runArcDoubCurve(self,state):
     '''
     Executes the code to make an Archimedes spiral that spirals out then in again using the variables defined in snowflakeUI.arcDoubCurveUI
     '''
     curves.archimedesDouble(cmds.floatField(self.loops,v=1,q=1),
                                        self.spiralIn,
                                        cmds.floatField(self.gap,v=1,q=1),
                                        cmds.floatField(self.height,v=1,q=1))
def deferStandinLoadChange(nodeName):
    status = cmds.getAttr(nodeName+'.deferStandinLoad')
    if status == False:
        cmds.floatField('standInBBoxScale', edit=True, enable=False)
        cmds.text('standInBBoxScaleLabel', edit=True, enable=False)
    else:
        cmds.floatField('standInBBoxScale', edit=True, enable=True)
        cmds.text('standInBBoxScaleLabel', edit=True, enable=True)
Exemple #26
0
def applyCallback( pxAmountField, pyAmountField, pzAmountField, pNoiseFactorField, *pArgs ):
    
    xAmount = cmds.floatField( pxAmountField, query=True, value=True )
    yAmount = cmds.floatField( pyAmountField, query=True, value=True )
    zAmount = cmds.floatField( pzAmountField, query=True, value=True )
    NoiseFactor = cmds.floatField( pNoiseFactorField, query=True, value=True )
    
    addNoise( xAmount, yAmount, zAmount, NoiseFactor )
    def resetSettings(self, *args):
        cmds.optionVar(intValue=["kT_jDT_divisions", 2])
        cmds.optionVar(intValue=["kT_jDT_reconstruct", 0])
        cmds.optionVar(floatValue=["kT_jDT_pTolerance", 0.001])

        cmds.intField("n_iF_divisions", edit=True, v=2)
        cmds.checkBox("n_cB_reconstruct", edit=True, v=0)
        cmds.floatField("n_fF_pTolerance", edit=True, v=0.001)
Exemple #28
0
 def core(self):
     
     uiData.addFrameLayout( self._uiName, self._label, 0, False, False )
     
     uiData.setSpace( 10 )
     
     buttonWidth = 40
     textWidth = self._width * 0.33
     fieldWidth = self._width - textWidth - buttonWidth
     
     cmds.rowColumnLayout( nc=5, cw=[(1,self._sideSpace),(2,textWidth),(3,fieldWidth),(4,buttonWidth),(5,self._sideSpace)] )
     uiData.setSpace()
     cmds.text( l='Target World CTL   :  ', al='right' )
     self._worldCtl = cmds.textField()
     cmds.button( l='Load', c=self.loadWorldCtl )
     uiData.setSpace()
     cmds.setParent( '..' )
     
     uiData.setSpace( 5 )
     
     halfWidth = self._width*0.5
     lastWidth = self._width - halfWidth
     
     cmds.rowColumnLayout( nc=4, cw=[(1,self._sideSpace),(2,halfWidth ),(3,lastWidth ),(4,self._sideSpace)] )
     uiData.setSpace()
     self._timeControl  = cmds.textScrollList( h=140, ams=True, sc= self.leftScrollSelectCmd  )
     
     self._attrs = cmds.rowColumnLayout( nc=1, cw=[1,lastWidth], en=0 )
     cmds.rowColumnLayout( nc=2, cw=[(1,lastWidth*0.5),(2,lastWidth*0.5)] )
     cmds.text( l='Weight : ', align='right', h=22 ); 
     self._weight = cmds.floatField( v=10.0, cc= self.changeCmd, dc=self.dragCmd, step=0.01, min=0.0, max=10.0 )
     self._weightPopup = addAttributePopup( cmds.floatField, self._weight )
     cmds.text( l='Offset : ', align='right', h=22 ); 
     self._offset = cmds.floatField( cc= self.changeCmd, dc=self.dragCmd, step=0.01 )
     self._offsetPopup = addAttributePopup( cmds.floatField, self._offset )
     cmds.text( l='Mult  : ', align='right', h=22); 
     self._mult = cmds.floatField( v=1.0, cc= self.changeCmd, dc=self.dragCmd, step=0.01 )
     self._multPopup = addAttributePopup( cmds.floatField, self._mult )
     cmds.text( l='' );  
     self._limitAble = cmds.checkBox( l='Limit Able', h=25, cc= self.changeCmd, bgc=[0.165, 0.165, 0.165] )
     self._limitAblePopup = addAttributePopup( cmds.checkBox, self._limitAble )
     cmds.setParent( '..' )
     self._limitAbleLay = cmds.rowColumnLayout( nc=2, cw=[(1,lastWidth*0.5),(2,lastWidth*0.5)], en=0 )
     cmds.text( l='Min Time  : ', align='right', h=22 ); 
     self._minTime = cmds.floatField( cc= self.changeCmd, dc=self.dragCmd, step=0.01 )
     self._minTimePopup = addAttributePopup( cmds.floatField, self._minTime )
     cmds.text( l='Max Time  : ', align='right', h=22 ); 
     self._maxTime = cmds.floatField( v=1.0, cc= self.changeCmd, dc=self.dragCmd, step=0.01 )
     self._maxTimePopup = addAttributePopup( cmds.floatField, self._maxTime )
     cmds.setParent( '..' )
     cmds.setParent( '..' )
     uiData.setSpace()
     cmds.setParent( '..' )
     
     uiData.setSpace( 5 )
     
     cmds.setParent( '..' )
     cmds.setParent( '..' )
 def CreateImagePlane(self):
     print self.ChildSelection
     print self.ParentSelection
     
     Texture = self.Path + self.ParentSelection + "/" + self.ChildSelection + ".png"
     
     if os.path.exists(Texture):
         if cmds.objExists("RWSPlane"):
             cmds.delete("RWSPlane")
         if cmds.objExists("RWSTexture"):
             cmds.delete("RWSTexture")
         if cmds.objExists("RWSTexturePlacer"):
             cmds.delete("RWSTexturePlacer")
         if cmds.objExists("RWSShader"):
             cmds.delete("RWSShader")
         if cmds.objExists("RWSShaderSG"):
             cmds.delete("RWSShaderSG")
             
         cmds.polyPlane(name = "RWSPlane",width = cmds.floatField("RWSYfield", query = True, v = True), height = cmds.floatField("RWSZfield", query = True, v = True) , subdivisionsX = 1, subdivisionsY = 1  )
         cmds.rotate(90, 0, 0, "RWSPlane" )
         
         cmds.setAttr("RWSPlaneShape.castsShadows", 0)
         cmds.setAttr("RWSPlaneShape.receiveShadows", 0)
         cmds.setAttr("RWSPlaneShape.motionBlur", 0)
         cmds.setAttr("RWSPlaneShape.primaryVisibility", 0)
         cmds.setAttr("RWSPlaneShape.smoothShading", 0)
         cmds.setAttr("RWSPlaneShape.visibleInReflections", 0)
         cmds.setAttr("RWSPlaneShape.visibleInRefractions", 0)
         cmds.setAttr("RWSPlaneShape.doubleSided", 0)
         
         if cmds.objExists("CMSettings"):
             ModelName = cmds.getAttr("CMSettings.ModelName")
         else:
             ModelName = cmds.ls(sl = True)
             
         
         bbx = cmds.xform(ModelName, bb = True, q = True)
         zMove = -(bbx[5]-bbx[2])/2
         yMove = cmds.floatField("RWSZfield", query = True, v = True)/20
         cmds.move(0, yMove, zMove ,"RWSPlane")
         material = cmds.shadingNode('lambert', asShader=1, name='RWSShader')
         SG = cmds.sets(renderable=1, noSurfaceShader=1, empty=1, name = 'RWSShaderSG')   
         cmds.connectAttr((material + '.outColor'),(SG + '.surfaceShader'),f=1)
         
         cmds.shadingNode("file", asTexture = True, name = "RWSTexture" )
         cmds.setAttr("RWSTexture.fileTextureName", Texture, type = "string")
         cmds.shadingNode("place2dTexture", asUtility = True, name = "RWSTexturePlacer")
         cmds.connectAttr( "RWSTexturePlacer.outUV", "RWSTexture.uv")
         cmds.connectAttr( "RWSTexturePlacer.outUvFilterSize", "RWSTexture.uvFilterSize")
         cmds.connectAttr(  "RWSTexture.outColor", "RWSShader.color", force = True)
          
         try:
             cmds.select("RWSPlane")
             cmds.sets(cmds.ls(selection = True), forceElement = 'RWSShaderSG', e = True)
         except:
             print "Failed to assign shader"
         
         cmds.select(None)
def rsSetValue(i_f_mmValue, i_s_mmfield):
    l_oSels = rsObjList()
    if i_s_mmfield == "minValue":
        f_minValue = cmds.floatField("rsMinField", query=True, value=True)
        cmds.addAttr(l_oSels[2], edit=True, minValue=f_minValue)
    else:
        f_maxValue = cmds.floatField("rsMaxField", query=True, value=True)
        cmds.addAttr(l_oSels[2], edit=True, maxValue=f_maxValue)
    return True
def drawTree(branchesText, angleText, angleVarianceText, lengthFactorText,
             lengthVarianceText, radiusFactorText, radiusVarianceText,
             initialRadiusText, initialLengthText):

    branchNum = mc.intField(branchesText, query=True, value=True)
    angle = mc.intField(angleText, query=True, value=True)
    angleVariance = mc.intField(angleVarianceText, query=True, value=True)
    lengthFactor = mc.intField(lengthFactorText, query=True, value=True)
    lengthVariance = mc.intField(lengthVarianceText, query=True, value=True)
    radiusFactor = mc.intField(radiusFactorText, query=True, value=True)
    radiusVariance = mc.intField(radiusVarianceText, query=True, value=True)
    initialRadius = mc.floatField(initialRadiusText, query=True, value=True)
    initialLength = mc.intField(initialLengthText, query=True, value=True)

    tree = L_Tree(branchNum, angle, angleVariance, lengthFactor,
                  lengthVariance, radiusFactor, radiusVariance)

    tree.drawBranch(0, 0, 0, 0, 0, 1, 0, initialRadius, initialLength)
    def displayOptions(self):
        self.myLayout = mc.rowColumnLayout(adjustableColumn=True)
        self.textInput1 = mc.text(
            label='Please slect color and  type light intensity')
        '''This create the checkbox options'''
        self.light = mc.text(label='Choose Light to adjust')
        self.turnOnLight1 = mc.checkBox(label="Key Light")
        self.turnOnLight2 = mc.checkBox(label="Fill Light")
        self.turnOnLight3 = mc.checkBox(label="Rim Light")
        '''This creats the floatfield that lets you input a number 
        for the intensity of the lights'''
        self.light = mc.floatField()

        self.button1 = mc.button(label='Apply intensity',
                                 command=self.ChooseIntensity)
        '''This create the colorpicker'''
        self.colors = mc.colorInputWidgetGrp()
        mc.button(label='Apply Color', command=self.ChooseColor)
Exemple #33
0
    def __init__(self):
        self.mainWindow = cmds.window(w=420, h=100)
        cmds.showWindow(self.mainWindow)
        self.column = cmds.columnLayout()

        cmds.rowLayout(nc=8, p=self.column)
        cmds.text(label="Seed")
        self.textF = cmds.textField(cc=partial(self.setSeed))
        cmds.rowLayout(nc=8, p=self.column)
        self.randomizeButton = cmds.button("Randomize",
                                           align="left",
                                           c=partial(self.randomize))

        cmds.rowLayout(nc=8, p=self.column)
        cmds.text(label="Root Chance Deviation")
        self.amountRoots = cmds.floatField("Base Blocks",
                                           minValue=0.5,
                                           maxValue=2.0,
                                           value=1.0)
        cmds.rowLayout(nc=8, p=self.column)
        cmds.text(label="First Layer Amount")
        self.amountBase = cmds.intField("Base Blocks",
                                        cc=partial(self.setMaxAmountBase),
                                        minValue=5,
                                        value=15)
        cmds.rowLayout(nc=8, p=self.column)
        cmds.text(label="Second Layer Amount")
        self.amountStructure = cmds.intField("Structures",
                                             cc=partial(
                                                 self.setMaxAmountSecondBase),
                                             minValue=5,
                                             value=15)
        cmds.rowLayout(nc=8, p=self.column)
        cmds.text(label="Maximum Distance from Center")
        self.amountDistance = cmds.intField("Distance",
                                            minValue=100,
                                            maxValue=200,
                                            value=200)
        cmds.rowLayout(nc=8, p=self.column)
        self.generateButton = cmds.button("Generate",
                                          align="left",
                                          c=partial(self.generate))

        self.randomize()
Exemple #34
0
def random_place(x_minF, x_maxF, y_minF, y_maxF, z_minF, z_maxF, amountF,
                 checkboxesF, rand_window, close):
    '''Copy and randomly place selected objects'''

    sels = cmds.ls(sl=True)
    saved_sel = []

    x_min = cmds.floatField(x_minF, q=True, v=True)
    x_max = cmds.floatField(x_maxF, q=True, v=True)
    y_min = cmds.floatField(y_minF, q=True, v=True)
    y_max = cmds.floatField(y_maxF, q=True, v=True)
    z_min = cmds.floatField(z_minF, q=True, v=True)
    z_max = cmds.floatField(z_maxF, q=True, v=True)

    amount = cmds.intSliderGrp(amountF, q=True, v=True)

    tran = cmds.checkBoxGrp(checkboxesF, q=True, v1=True)
    rot = cmds.checkBoxGrp(checkboxesF, q=True, v2=True)
    scal = cmds.checkBoxGrp(checkboxesF, q=True, v3=True)

    for sel in sels:
        for i in range(amount - 1):
            copy = cmds.duplicate(sel, rr=True)

            if tran == True:
                x = rand.uniform(x_min, x_max)
                y = rand.uniform(y_min, y_max)
                z = rand.uniform(z_min, z_max)
                cmds.move(x, y, z, copy, ws=True, a=True, rpr=True)

            if rot == True:
                x = rand.uniform(0, 360)
                y = rand.uniform(0, 360)
                z = rand.uniform(0, 360)
                cmds.rotate(x, y, z, copy)

            if scal == True:
                x = rand.uniform(.5, 2)
                y = rand.uniform(.5, 2)
                z = rand.uniform(.5, 2)
                cmds.scale(x, y, z, copy)

            saved_sel.append(copy)

        cmds.select(clear=True)
    for sel in saved_sel:
        cmds.select(sel, add=True)

    if close == True:
        if cmds.window(rand_window, q=True, exists=True):
            cmds.deleteUI(rand_window)
Exemple #35
0
def createUI(pWindowTitle, pApplyCall):

    destroyWindow()

    cmds.window(
        windowID,
        title=pWindowTitle,
        sizeable=True,
        resizeToFitChildren=True
    )

    cmds.rowColumnLayout(
        numberOfColumns=3,
        columnWidth=[(1, 55), (2, 75), (3, 60)],
        columnOffset=[(1, 'left', 3), (2, 'right', 3), (3, 'left', 3)]
    )

    # First row - focal length
    cmds.button(label='Help', command=helpCall)
    cmds.text(label='Focal Length:')
    camFocLenField = cmds.floatField(value=35.0)

    # Second row - name
    cmds.separator(h=10, style='none')
    cmds.text(label='Name:')
    camNameField = cmds.textField(text='shot')

    # Third row - separators only
    cmds.separator(h=10, style='none')
    cmds.separator(h=10, style='none')
    cmds.separator(h=10, style='none')

    # Fourth row - buttons only
    cmds.button(label='Generate', command=genCall)
    cmds.button(
        label='Apply',
        command=partial(
            pApplyCall, camFocLenField, camNameField
        )
    )
    cmds.button(label='Cancel', command=destroyWindow)

    cmds.showWindow()
Exemple #36
0
def gearRig(*args):
    '''
    (*args) -> None
    
    gets values from ui fields, writes appropriate expression, 
    assigns expression to driven gear    
    '''
    obs = cmds.ls(sl=True)  # Get the selected gears
    if (len(obs) > 1):  # Make sure at least two gears have been selected
        ratio = cmds.floatField('fltFld', q=True,
                                v=True)  # Get ratio between the two gears
        drivenAxis = cmds.optionMenu(
            'drivenAx', q=True, v=True)  # Get axis selection for driven gear
        driverAxis = cmds.optionMenu(
            'driverAx', q=True, v=True)  # Get axis selection for driver gear
        if (drivenAxis != driverAxis):
            cmds.select(obs[-1])
            origin = cmds.xform(sp=True, q=True,
                                ws=True)  # Get position of driver gear
            getIndex = {'x': 0, 'y': 1, 'z': 2}
            d1 = getIndex[driverAxis.lower()]
            d2 = getIndex[drivenAxis.lower()]
        # set up expression
        for i in range(len(obs) - 1):  # -1 to exclude driver gear
            cmds.select(obs[i])
            cmds.makeIdentity(apply=True, t=1, r=1, s=1,
                              n=0)  # Freeze transforms
            r = -ratio
            if (drivenAxis != driverAxis):
                position = cmds.xform(sp=True, q=True,
                                      ws=True)  # Get position of driven gear
                dist1 = position[d1] - origin[d1]
                dist2 = position[d2] - origin[
                    d2]  # Find position of driven relative to driver
                if (dist1 * dist2 >=
                        0):  # Check if the distances are the same polarity
                    r = ratio  # Driven gears with same polarity dimensions spin same direction as the driver gear
            gearExp = "{}.rotate{} = ({}.rotate{} * {});".format(
                obs[i], drivenAxis, obs[-1], driverAxis, r)
            cmds.expression(s=gearExp,
                            o=obs[i])  # apply expression to driven gear
    else:
        cmds.warning("Must select at least two gears")
    def GetUserInfo(self):

        minXValue = cmds.floatField(self.xMin, query=True, value=True)
        maxXValue = cmds.floatField(self.xMax, query=True, value=True)
        minYValue = cmds.floatField(self.yMin, query=True, value=True)
        maxYValue = cmds.floatField(self.yMax, query=True, value=True)
        minZValue = cmds.floatField(self.zMin, query=True, value=True)
        maxZValue = cmds.floatField(self.zMax, query=True, value=True)

        NumofDuplications = cmds.intField(self.numOfDup,
                                          query=True,
                                          value=True)
        RandomDuplication(minXValue, maxXValue, minYValue, maxYValue,
                          minZValue, maxZValue, NumofDuplications)
Exemple #38
0
    def updateCondition(self, *args):

        namePlug = self._attrName + '.weight'
        self._keepValue = cmds.getAttr(namePlug)
        cmds.floatField(self._field, e=1, v=self._keepValue)
        cmds.floatSlider(self._slider, e=1, v=self._keepValue)

        cons = cmds.listConnections(namePlug)

        if not cons:
            cmds.floatField(self._field, e=1, bgc=[0.1, 0.1, 0.1])
        else:
            if cmds.nodeType(cons[0]) == 'animCurveTU':
                cmds.floatField(self._field, e=1, bgc=[0.95, 0.45, 0.45])
Exemple #39
0
 def runPlaneEmit(self,state):
     '''
     Executes the code to emit particles from a plane using the variables defined in snowflakeUI.planeEmitUI and starts the progress window
     Will create an error popup if the variable values would stop the code from functioning correctly
     '''
     if cmds.intField(self.endFrame,v=1,q=1)<=cmds.intField(self.startFrame,v=1,q=1):
         errorPopup('End Frame must be after Start Frame')
         return
     if cmds.intField(self.lifeTime,v=1,q=1)<=0:
         errorPopup('Particles have to have a lifetime')
         return
     if cmds.intField(self.fadeOut,v=1,q=1)>cmds.intField(self.lifeTime,v=1,q=1):
         errorPopup('Lifetime must be larger than fadeout time')
         return
     try:
         vtxCount = cmds.polyEvaluate(cmds.textField(self.sourcePlane,tx=1,q=1),v=1)
         if vtxCount!=4:
             errorPopup('Select an unsubdivided plane')
             return
     except:
         errorPopup('Choose a source plane')
         return
     particleFX.reloadFile()
     cmds.progressWindow(title='SnowFX',
                                   progress=0,
                                   status='Starting up...')
     try:
         particles=self.makeAllParticles()
         particleFX.planeEmit(cmds.textField(self.sourcePlane,tx=1,q=1),
                                        cmds.intField(self.startFrame,v=1,q=1),
                                        cmds.intField(self.endFrame,v=1,q=1)-cmds.intField(self.startFrame,v=1,q=1),
                                        particles,
                                        cmds.floatField(self.maxDistance,v=1,q=1),
                                        cmds.floatField(self.minDistance,v=1,q=1),
                                        cmds.floatField(self.maxAngle,v=1,q=1),
                                        cmds.intField(self.forceTime,v=1,q=1),
                                        cmds.intField(self.lifeTime,v=1,q=1),
                                        cmds.intField(self.lifeTimeVar,v=1,q=1),
                                        cmds.intField(self.fadeOut,v=1,q=1),
                                        cmds.floatField(self.turbulenceAmp,v=1,q=1),
                                        cmds.intField(self.turbulencePer,v=1,q=1),
                                        (cmds.floatField(self.driftX,v=1,q=1),cmds.floatField(self.driftY,v=1,q=1),cmds.floatField(self.driftZ,v=1,q=1)))
         group = cmds.group(em=1,n='snowFX')
         for x in particles:
             cmds.parent(x.name,group)
         cmds.progressWindow(ep=1)
     except Exception, err:
         sys.stderr.write('ERROR: %s\n' % str(err))
         cmds.progressWindow(ep=1)
         errorPopup('Something went wrong :( \n Check the script editor for detials')
def Cas_massCopyWeight_UI():
    Cas_massCopyWeightWin = "Cas_massCopyWeightWindow"
    if cmds.window(Cas_massCopyWeightWin, ex=True):
        cmds.deleteUI(Cas_massCopyWeightWin)

    cmds.window(Cas_massCopyWeightWin,
                title="Cas_CopyWeight v4.0",
                wh=[176, 180],
                s=False)
    cmds.columnLayout()
    cmds.rowColumnLayout(numberOfColumns=2, columnWidth=[(1, 117), (2, 50)])
    cmds.text(l="Weight prune value", al="center")
    globals()["Cas_MCW_pruneValueCT"] = cmds.floatField(v=0.01, max=1, min=0)
    cmds.setParent("..")
    globals()["Cas_MCW_convertRidgidToSoftCheckCT"] = cmds.checkBox(
        v=False, l="Auto convert rigid to soft skin")
    globals()["Cas_MCW_autoDeleteJointClusterCheckCT"] = cmds.checkBox(
        v=False, l="Auto delete rigid joint clusters")
    Cas_MCW_convertRidgidToSoftCT = cmds.button(
        l="Convert rigid skin to soft skin", h=30, al="center", w=170)
    Cas_MCW_deleteRidgidJointClusterCT = cmds.button(
        l="Delete rigid skin joint clusters", h=30, al="center", w=170)
    Cas_MCW_massWeightCopyCT = cmds.button(l="Perform Copy Weight",
                                           w=170,
                                           h=40)

    #commands
    cmds.button(Cas_MCW_massWeightCopyCT,
                e=True,
                c="Cas_massCopyWeight_python.Cas_MCW_massCopyWeight_cmd()")
    cmds.button(
        Cas_MCW_convertRidgidToSoftCT,
        e=True,
        c="Cas_massCopyWeight_python.Cas_MCW_convertRidgidToSoftButton_cmd()")
    cmds.button(
        Cas_MCW_deleteRidgidJointClusterCT,
        e=True,
        c="Cas_massCopyWeight_python.Cas_MCW_deleteRidgidJointCluster_cmd()")

    #print cmds.ls(sl=True , tr= 1)
    cmds.window(Cas_massCopyWeightWin, edit=True, wh=[176, 180])
    cmds.showWindow(Cas_massCopyWeightWin)
Exemple #41
0
 def getLong(self, elem):
     """ Return the current Int value of the Input elem
     @type  elem: dictionary
     @param elem: the elem input dictionary       
     
     @rtype:   Int
     @return:  the current Int value input for this specific elem
     """
     print elem["type"]
     if elem["type"] == "inputInt":
         return cmds.intField(elem["id"], q=1, v=1)
     elif elem["type"] == "sliders":
         return int(cmds.floatSliderGrp(elem["id"], q=1, v=1))
     elif elem["type"] == "inputFloat":
         return int(cmds.floatField(elem["id"], q=1, v=1))
     else:
         #specific command for menulike
         str = cmds.text(elem["variable"], q=1, l=1)
         return elem["value"].index(
             str)  #maya combo menu is a txt + pulldown menu
Exemple #42
0
    def keysUI(self, *args):

        column = cmds.columnLayout('Keys', adj=True)

        # Tween Key

        self.frame('Tween Key')

        self.tweenFloat = cmds.floatField(minValue=0.0,
                                          maxValue=1.0,
                                          value=.5,
                                          precision=2,
                                          cc=self.tweenKeyFunction,
                                          vis=False)
        self.tweenInt = cmds.intField(minValue=0,
                                      maxValue=100,
                                      value=50,
                                      ed=False)

        self.tweenSlide = cmds.floatSlider(minValue=0.0,
                                           maxValue=1.0,
                                           value=.5,
                                           dc=self.tweenKeyFunction)

        self.formRow(items=[
            0.0, .0833, .1666, .2499, .3332, .4165, .5, .5833, .6666, .7499,
            .8332, .9165, 1.0
        ],
                     special=[0.0, .2499, .5, .7499, 1.0],
                     roundOff=100,
                     command=self.tweenKeyFunction)

        self.end()

        #column = cmds.columnLayout('Keys', adj=True)
        #widget = wrapInstance(long(OpenMayaUI.MQtUtil.findControl(column)), QtWidgets.QWidget)
        #control = tweenKey.tweenControl(True, True)
        #control.setParent(widget)
        #cmds.setParent('..')

        cmds.setParent('..')  # tabEnd
Exemple #43
0
    def create(self):
        self.delete()

        self.window_name = cmds.window(self.window_name)
        self.m_column = cmds.columnLayout(p=self.window_name, adj=True)
        cmds.button(p=self.m_column,
                    label='Create Control',
                    c=lambda *args: self.createControl())
        self.color = cmds.textField(p=self.m_column)
        cmds.button(p=self.m_column,
                    label='Change Color',
                    command=lambda *args: self.colorBtn())

        cmds.text('xMax')
        self.xMax = cmds.floatField(p=self.m_column)
        cmds.text('xMin')
        self.xMin = cmds.floatField(p=self.m_column)
        cmds.text('yMax')
        self.yMax = cmds.floatField(p=self.m_column)
        cmds.text('yMin')
        self.yMin = cmds.floatField(p=self.m_column)
        cmds.text('zMax')
        self.zMax = cmds.floatField(p=self.m_column)
        cmds.text('zMin')
        self.zMin = cmds.floatField(p=self.m_column)
        cmds.text('Number of Duplicates')
        self.num = cmds.intField(p=self.m_column)

        cmds.button(p=self.m_column,
                    label='Randomize',
                    command=lambda *args: self.randBtn())
        cmds.text('Name')
        self.a_name = cmds.textField(p=self.m_column)
        cmds.text('Padding')
        self.padding = cmds.intField(p=self.m_column)
        cmds.text('Suffix')
        self.a_suffix = cmds.textField(p=self.m_column)
        cmds.button(p=self.m_column,
                    label='Rename',
                    command=lambda *args: self.renameBtn())
        cmds.button(p=self.m_column,
                    label='Spawn Locator in center of selection',
                    command=lambda *args: self.spawnCenterLocator())
        cmds.button(p=self.m_column,
                    label='Spawn Locator in center of each',
                    command=lambda *args: self.spawnIndLocator())

        cmds.showWindow(self.window_name)
Exemple #44
0
def UI():
    name = 'modifyXgmSplineGuideUI'

    if mc.window(name, ex=1):
        mc.deleteUI(name)
    mc.window(name)
    mc.window(name, e=1, s=0, wh=[150, 245])

    mc.rowColumnLayout('top_rcl', nc=1)
    mc.rowColumnLayout(nc=2, p='top_rcl')
    mc.text(u'      混合')
    mc.floatField('hh_tf', v=0.0, precision=1)
    mc.text(u'      锥化')
    mc.floatField('zh_tf', v=0.2, precision=1)
    mc.text(u'      宽度')
    mc.floatField('kd_tf', v=0.01, precision=2)

    mc.rowColumnLayout(nc=1, p='top_rcl')
    mc.button(l=u'修改', w=145, c=lambda *args: modify_xgmSplineGuide())

    mc.separator()
    mc.separator()

    mc.rowColumnLayout(nc=3,
                       p='top_rcl',
                       columnOffset=[2, 'both', 5],
                       rowOffset=[2, 'both', 5])
    mc.button(l=u'5', c=lambda *args: rebuild_XgenCVCountNum(5), w=45)
    mc.button(l=u'6', c=lambda *args: rebuild_XgenCVCountNum(6), w=45)
    mc.button(l=u'7', c=lambda *args: rebuild_XgenCVCountNum(7), w=45)
    mc.button(l=u'8', c=lambda *args: rebuild_XgenCVCountNum(8), w=45)
    mc.button(l=u'9', c=lambda *args: rebuild_XgenCVCountNum(9), w=45)
    mc.button(l=u'10', c=lambda *args: rebuild_XgenCVCountNum(10), w=45)

    mc.rowColumnLayout(nc=1, p='top_rcl', columnOffset=[2, 'both', 5])
    mc.separator()

    mc.rowColumnLayout(nc=3, p='top_rcl', columnOffset=[2, 'both', 5])
    mc.text(u'  点数:')
    mc.intField('mytext1', v=11, w=40)
    mc.button(l=u'重建', c=lambda *args: rebuild_XgenCVCount(), w=60)

    mc.rowColumnLayout(nc=1, p='top_rcl')
    mc.separator()
    mc.separator()
    mc.button(l=u'规格化', c=lambda *args: xgmNormalizeGuides(), w=145)

    mc.showWindow()
Exemple #45
0
    def buildUI(self):
        # To start with we create a layout to hold our UI objects
        # A layout is a UI object that lays out its children, in this case in a column
        column = cmds.columnLayout(rowSpacing=10)

        # Now we create a text label to tell a user how to use our UI
        cmds.text(label="Set the tween amount using the slider or box")

        #ADDED HERE
        #rowColumn allows for spacing adjustment
        row = cmds.rowColumnLayout(numberOfColumns=2, columnSpacing=(2, 10))

        ###EDITED SLIDER TO WORK ON RANGE [0, 1]
        # We create a slider, set its minimum, maximum and default value.
        # The changeCommand needs to be given a function to call, so we give it our tween function
        # We need to hold on to our slider's name so we can edit it later, so we hold it in a variable
        # calls updateValues now to match field value
        self.slider = cmds.floatSlider(min=0,
                                       max=1,
                                       value=0.5,
                                       step=0.01,
                                       dragCommand=self.updateValues)

        # ADDED HERE
        # created a field to receive input
        self.myTextField = cmds.floatField(minValue=0,
                                           maxValue=1,
                                           value=0.5,
                                           step=0.01,
                                           changeCommand=self.updateValues)
        cmds.setParent(column)  # change active parent

        # adjust the layout
        row = cmds.rowColumnLayout(numberOfColumns=2, columnSpacing=(2, 5))
        #Reset button
        cmds.button(label="RESET", command=self.reset)

        # We add a button to close our UI
        cmds.button(label="Close", command=self.close)
        cmds.setParent(column)
   def syncVectorVariable(self, nameAttr, valueAttr, idx, layout):
      elemNameAttr = "%s[%d]" % (nameAttr, idx)
      elemValueAttr = "%s[%d]" % (valueAttr, idx)

      children = cmds.formLayout(layout, query=1, childArray=1)
      
      value = cmds.getAttr(elemValueAttr)
      value = value[0]
      
      cmds.textField(children[1], edit=1, text=cmds.getAttr(elemNameAttr))
      cmds.floatField(children[3], edit=1, value=value[0])
      cmds.floatField(children[4], edit=1, value=value[1])
      cmds.floatField(children[5], edit=1, value=value[2])

      self.setupVariableNameCallback(elemNameAttr, children[1])
      self.setupVectorVariableValueCallback(elemValueAttr, children[3], children[4], children[5])
Exemple #47
0
def gammaFunc():
	#获取设定值
	tmp = cmds.textField('channel',q=1, tx=1)
	Att = tmp.split(';')
	gammaVaule = cmds.floatField('gammaVaule',q=1,v=1)
	
	#创建类型 1材质 2 灯光 3 全部
	cType = cmds.radioButtonGrp('type',q=1,sl=1)
	#创建范围 1 全部 2 选择
	cRange = cmds.radioButtonGrp('range',q=1,sl=1)
	#获取是否创建全局控制
	glob = cmds.checkBox('globalCtrl',q=1,v=1)
	if glob ==True and not cmds.objExists('globalGammaCtrl'):
		globalGammaCtrl(gammaVaule=0.454)
	#全部
	if cRange  == 1:
		if cType ==1:
			#材质操作
			sl = cmds.ls(mat=1)
			for s in sl:
				for attr in Att:
					if mel.eval("attributeExists %s %s"%(attr,s)) and cmds.getAttr(s+'.'+attr,type=1)=='float3':
						myColor = s+'.'+attr
						channel = cmds.listConnections(myColor,p=1)
						if channel = None:
							#cmds.createNode('gammaCorrect')
							c = cmds.getAttr(myColor)
							gammaNode = cmds.shadingNode('gammaCorrect',asUtility=1)
							cmds.setAttr(gammaNode,c)
							cmds.connectAttr(gammaNode+'.outValue',myColor)
							if glob==True:
								cmds.connectAttr('globalGammaCtrl'+'.gamma',gammaNode+'.gammaX')
								cmds.connectAttr('globalGammaCtrl'+'.gamma',gammaNode+'.gammaY')
								cmds.connectAttr('globalGammaCtrl'+'.gamma',gammaNode+'.gammaZ')

		if cType ==2:
			#灯光操作
			sl = cmds.ls(type = lit)
		if cType ==3:
			sl = cmds.ls(type = lit,mat=1)
Exemple #48
0
def pfxUVLayoutDoIt(*args):
    refresh = 0
    
    # uvset is one or all
    uvSetSource = mc.optionMenu('UVSetSourceSelection', q=True, v=True)
    uvSetTarget = mc.optionMenu('UVSetTargetSelection', q=True, v=True)
    
    # get new target uv set name
    if uvSetTarget == '<NEW>':
        result = mc.promptDialog(title='New Target UV Set Name',
                message='Enter Name: ',
                text='%s_copy' % uvSetSource,
                button=['OK', 'Cancel'],
                defaultButton='OK',
                cancelButton='Cancel',
                dismissString='Cancel')

        if result == 'OK':
            uvSetTarget = mc.promptDialog(query=True, text=True)
            refresh +=1
        else:
            print '    chickened out before doing anything'
            return
    
    # layout
    layout = mc.optionMenu('UVLayout', q=True, v=True)
    
    # param1
    param1 = mc.floatField('UVLayoutParam1Val', q=True, v=True)
    
    # layout uv's
    if layout == 'grass':
        grassLayout(uvSetSource, param1, uvSetTarget)
    else:
        leafLayout(uvSetSource, float(layout[0]), param1, uvSetTarget)
        
    # new uv sets
    if refresh:
        refreshWindow()
Exemple #49
0
def createUI():
    global win
    global intensityField
    win = "multiLightWin"
    if cmds.window(win, exists=True):
        deleteWindow()

    myWindow = cmds.window(win,
                           title="multi light",
                           width=100,
                           height=150,
                           sizeable=False,
                           mxb=False,
                           mnb=False)
    cmds.columnLayout(adjustableColumn=True)
    intensityField = cmds.floatField(minValue=0)
    cmds.button(label="set", align="center", command=setIntensity)
    cmds.checkBox(label="invisible",
                  onCommand=("invisible(1)"),
                  offCommand=("invisible(0)"))
    cmds.button(label="close", align="center", command=deleteWindow)
    cmds.showWindow(myWindow)
    def CreateWindow(self):

        self.DeleteWindow()

        self.window = cmds.window(self.PlacementArea,
                                  w=350,
                                  h=350,
                                  mnb=True,
                                  mxb=False,
                                  title="Random Placement")
        self.gridLayout = cmds.gridLayout(parent=self.window,
                                          numberOfColumns=4,
                                          numberOfRows=5,
                                          cellWidthHeight=(75, 50),
                                          cr=True)

        cmds.text(parent=self.gridLayout, label="")
        cmds.text(parent=self.gridLayout, label="Amount")
        self.numOfDup = cmds.intField(parent=self.gridLayout)
        cmds.text(parent=self.gridLayout, label="")

        cmds.text(parent=self.gridLayout, label="xMin")
        self.xMin = cmds.floatField(parent=self.gridLayout)
        cmds.text(parent=self.gridLayout, label="xMax")
        self.xMax = cmds.floatField(parent=self.gridLayout)

        cmds.text(parent=self.gridLayout, label="yMin")
        self.yMin = cmds.floatField(parent=self.gridLayout)
        cmds.text(parent=self.gridLayout, label="yMax")
        self.yMax = cmds.floatField(parent=self.gridLayout)

        cmds.text(parent=self.gridLayout, label="zMin")
        self.zMin = cmds.floatField(parent=self.gridLayout)
        cmds.text(parent=self.gridLayout, label="zMax")
        self.zMax = cmds.floatField(parent=self.gridLayout)

        cmds.text(parent=self.gridLayout, label="")
        cmds.button(parent=self.gridLayout,
                    label="Execute",
                    command=lambda *x: self.GetUserInfo())
        cmds.button(parent=self.gridLayout,
                    label="Cancel",
                    command=('cmds.deleteUI(\"' + self.window +
                             '\", window=True)'))

        cmds.showWindow(self.window)
Exemple #51
0
    def randomMizeCTLs(self, numShapes, mRateUpper, cFlag, sFlag, cGroup,
                       syFlag, *args):
        print "Randomise"

        #print "Random func In: %s" % self.allCurrentGenWeights
        self.updateRig('currentGen')
        #print "Random func In2: %s" % self.allCurrentGenWeights

        numSampleShapes = cmds.intField(numShapes, query=True, value=True)
        upperLim = cmds.floatField(mRateUpper, query=True, value=True)
        constrainFlag = cmds.checkBox(cFlag, query=True, value=True)
        sampleFlag = cmds.checkBox(sFlag, query=True, value=True)
        controlGroup = cmds.optionMenu(cGroup, query=True, value=True)
        symFlag = cmds.checkBox(syFlag, query=True, value=True)

        print controlGroup

        randomCTLTree = self.randomCTLweights(self.allCurrentGenWeights,
                                              numSampleShapes, upperLim,
                                              constrainFlag, sampleFlag,
                                              controlGroup, symFlag)
        self.allCurrentWeights = randomCTLTree
        self.updateRig('current')
Exemple #52
0
def invokeBuild(arg):
    maxInfluence = cmds.intField(uiMaxInfluenceName[1], query=True, value=True)
    numJoints = cmds.intField(uiNumJointsName[1], query=True, value=True)
    numIterations = cmds.intField(uiNumIterationsName[1],
                                  query=True,
                                  value=True)
    transformStr = cmds.radioCollection(uiTransformRadioCollectionName,
                                        query=True,
                                        select=True)
    transformType = uiTransformNames.index(transformStr)
    concentrate = cmds.floatField(uiConcentrateName[1], query=True, value=True)

    cmds.undoInfo(openChunk=True)
    try:
        ssds.build(numJoints=numJoints,
                   transformType=transformType,
                   numMaxInfluences=maxInfluence,
                   numIterations=numIterations,
                   concentrate=concentrate)
    except Exception as e:
        raise e
    finally:
        cmds.undoInfo(closeChunk=True)
Exemple #53
0
    def updateObjectUserAttribute(self, unused):
        for v in self.userAttributes_type_settings:
            if v['type'] == TYPE_BOOL:
                updated_value = cmds.checkBox('userAttributeValue' + v['key'],
                                              q=True,
                                              v=True)
            elif v['type'] == TYPE_INT:
                updated_value = cmds.intField('userAttributeValue' + v['key'],
                                              q=True,
                                              v=True)
            elif v['type'] == TYPE_FLOAT:
                updated_value = cmds.floatField('userAttributeValue' +
                                                v['key'],
                                                q=True,
                                                v=True)
            else:
                updated_value = cmds.textField('userAttributeValue' + v['key'],
                                               q=True,
                                               text=True)

            v['value'] = updated_value

        self.saveObjectUserAttribute()
Exemple #54
0
def applyCall(pCamFocLenField, pCamNameField, *args):
    """Create a new camera stack at the scene origin with
    assigned custom properties."""

    camFocLen = cmds.floatField(pCamFocLenField, query=True, value=True)
    camName = cmds.textField(pCamNameField, query=True, text=True)

    print 'Focal Length: %s' % (camFocLen)
    print 'Name: %s' % (camName)

    # Create new stack at scene origin
    camMover = cmds.circle(
        name=camName + '_cam_move_all',
        normal=[0, 1, 0],
        center=[0, 0, 0],
        radius=1.5,
        sweep=360,
        sections=8
    )

    # Beauty cam - basic camera moves
    cmds.camera(
        displayGateMask=True,
        filmFit='overscan',
        focalLength=camFocLen,
        overscan=1.0
    )

    mainCam = cmds.rename(camName + '_main')
    cmds.parent(mainCam, camMover)

    # Generate child cameras and connections
    subCam(mainCam, camName)

    cmds.select(mainCam, replace=True)

    destroyWindow()
def FaceCapImport(*args):
    sceneScale = cmds.floatField("sceneScaleField", q=True, v=True)
    sceneFramesPerSecond = cmds.currentTime('1sec', edit=True)

    filePaths = cmds.fileDialog2(fileMode=1,
                                 caption="Select FaceCap Capture...")

    with open(filePaths[0], 'r') as file1:
        fileName = os.path.basename(filePaths[0])
        name, extension = os.path.splitext(fileName)

        print("Please wait...")

        captureRoot = CreateFaceCapCaptureRoot(name)
        blendshapeRoot = CreateFaceCapCaptureBlendshapeRoot(
            captureRoot[0], name)
        blendshapeNames = []

        for line in file1:
            line = line.strip()
            items = line.split(',')
            if 'bs' in items[0]:
                blendshapeNames = CreateFaceCapCaptureBlendshapeAttributes(
                    captureRoot[0], blendshapeRoot[0], items)
            elif 'k' in items[0]:
                CreateFaceCapCaptureKeyframes(items, sceneScale,
                                              captureRoot[0],
                                              blendshapeRoot[0],
                                              blendshapeNames,
                                              sceneFramesPerSecond)

    cmds.playbackOptions(maxTime=cmds.currentTime(query=True))
    cmds.playbackOptions(animationEndTime=cmds.currentTime(query=True))

    FaceCapImportAudio(filePaths[0])

    print("All Done...")
Exemple #56
0
 def getSetting( self ):
     try:
         minValue, maxValue, byFrame = self._timeRange.split( ',' )
         minValue = float( minValue )
         maxValue = float( maxValue )
         byFrame  = float( byFrame )
     except: 
         minValue, maxValue, byFrame = ( 1.0, 10.0, 1.0 )
         
     try:
         self._rangeBySlider = int( self._rangeBySlider )
     except:
         self._rangeBySlider = 0
 
     cmds.floatField( self._minField, e=1, v=minValue, en=(1-self._rangeBySlider) )
     cmds.floatField( self._maxField, e=1, v=maxValue, en=(1-self._rangeBySlider) )
     cmds.floatField( self._byFrameField, e=1, v=byFrame )
     cmds.checkBox( self._rangeBySliderAble, e=1, v=self._rangeBySlider )
Exemple #57
0
 def execute(self,*a):
  jb = cmds.radioCollection('rdc_acac1',q=1,select=1)
  fl = cmds.intField('if_acacFL',q=1,value=1)
  fs = cmds.intField('if_acacFS',q=1,value=1)
  jl = cmds.floatField('ff_acacSL',q=1,value=1)

  sel = cmds.ls(selection=1)
  lenList = []
  for x in sel :
   if cmds.nodeType(x) != 'nurbsCurve' :
    for y in cmds.listRelatives(x) :
     if cmds.nodeType(y) == 'nurbsCurve' :
      x = y
   lenList.append(cmds.arclen(x))
  ll = max(lenList) / fl
  sl = min(lenList) / fs
  for x in sel :
   cvn = cmds.getAttr(x+'.spans') + cmds.getAttr(x+'.degree')
   fcvn = int(round(cmds.arclen(x)/jl))
   if jb == 'if_acacFL' : fcvn = int(round(cmds.arclen(x)/ll))
   if jb == 'if_acacFS' : fcvn = int(round(cmds.arclen(x)/sl))
   if fcvn < 4 : fcvn = 4
   if cvn != fcvn :
    cmds.rebuildCurve(x,constructionHistory=0,replaceOriginal=1,rebuildType=0,keepRange=0,spans=fcvn-3,degree=3)
Exemple #58
0
 def getSetting( self, *args ):
 
     try: 
         minValue, maxValue, byFrame = self._timeRange.split( ',' )
         minValue = float( minValue )
         maxValue = float( maxValue )
         byFrame  = float( byFrame )
     except: 
         minValue, maxValue, byFrame = ( 1.0, 10.0, 1.0 )
         
     try:
         self._rangeBySlider = int( self._rangeBySlider )
     except:
         self._rangeBySlider = 0
 
     cmds.textField( self._worldCtl, e=1, tx= self._worldCtlName )
     cmds.textField( self._filePath, e=1, tx= self._fileBrowserStr )
     cmds.floatField( self._minField, e=1, v=minValue )
     cmds.floatField( self._maxField, e=1, v=maxValue )
     cmds.floatField( self._byFrameField, e=1, v=byFrame )
     cmds.checkBox( self._rangeBySliderAble, e=1, v=self._rangeBySlider )
Exemple #59
0
    def getPivot(method):
        ## Methods
        ## 1 = Updates UI with sampled position
        ## 2 = Return Custom UV
        ## None = return selection center

        try:
            pivot = mc.polyEvaluate(mc.ls(sl=True), bc2=True)
            pivotU = ((pivot[0][0] + pivot[0][1]) * 0.5)
            pivotV = ((pivot[1][0] + pivot[1][1]) * 0.5)
        except:
            mel.eval("warning (\"You do not have any UVs selected!\")")

        if method == 1:
            mc.floatField('scalePivotFieldU', edit=True, value=pivotU)
            mc.floatField('scalePivotFieldV', edit=True, value=pivotV)
            return
        elif method == 2:
            pivotU = mc.floatField('scalePivotFieldU', query=True, value=True)
            pivotV = mc.floatField('scalePivotFieldV', query=True, value=True)

        return (pivotU, pivotV)
Exemple #60
0
 def makeAllParticles(self):
     '''
     Generates all the required particles
     On End : Returns a list containing the names of all the particles
     '''
     shards=makeSnowflakes.makeShards(cmds.intField(self.shardNumber,v=1,q=1),
                                                       cmds.floatField(self.shardSize,v=1,q=1),
                                                       cmds.intField(self.shardSizeVar,v=1,q=1),
                                                       cmds.canvas(self.colour1,rgb=1,q=1),
                                                       cmds.canvas(self.colour2,rgb=1,q=1),
                                                       cmds.floatField(self.transparency,v=1,q=1),
                                                       cmds.floatField(self.glow,v=1,q=1))
     flakes=makeSnowflakes.makeSnowflakes(cmds.intField(self.flakeNumber,v=1,q=1)+1,
                                                            cmds.floatField(self.flakeRadius,v=1,q=1),
                                                            cmds.intField(self.flakeRadiusVar,v=1,q=1),
                                                            cmds.canvas(self.colour1,rgb=1,q=1),
                                                            cmds.canvas(self.colour2,rgb=1,q=1),
                                                            cmds.floatField(self.transparency,v=1,q=1),
                                                            cmds.floatField(self.glow,v=1,q=1))
     particles = flakes+shards
     cmds.delete(particles[0])
     particles=particles[1:]
     return particles