def buildUI(self,*args):
     sceneLights = self.getSceneLights()
     # create window
     if mc.window("lightGroupEditor",ex=True):
         mc.deleteUI("lightGroupEditor")
     mc.window("lightGroupEditor",w=270,h=100,t="lightGroupEditor",sizeable=True,titleBar=True)
     mc.columnLayout(cal = 'center')
     # create upper buttons
     mc.rowLayout(nc = 3, cw3 = (90,90,90), adjustableColumn = 3, cal = [(1,'center'),(2,'center'),(3,'center')],columnAttach=[(1, 'both', 0), (2, 'both', 0),(3,'both',0)])
     mc.button(l = 'Set All', c = self.setAllButton)
     mc.button(l = 'Clear All', c = self.clearAllButton)
     mc.button(l = 'Refresh', c = self.buildUI)
     mc.setParent('..')
     mc.separator(height = 10, width = 270 )
     mc.rowLayout(nc = 2, cw2 = (30,240), adjustableColumn = 2, cal = [(1,'center'),(2,'left')],columnAttach = [(1,'both',0),(2,'both',0)])
     mc.text(l = '#')
     mc.text(l = ' Light List')
     mc.setParent('..')
     # create center light list
     mc.columnLayout()
     self.buildList()
     mc.setParent('..')
     mc.setParent('..')
     # create lower buttons
     mc.rowLayout(nc = 4, cw4 = (30,105,35,100), adjustableColumn = 4, cal = [(1,'center'),(2,'right'),(3,'center'),(4,'center')],columnAttach=[(1, 'both', 0), (2, 'both', 0),(3,'both',0),(4,'both',0)])
     mc.text('')
     mc.text(l='New Group Number: ')
     mc.intField("editValue", value = 0)
     mc.button(l = 'Set Selected', c =self.editLightGroupsButton)
     mc.setParent('..')
     mc.separator(height = 10, width = 270 )
     mc.button(l = 'Delete Attributes', c =self.deleteAttrButton)
     mc.showWindow()
Example #2
0
 def updateFirstJoint( self ):
     
     lastJnt = cmds.listRelatives( cmds.ls( sl=1 ), c=1, ad=1, f=1 )[0]
     cmds.textField( WinA_Global.txf_endJoint, e=1, tx=cmds.ls( lastJnt )[0]  )
     cmds.intField( WinA_Global.num_original, e=1, v=1 )
     self.cmdSetEditMode()
     self.conditionControl( 'edit' )
def UI():
    if cmds.window("TressFXExporterUI", exists = True):
        cmds.deleteUI("TressFXExporterUI")

    windowTitle = 'TressFX Exporter' + ' ' + 'v' + tressfx_exporter_version
    window = cmds.window("TressFXExporterUI", title = windowTitle, w=280, h = 260, mnb=False, sizeable=False)
    mainLayout = cmds.columnLayout(w=280, h=260)

    cmds.separator(h=8, style='in')
    cmds.text(label='Number of vertices per strand (4, 8, 16, 32 or 64):', align='left')
    cmds.intField("numVerticesPerStrand", w=30, minValue=4, maxValue=64, value=16 )
    cmds.separator(h=8, style='in')
    cmds.checkBox("bothEndsImmovable", label='Both ends immovable')
    cmds.checkBox("InvertZ", label='Invert Z', value = True)
    cmds.checkBox("exportSkinCheckBox", label='Export skin data', value = False)
    cmds.checkBox("randomStrandCheckBox", label='Randomize strands for LOD', value = True)
    
    cmds.separator(h=15)
    
    cmds.button(label="Set the base mesh", w=170, h=30, command=SetBaseMesh)
    cmds.textField("MeshNameLabel", w=170, editable=False)
    
    cmds.separator(height=10, style='none')
    cmds.button(label="Export as binary (*.tfx)", w=170, h=30, command=ExportBinary)
    
    cmds.separator(h=15)
    
    version_text = 'v' + tressfx_exporter_version
    cmds.text(label=version_text, align='left')
    
    global selected_mesh_shape_name
    selected_mesh_shape_name = ''
    
    cmds.showWindow(window)
Example #4
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'])
def moveGeo():
	
	transx = cmds.intField("gTransX", q=True, value=True)
	transy = cmds.intField("gTransY", q=True, value=True)
	transz = cmds.intField("gTransZ", q=True, value=True)
	
	cmds.move( transx,transy,transz )
def rotGeo():
	
	transx = cmds.intField("gTransX", q=True, value=True)
	transy = cmds.intField("gTransY", q=True, value=True)
	transz = cmds.intField("gTransZ", q=True, value=True)
	
	cmds.rotate( transx,transy,transz )
def myLattice():
	
	valX = cmds.intField("lValX", q=True, value=True)
	valY = cmds.intField("lValY", q=True, value=True)
	valZ = cmds.intField("lValZ", q=True, value=True)
	
	cmds.lattice( dv=(valX,valY,valZ) )
Example #8
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')
Example #9
0
 def doubleCheckIntFieldWidget(self, myLabel, flag):
     self.tempLayout = mc.rowLayout(nc=4, h=self.widgetHeight, p=self.form)
     myCheckBox = mc.checkBox('%sCheckBox' % myLabel, l='', ann=flag, w=self.checkBoxLenght, cc=Callback(self.activateWidget, '%sIntFieldX' % myLabel, '%sIntFieldY' % myLabel), p=self.tempLayout)
     mc.text('%sText' % myLabel, l=' '.join(myLabel.split('_')), w=150, align='left', p=self.tempLayout)
     mc.intField('%sIntFieldX' % myLabel, p=self.tempLayout, enable=False, w=self.fieldLenght/2)
     mc.intField('%sIntFieldY' % myLabel, p=self.tempLayout, enable=False, w=self.fieldLenght/2)
     self.doubleIntCheckBoxes.append(myLabel)
def renameGui(parent):
	renCol = cmds.columnLayout()
	colWidth = winWidth/4
	cmds.rowColumnLayout(nc=4, cw=[[1,colWidth],[2,colWidth+40],[3,colWidth-40],[4,colWidth]],
		co=[[1,"both",3],[2,"both",3],[3,"both", 3],[4,"both",3]])
	cmds.text( label="Prefix", al="center" )
	cmds.text( label="Name", al="center" )
	cmds.text( label="###", al="center" )
	cmds.text( label="Suffix", al="center" )	
	
	cmds.textField( "mecRenPre" )
	cmds.textField( "mecRenName" )
	cmds.intField( "mecRenCount" )
	cmds.textField( "mecRenSuf" )
	cmds.setParent(renCol)
	
	cmds.rowColumnLayout( nc=3, cw=[[1,winWidth/3-20],[2,winWidth/3+40],[3,winWidth/3-20]],
		co=[[1,"both",3],[3,"both",3]])
	cmds.button(label="Prefix",
		c=Callback(prefix))
	cmds.button(label="Full Rename",
		c=Callback(fullRename))
	cmds.button(label="Suffix",
		c=Callback(suffix))
	cmds.setParent( parent )	
Example #11
0
 def create( *args ):
     
     controllerName = cmds.textField( Win_Global.textField, q=1, tx=1 )
     checked = cmds.checkBox( Win_Global.checkBox, q=1, v=1 )
     colorIndex1 = cmds.intField( Win_Global.intField1, q=1, v=1 )
     colorIndex2 = cmds.intField( Win_Global.intField2, q=1, v=1 )
     controllerSize = cmds.floatField( Win_Global.floatField, q=1, v=1 )
     
     topJoints = pymel.core.ls( sl=1 )
     for i in range( len( topJoints ) ):
         topJoint = topJoints[i]
         ctls, pinCtls = sgCmds.createFkControl( topJoint, controllerSize, checked )
         for j in range( len( ctls ) ):
             ctl = ctls[j]
             pinCtl = pinCtls[j]
             ctl.getShape().overrideEnabled.set( 1 )
             ctl.getShape().overrideColor.set( colorIndex1 )
             
             if pinCtl:
                 pinCtl.getShape().overrideEnabled.set( 1 )
                 pinCtl.getShape().overrideColor.set( colorIndex2 )
             
             if controllerName:
                 if len( topJoints ) == 1:
                     cuName = controllerName + '_%d' %( j )
                 else:
                     cuName = controllerName + '_%d_%d' %( i, j )
                 ctl.rename( cuName )
                 ctl.getParent().rename( 'P' + cuName )
                 if pinCtl:
                     pinCtl.rename( cuName + '_Move' )
                     pinCtl.getParent().rename( 'P' + pinCtl.name() )
    def export( *args ):
        
        import sgBFunction_fileAndPath
        import sgBFunction_dag
        
        exportPath = cmds.textField( WinA_Global.txf_export, q=1, tx=1 )
        minFrame = cmds.intField( WinA_Global.fld_startFrame, q=1, v=1 )
        maxFrame = cmds.intField( WinA_Global.fld_endFrame,  q=1, v=1 )

        exportPath = exportPath.replace( '\\', '/' )
        folderPath = '/'.join( exportPath.split( '/' )[-1:] )
        sgBFunction_fileAndPath.makeFolder( folderPath )
        
        sels = cmds.ls( sl=1 )
        cams = []
        for sel in sels:
            selShape = sgBFunction_dag.getShape( sel )
            if cmds.nodeType( selShape ) == 'camera':
                cams.append( sel )
        
        import sgBFunction_scene
        
        sgBFunction_scene.doBake( exportPath, minFrame, maxFrame )
        
        WinA_Cmd.write_windowInfo()
Example #13
0
def findSpeeds(arg):
    frameRates = {"game": 15, "film": 24, "pal": 25, "ntsc": 30, "show": 48, "palf": 50, "ntscf": 60}

    first_user_frame = cmds.intField(window_UI["first_frame"], query=True, value=True)
    last_user_frame = cmds.intField(window_UI["last_frame"], query=True, value=True)

    start_frame = cmds.playbackOptions(query=True, minTime=True)
    end_frame = cmds.playbackOptions(query=True, maxTime=True)

    if first_user_frame < start_frame or last_user_frame > end_frame:
        return

    current_frame = first_user_frame

    fps = frameRates[cmds.currentUnit(query=True, time=True)]
    timeInterval = 1.0 / fps

    selectedObjects = cmds.ls(selection=True)
    attr = "speed"
    addAttributeToObjects(selectedObjects, attr)

    prevPos = []
    for obj in selectedObjects:
        prevPos.append(cmds.getAttr(obj + ".translate")[0])

    while current_frame < last_user_frame:
        current_frame += 1
        for k in xrange(0, len(selectedObjects)):
            obj = selectedObjects[k]
            currentPos = cmds.getAttr(obj + ".translate", time=current_frame)[0]

            speed = getSpeed(prevPos[k], currentPos, timeInterval)

            cmds.setKeyframe(obj, at="speed", v=speed, t=current_frame)
            prevPos[k] = currentPos
Example #14
0
def createUI (pWindowTitle, pApplyCallback):
    
    windowID = 'MyWindowID'
    
    if cmds.window(windowID, exists=True):
        cmds.deleteUI(windowID)
        
    cmds.window(windowID, title=pWindowTitle, sizeable=False, resizeToFitChildren=True)
    cmds.rowColumnLayout(numberOfColumns=3, columnWidth=[(1,75),(2,60),(3,60)], columnOffset=[(1,'right',3)])

    cmds.text(label='Time Range:') 
    startTimeField = cmds.intField()
    endTimeField = cmds.intField()
    
    cmds.text(label='Attribute:')
    targetAttributeField = cmds.textField()
    
    cmds.separator(h=10, style='none')
    
    cmds.separator(h=10, style='none')
    cmds.separator(h=10, style='none')
    cmds.separator(h=10, style='none')
    
    cmds.separator(h=10, style='none')
    
    cmds.button(label='Apply', command=pApplyCallback)    
    
    def cancelCallback(*pArgs):
        if cmds.window(windowID, exists=True):
            cmds.deleteUI(windowID)
    
    cmds.button(label='Cancel', command=cancelCallback)    
        
    cmds.showWindow()
 def toggle_server(self, arg=None):
     if self.ServerStarted:
         self.ServerStarted = False
         self.timer.stop()
         del self.timer
         del self.receiver
         
         if cmds.window(self.winName, exists=True):
             cmds.intField(self.ui_oscport, edit=True, enable=True)
             cmds.button(self.receiveButton, edit=True, label='Start Receiving')
         
         for name in cmds.lsUI(type='shelfButton'):
             if cmds.shelfButton(name, query=True, label=True) == 'NI mate receiver':
                 cmds.setParent('MayaWindow')
                 cmds.shelfButton(name, edit=True, enableBackground=False)
     else:
         self.receiver = NImateReceiver(self.osc_port)
         self.timer = TimerObj(self.timer_exec)
         self.ServerStarted = True
         
         if cmds.window(self.winName, exists=True):
             cmds.intField(self.ui_oscport, edit=True, enable=False)
             cmds.button(self.receiveButton, edit=True, label='Stop Receiving')
         
         for name in cmds.lsUI(type='shelfButton'):
             if cmds.shelfButton(name, query=True, label=True) == 'NI mate receiver':
                 cmds.setParent('MayaWindow')
                 if self.record:
                     cmds.shelfButton(name, edit=True, enableBackground=True, backgroundColor=(1,0,0))
                 else:
                     cmds.shelfButton(name, edit=True, enableBackground=True, backgroundColor=(0,0.667,1))
Example #16
0
def fieldsGUI(curParent):
	frm = cmds.formLayout( parent=curParent)
	# Row 1 labels
	txt1 = cmds.text(label="fileName", w=200)
	txt2 = cmds.text(label="##", w=60)
	txt3 = cmds.text(label="Pad", w=40)
	
	# Row 2 Fields
	global mainName, counter, pad, copyChk
	mainName = cmds.textField( w=200 )
	counter = cmds.intField( w=60, v=1 )
	pad = cmds.intField( w=40, v=3 )
	
	# Row 3 Buttons
	btn1 = cmds.button(label="Next", w=200, c=Callback(process))
	# copyChk = cmds.checkBox( label="move", v=1, 
	
	# Positioning GUI elements
	cmds.formLayout(frm, e=1, af=[])
	cmds.formLayout(frm, e=1, ac=[])
	
	# Row1
	cmds.formLayout(frm, e=1, af=[[txt1, "left", 0],[txt1, "top", 0]])
	cmds.formLayout(frm, e=1, af=[txt2, "top", 0], ac=[txt2, "left", 0, txt1])
	cmds.formLayout(frm, e=1, af=[txt3, "top", 0], ac=[txt3, "left", 0, txt2])
	
	# Row 2
	cmds.formLayout(frm, e=1, af=[mainName, "left", 0],ac=[mainName, "top", 0, txt1])
	cmds.formLayout(frm, e=1, ac=[[counter, "left", 0, mainName],[counter, "top", 0, txt1]])
	cmds.formLayout(frm, e=1, ac=[[pad, "left", 0, counter],[pad, "top", 0, txt1]])
		
	# Row 3
	cmds.formLayout(frm, e=1, af=[btn1, "left", 0],ac=[btn1, "top", 0, mainName])
	
	return frm
Example #17
0
    def setEditMode(self, topJoint, endJoint, curveEdit=True ):

        self.dragOn = False

        endJoint = cmds.ls( endJoint, l=1 )[0]
        jntChildren = cmds.listRelatives( topJoint, c=1, ad=1, f=1 )
        jntChildren.append( topJoint )
        jntChildren.reverse()
        
        if not endJoint in jntChildren:
            cmds.frameLayout( WinA_Global.frame, e=1, en=0 )
            cmds.floatSliderGrp( WinA_Global.slider_joint, e=1, v=0 )
            return False
        
        index = jntChildren.index( endJoint )
        self.jntH = jntChildren[:index+1]
        self.numPoints = len( self.jntH )
        
        cmds.intField( WinA_Global.num_original, e=1, v=self.numPoints )
        cmds.floatSliderGrp( WinA_Global.slider_joint, e=1, v=0 )
        
        self.editCurveByPosition()
        self.setGlobalValue( self.getGlobalValue() )
        
        return True
def swarmfunc(x, y, z, n, objectList, *args): #simply for parsing arguments and passing to the swarm function!
	shape = cmds.optionMenu( objectList, query = True, value = True)
	n=cmds.intField( n, query=True, value=True )
	x=cmds.intField( x, query=True, value=True )
	y=cmds.intField( y, query=True, value=True )
	z=cmds.intField( z, query=True, value=True )
	
	#this will call the swarm function
	print ('Calling swarm function with the following params:-')
	print ('No. of particles: %s' % n)
	print ('Dimensions(x, y, z): (%s, %s, %s)' % (x, y, z))
	#print n
	s=1
	if shape=='Cube':
		s=1
	elif shape=='Sphere':
		s=2
	elif shape=='Cylinder':
		s=3
	elif shape=='Cone':
		s=4
	elif shape=='Torus':
		s=5
	print ('Shape: %s\nCorresponding value: %s \n' % (shape, s))
	cmds.swarm(np=n, dim=(x, y, z), sv=s)
Example #19
0
def buildGhostAnimation(*args):
    
    obj = 'ghost_body1'

    # get animation start and end points from ui controls
    animation_start = cmds.intField('animation_start', query=True, value=True)
    animation_end   = cmds.intField('animation_end', query=True, value=True)

    for current_time in range(animation_start, animation_end + 1):
        
        cmds.currentTime(current_time, edit=True)
        locatorPos = cmds.xform('character_locator', q=1, t=True)
        
        x = round(locatorPos[0], 2)
        z = round(locatorPos[2], 2)

        if x % 1 == 0.25 or z % 1 == 0.25:
            cmds.xform(obj, rotation = [0, 11.25, 0])
        elif x % 1 == 0.5 or z % 1 == 0.5:
            cmds.xform(obj, rotation = [0, 22.5, 0])
        elif x % 1 == 0.75 or z % 1 == 0.75:
            cmds.xform(obj, rotation = [0, 33.75, 0])
        elif x % 1 == 0 or z % 1 == 0:
            cmds.xform(obj, rotation = [0, 0, 0])
        else:
            assert False, "Unhandled character position"

        cmds.setKeyframe([obj])
    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.intField( WinA_Global.fld_startFrame, q=1, v=1 )
        endFrame   = cmds.intField( WinA_Global.fld_endFrame, q=1, v=1 )
        exportTargets = sgBFunction_selection.getDeformedMeshObjectsFromGroup( 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']
        pointSpace = [ 'world', 'local' ]
        
        if not exportTargets:
            cmds.error( 'Target is not exists' )
        else:
            sgBExcute_data.exportCacheData( exportTargets, startFrame, endFrame, path, cacheType[cacheTypeIndex], pointSpace[pointsSpaceIndex] )
Example #21
0
	def getRenderSettings(self):
		#get render settings
		frCheck = cmds.menuItem(self._rs_mm_range, q=True, cb=True)
		padCheck = cmds.menuItem(self._rs_mm_pad, q=True, cb=True)
		resCheck = cmds.menuItem(self._rs_mm_res, q=True, cb=True)
		fncCheck = cmds.menuItem(self._rs_mm_fnc, q=True, cb=True)
		ofCheck = cmds.menuItem(self._rs_mm_of, q=True, cb=True)
		rCheck = cmds.menuItem(self._rs_mm_r, q=True, cb=True)
		pdCheck = cmds.menuItem(self._rs_mm_pd, q=True, cb=True)
		rdCheck = cmds.menuItem(self._rs_mm_rd, q=True, cb=True)
		fr, pad, res, fnc, of, r, pd, rd = None, None, None, None, None, None, None, None
		renderers = ['default', 'rman', 'sw', 'mr']
		if frCheck:
			fr = [cmds.intField(self._rs_start, q=True, v=True), cmds.intField(self._rs_end, q=True, v=True)]
		if padCheck:
			pad = cmds.intField(self._rs_pad, q=True, v=True)
		if resCheck:
			res = [cmds.intField(self._rs_resW, q=True, v=True), cmds.intField(self._rs_resH, q=True, v=True)]
		if fncCheck:
			fnc = cmds.optionMenu(self._rs_fncOpt, q=True, v=True)
		if ofCheck:
			of = cmds.optionMenu(self._rs_ofOpt, q=True, v=True)
		if rCheck:
			r = renderers[cmds.optionMenu(self._rs_rOpt, q=True, sl=True)]
		if pdCheck:
			pd = cmds.textField(self._rs_pdField, q=True, tx=True)
		if rdCheck:
			rd = cmds.textField(self._rs_rdField, q=True, tx=True)
		
		return {'range':fr, 'pad':pad, 'res':res, 'fnc':fnc, 'of':of, 'r':r, 'pd':pd, 'rd':rd}
Example #22
0
def gui():
    if (cmds.window('dk_pipe_gui_001', ex=True)):
        cmds.deleteUI('dk_pipe_gui_001')
    # This clears any window preferences on our GUI
    if (cmds.windowPref('dk_pipe_gui_001', ex=True)):
        cmds.windowPref('dk_pipe_gui_001', r=True)

    cmds.window('dk_pipe_gui_001', t="Build Pipes")
    cmds.columnLayout('MAIN')
    cmds.rowColumnLayout(nc=2)

    cmds.iconTextStaticLabel(st='textOnly', l='No. Pipes')
    cmds.intField('n_pipes_int', w=150, min=1, max=20, v=8)

    cmds.iconTextStaticLabel(st='textOnly', l='Min Pipe Size')
    cmds.floatSlider('min_pipe_size_int', min=1, max=4, value=1, step=1)

    cmds.iconTextStaticLabel(st='textOnly', l='Max Pipe Size')
    cmds.floatSlider('max_pipe_size_int', min=1, max=4, value=1, step=1)

    cmds.iconTextStaticLabel(st='textOnly', l='Art Radius')
    cmds.intField('main_radius_int', value=3)

    cmds.button(w=150, l='Create Pipes', c=handle_input)

    cmds.setParent('MAIN')
    cmds.columnLayout('SECOND')
    cmds.button(w=300, l='Delete History (All)', c=handle_delete_button)

    cmds.showWindow('dk_pipe_gui_001')
Example #23
0
	def rs_getRangeBtnCommand(self, *args):
		sel = cmds.textScrollList(self._fl_list, q=True, si=True)[-1]
		if sel:
			fr = getMAFrameRange(sel)
			if fr[0]:
				cmds.intField(self._rs_start, e=True, v=fr[0])
			if fr[1]:
				cmds.intField(self._rs_end, e=True, v=fr[1])
    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)
Example #25
0
def handle_input(*args):
    n_pipes_int = cmds.intField('n_pipes_int', q=True, v=True)
    min_pipe_size_int = cmds.floatSlider('min_pipe_size_int', q=True, v=True)
    max_pipe_size_int = cmds.floatSlider('max_pipe_size_int', q=True, v=True)
    main_radius = cmds.intField('main_radius_int', q=True, v=True)

    make_art(n_pipes=n_pipes_int, min_piped=min_pipe_size_int, max_piped=max_pipe_size_int,
             main_radius=main_radius)
Example #26
0
def gui():
	
	win = "sbaRigTool"
	winWidth = 220
	# Checking to see if the window exists.
	if( cmds.window( win, ex=True ) ):
		cmds.deleteUI(win)
	if( cmds.windowPref( win, ex=True ) ):
		cmds.windowPref( win, r=True )
	
	# Creating the window.
	cmds.window(win, title="Rigging Toolset", w=winWidth, h=360 )
	mainCol = cmds.columnLayout(co=["both", 5], rs=3)
	# GUI controls go here.
	
	# Rigging toolset
	cmds.frameLayout( label="Rigging Tools",  labelAlign="center" )
	rigCol = cmds.columnLayout(co=["both", 5], rs=3)
	cmds.text( label="Constraints", w=180 )	
	cmds.rowColumnLayout( nc=2, cw=[[1,115],[2,70]], co=[[1,"right", 5],[2, "left", 5]])
	cmds.button( label="Point")
	cmds.checkBox( label="Offset" )
	cmds.button( label="Orient")
	cmds.checkBox( label="Offset" )
	cmds.button( label="Parent")
	cmds.checkBox( label="Offset" )
	cmds.setParent(rigCol)
	
	cmds.button( label="Pole Vector", w=180 )
	
	cmds.button( label="Delete History", w=180 )
	cmds.button( label="Freeze Tranforms", w=180 )
	cmds.setParent( mainCol )
	
	# Control Icons
	cmds.frameLayout( label="Control Icons Tools",  labelAlign="center" )
	iconCol = cmds.columnLayout(co=["both", 5], rs=3)

	cmds.text( label="Create Control Icons", w=185 )
	colVal = 185
	cmds.rowColumnLayout(nc=4, cw=[[1,colVal/4],[2,colVal/4],[3,colVal/4],[4,colVal/4]])
	cmds.button( label="Circle" )
	cmds.button( label="Square" )
	cmds.button( label="Cube" )
	cmds.button( label="COG" )
	
	cmds.setParent(iconCol)
	cmds.text( label="Color Control Icons", w=185 )
	cmds.rowColumnLayout(nc=3, cw=[[1,colVal/3],[2,colVal/3],[3,colVal/3]])
	cmds.button( label="Red" )
	cmds.button( label="Yellow" )
	cmds.button( label="Blue" )
	cmds.setParent(iconCol)
	cmds.rowColumnLayout(nc=2, cw=[[1,50],[2,colVal-50]], co=[[1,"right",5],[2,"left", 5]])
	cmds.intField( v=1, min=1, max=15 )
	cmds.button( label="Apply Color" )
	
	cmds.showWindow()
Example #27
0
 def changeIterationsLoopCmd(self, *args):
     '''
     
     '''        
     iMethod = cmds.optionMenuGrp(self._ISmethodGrp, query = True, select = True)
     if iMethod == 1:
         self._IScontextTool._mVoroCount = cmds.intField(self._ISiterationsLoopField, query = True, value = True)
     else:
         self._IScontextTool._mVoroLoops = cmds.intField(self._ISiterationsLoopField, query = True, value = True)
Example #28
0
def exportFrameReference(*args):

    # get animation start and end points from ui controls
    animation_start = cmds.intField('animation_start', query=True, value=True)
    animation_end   = cmds.intField('animation_end', query=True, value=True)

    # prompt user to select file
    filename = cmds.fileDialog2(fileMode=0, caption="Export Matrix", okCaption="Export").pop()
    
    # generate zero-filled matrix
    matrix = []
    for i in range(0, 36):
        matrix.append([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])

    current_frame = animation_start
    start_x = -14
    start_y = -15
    
    # assumes first frame is a keyframe, prb a bad assumption but nevermind
    
    while current_frame <= animation_end:
        
        # jump to current frame
        cmds.currentTime(current_frame, edit=True)
        
        # get locator x and y (actually z) positions
        locatorPos = cmds.xform('character_locator', q=1, t=True)
        current_tx = locatorPos[0]
        current_ty = locatorPos[2]
        
        x = 0 - int(round(start_x - current_tx))
        y = 0 - int(round(start_y - current_ty))

        # write frame no to correct position in matrix
        matrix[y][x] = int(current_frame)

        # advance current frame to next keyframe
        next_frame = cmds.findKeyframe(timeSlider=True, which='next')
        if next_frame > current_frame:
            current_frame = next_frame
        else:
            break

    # construct coffeescript matrix from internal one
    matrix_output = "["
    for line in matrix:
        matrix_output += "\n    ["
        for index, ref in enumerate(line):
            if index:
                matrix_output += ', '
            matrix_output += str(ref)#.zfill(4)
        matrix_output += "]"
    matrix_output += "\n]"

    # write to file
    with open(filename, 'w') as export_file:
        export_file.write(matrix_output)
Example #29
0
	def dpaf_setDefaultAfAttr(self, op):

		if op == 0:
			cmds.intField('af_frmPTask_F', e= 1, v= 1)
		if op == 1:
			cmds.intField('af_priority_F', e= 1, v= 99)
		if op == 2:
			cmds.textField('af_hostMask_F', e= 1, text= '')
		if op == 3:
			cmds.textField('af_hostExcl_F', e= 1, text= '')
Example #30
0
def applyCallback (pApplyCallback, pStartTimeField, pEndTimeField,pTargetAttributeField, *pArgs):
      
    startTime = cmds.intField (pStartTimeField, query=True, value=True)
    endTime = cmds.intField (pEndTimeField, query=True, value=True)
    targetAtribbute = cmds.textField (pTargetAttributeField, query=True, text=True)
    
    selectionList = cmds.ls (selection=True, type='transform')
    
    for objectName in selectionList:
        keyFullRotation (objectName, startTime, endTime, targetAttribute)
Example #31
0
    def UI_custom(self):
        cmds.rowLayout(nc=2, columnWidth=[1, 300], adj=2)
        cmds.text(label="Number of Joints :")
        numberOfJoints = len(self.jointInfo)
        self.numberOfJointsField = cmds.intField(
            value=numberOfJoints,
            min=2,
            changeCommand=self.changeNumberOfJoints)

        cmds.setParent("..")

        joints = self.getJoints()

        self.createRotationOrderUIControl(joints[0])

        cmds.separator()

        cmds.text(label="Orientation:", align="left")
        cmds.rowLayout(nc=3)
        cmds.attrEnumOptionMenu(attribute=self.moduleNamespace +
                                ":module_grp.sao_local",
                                label="local:")
        cmds.text(label=" will be oriented to ")
        cmds.attrEnumOptionMenu(attribute=self.moduleNamespace +
                                ":module_grp.sao_world",
                                label="World")

        cmds.setParent("..")

        cmds.separator()

        interpolating = False
        if cmds.objExists(self.moduleNamespace + ":interpolation_container"):
            interpolating = True

        cmds.rowLayout(nc=2, columnWidth=[1, 100], adj=2)
        cmds.text(label="Interpolate:")
        cmds.checkBox(label="",
                      value=interpolating,
                      onc=partial(self.setup_interpolation, True),
                      ofc=self.delete_interpolation)
def CurveExtruder(profileArray, shapesArray):
    polygonTypeQuery = cmds.optionMenu("OutputTypeQuery", query=True, value=0)
    rotationValue = cmds.intField("RotateAlongValue", query=True, value=True)

    if polygonTypeQuery == "NURBS":
        polygonTypeQuery = 0
    else:
        polygonTypeQuery = 1

    for curva in shapesArray:
        cmds.select(curva)
        cmds.extrude(profileArray[0],
                     curva,
                     extrudeType=2,
                     fixedPath=True,
                     useComponentPivot=1,
                     useProfileNormal=True,
                     constructionHistory=False,
                     polygon=polygonTypeQuery,
                     rotation=rotationValue)
        cmds.delete(constructionHistory=True)
Example #33
0
def makeRandomPieces(intFieldValue, planeNameField, *args):
    numToMake = cmds.intField(intFieldValue, query=True, value=True)
    planeName = cmds.textField(planeNameField, query=True, text=True)
    print planeName
    if architectureList != []:
        print "Generating " + str(numToMake) + " pieces..."
        for numToGenerate in xrange(numToMake):
            # Get random index in architecture list
            randInd = random.randint(0, len(architectureList) - 1)
            numVerts = cmds.polyEvaluate(planeName, vertex = True)
            randVert = random.randint(0, numVerts - 1)
            randVertName = planeName + ".vtx[" + str(randVert) + "]"
            vertPos = cmds.xform(randVertName, query = True, worldSpace = True, translation = True)
         
            dupPiece = cmds.duplicate(architectureList[randInd])
            cmds.xform(dupPiece[0], rotation = [0, random.randint(0, 360), 0], relative = True)
            
            currentPos = cmds.getAttr(dupPiece[0] + '.translate')[0]
            cmds.move(vertPos[0],vertPos[1]+currentPos[1],vertPos[2], dupPiece[0], absolute=True)
    else:
        cmds.error("Store pieces first.")
Example #34
0
    def RenameShot(self, *args):
        key = args[0]

        newName = str(
            mc.textField(self.animUIDict[key]['nameField'], q=True,
                         text=True).strip())

        if newName == key:
            return

        if newName in self.animDict:
            mc.textField(self.animUIDict[key]['nameField'], e=True, text=key)
            mc.confirmDialog(
                title="Name Conflict",
                message='Sorry, new name conflicts with an existing name',
                button=['Bummer'])
            return

        self.animDict[newName] = self.animDict.pop(key)
        self.animUIDict[newName] = self.animUIDict.pop(key)

        self.animListNode.subAnimList = self.animDict  #json.dumps(self.animDict)

        # Adjust UI elements to reflect new name
        mc.textField(self.animUIDict[newName]['nameField'],
                     e=True,
                     changeCommand=partial(self.RenameShot, newName))
        mc.intField(self.animUIDict[newName]['minField'],
                    e=True,
                    changeCommand=partial(self.AdjustShotRange, newName))
        mc.intField(self.animUIDict[newName]['maxField'],
                    e=True,
                    changeCommand=partial(self.AdjustShotRange, newName))
        mc.intField(self.animUIDict[newName]['lengthField'],
                    e=True,
                    changeCommand=partial(self.AdjustShotLength, newName))
        mc.button(self.animUIDict[newName]['frameBtn'],
                  e=True,
                  command=partial(self.SetShotRange, newName))
        mc.button(self.animUIDict[newName]['removeBtn'],
                  e=True,
                  command=partial(self.RemoveShot, newName))
        mc.button(self.animUIDict[newName]['minButton'],
                  e=True,
                  command=partial(self.SetShotRange, newName, max=False))
        mc.button(self.animUIDict[newName]['maxButton'],
                  e=True,
                  command=partial(self.SetShotRange, newName, min=False))
Example #35
0
    def create(self):

        form = cmds.formLayout()

        tx_label = cmds.text(l=self.label, h=22)
        fld_value = cmds.intField(v=self.defaultValue,
                                  h=22,
                                  min=self.min,
                                  max=self.max)

        cmds.setParent('..')

        cmds.formLayout(form,
                        e=1,
                        af=[(tx_label, 'left', 0), (tx_label, 'top', 0),
                            (fld_value, 'top', 0)],
                        ac=[(fld_value, 'left', 0, tx_label)])

        self.fld_value = fld_value
        self.form = form
        return form
Example #36
0
    def charNameColumn(self, w, *args):
        if cmds.columnLayout(self.firstCharColumn, q=True, exists=True):
            cmds.deleteUI(self.firstCharColumn)

        if cmds.scrollLayout('charNameColumn', q=True, exists=True):
            cmds.deleteUI('charNameColumn')

        charNameColumn = cmds.scrollLayout('charNameColumn',
                                           p=self.charColumn,
                                           w=w,
                                           h=self.h1,
                                           hst=15,
                                           vst=15)
        chars = cmds.intField(self.numChar, q=True, v=True)

        for i in range(chars):
            id = "char" + str(i + 1)
            cmds.textField(id, w=w - 10)
            i += 1

        return charNameColumn
Example #37
0
    def Randomizer(self):

        sel = cmds.ls(selection=True)
        Copies = cmds.intField(self.numDups, q=True, value=True)
        minX = cmds.intField(self.minX, q=True, value=True)
        maxX = cmds.intField(self.maxX, q=True, value=True)
        minY = cmds.intField(self.minY, q=True, value=True)
        maxY = cmds.intField(self.maxY, q=True, value=True)
        minZ = cmds.intField(self.maxZ, q=True, value=True)
        maxZ = cmds.intField(self.maxZ, q=True, value=True)

        for obj in range(len(cmds.ls(selection=True))):
            index = obj

            for obj in range(Copies):
                tempObj = (cmds.duplicate(sel[index], rr=True))
                randomX = random.uniform(minX, maxX)
                randomY = random.uniform(minY, maxY)
                randomZ = random.uniform(minZ, maxZ)
Example #38
0
	def displayOptions(self):
                mc.columnLayout("mainColumnLayout", rs=10)
                mc.text(label="Enter the name of house: ")
                self.houseName = mc.textField("houseNameField", text="", w=500)
                mc.text(label="Scale X: ")
                self.x = mc.floatField("scaleX", w=100)
                mc.text(label="Scale Y: ")
                self.y = mc.floatField("scaleY", w=100)
                mc.text(label="Scale Z: ")
                self.z = mc.floatField("scaleZ", w=100)
                mc.rowColumnLayout(rs=[1,1])
                mc.setParent("..")
                mc.columnLayout(rs=20)
                
                self.r = mc.floatSliderGrp("R",l="Red: ", cw3=[100,50,200],cal=[(1,"center"),(2,"center"),(3,"center")],f=True, pre=3, min=0.00,max=1.00,v=0.00)
                self.g = mc.floatSliderGrp("G",l="Green: ", cw3=[100,50,200],cal=[(1,"center"),(2,"center"),(3,"center")],f=True,pre=3, min=0.00,max=1.00,v=0.00)
                self.b = mc.floatSliderGrp("B",l="Blue: ", cw3=[100,50,200],cal=[(1,"center"),(2,"center"),(3,"center")],f=True, pre=3,min=0.00,max=1.00,v=0.00)
                
                mc.rowColumnLayout(rs=[10,10])
                mc.text(label="Number of Houses: ")
                self.numOfHouses = mc.intField("Num of houses", w=100)
def lockAndScaleJoyStick(thingToLock):

	print minValueToInject

	intFieldMin = cmds.intField(minCtrlValue, query=True, value=True)#get user input
	
	intFieldMax = cmds.intSliderGrp(maxCtrlValue, query=True, value=True)#get user input

	cmds.transformLimits(thingToLock, tx=[( -(intFieldMax)), intFieldMax], etx=[1, 1])

	cmds.transformLimits(thingToLock, ty=[( -(intFieldMax)), intFieldMax], ety=[1, 1])


	# parent("joyStickCtrlTmp", "JoystickBoxTmp")

	scaleToX("JoystickBoxTmp", intFieldMax)
	scaleToY("JoystickBoxTmp", intFieldMax)

	scaleToX("joyStickCtrlTmp", intFieldMax)
	scaleToY("joyStickCtrlTmp", intFieldMax)

	sel("joyStickCtrlTmp")
	selAdd("JoystickBoxTmp")

	freeze()

	parent("joyStickCtrlTmp", "JoystickBoxTmp")

	floatFieldMax = float(intFieldMax)

	scaleRatioMax = floatFieldMax / (floatFieldMax*floatFieldMax)

	scaleAll("JoystickBoxTmp", scaleRatioMax)

	#freeze()
	lockAllButTxAndTy("joyStickCtrlTmp")

	cmds.rename("joyStickCtrlTmp", "Controler")

	cmds.rename("JoystickBoxTmp", "Joystick")
Example #40
0
    def changeNumberOfJoints(self, *args):  #114
        self.blueprint_UI_instance.deleteScriptJob()

        joints = self.getJoints()
        numJoints = len(joints)
        newNumJoints = cmds.intField(self.numberOfJointsField,
                                     q=True,
                                     value=True)
        startPos = cmds.xform(self.getTranslationControl(joints[0]),
                              q=True,
                              worldSpace=True,
                              translation=True)
        endPos = cmds.xform(self.getTranslationControl(joints[numJoints - 1]),
                            q=True,
                            worldSpace=True,
                            translation=True)

        hookObject = self.findHookObjectForLock()
        rotationOrder = cmds.getAttr(joints[0] + ".rotateOrder")
        sao_local = cmds.getAttr(self.moduleNamespace +
                                 ":module_grp.sao_local")
        sao_world = cmds.getAttr(self.moduleNamespace +
                                 ":module_grp.sao_world")

        self.delete()

        newInstance = Spline(self.userSpecifiedName, hookObject, newNumJoints,
                             startPos, endPos)
        newInstance.install()
        newJoints = newInstance.getJoints()
        cmds.setAttr(newJoints[0] + ".rotateOrder", rotationOrder)
        cmds.setAttr(newInstance.moduleNamespace + ":module_grp.sao_local",
                     sao_local)
        cmds.setAttr(newInstance.moduleNamespace + ":module_grp.sao_world",
                     sao_world)

        self.blueprint_UI_instance.createScriptJob()
        cmds.select(newInstance.moduleNamespace + ":module_transform",
                    replace=True)
def doImport():
    global textureIndexField
    textureIndex = mc.intField(textureIndexField, query=True, value=True)
    flipUv = mc.checkBox(flipUvField, value=True)
    # print textureIndex

    timeStart = datetime.datetime.fromtimestamp(time.mktime(time.gmtime()))

    for i in range(0, len(filesToImport)):
        fileName = filesToImport[i]
        print fileName
        mc.progressBar(progressBarControl, edit=True, pr=i)
        importRipFile(fileName, textureIndex, flipUv)

    timeEnd = datetime.datetime.fromtimestamp(time.mktime(time.gmtime()))
    workTime = timeEnd - timeStart
    print str(len(filesToImport)) + " file(s) imported. Import time " + str(workTime.total_seconds()) + " sec"

    mc.select(clear=True)
    mc.deleteUI(winID, window=True)

    return
Example #42
0
    def propsNameColumn(self, w, *args):

        if cmds.columnLayout(self.firstPropsColumn, q=True, exists=True):
            cmds.deleteUI(self.firstPropsColumn)

        if cmds.scrollLayout('propsNameColumn', q=True, exists=True):
            cmds.deleteUI('propsNameColumn')

        propsNameColumn = cmds.scrollLayout('propsNameColumn',
                                            p=self.propsColumn,
                                            w=w,
                                            h=self.h1,
                                            hst=15,
                                            vst=15)
        props = cmds.intField(self.numProps, q=True, v=True)

        for i in range(props):
            id = 'props' + str(i + 1)
            cmds.textField(id, w=w - 10)
            i += 1

        return propsNameColumn
Example #43
0
    def envNameColumn(self, w, *args):

        if cmds.columnLayout(self.firstEnvColumn, q=True, exists=True):
            cmds.deleteUI(self.firstEnvColumn)

        if cmds.scrollLayout('envNameColumn', q=True, exists=True):
            cmds.deleteUI('envNameColumn')

        envNameColumn = cmds.scrollLayout('envNameColumn',
                                          p=self.envColumn,
                                          w=w,
                                          h=self.h1,
                                          hst=15,
                                          vst=15)
        envs = cmds.intField(self.numEnv, q=True, v=True)

        for i in range(envs):
            id = 'env' + str(i + 1)
            cmds.textField(id, w=w - 10)
            i += 1

        return envNameColumn
Example #44
0
    def randomDuplication(self, dupeamount, minx, maxx, miny, maxy, minz,
                          maxz):
        dupeamount = cmds.intField(self.dupeAmountInput, q=True, value=True)
        minx = cmds.intField(self.minXInput, q=True, value=True)
        maxx = cmds.intField(self.maxXInput, q=True, value=True)
        miny = cmds.intField(self.minYInput, q=True, value=True)
        maxy = cmds.intField(self.maxYInput, q=True, value=True)
        minz = cmds.intField(self.minZInput, q=True, value=True)
        maxz = cmds.intField(self.maxZInput, q=True, value=True)
        selection = cmds.ls(selection=True)
        objs = []

        for obj in selection:
            for dupeObj in range(0, dupeamount):
                objs = cmds.duplicate(obj)
                cmds.xform(objs,
                           ws=True,
                           t=(random.uniform(minx,
                                             maxx), random.uniform(miny, maxy),
                              random.uniform(minz, maxz)))
Example #45
0
    def __init__(self, *args):
        if (mc.window("ms_ConnectControlWin", exists=True)):
            mc.deleteUI("ms_ConnectControlWin", window=True)
        mc.window("ms_ConnectControlWin",
                  title="Connect Control v1.0",
                  rtf=True)

        #main window
        mc.columnLayout()

        self.controlField = mc.textFieldButtonGrp(label="Control",
                                                  buttonLabel="Load",
                                                  bc=self.loadControl)
        self.jointField = mc.textFieldButtonGrp(label="Joint",
                                                buttonLabel="Load",
                                                bc=self.loadJoint)
        mc.text("Number of joints to connect:")
        self.numField = mc.intField()

        mc.button(label="Connect", c=self.connect)

        mc.showWindow("ms_ConnectControlWin")
 def duplicateIt(self, duplicateNum):
     Xmin = cmds.intField(self.int_fieldXmin, query=True, value=True)
     Xmax = cmds.intField(self.int_fieldXmax, query=True, value=True)
     Ymin = cmds.intField(self.int_fieldYmin, query=True, value=True)
     Ymax = cmds.intField(self.int_fieldYmax, query=True, value=True)
     Zmin = cmds.intField(self.int_fieldZmin, query=True, value=True)
     Zmax = cmds.intField(self.int_fieldZmax, query=True, value=True)
     scaleMin = cmds.intField(self.int_fieldScaleMin,
                              query=True,
                              value=True)
     scaleMax = cmds.intField(self.int_fieldScaleMax,
                              query=True,
                              value=True)
     sels = cmds.ls(sl=True)
     for i in range(duplicateNum):
         cmds.duplicate(sels)
         transXValue = rand.randrange(Xmin, Xmax)
         transYValue = rand.randrange(Ymin, Ymax)
         transZValue = rand.randrange(Zmin, Zmax)
         scaleValue = rand.randrange(scaleMin, scaleMax)
         cmds.xform(translation=[transXValue, transYValue, transZValue],
                    scale=[scaleValue, scaleValue, scaleValue],
                    worldSpace=True)
         sels = cmds.ls(sl=True)
Example #47
0
 def editLightGroupsButton(self,*args):
     # set new group number to selected lights
     selectedLights = mc.textScrollList('mainList', q = True, si = True, fpn = True)
     newGroupId = mc.intField("editValue", q = True, value = True)
     if selectedLights != None:
         for lgt in selectedLights:
             splitVar = len(lgt.split('|'))
             if splitVar == 1:
                 newLgtName = str('|'+lgt)
                 lgtShape = mc.listRelatives(newLgtName,s=True,f=True)
                 if mc.objExists(lgtShape[0] +".mtoa_constant_lightGroup"):
                     mc.setAttr(lgtShape[0]+'.mtoa_constant_lightGroup', newGroupId)
                 else:
                     mc.addAttr(lgtShape[0],ln = "mtoa_constant_lightGroup",sn = "mtoa_constant_lightGroup",at = "long",dv = 1)
                     mc.setAttr(lgtShape[0]+'.mtoa_constant_lightGroup', newGroupId)
             else:
                 lgtShape = mc.listRelatives(lgt,s=True,f=True)
                 if mc.objExists(lgtShape[0] +".mtoa_constant_lightGroup"):
                     mc.setAttr(lgtShape[0]+'.mtoa_constant_lightGroup', newGroupId)
                 else:
                     mc.addAttr(lgtShape[0],ln = "mtoa_constant_lightGroup",sn = "mtoa_constant_lightGroup",at = "long",dv = 1)
                     mc.setAttr(lgtShape[0]+'.mtoa_constant_lightGroup', newGroupId)              
         self.buildUI()
Example #48
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)
         if str in elem["value"]:
             return elem["value"].index(
                 str)  #maya combo menu is a txt + pulldown menu
         else:
             return 0
Example #49
0
    def buildUI(self):

        mc.rowColumnLayout(nc = 3)

        #create joint list input
        mc.text(l = "Joint List")
        self.jointListTxt = mc.textField(w = 200, ed = False)
        mc.button(l = "<<<", c = "self.putInTxtField()")

        #create num twist input
        mc.text(l = "Number of Twists")
        self.numTwistInput = mc.intField(minValue = 2, maxValue = 10, value = 4, s = 1, cc = "self.getNumTwist()")    #user input for number of twist wanted
        mc.button(l = "<<<", c = "self.getNumTwist()")

        #create prefix input
        mc.text(l = "Prefix")
        self.prefixInput = mc.textField(w = 200, tx = "L_arm_", cc = "getPrefix()")
        mc.button(l = "<<<", c = "self.getPrefix()")

        #execute twist code
        mc.button(l = "Create Upper Twist", w = 200, c = "Twist().upperTwist(jointList, prefix, numTwist)", bgc = (0.5,0.0,1.0))
        mc.button(l = "Create Lower Twist", w = 200, c = "Twist().lowerTwist(jointList, prefix, numTwist)", bgc = (1.0,0.0,0.5))
        mc.button(l = "Delete Twist", w = 100, c = "self.deleteTwist()", bgc = (1.0, 0.0, 0.0))
Example #50
0
def offset_selected_animation(offset_field, *args):
    time_offset = cmds.intField(offset_field, query=True, value=True)

    # Сформировать список выделенных объектов, имеющих ноду трансформы.
    selection_list = cmds.ls(selection=True, type='transform')

    # Определить границы кадров анимации на выделенном участке временной шкалы.
    time_slider = mel.eval('$tmpVar=$gPlayBackSlider')
    time_range_selected = cmds.timeControl(time_slider,
                                           query=True,
                                           rangeArray=True)
    start, stop = time_range_selected

    cmds.cutKey(
        selection_list,
        time=(start, stop),
        option='curve',
    )
    cmds.pasteKey(
        selection_list,
        timeOffset=time_offset,
        option='replace',
    )
Example #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')
Example #52
0
def ui():
    column = cmds.columnLayout(adj=True)
    cmds.frameLayout(lv=False, bgs=True)
    tweenInt = cmds.intField(minValue=0, maxValue=100, value=50, ed=False)
    tweenSlide = cmds.floatSlider(minValue=0.0,
                                  maxValue=1.0,
                                  value=.5,
                                  dc=tween)

    formRow(items=VALUERANGE,
            special=SPECIALVALUES,
            roundOff=ROUNDOFF,
            command=tween)

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

    cmds.setParent('..')
    cmds.setParent('..')
    return column
Example #53
0
def sm_create ():

	sphVis = cmds.checkBox ('jsap_sm_sphere_cb', q = 1, v = 1)
	lra = cmds.checkBox ('jsap_sm_lra_cb', q = 1, v = 1)
	falloff = cmds.floatField ('jsap_sm_falloff_ff', q = 1, v = 1)
	smooth = cmds.intField ('jsap_sm_smooth_if', q = 1, v = 1)
	mode = cmds.optionMenu ('jsap_sm_vis_om', q = 1, sl = 1)
	scale = cmds.floatField ('jsap_sm_scale_ff', q = 1, v = 1)
	display = cmds.checkBox ('jsap_sm_forceDisplay_cb', q = 1, v = 1)
	js_stickyMod.run_sel (falloff = falloff, sphVis = sphVis, smooth = smooth, lra = lra, mode = mode, scale = scale)
	if display == 1:
		try:
			panel = cmds.getPanel (wf = 1)
			cmds.modelEditor (panel, e = 1, nurbsCurves = 1)
			if mode == 1 or lra == 1:
				cmds.modelEditor (panel, e = 1, handles = 1)
		except:
			try:
				cmds.modelEditor ('modelPanel4', e = 1, nurbsCurves = 1)
				if mode == 1 or lra == 1:
					cmds.modelEditor ('modelPanel4', e = 1, handles = 1)
			except:
				sys.stdout.write ("Sticky Mod created! However, relevant viewport display options were not enabled because a viewport was not found.")
Example #54
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()
Example #55
0
 def RemoveMin(self):
     selVtx, clusterName = self.getSel()
     if not selVtx or not clusterName:
         return
     jntList = cmds.skinCluster(cmds.ls(selVtx[0], o=1)[0], q=1, inf=1)
     jntLock = []
     for j in jntList:
         jntLock.append(cmds.getAttr(j + '.liw'))
         cmds.setAttr(j + '.liw', 0)
     Influence = cmds.intField('InfluenceInt_JellyBean', q=1, v=1)
     for v in selVtx:
         transList = cmds.skinPercent(clusterName, v, ib=.000000001, q=1, t=None)
         while len(transList) > Influence:
             valueList = cmds.skinPercent(clusterName, v, ib=.000000001, q=1, v=1)
             tvdic = {}
             for w, j in zip(valueList, transList):
                 tvdic[j] = w
             tvList = sorted(tvdic.items(), key=lambda item: item[1])
             cmds.skinPercent(clusterName, v, tv=(tvList[0][0], 0))
             transList = cmds.skinPercent(clusterName, v, ib=.000000001, q=1, t=None)
     for j, l in zip(transList, jntLock):
         cmds.setAttr(j + '.liw', l)
     self.Load()
Example #56
0
    def _start_ui(self):
        # Remove size preference to force the window calculate its size
        windowName = 'VirtuCameraMayaWindow'
        if cmds.windowPref(windowName, exists=True):
            cmds.windowPref(windowName, remove=True)

        self._window_width = self._STREAM_WIDTH + 2
        self._window_height = self._STREAM_HEIGHT + 50
        self._ui_window = cmds.window(windowName,
                                      width=self._window_width,
                                      height=self._window_height,
                                      menuBarVisible=False,
                                      titleBar=True,
                                      visible=True,
                                      sizeable=False,
                                      closeCommand=self._close_ui,
                                      title='VirtuCamera For Maya %s.%s.%s' %
                                      self._SERVER_VERSION)
        self._ui_layout = cmds.formLayout(numberOfDivisions=100)
        self._ui_tx_port = cmds.text(label='Port')
        self._ui_int_port = cmds.intField(minValue=0,
                                          maxValue=65535,
                                          value=self._DEFAULT_PORT,
                                          width=45)
        self._ui_bt_serve = cmds.button(label='Start Serving',
                                        width=100,
                                        command=self._start_serving)
        self._ui_tx_help = cmds.text(label='')
        self._ui_bt_conf = cmds.button(label='Config',
                                       width=50,
                                       command=self._open_config_window)
        self._ui_view = cmds.text(
            label='Click on Start Serving and connect through the App',
            backgroundColor=[0.2, 0.2, 0.2],
            width=self._window_width,
            height=self._STREAM_HEIGHT)
        self._update_ui_layout()
Example #57
0
def main(*args):
    baseName = cmds.textFieldButtonGrp('baseTexField', q=True, text=True)
    targetList = cmds.textScrollList('trgTexScrList', q=True, allItems=True)
    centerFalloff = cmds.intField('falloffField', q=True, v=True)

    for targetName in targetList:
        # Create left/right target by duplicating base
        leftBlendTarget = createLfRtTarget(baseName, targetName, side='left')
        rightBlendTarget = createLfRtTarget(baseName, targetName, side='right')

        baseMeshes = removeNoMesh(
            cmds.listRelatives(baseName, allDescendents=True,
                               type='transform'))
        targetMeshes = removeNoMesh(
            cmds.listRelatives(targetName,
                               allDescendents=True,
                               type='transform'))
        leftTargetMeshes = removeNoMesh(
            cmds.listRelatives(leftBlendTarget,
                               allDescendents=True,
                               type='transform'))
        rightTargetMeshes = removeNoMesh(
            cmds.listRelatives(rightBlendTarget,
                               allDescendents=True,
                               type='transform'))

        # Calculate and assign vector
        vectorReproduce(baseMeshes,
                        targetMeshes,
                        leftTargetMeshes,
                        centerFalloff,
                        side='left')
        vectorReproduce(baseMeshes,
                        targetMeshes,
                        rightTargetMeshes,
                        centerFalloff,
                        side='right')
Example #58
0
 def weiter(*_):
     """
     Hier wird man in die Animations GUI weitergefuehrt
     :param _: metadata des button Commands
     """
     setPos(*_)
     r.attachPackage(cmds.intField(x_txt, query=True, value=True),
                     cmds.intField(y_txt, query=True, value=True))
     # Setz den ersten Keyframe
     r.setKeyframe(0)
     if selectedRadioVal == "Manuell":
         AnimationUI(cmds.intField(x_txt, query=True, value=True),
                     cmds.intField(y_txt, query=True, value=True))
     else:
         AlgorithmhUi(cmds.intField(x_txt, query=True, value=True),
                      cmds.intField(y_txt, query=True, value=True))
     # Schliesst die Init GUI
     cmds.deleteUI(winID)
    def DuplicateAndScatter(self):
        numOfDuplicates = cmds.intField(self.numOfDups, q=True, value=True)
        minX = cmds.intField(self.minXField, q=True, value=True)
        maxX = cmds.intField(self.maxXField, q=True, value=True)
        minY = cmds.intField(self.minYField, q=True, value=True)
        maxY = cmds.intField(self.maxYField, q=True, value=True)
        minZ = cmds.intField(self.minZField, q=True, value=True)
        maxZ = cmds.intField(self.maxZField, q=True, value=True)

        sels = cmds.ls(selection=True)

        for item in range(len(cmds.ls(selection=True))):
            index = item

            for items in range(numOfDuplicates):
                tempObj = (cmds.duplicate(sels[index], rr=True))
                randX = random.uniform(minX, maxX)
                randY = random.uniform(minY, maxY)
                randZ = random.uniform(minZ, maxZ)

                cmds.select(tempObj)
                cmds.xform(worldSpace=True, translation=[randX, randY, randZ])
Example #60
0
    def Randomizer(self):

        sel = cmds.ls(selection=True)
        Copies = cmds.intField(self.numDups, q=True, value=True)
        minX = cmds.intField(self.minX, q=True, value=True)
        maxX = cmds.intField(self.maxX, q=True, value=True)
        minY = cmds.intField(self.minY, q=True, value=True)
        maxY = cmds.intField(self.maxY, q=True, value=True)
        minZ = cmds.intField(self.maxZ, q=True, value=True)
        maxZ = cmds.intField(self.maxZ, q=True, value=True)

        for obj in range(len(cmds.ls(selection=True))):
            index = obj

            for obj in range(Copies):
                tempObj = (cmds.duplicate(sel[index], rr=True))
                RandX = random.uniform(minX, maxX)
                RandY = random.uniform(minY, maxY)
                RandZ = random.uniform(minZ, maxZ)

                cmds.select(tempObj)
                cmds.xform(worldSpace=True, translation=[RandX, RandY, RandZ])