def referenceButton(self, mayaFalse):
        if not pm.textField(self.sceneName, q=True, text=True):
            pm.confirmDialog(title=u'SER シーン管理', message=u'シーンを選択してください。')

        else:
            if pm.textField(self.refNamespace, q=True,
                            text=True):  #if namespace is present
                pm.createReference(pm.radioButton(
                    pm.radioCollection(self.radColle, sl=True, q=True),
                    q=True,
                    annotation=True) + '/' + pm.radioButton(pm.radioCollection(
                        self.radColle, sl=True, q=True),
                                                            q=True,
                                                            label=True),
                                   namespace=pm.textField(self.refNamespace,
                                                          q=True,
                                                          text=True))
            else:
                pm.createReference(pm.radioButton(
                    pm.radioCollection(self.radColle, sl=True, q=True),
                    q=True,
                    annotation=True) + '/' + pm.radioButton(pm.radioCollection(
                        self.radColle, sl=True, q=True),
                                                            q=True,
                                                            label=True),
                                   namespace=':')
예제 #2
0
	def UI(self):
		
		# create window
		if pm.window( 'ehm_ReverseShape_UI', exists=True ):
			pm.deleteUI( 'ehm_ReverseShape_UI' )
		pm.window( 'ehm_ReverseShape_UI', title='Reverse shape', w=300, h=80, mxb=False, mnb=True, sizeable=True )

		
		# main layout
		#mainLayout = pm.rowColumnLayout()
		formLayout = pm.formLayout(w=300, h=80)
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)
		pm.setParent( formLayout )
		
		# radio buttons
		self.AxisText = pm.text(label='Axis: ', align='right')
		self.AxisRC = pm.radioCollection()
		self.xRB = pm.radioButton(label="x", select=True )
		self.yRB = pm.radioButton(label="y")
		self.zRB = pm.radioButton(label="z")

		
		# buttons
		self.applyButton = pm.button( label='Apply',  h=30,  c= partial( self.reverseShape, None, 'x'  ) )
		
		
		# place frame layout
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'left', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'right', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'top', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'bottom', 38) )


		# place radio buttons
		#pm.formLayout( formLayout, edit=True, attachPosition=(self.AxisText,'left', 5, 0) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.AxisText,'right', 0 , 25) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.AxisText,'top', 17) )
		
		#pm.formLayout( formLayout, edit=True, attachPosition=(self.xRB,'left', 5, 25) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.xRB,'right', 10 , 50) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.xRB,'top', 15) )		

		#pm.formLayout( formLayout, edit=True, attachPosition=(self.yRB,'left', 5, 50) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.yRB,'right', 10, 75) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.yRB,'top', 15) )	

		#pm.formLayout( formLayout, edit=True, attachPosition=(self.zRB,'left', 5, 75) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.zRB,'right', 20 , 100) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.zRB,'top', 15) )	

		# place buttons
		pm.formLayout( formLayout, edit=True, attachPosition=(self.applyButton,'left', 4, 25) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.applyButton,'right', 2 , 75) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.applyButton,'bottom', 5) )
				
				
		# show window
		pm.showWindow( 'ehm_ReverseShape_UI' )
예제 #3
0
	def UI(self):
		
		# create window
		if pm.window( 'ehm_BakeAnimation_UI', exists=True ):
			pm.deleteUI( 'ehm_BakeAnimation_UI' )
		pm.window( 'ehm_BakeAnimation_UI', title='Bake Animation', w=400, h=80, mxb=False, mnb=True, sizeable=True )
		
		# main layout
		#mainLayout = pm.rowColumnLayout()
		formLayout = pm.formLayout(w=400, h=80)
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)
		pm.setParent( formLayout )
		
		# radio buttons
		self.bakeModeText = pm.text(label='Bake Mode: ', align='right')
		self.bakeModeRC = pm.radioCollection()
		self.newLocRB = pm.radioButton(label="Bake On New Locator", select=True )
		self.objItselfRB = pm.radioButton(label="Bake On Object Itself")
		
		
		# buttons
		self.BakeTransformbutton = pm.button( label='Bake Transform', h=30, backgroundColor=[0.5,0.7,0.4],  c=self.BakeTransform  )
		self.BakeGeometryButton = pm.button( label='Bake Geometry', h=30, backgroundColor=[0.7,0.5,0.3],  c= self.BakeGeometry )
		
		
		# place frame layout
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'left', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'right', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'top', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'bottom', 38) )


		# place radio buttons
		#pm.formLayout( formLayout, edit=True, attachPosition=(self.bakeModeText,'left', 5, 0) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.bakeModeText,'right', 0 , 20) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.bakeModeText,'top', 17) )
		
		#pm.formLayout( formLayout, edit=True, attachPosition=(self.newLocRB,'left', 5, 25) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.newLocRB,'right', 10 , 60) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.newLocRB,'top', 15) )		

		#pm.formLayout( formLayout, edit=True, attachPosition=(self.objItselfRB,'left', 5, 50) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.objItselfRB,'right', 10, 97) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.objItselfRB,'top', 15) )	


		# place buttons
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BakeTransformbutton,'left', 1, 2) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BakeTransformbutton,'right', 2 , 50) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.BakeTransformbutton,'bottom', 5) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.BakeGeometryButton,'left', 2, 50) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BakeGeometryButton,'right', 1 , 98) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.BakeGeometryButton,'bottom', 5) )		
		
		
		# show window
		pm.showWindow( 'ehm_BakeAnimation_UI' )
예제 #4
0
def aimConstraintParentTowardsChild(parent, children, isLastChild):

    # Set AIM axis
    aimAxisLabel = pm.radioButton(pm.radioCollection(aimAxisCollection, query = True, select = True),query = True, label = True)
    aimAxisIsNegative = pm.checkBox(aimAxisIsNegativeBox, query = True, value = True)
    aimAxisValue = 0
    if aimAxisIsNegative or isLastChild:
        aimAxisValue = -1.0
    else:
        aimAxisValue = 1.0

    aimAxisVector = []
    if aimAxisLabel == 'X':
        aimAxisVector = [aimAxisValue, 0.0, 0.0]
    elif aimAxisLabel == 'Y':
        aimAxisVector = [0.0,aimAxisValue, 0.0]
    elif aimAxisLabel == 'Z':
        aimAxisVector = [0.0, 0.0, aimAxisValue]

    # Set UP axis
    upAxisLabel = pm.radioButton(pm.radioCollection(upAxisCollection, query = True, select = True),query = True, label = True)
    upAxisIsNegative = pm.checkBox(upAxisIsNegativeBox, query = True, value = True)
    upAxisValue = 0
    if upAxisIsNegative:
        upAxisValue = -1.0
    else:
        upAxisValue = 1.0

    upAxisVector = []
    if upAxisLabel == 'X':
        upAxisVector = [upAxisValue, 0.0, 0.0]
    elif upAxisLabel == 'Y':
        upAxisVector = [0.0,upAxisValue, 0.0]
    elif upAxisLabel == 'Z':
        upAxisVector = [0.0, 0.0, upAxisValue]

    # Set WORLD UP axis
    worldUpAxisVector = worldUpAxisField.getValue()

    if isLastChild:
        parent.jointOrient.set([0,0,0])
        aimCon = pm.aimConstraint(children[0], parent, aim = aimAxisVector, u = upAxisVector, wu = worldUpAxisVector)
        pm.aimConstraint(children, parent, edit = True, rm = True)
        parent.jointOrient.set(parent.jointOrient.get()+parent.rotate.get())
        parent.rotate.set(0.0,0.0,0.0)
    else:
        pm.parent(children, world = True)
        parent.jointOrient.set([0,0,0])
        orientChildrenLabel = pm.radioButton(pm.radioCollection(orientChildrenTowardsCollection, query = True, select = True), query = True, label = True)
        if orientChildrenLabel == "Orient Parent towards average of child positions":
            aimCon = pm.aimConstraint(children, parent, aim = aimAxisVector, u = upAxisVector, wu = worldUpAxisVector)
        elif orientChildrenLabel == "Orient Parent towards first child position":
            aimCon = pm.aimConstraint(children[0], parent, aim = aimAxisVector, u = upAxisVector, wu = worldUpAxisVector)
        pm.aimConstraint(children, parent, edit = True, rm = True)
        parent.jointOrient.set(parent.jointOrient.get()+parent.rotate.get())
        parent.rotate.set(0.0,0.0,0.0)
        pm.parent(children, parent)
 def openFile(self, mayaFalse):
     #print(pm.radioButton(pm.radioCollection(self.radColle, sl = True, q = True), q= True, annotation = True) + '/' + pm.radioButton(pm.radioCollection(self.radColle, sl = True, q = True), q= True, label = True))
     pm.openFile(
         pm.radioButton(pm.radioCollection(self.radColle, sl=True, q=True),
                        q=True,
                        annotation=True) + '/' +
         pm.radioButton(pm.radioCollection(self.radColle, sl=True, q=True),
                        q=True,
                        label=True),
         force=True)
예제 #6
0
파일: Disperser.py 프로젝트: sundae24/Maya
    def create(self):
        if pm.window(self.window, exists=True):
            pm.deleteUI(self.window)
        pm.window(self.window, t=self.title)

        # source & targets
        pm.rowColumnLayout(nc=3,cal=[(1,'right')], cw=[(1,80),(2,200),(3,100)])
        pm.text(l='Source: ')
        self.sourceObjTf = pm.textField()
        pm.button(l='Select', c=self.selectSource)
        pm.text(l='Target(s): ')
        self.targetObjsTf = pm.textField()
        pm.button(l='Select', c=self.selectTarget)
        pm.setParent('..')

        # number
        pm.rowColumnLayout(w=self.size[0])
        self.copyNum = pm.intSliderGrp(l='Copies: ', v=10, cw3=[80,80,220],
                                       min=1, max=500, fmx=5000, f=True)
        pm.separator(h=10, st='in')

        # rotation
        pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)])
        pm.text(l='Rotation: ')
        self.rotationModeRC = pm.radioCollection()
        self.rotBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.rotBtnAlign = pm.radioButton(l='Align with Target')
        pm.text(l='')
        self.rotBtnRand = pm.radioButton(l='Random',
                                         onc=lambda *args: self.rotationRange.setEnable(True),
                                         ofc=lambda *args: self.rotationRange.setEnable(False))
        pm.setParent('..')
        self.rotationRange = pm.floatFieldGrp(l='Range: ', nf=3, v1=30, v2=30, v3=30,
                                              cw4=[80,100,100,100], en=False)
        pm.separator(h=10, st='in')

        # scale
        pm.rowColumnLayout(nc=2, cal=[(1,'right')], cw=[(1,80), (2,300)])
        pm.text(l='Scale: ')
        self.scaleModeRC = pm.radioCollection()
        self.scaleBtnFixed = pm.radioButton(l='Fixed', sl=True)
        pm.text(l='')
        self.scaleBtnRand = pm.radioButton(l='Random',
                                           onc=lambda *args: self.scaleRange.setEnable(True),
                                           ofc=lambda *args: self.scaleRange.setEnable(False))
        pm.setParent( '..' )
        self.scaleRange = pm.floatFieldGrp(l='Min Max: ', nf=2, v1=1, v2=1,
                                           cw3=[80,100,100], en=False)
        pm.separator(h=10, st='in')

        # disperse button
        pm.button(l='Disperse', c=self.disperse, w=380, al='center')

        pm.showWindow(self.window)
    def mainBody(self, path, mayaFalse):
        try:
            if pm.rowLayout(self.masterRow, exists=True, query=True):
                print 'yes'
                pm.deleteUI(self.masterRow, layout=True)
        except:
            print 'doesnt exist yet'

        print(os.listdir(path))
        self.fileList = [
            i for i in os.listdir(path)
            if os.path.isfile(os.path.join(path, i))
        ]
        self.masterRow = pm.rowLayout(width=600, nc=5, parent=self.masterCol)
        spacerCol = pm.columnLayout(width=25, parent=self.masterRow)
        col = pm.columnLayout(width=600, parent=self.masterRow)
        mainBox = pm.scrollLayout(horizontalScrollBarThickness=16,
                                  verticalScrollBarThickness=16,
                                  parent=col,
                                  width=500,
                                  height=600)
        self.radColle = pm.radioCollection()
        self.path = path
        #creating entry for each file
        for i in self.fileList:
            if '.ma' in i[-3:]:
                row1 = pm.rowLayout(i, nc=5, width=450, parent=mainBox)
                pm.image(image=str(path + '/' + i).rstrip('.ma') + '.png',
                         height=100,
                         width=100)
                column1 = pm.columnLayout(parent=row1)

                #writing a partial for command
                radioButtonChange = partial(self.fillSceneName, i)
                pm.radioButton(i,
                               label=i,
                               parent=column1,
                               onCommand=radioButtonChange,
                               annotation=path)

                radioSpacer = pm.rowLayout(nc=2)
                pm.text(label='',
                        width=16,
                        align='left',
                        parent=radioSpacer,
                        enable=False)
                pm.text('SER export',
                        label=u'comment コメント',
                        width=150,
                        height=20,
                        align='left',
                        parent=radioSpacer,
                        enable=False)
def rotProUI():
    """
        install:
        Place rotProUI.py in your C:\Users\(your user)\Documents\maya\scripts folder


        Usage:
        1. In script editor run (can be added to shelf):
            import rotProUI
            rotProUI()
        2. Select Object or faces
        3. Select projection type from dropdown
        4. Select rotation type
        5. Click project
            
        
    """
    projectionList = ['Cylindrical', 'Spherical']
    rotationDict = {
        '90 X': ('x', 90),
        '45 X': ('x', 45),
        '-90 X': ('x', -90),
        '-45 X': ('x', -45),
        '90 Y': ('y', 90),
        '45 Y': ('y', 45),
        '-90 Y': ('y', -90),
        '-45 y': ('y', -45),
        '90 Z': ('z', 90),
        '45 Z': ('z', 45),
        '-90 Z': ('z', -90),
        '-45 Z': ('z', -45)
    }
    rotProWin = pm.window(title='Rotate Projection Tool')
    rotProWinlayout = pm.columnLayout()
    rotProWintitle = pm.text(
        label='Please select the type of Projection \n and the RotationType.')
    rotProMenu = pm.optionMenu('rotProMenu2')
    menusorted = rotationDict.keys()
    print menusorted
    menusorted.sort()
    for option in projectionList:
        pm.menuItem(label=option)
    radio = pm.rowColumnLayout(nc=3)
    rotTypeMenuRadio = pm.radioCollection()
    for option in menusorted:
        pm.radioButton(label=option)
    SubmitButton = pm.button(label='Project',
                             c=Callback(RotPro, rotProMenu, rotTypeMenuRadio,
                                        rotationDict))
    close = pm.button(label='Close',
                      command=('pm.deleteUI(\"' + rotProWin +
                               '\", window=True)'))
    pm.showWindow(rotProWin)
예제 #9
0
    def createMethodInstance(self, i ):

        #setUITemplate('attributeEditorTemplate', pushTemplate=1)

        rowSpacing = [30, 20, 400]

        defs = []
        #try:
        argUtil = factories.ApiArgUtil( self.apiClassName, self.apiMethodName, i )
        proto = argUtil.getPrototype( className=False, outputs=True, defaults=False )

        enable = argUtil.canBeWrapped()

        if argUtil.isDeprecated():
            pm.text(l='DEPRECATED')
        # main info row
        row = pm.rowLayout( '%s_rowMain%s' % (self.methodName,i), nc=3, cw3=rowSpacing, enable=enable )
        self.rows.append(row)
        pm.text(label='')

        if self.overloadPrecedenceColl is not None:
            # toggle for overloaded methods
            pm.radioButton(label='', collection=self.overloadPrecedenceColl,
                                enable = enable,
                                onCommand=pm.Callback( MethodRow.overloadPrecedenceCB, self, i ))
        pm.text(   l='', #l=proto,
                annotation = self.methodInfoList[i]['doc'],
                enable = enable)

        pm.setParent('..')

        try:
            argList = factories.apiClassOverrides[self.apiClassName]['methods'][self.apiMethodName][i]['args']
        except (KeyError, IndexError):
            argList = self.methodInfoList[i]['args']

        returnType =  self.methodInfoList[i]['returnType']
        types = self.methodInfoList[i]['types']
        args = []

        for arg , type, direction in argList:
            type = str(types[arg])
            assert arg != 'return'
            self._makeArgRow( i, type, arg, direction, self.methodInfoList[i]['argInfo'][arg]['doc'] )

        if returnType:
            self._makeArgRow( i, returnType, 'return', 'return', self.methodInfoList[i]['returnInfo']['doc'] )

        pm.separator(w=800, h=14)

        return enable
예제 #10
0
    def createMethodInstance(self, i ):

        #setUITemplate('attributeEditorTemplate', pushTemplate=1)

        rowSpacing = [30, 20, 400]

        defs = []
        #try:
        argUtil = factories.ApiArgUtil( self.apiClassName, self.apiMethodName, i )
        proto = argUtil.getPrototype( className=False, outputs=True, defaults=False )

        enable = argUtil.canBeWrapped()

        if argUtil.isDeprecated():
            pm.text(l='DEPRECATED')
        # main info row
        row = pm.rowLayout( '%s_rowMain%s' % (self.methodName,i), nc=3, cw3=rowSpacing, enable=enable )
        self.rows.append(row)
        pm.text(label='')

        if self.overloadPrecedenceColl is not None:
            # toggle for overloaded methods
            pm.radioButton(label='', collection=self.overloadPrecedenceColl,
                                enable = enable,
                                onCommand=pm.Callback( MethodRow.overloadPrecedenceCB, self, i ))
        pm.text(   l='', #l=proto,
                annotation = self.methodInfoList[i]['doc'],
                enable = enable)

        pm.setParent('..')

        try:
            argList = factories.apiClassOverrides[self.apiClassName]['methods'][self.apiMethodName][i]['args']
        except (KeyError, IndexError):
            argList = self.methodInfoList[i]['args']

        returnType =  self.methodInfoList[i]['returnType']
        types = self.methodInfoList[i]['types']
        args = []

        for arg , type, direction in argList:
            type = str(types[arg])
            assert arg != 'return'
            self._makeArgRow( i, type, arg, direction, self.methodInfoList[i]['argInfo'][arg]['doc'] )

        if returnType:
            self._makeArgRow( i, returnType, 'return', 'return', self.methodInfoList[i]['returnInfo']['doc'] )

        pm.separator(w=800, h=14)

        return enable
예제 #11
0
    def saveFile(self, mayaFalse):
        if pm.confirmDialog(title=u'SER シーン管理',
                            message=u'上書きしますか?',
                            button=[u'はい', u'いいえ'],
                            defaultButton=u'はい',
                            cancelButton=u'いいえ',
                            dismissString=u'いいえ'):
            if pm.textField(self.sceneName, q=True, text=True) in pm.sceneName(
            ):  #check if the text field option is the same as the current scene file
                print 'overwrite and save'
                pm.saveFile()  #saving before exporting
                self.saveImageCreate(False)
                self.mainBody(self.path, False)
                pm.confirmDialog(message=u'保存しました!',
                                 title=u'Prism Scene Manager')

            else:
                print 'save new file'
                pm.saveAs(pm.radioButton(pm.radioCollection(
                    self.radColle, sl=True, q=True),
                                         q=True,
                                         annotation=True) + '/' +
                          pm.textField(self.sceneName, q=True, text=True),
                          type='mayaAscii')  #saving before exporting
                pm.saveFile()  #save?
                self.saveImageCreate(False)
                self.mainBody(self.path, False)  #call mainBody once more
                pm.confirmDialog(message=u'保存しました!',
                                 title=u'Prism Scene Manager')
예제 #12
0
	def spine_init ( self, size=5.0, limbName='spine', mode='biped', numOfJnts=4 , *args ):
		
		self.spine_initJnts=[]
		self.tmpCrv = None
		
		try:# if in UI mode, get number of joints from UI
			size = pm.floatSliderGrp( self.spineSizeF, q=True, value=True)
			limbName = pm.textField( self.limbNameTF, q=True, text=True)
			selectedMode = pm.radioCollection( self.characterModeRC, q=True, select=True)
			mode = pm.radioButton( selectedMode, q=True, label=True ).lower()
			numOfJnts = pm.intSliderGrp( self.numOfInitJntsIS, q=True, value=True)
		except:
			pass

		curveCVs=[]
		curveCVsCount=[]
		for i in range(numOfJnts):
			pm.select (clear=True)

			if mode=='biped':
				jntPos = ( 0, size+(size*1.0/(numOfJnts-1)*i), 0 )
			elif mode=='quadruped':
				jntPos = ( 0, size, (size*1.0/(numOfJnts-1)*i)-size/2.0 )
			else:
				pm.error('ehm_tools...Spine: mode arg accepts "biped" or "quadruped" only!')

			self.spine_initJnts.append(  pm.joint ( p = jntPos , name = "%s_%s_initJnt"%(limbName,i+1) )  )
			curveCVs.append( jntPos )
			curveCVsCount.append( i )

		self.tmpCrv = pm.curve( d=1, p=curveCVs , k=curveCVsCount )
		self.tmpCrv.getShape().template.set(True)
		pm.skinCluster( self.spine_initJnts,self.tmpCrv)	
예제 #13
0
    def mirrorBlsWeightsMapAB(self):
        if pm.radioButton(self.leftInput, q=1, sl=1):
            mirror_src = 'RIGHT'
        else:
            mirror_src = 'LEFT'

        mc.mirrorBlsWeights(ce=self.edge, s=mirror_src)
예제 #14
0
    def reverseShape(self, objs=None, axis='x', *args):

        try:
            selectedItem = pm.radioCollection(self.AxisRC, q=True, select=True)
            axis = (pm.radioButton(selectedItem, q=True, label=True)).lower()
        except:
            pass

        scaleValue = (-1, 1, 1)
        if axis == 'y':
            scaleValue = (1, -1, 1)
        elif axis == 'z':
            scaleValue = (1, 1, -1)
        elif axis != 'x':
            pm.warning('Axis was not correct, used "x" axis instead.')

        if objs == None:
            objs = pm.ls(sl=True)
        else:
            objs = pm.ls(objs)

        for obj in objs:
            try:
                shape = obj.getShape()
                if shape.type() == 'mesh':
                    pm.select(shape.vtx[:])
                    pm.scale(scaleValue)
                    pm.select(objs)
                elif shape.type() == 'nurbsCurve':
                    pm.select(shape.cv[:])
                    pm.scale(scaleValue)
                    pm.select(objs)
            except:
                pm.warning("Object doesn't have a shape. Skipped!")
            '''
예제 #15
0
 def __init__( self, name, names, parent ):
     self.name=name
     print parent
     self.radioCol = pm.radioCollection( self.name, nci=len(names), parent=parent)
     self.radioButtons=[]
     for name in names:
         self.radioButtons.append( pm.radioButton(label=name))
     self.radioCol.setSelect(self.radioButtons[0])
예제 #16
0
def ui_export_selection(exec_button):
    """create ui window for export to abc and guerilla
    """
    if pmc.window('exportabc', exists=True):
        pmc.deleteUI('exportabc')
    pmc.window('exportabc', menuBar=True, width=200, height=50)
    pmc.columnLayout()
    pmc.radioCollection('framemode')
    pmc.radioButton('currentframe', label='Current frame')
    pmc.radioButton('timeslider', label='Time Slider')
    pmc.radioButton('startend', label='Start / End')
    pmc.separator()
    pmc.text(label='Start frame')
    pmc.intField('start')
    pmc.text(label='End frame')
    pmc.intField('end')
    pmc.separator()
    pmc.checkBox('preroll', label='Pre roll')
    pmc.intField('prerollstart')
    pmc.text(label='Step')
    pmc.floatField('step', value=1.0)
    pmc.separator()
    pmc.checkBox('guerilla', label='Send to Guerilla')
    pmc.separator()
    pmc.button('export', label='Export', width=250, c=exec_button)
    pmc.showWindow()
def RotPro(menu1, menu2, rotationDict, *args):
    print 'ran'
    buttons = pm.radioCollection(menu2, q=True, sl=True)
    rtype = pm.radioButton(buttons, q=True, label=True)
    type = menu1.getValue()
    axis = rotationDict[rtype][0]
    mod = rotationDict[rtype][1]
    print type, axis, mod
    modx = 0
    mody = 0
    modz = 0
    faces = ''
    rotationamount = mod
    if axis == 'x':
        modx = rotationamount
        print 'modx', modx
    if axis == 'y':
        mody = rotationamount
    if axis == 'z':
        modz = rotationamount
    selected = pm.ls(sl=True)

    if (len(selected) < 1):
        pm.informBox(title='Object Selection Error',
                     message='Please Select a Single Object',
                     ok='Ok')
        return
    try:
        shape = selected[0].getChildren()
        faces = shape[0].f[0:]
    except:
        try:
            faces = selected
        except:
            pm.informBox(title='Object Selection Error',
                         message='Please Select a valid Object',
                         ok='Ok')
            return

    projection = pm.polyProjection(faces,
                                   rx=modx,
                                   ry=mody,
                                   rz=modz,
                                   type=type,
                                   ibd=True,
                                   sf=True)[0]
    print projection
    pm.select(d=True)
    pm.select(projection, r=True)
    pm.setToolTo('ShowManips')
    pm.showManipCtx()
    pm.ShowManipulators()
예제 #18
0
    def selectMirrorVtxAB(self):
        pm.textScrollList(self.outputWin, e=1, removeAll=True)
        pm.textScrollList(self.outputWin, e=1, append=['Calculation .  .  . '])
        if pm.radioButton(self.leftInput, q=1, sl=1):
            mirror_src = 'RIGHT'
        else:
            mirror_src = 'LEFT'

        sel = mc.ls(sl=1, flatten=1)
        sel_string = [str(x) for x in sel]

        adbTopo.selectMirrorVtx(sel_string, self.edge, mirror_src)
        self.progressBarCalculation()
예제 #19
0
 def UI(self):
     if pm.window(self.window_name, query=True, exists=True):
         pm.deleteUI(self.window_name)
     
     if pm.windowPref(self.window_name, query=True, exists=True):
         pm.windowPref(self.window_name, remove=True)
     
     with pm.window(self.window_name, width=250, menuBar=True) as my_window:
         pm.menu( label='Hints', tearOff=True )
         rename_hint = pm.menuItem( 'Rename', subMenu=True )
         pm.menuItem( 'Place consecutive #\'s for numerical incrementation.' )
         pm.menuItem( 'Use numpad enter to apply without clicking the button.' )
         
         with pm.columnLayout( adjustableColumn=True ):
             with pm.frameLayout( label='Rename', collapsable=True ):
                 pm.text('This will rename selected items from your scene.')
                 self.rename_field = pm.textField( enterCommand=self.rename_button )
             
                 with pm.frameLayout( label='Options', collapsable=True ):
                     with pm.columnLayout( adjustableColumn=True ):
                         with pm.rowLayout( numberOfColumns=4 ):
                             pm.text('Operation:', align='left')
                             self.operation_select = pm.radioCollection()
                             pm.radioButton('Rename', select=True)
                             pm.radioButton('Prefix')
                             pm.radioButton('Suffix')
                         
                         with pm.rowLayout( numberOfColumns=3 ):
                             pm.text('Hieararchy:', align='left')
                             self.hieararchy_select = pm.radioCollection()
                             pm.radioButton('Normal', select=True)
                             pm.radioButton('Chain')
                 
                 pm.button('RENAME IT!', command=self.rename_button)
             
     my_window.show()
예제 #20
0
def changeMethodVal(val):
    global pickMethod
    pickMethod=val
    global springMethod
    if val:
        pm.radioButton(dynSpringMagicRadioID,e=True,ed=True)
    else:
        springMethod=1
        pm.radioButton(dynHairMagicRadioID,e=True,select=True)
        pm.radioButton(dynSpringMagicRadioID,e=True,ed=False,select=False)
예제 #21
0
    def mirrorAB(self):
        pm.textScrollList(self.outputWin, e=1, removeAll=True)
        pm.textScrollList(self.outputWin, e=1, append=['Calculation .  .  . '])

        if pm.radioButton(self.leftInput, q=1, sl=1):
            mirror_src = 'RIGHT'
        else:
            mirror_src = 'LEFT'

        if not pm.selected():
            pm.select(self.targetGeo, r=1)
            mc.symmetrize(self.edge, side=mirror_src)
            pm.select(None)
        else:
            mc.symmetrize(self.edge, side=mirror_src)
        self.progressBarCalculation()
예제 #22
0
    def spine_init(self,
                   size=5.0,
                   limbName='spine',
                   mode='biped',
                   numOfJnts=4,
                   *args):

        self.spine_initJnts = []
        self.tmpCrv = None

        try:  # if in UI mode, get number of joints from UI
            size = pm.floatSliderGrp(self.spineSizeF, q=True, value=True)
            limbName = pm.textField(self.limbNameTF, q=True, text=True)
            selectedMode = pm.radioCollection(self.characterModeRC,
                                              q=True,
                                              select=True)
            mode = pm.radioButton(selectedMode, q=True, label=True).lower()
            numOfJnts = pm.intSliderGrp(self.numOfInitJntsIS,
                                        q=True,
                                        value=True)
        except:
            pass

        curveCVs = []
        curveCVsCount = []
        for i in range(numOfJnts):
            pm.select(clear=True)

            if mode == 'biped':
                jntPos = (0, size + (size * 1.0 / (numOfJnts - 1) * i), 0)
            elif mode == 'quadruped':
                jntPos = (0, size,
                          (size * 1.0 / (numOfJnts - 1) * i) - size / 2.0)
            else:
                pm.error(
                    'ehm_tools...Spine: mode arg accepts "biped" or "quadruped" only!'
                )

            self.spine_initJnts.append(
                pm.joint(p=jntPos, name="%s_%s_initJnt" % (limbName, i + 1)))
            curveCVs.append(jntPos)
            curveCVsCount.append(i)

        self.tmpCrv = pm.curve(d=1, p=curveCVs, k=curveCVsCount)
        self.tmpCrv.getShape().template.set(True)
        pm.skinCluster(self.spine_initJnts, self.tmpCrv)
예제 #23
0
 def GenerateMirrorFunctionControls(self, _moduleName, _scrollWidth):
     
     rotationRadioCollection = "rotation_radioCollection_all"
     translationRadioCollection = "translation_radioCollection_all"
     textLabel = "Mirror Settings:"
     
     behaviourName = "behaviour__"
     orientationName = "orientation__"
     mirroredName = "mirrored__"
     worldSpaceName = "worldSpace__"
     mirrorRowColumn = "mirrorFunctionRowColumn__"
     
     if _moduleName != None:
         rotationRadioCollection = "rotation_radioCollection_%s" %_moduleName
         translationRadioCollection = "translation_radioCollection_%s" %_moduleName
         textLabel = "%s Mirror Settings:" %_moduleName
         mirrorRowColumn = "mirrorFunctionRowColumn__%s" %_moduleName
         
         behaviourName = "behaviour__%s" %_moduleName
         orientationName = "orientation__%s" %_moduleName
         mirroredName = "mirrored__%s" %_moduleName
         worldSpaceName = "worldSpace__%s" %_moduleName
     
     pm.text(label = textLabel, parent = self.UIElements["topColumnLayout"])
     
     mirrorSettings_textWidth = 80
     mirrorSettings_columnWidth = (_scrollWidth - mirrorSettings_textWidth) / 2
     
     pm.rowColumnLayout(mirrorRowColumn, numberOfColumns = 3, columnAttach = (1, 'right', 0), columnWidth = [(1, mirrorSettings_textWidth), (2, mirrorSettings_columnWidth), (3, mirrorSettings_columnWidth)], parent = self.UIElements["topColumnLayout"])
     
     pm.text(label = "Rotation: ", parent = mirrorRowColumn)
     
     self.UIElements[rotationRadioCollection] = pm.radioCollection(parent = mirrorRowColumn)
     pm.radioButton(behaviourName, label = "Behaviour", select = True)
     pm.radioButton(orientationName, label = "orientation", select = False)
     
     pm.text(label = "Translation: ", parent = mirrorRowColumn)
     
     self.UIElements[translationRadioCollection] = pm.radioCollection(parent = mirrorRowColumn)
     pm.radioButton(mirroredName, label = "Mirrored", select = True)
     pm.radioButton(worldSpaceName, label = "World Space", select = False)
     
     pm.text(label = '')
예제 #24
0
    def resetMeshAB(self):
        pm.textScrollList(self.outputWin, e=1, removeAll=True)
        pm.textScrollList(self.outputWin, e=1, append=['Calculation .  .  .'])
        axisInput = ''
        if pm.checkBox(self.inputXchbx, q=1, value=1):
            axisInput += 'x'

        if pm.checkBox(self.inputYchbx, q=1, value=1):
            axisInput += 'y'

        if pm.checkBox(self.inputZchbx, q=1, value=1):
            axisInput += 'z'

        percentageInput = pm.intSliderGrp(self.percentageSlider, q=1, value=1)
        percentageInput /= 100.0

        positiveInput = pm.radioButton(self.posInput, q=1, sl=1)

        if not pm.selected():
            mc.resetDelta(str(self.baseGeo),
                          str(self.targetGeo),
                          percentage=percentageInput,
                          axis=axisInput,
                          positive=positiveInput)
        else:
            sel_type = type(pm.selected()[0])
            if str(sel_type) == "<class 'pymel.core.general.MeshVertex'>":
                mc.resetDelta(str(self.baseGeo),
                              percentage=percentageInput,
                              axis=axisInput,
                              positive=positiveInput)
            else:
                mc.resetDelta(str(self.baseGeo),
                              str(self.targetGeo),
                              percentage=percentageInput,
                              axis=axisInput,
                              positive=positiveInput)
        self.progressBarCalculation()
예제 #25
0
	def reverseShape( self, objs=None, axis='x', *args ):
				
		try:
			selectedItem = pm.radioCollection( self.AxisRC, q=True, select=True )
			axis = (pm.radioButton( selectedItem, q=True, label=True )).lower()
		except:
			pass
		
		
		scaleValue = ( -1, 1, 1 )
		if axis == 'y':
			scaleValue = ( 1, -1, 1 )
		elif axis == 'z':
			scaleValue = ( 1, 1, -1 )
		elif axis != 'x':
			pm.warning('Axis was not correct, used "x" axis instead.')
		
		if objs == None:
			objs = pm.ls( sl=True )
		else:
			objs = pm.ls( objs )
		
		for obj in objs:
			try:
				shape = obj.getShape()
				if shape.type() == 'mesh':
					pm.select( shape.vtx[:] )
					pm.scale( scaleValue )
					pm.select( objs )
				elif shape.type() == 'nurbsCurve':
					pm.select( shape.cv[:] )
					pm.scale( scaleValue )
					pm.select( objs )			
			except:
				pm.warning("Object doesn't have a shape. Skipped!")

			'''
예제 #26
0
	def UI(self):
		width = 570
		height = 280
		# create window
		if pm.window( 'ehm_Spine_UI', exists=True ):
			pm.deleteUI( 'ehm_Spine_UI' )
		pm.window( 'ehm_Spine_UI', title='Rig Spine', w=width, h=height, mxb=False, mnb=False, sizeable=True )
		
		# main layout
		baseForm = pm.formLayout()
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'left', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'right', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'top', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'bottom', 38) )
		# pm.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16)
		formLayout = pm.formLayout(w=width, h=height)
		
	

		# name of spine
		self.limbNameT = pm.text( label="Limb Name: ")			
		self.limbNameTF = pm.textField( text="spine")
	
		# spine size
		self.spineSizeT = pm.text( label="Spine Size: ")	
		self.spineSizeF = pm.floatSliderGrp(adjustableColumn=4,min=0, max=20, fieldMaxValue=10000, value=5, field=True )

		
		# character mode radio buttons
		self.characterModeText = pm.text(label='Character Mode: ', align='right')
		self.characterModeRC = pm.radioCollection()
		self.bipedRB = pm.radioButton(label="Biped", select=True )
		self.quadrupedRB = pm.radioButton(label="Quadruped")


		# number of init joints
		self.numOfInitJntsText = pm.text( label='Number of Initial joints: ', align='right')		
		self.numOfInitJntsIS = pm.intSliderGrp( field=True, value=4, maxValue=10, fieldMaxValue=1000 )
		
		# number of FK controls
		self.numOfFKctrlText = pm.text( label='Number of FK Controls: ', align='right')		
		self.numOfFKctrlIS = pm.intSliderGrp( field=True, value=2, maxValue=10, fieldMaxValue=1000 )
		
		# number of init joints
		self.numOfJntsText = pm.text( label='Number of joints: ', align='right')		
		self.numOfJntsIS = pm.intSliderGrp( field=True, value=6, maxValue=20, fieldMaxValue=1000 )		
		
		# extras check boxes
		self.extrasText = pm.text( label='Extras: ', align='right' )		
		self.ssCB = pm.checkBox( label="Squash Stretch", value=True )	
		self.volumeCB = pm.checkBox( label="Preserve Volume", value=True )	
		self.stretchSwitchCB = pm.checkBox( label="Create Stretch Switch On Spline Curve", value=True )	
		self.midCtrlCB = pm.checkBox( label="MidCtrl", value=True )

		
		
		# buttons
		self.initButton = pm.button( label='Place joints',  h=30,  c=partial( self.spine_init, 5.0, 'spine', 'biped', 4 ), parent=baseForm  )
		self.packButton = pm.button( label='Finish Rig', h=30,  c=partial( self.spine_pack, 5.0, 'spine', 'biped', 4 , None, False, True, True, True, None, 3 ), parent=baseForm    )		
		self.closeButton = pm.button( label='Close', h=30,  c= self.closeUI , parent=baseForm    )		

		# place limb name
		pm.formLayout( formLayout, edit=True, attachPosition=(self.limbNameT,'right', 0, 28 ) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.limbNameT,'top', 17 ) )
		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.limbNameTF,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.limbNameTF,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.limbNameTF,'top', 15 ) )		
		
		# place spine size
		pm.formLayout( formLayout, edit=True, attachPosition=(self.spineSizeT,'right', 0, 28 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.spineSizeT,'top', 15, self.limbNameT ) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.spineSizeF,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.spineSizeF,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.spineSizeF,'top', 12, self.limbNameT ) )	
		
		# place character mode
		pm.formLayout( formLayout, edit=True, attachPosition=(self.characterModeText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.characterModeText,'top', 17, self.spineSizeT) )
		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.bipedRB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.bipedRB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.bipedRB,'top', 15, self.spineSizeT) )		

		pm.formLayout( formLayout, edit=True, attachPosition=(self.quadrupedRB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.quadrupedRB,'right', 15, 100 ) )
		
		pm.formLayout( formLayout, edit=True, attachControl=(self.quadrupedRB,'top', 35, self.spineSizeT) )	


		# place number of joints
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfInitJntsText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfInitJntsText,'top', 37, self.characterModeText) )
	
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfInitJntsIS,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfInitJntsIS,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfInitJntsIS,'top', 32, self.characterModeText ) )	
			

		# place number of joints
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfJntsText,'top', 17, self.numOfInitJntsText) )
	
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsIS,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsIS,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfJntsIS,'top', 12, self.numOfInitJntsText ) )	

		# placee number of FK controls
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfFKctrlText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfFKctrlText,'top', 17, self.numOfJntsText) )
	
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfFKctrlIS,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfFKctrlIS,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfFKctrlIS,'top', 12, self.numOfJntsText ) )	
		
		
		# place check boxes
		pm.formLayout( formLayout, edit=True, attachPosition=(self.extrasText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.extrasText,'top', 17, self.numOfFKctrlText) )
	
		pm.formLayout( formLayout, edit=True, attachPosition=(self.ssCB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.ssCB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.ssCB,'top', 15, self.numOfFKctrlText ) )	
		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.volumeCB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.volumeCB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.volumeCB,'top', 35, self.numOfFKctrlText ) )	

		pm.formLayout( formLayout, edit=True, attachPosition=(self.stretchSwitchCB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.stretchSwitchCB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.stretchSwitchCB,'top', 55, self.numOfFKctrlText ) )	

		pm.formLayout( formLayout, edit=True, attachPosition=(self.midCtrlCB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.midCtrlCB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.midCtrlCB,'top', 75, self.numOfFKctrlText ) )	

		# place buttons		
		pm.formLayout( baseForm, edit=True, attachPosition=(self.initButton,'left', 3, 0) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.initButton,'right', 1, 33) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.initButton,'bottom', 3) )	

		pm.formLayout( baseForm, edit=True, attachPosition=(self.packButton,'left', 1, 33) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.packButton,'right', 3, 66) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.packButton,'bottom', 3) )	

		pm.formLayout( baseForm, edit=True, attachPosition=(self.closeButton,'left', 1, 66) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.closeButton,'right', 3, 100) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.closeButton,'bottom', 3) )	

		# show window
		pm.showWindow( 'ehm_Spine_UI' )
예제 #27
0
 def show(self):
     window = pm.window(self.windowName,title=self.windowName)
     with window:
         with pm.frameLayout(bs='in',label=u'頂点を円上に整列'):
             with pm.frameLayout(bs='in', label=u'射影平面'):
                 self.rc1 = pm.radioCollection()
                 with pm.rowLayout(numberOfColumns=3):
                     pm.radioButton('X', label=u'YZ', select=True)
                     pm.radioButton('Y', label=u'XZ')
                     pm.radioButton('Z', label=u'XY')
             with pm.frameLayout(bs='in', label=u'円の半径'):
                 self.rc2 = pm.radioCollection()
                 with pm.rowLayout(numberOfColumns=3):
                     pm.radioButton('Min', label=u'最短値', select=True)
                     pm.radioButton('Cen', label=u'中間値')
                     pm.radioButton('Max', label=u'最長値')
                     self.checkBox = pm.checkBox(label = u'ワールド軸 (off / ローカル)', value=True)
                     pm.button(label='Submit',width=40,height=32,command=pm.Callback(self.callBack))
예제 #28
0
def main(*args):

	if pm.window('riggingToolkitWindow', exists = True):
	    pm.deleteUI('riggingToolkitWindow', window = True) 
	    print 'Pre-existing window ToolKit deleted'

	if pm.dockControl('riggingToolkitDockControl', exists = True):
		pm.deleteUI('riggingToolkitDockControl', control = True)


	#Declarations
	global windowWidth
	global windowHeight
	global jointChainLenField
	global nameField
	global suffixField
	global typeIndex
	global stretchyCheckBox

	global newNameField
	global newSuffixField

	windowWidth = 325
	windowHeight = 100000
	allowedAreas = ['left', 'right']
	buttonIndex = 0
	typeIndex = 0


	childFrameWidth = windowWidth - 5

	window_object = pm.window('riggingToolkitWindow', t = 'Rigging Toolkit', width = windowWidth, height = windowHeight, sizeable = False)

	scrollFieldColumnLayout = pm.rowColumnLayout(nc = 1)
	scrollField = pm.scrollLayout(w = 350, h = 600)
	mainColumnLayout = pm.rowColumnLayout(nc = 1)
	jointFrameLayout = pm.frameLayout('jointLayout', cll = True, cl = False, width = windowWidth, l = 'Joint Layout')

	jointChainColumn = pm.rowColumnLayout(nc = 2)

	pm.text(l = 'Name', al = 'center', width = windowWidth/2)
	pm.text(l = 'Suffix', al = 'center', width = windowWidth/2)
	nameField = pm.textField()
	suffixField = pm.textField()

	pm.setParent(jointFrameLayout)
	worldColumn = pm.rowColumnLayout(nc = 2)
	pm.button(l = 'Define World', w = (windowWidth/6) * 5, c = defineWorld)
	pm.button(l = 'Set', w = windowWidth/6, c = setWorld)

	pm.setParent(jointFrameLayout)

	jointChainColumnSecondary = pm.rowColumnLayout(nc = 2)

	jointChainLenField = pm.textField(w = windowWidth/8, tx = '5')
	jointChainButton = pm.button(l = 'Create Joint Chain', c = createJointChain, w = ((windowWidth/8)*7))

	pm.setParent(jointFrameLayout)

	radioButtonRColmn = pm.rowColumnLayout(nc = 2)
	jntChnTypRadioCollection = pm.radioCollection()
	normChain = pm.radioButton(l = 'Normal', w = windowWidth/2, onc = lambda *args: buttonIndexUpdate(0))
	ribnChain = pm.radioButton(l = 'Ribbon', w = windowWidth/2, onc = lambda *args: buttonIndexUpdate(1))

	pm.setParent(mainColumnLayout)	
	jointSetupFrmLyt = pm.frameLayout('jointSetup', cll = True, cl = True, w = windowWidth, l = 'Joint Setup')
	separatorText('Spine Setup')
	spineTypeClmnLyt = pm.rowColumnLayout(nc = 2)
	pm.button(l = 'Schleifer', c = schleiferify, w = (windowWidth/2))
	pm.button(l = 'Ribbon', c = folliclify, w = windowWidth/2)

	pm.setParent(jointSetupFrmLyt)
	separatorText('Switch Setup')

	fkIkSpineClmnLyt = pm.rowColumnLayout(nc = 2)
	pm.button(l = 'Fk', c =  lambda *args: makeFk( False, pm.ls(selection = True)[0]), w = windowWidth/2)
	pm.button(l = 'Ik', c = lambda *args: makeIk( False, pm.ls(selection = True)[0]), w = windowWidth/2)
	pm.setParent(jointSetupFrmLyt)
	pm.button(l = 'Fk Ik', c = makeFkIk, w = windowWidth)
	stretchyCheckBox = pm.checkBox(l = 'Stretchy', v = 0)

	footRollSetup = pm.frameLayout('footRollSetup', cll = True, cl = True, w = windowWidth, l = 'FootRoll Setup')
	separatorText('Setup')
	footRollRowCol = pm.rowColumnLayout( nc = 2)
	pm.button(l = 'Setup', c = setupFootRoll, w = childFrameWidth * 0.7)
	pm.button(l = 'Accept', c = acceptFootRoll, w = childFrameWidth * .3)

	pm.setParent(mainColumnLayout)
	miscFrmLyt = pm.frameLayout('miscTools', cll = True, cl = True, w = windowWidth, l = 'Miscellaneous Tools')
	renameFrmLyt = pm.frameLayout('renameTool', cll = True, cl = True, w = windowWidth, l = 'Joint Tools')
	jointChainColumn = pm.rowColumnLayout(nc = 2)

	pm.text(l = 'Name', al = 'center', width = windowWidth/2)
	pm.text(l = 'Suffix', al = 'center', width = windowWidth/2)
	newNameField = pm.textField(w = windowWidth/2, pht = "Type Name Here")
	newSuffixField = pm.textField(w = windowWidth/2, pht = "Type Suffix Here")
	pm.setParent(renameFrmLyt)
	pm.button(l = 'Rename', c = jointChainRename, w = windowWidth)
	pm.button(l = 'Pad', c = createPad, w = windowWidth)
	pm.button(l = 'Select hierarchy', c = lambda *args: pm.select(hi = True), w = windowWidth)


	pm.setParent(miscFrmLyt)
	ctrlsFrmLyt = pm.frameLayout('ctrlTools', cll = True, cl = True, w = windowWidth, l = 'Control Tools')
	separatorText('Controls')
	pm.button(l = 'Edit Controls', c = editControls, w = windowWidth)
	pm.button(l = 'SDK Creator', c = lambda *args: customSdk.gui(), w = windowWidth)


	pm.setParent(miscFrmLyt)
	visualScaleFrmLyt = pm.frameLayout(label = 'Visual Scale', cll = True, cl = True)

	separatorText('Visual Scale')

	jointSize = 1.00
	ikSize = 1.00

	pm.columnLayout(columnOffset = ['left', -100], adjustableColumn = True, cal = 'left')
	jointSizeSliderObject = pm.floatSliderGrp(min = 0.001, max = 10, l = 'Joint Size', pre = 2, f = True, v = jointSize, cc = changeJointScale, dc = changeJointScale, adjustableColumn = True,)

	ikSizeSliderObject = pm.floatSliderGrp(min = 0.001, max = 10, l = 'IK Size', f = True, v = ikSize, cc = changeIKScale, dc = changeIKScale, adjustableColumn = True)

	pm.setParent(miscFrmLyt)
	facialFrame = pm.frameLayout('facialTools', cll = True, cl = True, w = windowWidth, l = 'Facial Tools')
	separatorText('Direct Connect')
	directConRowCol = pm.rowColumnLayout(nc = 3)
	pm.button(l = 'Trans', c = conTrans, w = windowWidth/3)
	pm.button(l = 'Rot', c = conRot, w = windowWidth/3)
	pm.button(l = 'Scale', c = conScale, w = windowWidth/3)

	pm.setParent(miscFrmLyt)
	geoFrame = pm.frameLayout('geometryTools', cll = True, cl = True, w = windowWidth, l = 'Geometry Tools')
	pm.text(l = 'Geometry', al = 'center', w = windowWidth)
	pm.rowColumnLayout(nc = 2)
	pm.button(l = 'Reference', c = refGeo, w = windowWidth/2)
	pm.button(l = 'Unreference', c = unRefGeo, w = windowWidth/2)
	pm.setParent(geoFrame)
	pm.text(l = 'Accessories', al = 'center', w = windowWidth)
	pm.rowColumnLayout(nc = 2)
	pm.button(l = 'Hide', c = hideAcc, w = windowWidth/2)
	pm.button(l = 'Unhide', c = unHideAcc, w = windowWidth/2)
	pm.dockControl('riggingToolkitDockControl', l = 'Rigging Toolkit', area = 'right', content = window_object, allowedArea = allowedAreas)
예제 #29
0
    def __init__(self):
        winWidth = 400
        winHeight = 360
        winName = "voxel_maker_window"
        winTitle = "Voxel Maker"
        rightOffset = 10
        leftOffset = 10 
        topOffset = 2
        bottomOffset = 2
                
        if pm.window(winName, exists=True):
            pm.deleteUI(winName)
            
        self._mainWindow = pm.window(winName, title=winTitle, menuBar=True)
        
        if self._initialWin:
            self.loadSettings()
            self._initialWin = False
        
        # menu bar
        pm.menu(label='Edit')
        pm.menuItem(label='Save Settings', command=self.saveSettings)
        pm.menuItem(label='Reset Settings', command=self.resetSettings)
        pm.menu(label='Help')
        pm.menuItem(label='Wiki', command=self.goDocLink)    
        pm.menuItem(label='Report Issues', command=self.goBugLink)   
        
        # add layouts
        colLayout = pm.columnLayout(adj=True, parent=self._mainWindow)
        voxelType = pm.radioCollection('VoxelType')
        
        # frame 1
        frameLayout_cube = pm.frameLayout(label='Cube Settings', borderStyle='etchedOut', parent=colLayout, mw=2)
        formLayout_cube = pm.formLayout(parent=frameLayout_cube)
        
        cvRButton = pm.radioButton('default', label='Cube Voxel', parent=formLayout_cube, sl=not self._customVoxelSelected)
        #pm.addAttr(longName='bevel', attributeType='float')
        #testCtrlGrp = pm.attrControlGrp( attribute='defaultResolution.width' )
        
        formLayout_cube.attachForm(cvRButton, 'top', topOffset)
        formLayout_cube.attachForm(cvRButton, 'left', leftOffset)
        
        # frame 2
        frameLayout_custom = pm.frameLayout('custom', label='Custom Voxel Settings', borderStyle='etchedOut', parent=colLayout)
        formLayout_custom = pm.formLayout(parent=frameLayout_custom)
        formLayout_custom_1 = pm.formLayout(parent=formLayout_custom)
        
        cusvRButton = pm.radioButton('custom_voxel', label='Custom Voxel', parent=formLayout_custom,
                                     changeCommand=self.changeCustomVoxelSelected, sl = self._customVoxelSelected)
        pm.radioCollection()
        importRButton = pm.radioButton(label='Import', parent=formLayout_custom_1, enable=self._customVoxelSelected, sl=self._importSelected)
        importField = pm.textFieldButtonGrp( label='Path', text=self._importFilePath, buttonLabel='Find',
                                             buttonCommand=self.getImportFilePath, parent=formLayout_custom_1, 
                                             enable=self._customVoxelSelected, editable=False )
        insceneRButton = pm.radioButton(label='In Scene: Select the profile first, the sample object secondly', parent=formLayout_custom_1, enable=self._customVoxelSelected,
                                        changeCommand=self.changeImportSelected, sl=not self._importSelected)
        
        formLayout_custom.attachForm(cusvRButton, 'top', topOffset)
        formLayout_custom.attachForm(cusvRButton, 'left', leftOffset)
        formLayout_custom.attachControl(formLayout_custom_1, 'top', topOffset, cusvRButton)
        formLayout_custom.attachForm(formLayout_custom_1, 'left', leftOffset)
        formLayout_custom_1.attachForm(importRButton, 'top', topOffset)
        formLayout_custom_1.attachForm(importRButton, 'left', leftOffset)
        formLayout_custom_1.attachControl(importField, 'top', topOffset, importRButton)
        formLayout_custom_1.attachForm(importField, 'left', leftOffset-100)
        formLayout_custom_1.attachControl(insceneRButton, 'top', topOffset, importField)
        formLayout_custom_1.attachForm(insceneRButton, 'left', leftOffset)    
        
        
        # frame 3
        frameLayout_density = pm.frameLayout(label='Density Settings', borderStyle='etchedOut', parent=colLayout)
        formLayout_density = pm.formLayout(parent=frameLayout_density)
        
        densityIntSlider = pm.intSliderGrp('density', field=True, label='Density', minValue=1, maxValue=20,
                                           fieldMinValue=1, fieldMaxValue=100, value=self._density, sliderStep=1, changeCommand=self.changeDensity)
    
        formLayout_density.attachForm(densityIntSlider, 'top', topOffset)
        formLayout_density.attachForm(densityIntSlider, 'left', leftOffset-100)

        # frame 4
        frameLayout_seperate = pm.frameLayout(label='Is Result separated', borderStyle='etchedOut', parent=colLayout)
        formLayout_seperate = pm.formLayout(parent=frameLayout_seperate)
        
        isSeperate = pm.radioCollection('IsSeperate')
        ySepRButton = pm.radioButton('Yes', label='Yes', parent=formLayout_seperate, changeCommand=self.changeseparated, sl=self._separated)
        nSepRButton = pm.radioButton('No', label='No', parent=formLayout_seperate, sl=not self._separated)

        formLayout_seperate.attachForm(ySepRButton, 'top', topOffset)
        formLayout_seperate.attachForm(ySepRButton, 'left', leftOffset)
        formLayout_seperate.attachControl(nSepRButton, 'left', leftOffset, ySepRButton)
        formLayout_seperate.attachForm(nSepRButton, 'top', topOffset)
        
        # apply/close buttons
        acButton = pm.button(label='Apply and Close', command=pm.Callback(self.apply, voxelType, self._importFilePath, True), parent=colLayout)
        aButton = pm.button(label='Apply', command=pm.Callback(self.apply, voxelType, self._importFilePath, False), parent=colLayout)
        rButton = pm.button(label='Refresh', command=self.refresh, parent=colLayout)        
        cButton = pm.button(label='Close', command=self.close, parent=colLayout)
    
        
        # show window
        self._mainWindow.show()
        self._mainWindow.setWidthHeight((winWidth, winHeight))     
예제 #30
0
	def bipedLimb_pack( self, ctrlSize=1.0, FKIKMode='FKIK', mirror=True, numOfSegs=6, bendy=True, mode='arm', *args ):

		try:# if in UI mode, get number of joints from UI
			ctrlSize = pm.floatSliderGrp( self.spineSizeF, q=True, value=True)
			selectedMode = pm.radioCollection( self.characterModeRC, q=True, select=True)
			mode = pm.radioButton( selectedMode, q=True, label=True ).lower()
			numOfSegs = pm.intSliderGrp( self.numOfJntsIS, q=True, value=True)
			bendy = pm.checkBox( self.bendyCB, q=True, value=True )		
		except:
			pass
		
		bipedLimbJnts = []
		FKIKstuff = []
		OSbipedLimbJnts = []	
		OSFKIKstuff = []	
		
		#============================================================================
		# find some info for naming and control sizes

		side = self.BipedLimbInitJnts[0].name()[0]
		limbLen = Dist( self.BipedLimbInitJnts[0] , self.BipedLimbInitJnts[1] )
		
		otherSide = 'R'
		if side == 'R':
			otherSide = 'L'	
		
		
		#============================================================================
		# getting info from selected objects
		if mode == 'arm':
			firstInitJnt 	= 	self.BipedLimbInitJnts[0]
			secondInitJnt 	= 	self.BipedLimbInitJnts[1]
			thirdInitJnt 	=	self.BipedLimbInitJnts[2]
			forthInitJnt 	= 	self.BipedLimbInitJnts[3]

			armPos 		= 	self.worldPos( firstInitJnt )
			elbowPos  	= 	self.worldPos( secondInitJnt )
			handPos  	= 	self.worldPos( thirdInitJnt )
			handEndPos  = 	self.worldPos( forthInitJnt )

		elif mode == 'leg':
			firstInitJnt 		= 	self.BipedLimbInitJnts[0]
			secondInitJnt 		= 	self.BipedLimbInitJnts[1]
			thirdInitJnt 		=	self.BipedLimbInitJnts[2]
			heelInitJnt 	    = 	self.BipedLimbInitJnts[3]
			forthInitJnt 	    = 	self.BipedLimbInitJnts[4]
			toeEndInitJnt 	    = 	self.BipedLimbInitJnts[5]
			outsideInitJnt 	    = 	self.BipedLimbInitJnts[6]
			insideInitJnt 	    = 	self.BipedLimbInitJnts[7]
			
			upLegPos 			= 	self.worldPos( firstInitJnt )
			kneePos      		= 	self.worldPos( secondInitJnt )
			anklePos      		= 	self.worldPos( thirdInitJnt )
			ballPos         	= 	self.worldPos( forthInitJnt )
			toeEndPos      	 	= 	self.worldPos( toeEndInitJnt )
			heelPos        	 	= 	self.worldPos( heelInitJnt )
			outsidePos      	= 	self.worldPos( outsideInitJnt )
			insidePos       	= 	self.worldPos( insideInitJnt )

			


		#============================================================================
		# create arm or leg joints
		if mode == 'arm':
			pm.select ( cl = True )
			upLimbJnt =pm.joint ( p = armPos  , name = ( side + "_upArm_jnt" ) )

			midLimbJnt = pm.joint ( p = elbowPos , name = ( side + "_elbow_jnt" ) )
			pm.joint( upLimbJnt, e=True, zso=True, oj='xyz', sao='yup')

			butLimbJnt = pm.joint ( p = handPos , name = ( side + "_hand_jnt" ) )
			pm.joint( midLimbJnt,  e=True, zso=True, oj='xyz', sao='yup')

			handEndJnt = pm.joint ( p = handEndPos , name = ( side + "_hand_end_jnt" ) )
			pm.joint( butLimbJnt,  e=True, zso=True, oj='xyz', sao='yup')

			bipedLimbJnts = [ upLimbJnt, midLimbJnt, butLimbJnt, handEndJnt ]

		elif mode == 'leg':
			pm.select ( cl = True )
			upLimbJnt =pm.joint ( p = upLegPos  , name = ( side + "_upLeg_jnt" ) )

			midLimbJnt = pm.joint ( p = kneePos , name = ( side + "_knee_jnt" ) )
			pm.joint( upLimbJnt, e=True, zso=True, oj='xzy', sao='xup')

			butLimbJnt = pm.joint ( p = anklePos , name = ( side + "_ankle_jnt" ) )
			pm.joint( midLimbJnt,  e=True, zso=True, oj='xzy', sao='xup')

			ballJnt = pm.joint ( p = ballPos , name = ( side + "_ball_jnt" ) )
			pm.joint( butLimbJnt,  e=True, zso=True, oj='xzy', sao='xup')
			
			toeEndJnt = pm.joint ( p = toeEndPos , name = ( side + "_toeEnd_jnt" ) )
			pm.joint( ballJnt,  e=True, zso=True, oj='xzy', sao='xup')
			
			pm.select(clear=True)
			heelJnt = pm.joint ( p = heelPos , name = ( side + "_heel_jnt" ) )

			pm.select(clear=True)
			outsideJnt = pm.joint ( p = outsidePos , name = ( side + "_outside_jnt" ) )

			pm.select(clear=True)
			insideJnt = pm.joint ( p = insidePos , name = ( side + "_inside_jnt" ) )
			
			bipedLimbJnts = [ upLimbJnt, midLimbJnt, butLimbJnt, ballJnt, toeEndJnt, heelJnt,outsideJnt,insideJnt ]


				
		#============================================================================
		# find the pole vector position
		# orient joints and set preferred angle
		
		# find pole vector position
		PVposition = FindPVposition( objs= (upLimbJnt, midLimbJnt, butLimbJnt) )

		if mode == 'arm': # arm mode .................................................
			
			if PVposition: # arm is bent!
				# create and position aim locator
				aimLoc = pm.spaceLocator()
				PVposition = FindPVposition( objs= (upLimbJnt, midLimbJnt, butLimbJnt) )
				aimLoc.translate.set( PVposition )
			
			else: # arm is not bent!
				# create and position aim locator
				aimLoc = pm.spaceLocator()
				pm.parent( aimLoc, midLimbJnt )
				pm.makeIdentity( aimLoc, t=True, r=True, s=True )
				aimLoc.translateZ.set( -limbLen*1.5 )
				pm.parent( aimLoc, w=True)
				aimLoc.rotate.set( 0,0,0 )

			# rotate the aim to match the rotation of the arm
			pm.delete( pm.aimConstraint( midLimbJnt, aimLoc, worldUpType="object", aimVector=(1,0,0), upVector=(0,1,0), worldUpObject= butLimbJnt  ) )

			# orient joints according to aim locator
			for jnt in ( upLimbJnt, midLimbJnt, butLimbJnt ):
				OriJnt( jnt=jnt, upAim=aimLoc , aimAxis='-z' )
				
			# set preferred angle
			midLimbJnt.preferredAngleY.set( -90 )
			
			poleVectorTransform = None
			footRotate = None
			

			

		elif mode == 'leg': # leg mode .................................................
			
			if PVposition: # leg is bent!
				# create and position aim locator
				aimLoc = pm.spaceLocator()
				PVposition = FindPVposition( objs= (upLimbJnt, midLimbJnt, butLimbJnt) )
				aimLoc.translate.set( PVposition )
				
			else: # leg is not bent!
				PVposition = self.PVbyToeJnt( upLimbJnt, midLimbJnt, toeEndJnt )
				# create and position aim locator
				aimLoc = pm.spaceLocator()
				aimLoc.translate.set( PVposition ) # position aim in front of the foot
				
			# rotate the aim to match the rotation of the arm
			pm.delete( pm.aimConstraint( midLimbJnt, aimLoc, worldUpType="object", aimVector=(1,0,0), upVector=(0,1,0), worldUpObject= butLimbJnt  ) )

			# orient joints according to aim locator
			for jnt in bipedLimbJnts[:-4]:
				OriJnt( jnt=jnt, upAim=aimLoc , aimAxis='-y' )

			# set preferred angle
			midLimbJnt.preferredAngleZ.set( 90 )
			
			# find foot Y rotation to pass to rigIK and rigFKIK
			footRotateY = ProjectedAim( objs=( butLimbJnt , toeEndJnt ) )
			footRotate = ( 0, footRotateY, 0 )					

		# pole vector transformations to be passed to rigIK and rigFKIK
		PVposition = pm.xform( aimLoc, q=True, ws=True, t=True )
		PVrotation = pm.xform( aimLoc, q=True, ws=True, ro=True )
		poleVectorTransform = ( PVposition, PVrotation )
		
		

		#============================================================================
		# If mirror is ON
		if mirror == True:
			# mirror joints
			OSjnts =  pm.mirrorJoint( upLimbJnt, mirrorYZ=True , mirrorBehavior=True, searchReplace=( "L", "R" ) )
			if mode=='leg':
				OSjnts.append( pm.mirrorJoint( heelJnt, mirrorYZ=True , mirrorBehavior=True, searchReplace=( "L", "R" ) ) )
				OSjnts.append( pm.mirrorJoint( outsideJnt, mirrorYZ=True , mirrorBehavior=True, searchReplace=( "L", "R" ) ) )
				OSjnts.append( pm.mirrorJoint( insideJnt, mirrorYZ=True , mirrorBehavior=True, searchReplace=( "L", "R" ) ) )
			OSbipedLimbJnts = pm.ls( OSjnts )

			# transforms of mirrored pole vector
			OSaimLoc = MirrorObjLikeJnt( aimLoc )[0]
			OSPVposition = pm.xform( OSaimLoc, q=True, ws=True, t=True )
			OSPVrotation = pm.xform( OSaimLoc, q=True, ws=True, ro=True )
			OSpoleVectorTransform = ( OSPVposition, OSPVrotation )
			
			# transforms of mirrored hand or foot control
			footNull = pm.group(em=True)
			if mode=='leg':
				footNull.translate.set( anklePos )
				footNull.rotate.set( footRotate )
			elif mode=='arm':
				footNull.translate.set( handPos )
			
			OShandTransforms = MirrorObjLikeJnt( objs=footNull, returnValue=True )
			OSfootRotate = OShandTransforms[0][1]
			pm.delete( footNull )


		#============================================================================
		# create IK, FK rigs and blend them
		
		
		# FK mode =============
		if FKIKMode == 'FK':
			RigFK( jnts = OSbipedLimbJnts, side = side )
			# other side
			if mirror:
				RigFK( jnts = OSbipedLimbJnts, side=otherSide )

			

		# IK mode =============
		elif FKIKMode == 'IK':
			armRigStuff = RigIK( 		  jnts=bipedLimbJnts
										, mode=mode
										, side = side
										, poleVectorTransform=poleVectorTransform
										, footRotate=footRotate
										, rigHandOrFoot=True
										, ctrlSize = ctrlSize )
			
			
			# other side
			if mirror:
				OSarmRigStuff = RigIK( 		  jnts=OSbipedLimbJnts 
											, mode=mode
											, side=otherSide
											, poleVectorTransform=OSpoleVectorTransform
											, mirrorMode=True
											, footRotate=OSfootRotate
											, rigHandOrFoot=True
											, ctrlSize = ctrlSize )
				

		# FKIK mode =============
		elif FKIKMode == 'FKIK':
			# for i in ( bipedLimbJnts, mode, side, poleVectorTransform, footRotate ):
				# print i
			# return None			
			FKIKstuff = RigFKIK( 		  jnts=bipedLimbJnts
										, mode=mode
										, side=side
										, poleVectorTransform=poleVectorTransform
										, footRotate=footRotate
										, rigHandOrFoot=True
										, ctrlSize = ctrlSize )
			
			# other side
			if mirror:
				OSFKIKstuff = RigFKIK( 		  jnts=OSbipedLimbJnts
											, mode=mode
											, side=otherSide
											, poleVectorTransform=OSpoleVectorTransform
											, mirrorMode=True
											, footRotate=(0,0,0)
											, rigHandOrFoot=True )
				
				'''
				OSFKIKstuff = RigFKIK( 		  jnts=OSbipedLimbJnts
											, mode=mode
											, side=otherSide
											, poleVectorTransform=OSpoleVectorTransform
											, mirrorMode=True
											, footRotate=OSfootRotate
											, rigHandOrFoot=True )
				'''
		
		
		#============================================================================
		# rig bendy limbs
		bendies = RigBendyLimb( jnts=bipedLimbJnts[:3]
								, bendyCtrl=FKIKstuff[3]
								, numOfSegs= numOfSegs
								, side=side )
		if mirror:
			OSbendies = RigBendyLimb( jnts=OSbipedLimbJnts[:3]
									, bendyCtrl=OSFKIKstuff[3]
									, numOfSegs= numOfSegs
									, isMirroredJoint=True
									, side=otherSide )
		
		# clean up
		pm.delete( self.BipedLimbInitJnts, aimLoc )
		bendies[-1].setParent( FKIKstuff[-1] )
		if mirror:
			pm.delete( OSaimLoc )
			OSbendies[-1].setParent( OSFKIKstuff[-1] )
예제 #31
0
 def MirrorModule_UI(self):
     
     for module in self.modules:
         self.moduleNames.append(module.partition("__")[2])
     
     if len(self.modules) > 1:
         result = pm.confirmDialog(title = "Mirror Multiple Modules", message = "%d modules selected for mirror. \nHow would you like to apply mirror settings?" %len(self.modules), button = ["Same for All", "Individually", "Cancel"], defaultButton = "Same for All", cancelButton = "Cancel", dismissString = "Cancel")
         
         if result == 'Cancel':
             return
         
         if result == 'Same for All':
             self.sameMirrorSettingsForAll = True
     
     
     # Refresh UI
     if pm.window("mirrorModule_UI_window", exists = True):
         pm.deleteUI("mirrorModule_UI_window")
     
     
     # Create UI
     windowWidth = 300
     windowHeight = 400
     self.UIElements["window"] = pm.window("mirrorModule_UI_window", width = windowWidth, height = windowHeight, title = "Mirror Module(s)", sizeable = False)
     
     self.UIElements["scrollLayout"] = pm.scrollLayout(horizontalScrollBarThickness = 0, parent = self.UIElements["window"])
     self.UIElements["topColumnLayout"] = pm.columnLayout(adjustableColumn = True, rowSpacing = 3, parent = self.UIElements["scrollLayout"])
     
     scrollWidth = windowWidth - 30
     
     mirrorPlane_textWidth = 80
     mirrorPlane_columnWidth = (scrollWidth - mirrorPlane_textWidth) / 3
     
     self.UIElements["mirrorPlane_rowColumn"] = pm.rowColumnLayout(numberOfColumns = 4, columnAttach = (1, 'right', 0), columnWidth = [(1, mirrorPlane_textWidth), (2, mirrorPlane_columnWidth), (3, mirrorPlane_columnWidth), (4, mirrorPlane_columnWidth)], parent = self.UIElements["topColumnLayout"])
     
     pm.text(label = "Mirror Plane: ", parent = self.UIElements["mirrorPlane_rowColumn"])
     
     self.UIElements["mirrorPlane_radioCollection"] = pm.radioCollection(parent = self.UIElements["mirrorPlane_rowColumn"])
     pm.radioButton("XY", label = "XY", select = False)
     pm.radioButton("YZ", label = "YZ", select = True)
     pm.radioButton("XZ", label = "XZ", select = False)
     
     pm.separator(style = 'in', parent = self.UIElements["topColumnLayout"])
     
     pm.text(label = "Mirrored Name(s): ", parent = self.UIElements["topColumnLayout"])
     
     columnWidth = scrollWidth / 2
     self.UIElements["moduleName_rowColumn"] = pm.rowColumnLayout(numberOfColumns = 2, columnAttach = (1, 'right', 0), columnWidth = [(1, columnWidth), (2, columnWidth)], parent = self.UIElements["topColumnLayout"])
     
     for module in self.moduleNames:
         pm.text(label = "%s >> " %module, parent = self.UIElements["moduleName_rowColumn"])
         self.UIElements["moduleName_%s" %module] = pm.textField(enable = True, text = "%s_mirror" %module, parent = self.UIElements["moduleName_rowColumn"])
     
     pm.separator(style = 'in', parent = self.UIElements["topColumnLayout"])
     
     
     if self.sameMirrorSettingsForAll:
         self.GenerateMirrorFunctionControls(None, scrollWidth)
     else:
         for module in self.moduleNames:
             self.GenerateMirrorFunctionControls(module, scrollWidth)
     
     pm.separator(style = 'in', parent = self.UIElements["topColumnLayout"])
     
     
     self.UIElements["button_row"] = pm.rowLayout(numberOfColumns = 2, columnWidth = [(1, columnWidth), (2, columnWidth)], columnAttach = [(1, 'both', 10), (2, 'both', 10)], columnAlign = [(1, 'center'), (2, 'center')], parent = self.UIElements["topColumnLayout"])
     pm.button(label = "Accept", command = self.AcceptWindow, parent = self.UIElements["button_row"])
     pm.button(label = "Cancel", command = self.CancelWindow, parent = self.UIElements["button_row"])
     
     
     pm.showWindow(self.UIElements["window"])
예제 #32
0
    def show_UI(self):

        # Init main window
        if (pm.window("main_window", exists=True)):
            pm.deleteUI("main_window")
        self.main_window = pm.window(t=MAIN_WINDOW_TITLE,
                                     wh=MAIN_WINDOW_DIMENSIONS,
                                     s=MAIN_WINDOW_RESIZEABLE)

        # Main vertical layout
        window_v_layout = pm.columnLayout(adj=True,
                                          rs=MAIN_WINDOW_CONTENT_SPACING,
                                          h=MAIN_WINDOW_DIMENSIONS[1])

        # Checklist scroll layout
        checklist_scroll_layout = pm.scrollLayout(cr=True)

        # Checklist vertical layout
        checklist_vertical_layout = pm.columnLayout(adj=True)

        # Checklist header
        checklist_frame_layout = pm.frameLayout(l='Checker Options')

        opVars = pm.language.Env.optionVars

        # Show function checklist
        for fn_name in self.lookup_order:

            # If option is in opVars, use that value
            # Otherwise, use default value
            fn = self.functions[fn_name]
            if fn_name in opVars:
                option = opVars[fn_name]
                self.options[fn_name] = option
            else:
                option = self.options[fn_name]

            # Per-row layout
            checklist_row_layout = pm.rowLayout(nc=2,
                                                cl2=('right', 'center'),
                                                cw2=CHECKLIST_COLUMN_WIDTHS)

            # Function description label
            pm.text(l=fn.desc, align='right')

            # Begin radio buttons
            radio_row_layout = pm.rowLayout(nc=3)
            collection = pm.radioCollection()

            # Draw skip radio button
            set_skip = pm.Callback(self.set_option, fn_name,
                                   self.checker_option.SKIP)
            skip_button = pm.radioButton(l='Skip', onc=set_skip)

            # Draw check radio button
            if fn.checkFn:
                set_check = pm.Callback(self.set_option, fn_name,
                                        self.checker_option.CHECK)
                check_button = pm.radioButton(l='Check', onc=set_check)

            # Draw cleanup radio button
            if fn.cleanupFn:
                set_cleanup = pm.Callback(self.set_option, fn_name,
                                          self.checker_option.CLEANUP)
                cleanup_button = pm.radioButton(l='Cleanup', onc=set_cleanup)

            # End radio row collection
            pm.setParent('..')

            # End radio row layout
            pm.setParent('..')

            # End per-row layout
            pm.setParent('..')

            # Set selected radio button based on selected option
            if option is self.checker_option.SKIP:
                selected = skip_button
            elif option is self.checker_option.CHECK:
                selected = check_button
            else:
                selected = cleanup_button

            pm.radioCollection(collection, edit=True, select=selected)

        # End checklist vertical layout
        pm.setParent('..')

        # End checklist scroll layout
        pm.setParent('..')

        log_frame_layout = pm.frameLayout(l='Log Output')

        # Start log scroll layout
        log_scroll_layout = pm.scrollLayout(cr=True, h=LOG_SCROLL_AREA_HEIGHT)

        # Log text object
        # The -32 is prevent the horizontal scrollbar from appearing
        self.log_text = pm.text(l=self.log_results,
                                h=MAX_LOG_HEIGHT,
                                al='left',
                                w=MAIN_WINDOW_DIMENSIONS[0] - 32,
                                ww=True)

        # End log scroll layout
        pm.setParent('..')

        pm.setParent('..')

        # Start button horizontal layout
        button_h_layout = pm.rowLayout(nc=3,
                                       cw3=(128, 128, 128),
                                       ct3=('both', 'both', 'both'),
                                       h=MAIN_BUTTON_AREA_HEIGHT)

        # If Run and Export Selected, check and attempt to export
        pm.button(l='Run and Export Selected', c=self.check_and_export)

        # If Check/Cleanup, run check and cleanup
        pm.button(l='Run', c=self.check)

        # If Cancel, close the window
        pm.button(l='Close', c=self.close_main_window)

        # End button horizontal layout
        pm.setParent('..')

        # End main vertical layout
        pm.setParent('..')

        pm.showWindow(self.main_window)
예제 #33
0
	def UI(self):
		
		# create window
		if pm.window( 'ehm_Poser_UI', exists=True ):
			pm.deleteUI( 'ehm_Poser_UI' )
		pm.window( 'ehm_Poser_UI', title='Pose Tools', w=400, h=235, mxb=False, mnb=True, sizeable=True )
		
		# main layout
		#mainLayout = pm.rowColumnLayout()
		formLayout = pm.formLayout(w=400, h=235)
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)
		pm.setParent( formLayout )
			
		
		# select and default buttons
		self.selectAndDefaultText = pm.text(label='Selection: ', align='right')
		self.selectAllButton = pm.button( label='Select All', h=30, backgroundColor=[0.5,0.7,0.5],  c= self.selectAllControls  )			
		self.setDefaultButton = pm.button( label='Set Default Pose',  h=30, backgroundColor=[0.5,0.7,0.5],  c=self.setDefaultPose  )			
		
		
		# reset buttons
		self.resetText = pm.text(label='Resets: ', align='right')		
		self.resetAllButton = pm.button( label='Reset All Attributes',  h=30, backgroundColor=[0.7,0.5,0.5], c=self.resetAllAttributes  )
		self.resetSRTButton = pm.button( label='Reset SRT',  h=30, backgroundColor=[0.7,0.5,0.5], c=self.resetTransformAttributes  )
		
		
		# reset and mirror mode separator 
		self.resetMirrorSEP = pm.separator( style='out' )
		
		# mirror mode radio buttons
		self.mirrorModeText = pm.text(label='Mirror Mode: ', align='right')
		self.mirrorModeRC = pm.radioCollection()
		self.behaviorRB = pm.radioButton(label="Behavior", select=True )
		self.orientationRB = pm.radioButton(label="Orientation")
		self.hybridRB = pm.radioButton(label="Hybrid")		
		
		
		# flip and mirror buttons
		self.mirrorText = pm.text(label='Mirror: ', align='right')	
		self.flipButton = pm.button( label='Flip', h=30, backgroundColor=[0.5,0.5,0.7],  c=partial( self.flip_pose, True )   )
		self.mirrorButton = pm.button( label='Mirror', h=30, backgroundColor=[0.5,0.5,0.7],  c=partial( self.mirror_pose, True )  )
		
		
		# match FK IK separator 
		self.matchFKIKSEP = pm.separator( style='out' )		
		
		
		# match FK IK buttons
		self.matchFKIKText = pm.text(label='Match FK IK: ', align='right')	
		self.matchFKIKButton = pm.button( label='FK <---> IK   ,   IK <---> FK', h=30, backgroundColor=[0.4,0.3,0.6],  c = self.matchFKIK   )
		
		
		# place frame layout
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'left', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'right', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'top', 3) )
		pm.formLayout( formLayout, edit=True, attachForm=(frameLayout,'bottom', 3) )

		
		# place select and default buttons
		pm.formLayout( formLayout, edit=True, attachPosition=(self.selectAndDefaultText,'right', 0 , 20) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.selectAndDefaultText,'top', 30) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.selectAllButton,'left', 2 , 30) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.selectAllButton,'right', 2 , 65) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.selectAllButton,'top', 20) )		

		pm.formLayout( formLayout, edit=True, attachPosition=(self.setDefaultButton,'left', 2, 65) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.setDefaultButton,'right', 8, 100) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.setDefaultButton,'top', 20) )	

		# palce reset buttons		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.resetText,'right', 0 , 20) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.resetText,'top', 65) )		
		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.resetAllButton,'left', 2, 30) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.resetAllButton,'right', 2 , 65) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.resetAllButton,'top', 55) )
		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.resetSRTButton,'left', 2, 65) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.resetSRTButton,'right', 8 , 100) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.resetSRTButton,'top', 55) )	
		

		# place reset and mirror mode separator 
		pm.formLayout( formLayout, edit=True, attachPosition=(self.resetMirrorSEP,'left', 2, 1) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.resetMirrorSEP,'right', 2 , 99) )		
		pm.formLayout( formLayout, edit=True, attachForm=(self.resetMirrorSEP,'top', 105) )

		
		# place mirror mode radio buttons
		pm.formLayout( formLayout, edit=True, attachPosition=(self.mirrorModeText,'right', 0 , 20) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.mirrorModeText,'top', 115) )
				
		pm.formLayout( formLayout, edit=True, attachPosition=(self.behaviorRB,'left', 2, 30) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.behaviorRB,'right', 2 , 55) )		
		pm.formLayout( formLayout, edit=True, attachForm=(self.behaviorRB,'top', 115) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.orientationRB,'left', 2, 55) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.orientationRB,'right', 8 , 80) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.orientationRB,'top', 115) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.hybridRB,'left', 2, 80) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.hybridRB,'right', 8 , 100) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.hybridRB,'top', 115) )			
		
		
		# palce mirror buttons		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.mirrorText,'right', 0 , 20) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.mirrorText,'top', 145) )						
		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.flipButton,'left', 2,30) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.flipButton,'right', 2,65) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.flipButton,'top', 135) )

		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.mirrorButton,'left', 2, 65) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.mirrorButton,'right', 8 , 100) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.mirrorButton,'top', 135) )
		

		#  place match FKIK separator
		pm.formLayout( formLayout, edit=True, attachPosition=(self.matchFKIKSEP,'left', 2, 1) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.matchFKIKSEP,'right', 2 , 99) )		
		pm.formLayout( formLayout, edit=True, attachForm=(self.matchFKIKSEP,'top', 180) )		

		
		# place match FK IK buttons
		pm.formLayout( formLayout, edit=True, attachPosition=(self.matchFKIKText,'right', 2 , 20) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.matchFKIKText,'top', 200) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.matchFKIKButton,'left', 2, 30) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.matchFKIKButton,'right', 8 , 100) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.matchFKIKButton,'top', 195) )

		# show window
		pm.showWindow( 'ehm_Poser_UI' )
예제 #34
0
def adjustAimUpAxisOnChange(aimDirStr):
    aimDirLabel = pm.radioButton(pm.radioCollection(aimAxisCollection, query = True, select = True), query = True, label = True)
    upDirLabel = pm.radioButton(pm.radioCollection(upAxisCollection, query = True, select = True), query = True, label = True)
    if aimDirStr == 'aimX' and upDirLabel == 'X':
        pm.radioButton(upAxisYBtn, edit = True, select = True)
    elif aimDirStr == 'aimY' and upDirLabel == 'Y':
        pm.radioButton(upAxisZBtn, edit = True, select = True)
    elif aimDirStr == 'aimZ' and upDirLabel == 'Z':
        pm.radioButton(upAxisXBtn, edit = True, select = True)
    elif aimDirStr == 'upX' and aimDirLabel == 'X':
        pm.radioButton(aimAxisYBtn, edit = True, select = True)
    elif aimDirStr == 'upY' and aimDirLabel == 'Y':
        pm.radioButton(aimAxisZBtn, edit = True, select = True)
    elif aimDirStr == 'upZ' and aimDirLabel == 'Z':
        pm.radioButton(aimAxisXBtn, edit = True, select = True)
예제 #35
0
    def UI(self):
        width = 570
        height = 280
        # create window
        if pm.window('ehm_Spine_UI', exists=True):
            pm.deleteUI('ehm_Spine_UI')
        pm.window('ehm_Spine_UI',
                  title='Rig Spine',
                  w=width,
                  h=height,
                  mxb=False,
                  mnb=False,
                  sizeable=True)

        # main layout
        baseForm = pm.formLayout()
        frameLayout = pm.frameLayout(borderStyle='etchedIn',
                                     labelVisible=False)
        pm.formLayout(baseForm, edit=True, attachForm=(frameLayout, 'left', 6))
        pm.formLayout(baseForm,
                      edit=True,
                      attachForm=(frameLayout, 'right', 6))
        pm.formLayout(baseForm, edit=True, attachForm=(frameLayout, 'top', 6))
        pm.formLayout(baseForm,
                      edit=True,
                      attachForm=(frameLayout, 'bottom', 38))
        # pm.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16)
        formLayout = pm.formLayout(w=width, h=height)

        # name of spine
        self.limbNameT = pm.text(label="Limb Name: ")
        self.limbNameTF = pm.textField(text="spine")

        # spine size
        self.spineSizeT = pm.text(label="Spine Size: ")
        self.spineSizeF = pm.floatSliderGrp(adjustableColumn=4,
                                            min=0,
                                            max=20,
                                            fieldMaxValue=10000,
                                            value=5,
                                            field=True)

        # character mode radio buttons
        self.characterModeText = pm.text(label='Character Mode: ',
                                         align='right')
        self.characterModeRC = pm.radioCollection()
        self.bipedRB = pm.radioButton(label="Biped", select=True)
        self.quadrupedRB = pm.radioButton(label="Quadruped")

        # number of init joints
        self.numOfInitJntsText = pm.text(label='Number of Initial joints: ',
                                         align='right')
        self.numOfInitJntsIS = pm.intSliderGrp(field=True,
                                               value=4,
                                               maxValue=10,
                                               fieldMaxValue=1000)

        # number of FK controls
        self.numOfFKctrlText = pm.text(label='Number of FK Controls: ',
                                       align='right')
        self.numOfFKctrlIS = pm.intSliderGrp(field=True,
                                             value=2,
                                             maxValue=10,
                                             fieldMaxValue=1000)

        # number of init joints
        self.numOfJntsText = pm.text(label='Number of joints: ', align='right')
        self.numOfJntsIS = pm.intSliderGrp(field=True,
                                           value=6,
                                           maxValue=20,
                                           fieldMaxValue=1000)

        # extras check boxes
        self.extrasText = pm.text(label='Extras: ', align='right')
        self.ssCB = pm.checkBox(label="Squash Stretch", value=True)
        self.volumeCB = pm.checkBox(label="Preserve Volume", value=True)
        self.stretchSwitchCB = pm.checkBox(
            label="Create Stretch Switch On Spline Curve", value=True)
        self.midCtrlCB = pm.checkBox(label="MidCtrl", value=True)

        # buttons
        self.initButton = pm.button(label='Place joints',
                                    h=30,
                                    c=partial(self.spine_init, 5.0, 'spine',
                                              'biped', 4),
                                    parent=baseForm)
        self.packButton = pm.button(label='Finish Rig',
                                    h=30,
                                    c=partial(self.spine_pack, 5.0, 'spine',
                                              'biped', 4, None, False, True,
                                              True, True, None, 3),
                                    parent=baseForm)
        self.closeButton = pm.button(label='Close',
                                     h=30,
                                     c=self.closeUI,
                                     parent=baseForm)

        # place limb name
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.limbNameT, 'right', 0, 28))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(self.limbNameT, 'top', 17))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.limbNameTF, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.limbNameTF, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(self.limbNameTF, 'top', 15))

        # place spine size
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.spineSizeT, 'right', 0, 28))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.spineSizeT, 'top', 15,
                                     self.limbNameT))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.spineSizeF, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.spineSizeF, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.spineSizeF, 'top', 12,
                                     self.limbNameT))

        # place character mode
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.characterModeText, 'right', 0, 28))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.characterModeText, 'top', 17,
                                     self.spineSizeT))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.bipedRB, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.bipedRB, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.bipedRB, 'top', 15, self.spineSizeT))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.quadrupedRB, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.quadrupedRB, 'right', 15, 100))

        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.quadrupedRB, 'top', 35,
                                     self.spineSizeT))

        # place number of joints
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfInitJntsText, 'right', 0, 28))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.numOfInitJntsText, 'top', 37,
                                     self.characterModeText))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfInitJntsIS, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfInitJntsIS, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.numOfInitJntsIS, 'top', 32,
                                     self.characterModeText))

        # place number of joints
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfJntsText, 'right', 0, 28))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.numOfJntsText, 'top', 17,
                                     self.numOfInitJntsText))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfJntsIS, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfJntsIS, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.numOfJntsIS, 'top', 12,
                                     self.numOfInitJntsText))

        # placee number of FK controls
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfFKctrlText, 'right', 0, 28))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.numOfFKctrlText, 'top', 17,
                                     self.numOfJntsText))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfFKctrlIS, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.numOfFKctrlIS, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.numOfFKctrlIS, 'top', 12,
                                     self.numOfJntsText))

        # place check boxes
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.extrasText, 'right', 0, 28))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.extrasText, 'top', 17,
                                     self.numOfFKctrlText))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.ssCB, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.ssCB, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.ssCB, 'top', 15,
                                     self.numOfFKctrlText))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.volumeCB, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.volumeCB, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.volumeCB, 'top', 35,
                                     self.numOfFKctrlText))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.stretchSwitchCB, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.stretchSwitchCB, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.stretchSwitchCB, 'top', 55,
                                     self.numOfFKctrlText))

        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.midCtrlCB, 'left', 0, 30))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.midCtrlCB, 'right', 15, 100))
        pm.formLayout(formLayout,
                      edit=True,
                      attachControl=(self.midCtrlCB, 'top', 75,
                                     self.numOfFKctrlText))

        # place buttons
        pm.formLayout(baseForm,
                      edit=True,
                      attachPosition=(self.initButton, 'left', 3, 0))
        pm.formLayout(baseForm,
                      edit=True,
                      attachPosition=(self.initButton, 'right', 1, 33))
        pm.formLayout(baseForm,
                      edit=True,
                      attachForm=(self.initButton, 'bottom', 3))

        pm.formLayout(baseForm,
                      edit=True,
                      attachPosition=(self.packButton, 'left', 1, 33))
        pm.formLayout(baseForm,
                      edit=True,
                      attachPosition=(self.packButton, 'right', 3, 66))
        pm.formLayout(baseForm,
                      edit=True,
                      attachForm=(self.packButton, 'bottom', 3))

        pm.formLayout(baseForm,
                      edit=True,
                      attachPosition=(self.closeButton, 'left', 1, 66))
        pm.formLayout(baseForm,
                      edit=True,
                      attachPosition=(self.closeButton, 'right', 3, 100))
        pm.formLayout(baseForm,
                      edit=True,
                      attachForm=(self.closeButton, 'bottom', 3))

        # show window
        pm.showWindow('ehm_Spine_UI')
예제 #36
0
 with pm.frameLayout():
     pm.separator(width = 450)
     pm.text(label = "Manipulate Rotate and Rotate Axis")
     with pm.columnLayout(rowSpacing = 2):
         setRotateToZeroBtn = pm.button(label="Set Rotate to 0", width = 455)
         adjustJointOrientWithRotateBtn = pm.button(label="Adjust Joint Orient with Rotate values", width = 455)
         pm.separator(width = 455, height = 4, style = 'none')
         setRotateAxisToZeroBtn = pm.button(label="Set Rotate Axis to 0", width = 455)
 with pm.frameLayout():
     pm.separator(width = 450)
     pm.text(label = "Orient Joints")
     with pm.columnLayout():
         with pm.rowLayout(numberOfColumns = 5):
             pm.text(label = "Aim Axis")
             aimAxisCollection = pm.radioCollection()
             aimAxisXBtn = pm.radioButton(label = 'X', select = 1)
             aimAxisYBtn = pm.radioButton(label = 'Y')
             aimAxisZBtn = pm.radioButton(label = 'Z')
             aimAxisIsNegativeBox = pm.checkBox(label = "Is negative")
         with pm.rowLayout(numberOfColumns = 5):
             pm.text(label = "Up Axis")
             upAxisCollection = pm.radioCollection()
             upAxisXBtn = pm.radioButton(label = 'X')
             upAxisYBtn = pm.radioButton(label = 'Y', select = 1)
             upAxisZBtn = pm.radioButton(label = 'Z')
             upAxisIsNegativeBox = pm.checkBox(label = "Is negative")
         with pm.rowLayout(numberOfColumns = 4):
             worldUpAxisField = pm.floatFieldGrp(label = "World Up Axis",numberOfFields = 3, value1 = 0.00, value2 = 1.00, value3 = 0.00, precision = 2)
             setWorldUpXBtn = pm.button(label='X')
             setWorldUpYBtn = pm.button(label='Y')
             setWorldUpZBtn = pm.button(label='Z')
예제 #37
0
	def flip_pose( self, mirrorMode=True, *args ):
		
		try:
			selectedItem = pm.radioCollection( self.mirrorModeRC, q=True, select=True )
			mirrorModeInUI = (pm.radioButton( selectedItem, q=True, label=True )).lower()
		except:
			pass

		objs = pm.ls( sl=True )

		flippedObjs = [] # list of objects already flipped
		
		for obj in objs:
			
			mirrorMode = mirrorModeInUI
			mirrorModeAttrExists = pm.attributeQuery( 'mirrorMode', node=obj, exists=True )
			if mirrorModeAttrExists:
				mirrorMode = obj.mirrorMode.get()

			name = self.findMirror( obj ) # find mirrored object's name
			
			if name in flippedObjs: # prevent object to get flipped twice
				continue
			flippedObjs.append( obj )				

			# get object's attributes
			allAttrs = pm.listAttr( obj, keyable=True, unlocked=True )
			userAttrs =  pm.listAttr(obj, ud=True, unlocked=True)

			
			if not name: # if mirror not found go to next object

				# 1. create 3 locators representing Position, aimVector and upVector
				pos = self.createChildLoc( obj )
				aim = self.createChildLoc( obj )
				upv = self.createChildLoc( obj )


				# 2. get the flip plane from our control object, default is YZ. place aim and up vectors accordingly
				try:
					flipPlane = obj.mirrorPlane.get()
				except:
					flipPlane = 'YZ'

				if flipPlane == 'YZ':
					aim.translateZ.set(1)
					upv.translateY.set(1)
					
				elif flipPlane == 'XZ':
					aim.translateX.set(1)
					upv.translateZ.set(1)
					
				elif flipPlane == 'XY':
					aim.translateX.set(1)
					upv.translateY.set(1)


				# 3. parent locators under control's parent. They should be in the same group as our control object we want to flip

				try:
					controlParent = obj.getParent() 
				except:
					controlParent = None

				if controlParent:
					pm.parent( pos, controlParent )
					pm.parent( aim, controlParent )
					pm.parent( upv, controlParent )


				# 4. group all locators and scale the group according to our flip plane

				grp = pm.group( pos, aim, upv )
				pm.xform( grp, os=True, piv=(0,0,0) )

				if flipPlane == 'YZ':
					grp.scaleX.set(-1)
				elif flipPlane == 'XZ':
					grp.scaleY.set(-1)	
				elif flipPlane == 'XY':
					grp.scaleZ.set(-1)



				# 5. create point and aim constraints to achieve the pose on a null object and apply the values to our control

				result = pm.group( empty=True )

				result.rotateOrder.set( obj.rotateOrder.get() )

				if controlParent:
					pm.parent( result, controlParent )
				pm.pointConstraint( pos, result )

				if flipPlane == 'YZ':
					pm.aimConstraint( aim, result, aimVector=[0,0,1], upVector=[0,1,0], worldUpType="object", worldUpObject=upv  )
				elif flipPlane == 'XZ':
					pm.aimConstraint( aim, result, aimVector=[1,0,0], upVector=[0,0,1], worldUpType="object", worldUpObject=upv  )
				elif flipPlane == 'XY':
					pm.aimConstraint( aim, result, aimVector=[1,0,0], upVector=[0,1,0], worldUpType="object", worldUpObject=upv  )

				result.scale.set( obj.scale.get() )


				# get object's attributes
				allAttrs = pm.listAttr( obj, keyable=True, unlocked=True )
				userAttrs =  pm.listAttr(obj, ud=True, unlocked=True)

				for attr in allAttrs:
					try:
						obj.attr(attr).set( result.attr(attr).get() )
					except:
						continue

				
				# 6. delete extra nodes
				pm.delete( grp, result )
				continue
			
			
			
			for attr in allAttrs:
				if pm.connectionInfo( pm.PyNode(name).attr(attr), isDestination=True ):
					pass  				
				if attr not in userAttrs:# match main attributes
					try:
						otherValue = pm.PyNode(name).attr(attr).get()
						value = obj.attr(attr).get()					
						if attr == 'visibility': # no need to mirror visibility
							pass
						
						elif attr=='translateX': # translate x is always reversed
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( -value )					
								obj.attr(attr).set( -otherValue )
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( -value )
								obj.attr(attr).set( -otherValue )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )
								obj.attr(attr).set( -otherValue )
						
						elif attr=='translateY': # translate x is always reversed
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( -value )					
								obj.attr(attr).set( -otherValue )
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( value )
								obj.attr(attr).set( otherValue )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )
								obj.attr(attr).set( -otherValue )
							
						elif attr=='translateZ': # translate x is always reversed
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( -value )					
								obj.attr(attr).set( -otherValue )
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( value )
								obj.attr(attr).set( otherValue )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )
								obj.attr(attr).set( -otherValue )				
						
						elif attr=='rotateX':
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( value )
								obj.attr(attr).set( otherValue )
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( value )
								obj.attr(attr).set( otherValue )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )
								obj.attr(attr).set( -otherValue )
						
						elif attr=='rotateY':
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( value )
								obj.attr(attr).set( otherValue )
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( -value )
								obj.attr(attr).set( -otherValue )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( value )
								obj.attr(attr).set( otherValue )
						
						elif attr=='rotateZ':
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( value )
								obj.attr(attr).set( otherValue )								
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( -value )
								obj.attr(attr).set( -otherValue )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )
								obj.attr(attr).set( -otherValue )
						
						else:
							pm.PyNode(name).attr(attr).set( value )
							obj.attr(attr).set( otherValue )		

					except:
						pm.error('ehm_tools...mirrorPose: Flip failed on main attributes!')

				
				else:#  match user defined attributes
					try:
						otherValue = pm.PyNode(name).attr(attr).get()
						value = obj.attr(attr).get()
						pm.PyNode(name).attr(attr).set( value )					
						obj.attr(attr).set( otherValue )
					except:
						pm.error('ehm_tools...mirrorPose: Flip failed on user defined attributes!')    
						
		pm.select( objs )
예제 #38
0
	def mirror_pose( self, mirrorMode='behavior', *args ):

		
		try:
			selectedItem = pm.radioCollection( self.mirrorModeRC, q=True, select=True )
			mirrorModeInUI = (pm.radioButton( selectedItem, q=True, label=True )).lower()
		except:
			pass
		
		objs = pm.ls( sl=True )

		for obj in objs:
			name = self.findMirror( obj ) # find mirrored object's name
			
			if not name:
				continue
			
			mirrorMode = mirrorModeInUI
			mirrorModeAttrExists = pm.attributeQuery( 'mirrorMode', node=obj, exists=True )
			if mirrorModeAttrExists:
				mirrorMode = obj.mirrorMode.get()
			
			
			# get object's attributes
			allAttrs = pm.listAttr( obj, keyable=True, unlocked=True )
			userAttrs =  pm.listAttr(obj, ud=True, unlocked=True)
					
			for attr in allAttrs:
				if pm.connectionInfo( pm.PyNode(name).attr(attr), isDestination=True ):
					pass  				
				if attr not in userAttrs:# match main attributes
					try:
						value = obj.attr(attr).get()
						
						if attr == 'visibility': # no need to mirror visibility
							pass
						
						elif attr=='translateX': # translate x is always reversed
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( -value )							
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( -value )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )							
				
						elif attr=='translateY': # translate x is always reversed
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( -value )							
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( value )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )							
						
						elif attr=='translateZ': # translate x is always reversed
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( -value )							
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( value )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )							
						
						elif attr=='rotateX':
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( value )							
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( value )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )
						
						elif attr=='rotateY':
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( value )							
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( -value )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( value )
						
						elif attr=='rotateZ':
							if mirrorMode=='behavior':
								pm.PyNode(name).attr(attr).set( value )							
							elif mirrorMode=='orientation':
								pm.PyNode(name).attr(attr).set( -value )
							elif mirrorMode=='hybrid':
								pm.PyNode(name).attr(attr).set( -value )
												
						else:
							pm.PyNode(name).attr(attr).set( value )
					
					except:
						pm.error('ehm_tools...mirrorPose: Mirror failed on main attributes!')

				
				for userAttr in userAttrs:# find and match user defined attributes
					try:
						value = obj.attr(userAttr).get()
						pm.PyNode(name).attr(userAttr).set( value )
					except:
						pm.error('ehm_tools...mirrorPose: Mirror failed on user defined attributes!')    
예제 #39
0
	def spine_pack ( self
						, size=5.0
						, limbName='spine'
						, mode='biped'
						, numOfJnts=4 
						, mainCtrl=None
						, midCtrl=False
						, ss=True
						, stretchSwitch=True
						, volume=True
						, numOfFKctrl=None
						, numOfSpans=3 
						, *args ):
		
		try:# if in UI mode, get number of joints from UI
			size = pm.floatSliderGrp( self.spineSizeF, q=True, value=True)
			limbName = pm.textField( self.limbNameTF, q=True, text=True)
			selectedMode = pm.radioCollection( self.characterModeRC, q=True, select=True)
			mode = pm.radioButton( selectedMode, q=True, label=True ).lower()
			numOfJnts = pm.intSliderGrp( self.numOfJntsIS, q=True, value=True)
			numOfFKctrl = pm.intSliderGrp( self.numOfFKctrlIS, q=True, value=True )
			ss = pm.checkBox( self.ssCB, q=True, value=True )	
			volume = pm.checkBox( self.volumeCB, q=True, value=True )
			stretchSwitch = pm.checkBox( self.stretchSwitchCB, q=True, value=True )
			midCtrl = pm.checkBox( self.midCtrlCB, q=True, value=True )			
		except:
			pass	
		
		# create spine curve and it's joints 	
		crv = pm.duplicate( self.tmpCrv, name=('%s_crv'%limbName) )[0]
		crv.getShape().template.set(False)
		pm.rebuildCurve( crv, ch=False, s=numOfSpans )
		jnts = (JntOnCrv( numOfJnts=numOfJnts, crv=crv )).newJnts

		Renamer( objs=jnts , name="%s_###_jnt"%limbName )


		# orient spine joints 
		pm.joint( jnts[0],  e=True, oj='xzy', secondaryAxisOrient='xup', ch=True, zso=True )



		# create joints which will drive the spine curve
		if not midCtrl: # create base and end control joints
			controlJnts = (JntOnCrv( crv=crv , numOfJnts=2 )).newJnts
			startJnt  = pm.rename(controlJnts[0],'hip_ctrl' )
			endJnt    = pm.rename(controlJnts[1],'torso_ctrl' )
			pm.parent(  endJnt , world=True )

		else: # create base, end and middle control joint
			controlJnts = (JntOnCrv( crv=crv , numOfJnts=3 )).newJnts
			startJnt  = pm.rename(controlJnts[0],'hip_ctrl' )
			midJnt    = pm.rename(controlJnts[1],'mid_ctrl' )
			endJnt    = pm.rename(controlJnts[2],'torso_ctrl' )
			pm.parent( midJnt, endJnt , world=True )


		# orient control joints
		for jnt in controlJnts:
			if mode=='biped':
				jnt.jointOrient.set(90,0,90)
			elif mode=='quadruped':
				jnt.jointOrient.set(180,-90,0)	

		# remove init joints and curve
		pm.delete( self.tmpCrv, self.spine_initJnts )

		
		# create body control
		body_ctrl = (pm.curve ( d = 1 , p = [ (0, -size*.3 ,  size*.3)
											, (0, -size*.3 , -size*.3)
											, (0,  size*.3 , -size*.3)
											, (0,  size*.3 ,  size*.3)
											, (0, -size*.3 ,  size*.3) ]
							, k = [ 0 , 1 , 2 , 3 , 4 ] 
							, name = 'body_ctrl'
							) )
		body_ctrl.getShape().overrideEnabled.set(True)	
		body_ctrl.getShape().overrideColor.set(17)	
		pm.xform( body_ctrl, ws=True, t=pm.xform(startJnt, q=True, ws=True, t=True) )
		pm.xform( body_ctrl, ws=True, ro=pm.xform(startJnt, q=True, ws=True, ro=True) )
			

		# create IK controls 
		JntToCrv( jnts=controlJnts, shape='circle', size=size*0.25 )
		for jnt in controlJnts:
			jnt.overrideEnabled.set(True)
			jnt.overrideColor.set(17)	

		IKzeroGrps = ZeroGrp( objs=controlJnts )

		# create FK controls 
		if numOfFKctrl :
			fkCtrls = [] 		
			for i in range(numOfFKctrl):
				fkCtrls.append( (pm.circle( c=(0,0,0), nr=(1,0,0), r=size*0.25, name = "%s_FK_%s)ctrl"%(limbName,i) ) )[0]  )
				fkCtrls[i].getShape().overrideEnabled.set(True)	
				fkCtrls[i].getShape().overrideColor.set(18)	
				pm.xform( fkCtrls[i], ws=True, t=pm.xform(startJnt, q=True, ws=True, t=True) )
				moveAmount = size*0.07+(size/float(numOfFKctrl)*i)
				if mode=='biped':
					pm.move( fkCtrls[i], (0,moveAmount,0), r=True )
					pm.rotate( fkCtrls[i], (90,0,90)  , r=True )
				elif mode=='quadruped':
					pm.move( fkCtrls[i], (0,0,moveAmount), r=True )
					pm.rotate( fkCtrls[i], (180,-90,0), r=True )			

			pm.parent ( IKzeroGrps[0][-1] , fkCtrls[-1] )

			for i in range(numOfFKctrl-1):
				fkCtrls[i+1].setParent( fkCtrls[i] )

			fkCtrlsZeroGrps = ZeroGrp( objs=fkCtrls[0] )


		# keep mid control between first and last joints
		if midCtrl:
			startNull= pm.group(em=True,name='%s_start_null'%limbName)
			endNull= pm.group(em=True,name='%s_end_null'%limbName)
			startNull.setParent( startJnt )
			endNull.setParent( endJnt )
			pm.xform( startNull, t=(size*.3,0,0), ro=(0,0,0), os=True )
			pm.xform( endNull, t=(-size*.3,0,0), ro=(0,0,0), os=True )
			pm.pointConstraint( startNull, endNull, IKzeroGrps[0][1] )
			midOriNull= pm.group(em=True,name='%s_midOrient_null'%limbName)
			pm.pointConstraint( startJnt, midOriNull )
			pm.aimConstraint( endJnt, midOriNull, aimVector=(1,0,0), worldUpType="none")
			midOriNull.rotate >> IKzeroGrps[0][1].rotate		


		# parent FK, IK and mid cotrol to body
		if midCtrl and numOfFKctrl:
			pm.parent( fkCtrlsZeroGrps[0], midOriNull, IKzeroGrps[0][:-1], body_ctrl )
		elif numOfFKctrl:
			pm.parent( fkCtrlsZeroGrps[0], IKzeroGrps[0][:-1], body_ctrl )

		elif midCtrl:
			pm.parent( midOriNull, IKzeroGrps[0], body_ctrl )
		else:
			pm.parent( IKzeroGrps[0], body_ctrl )

		bodyCtrlZeroGrp = ZeroGrp( objs=body_ctrl )


		# lock and hide extra attributes
		if numOfFKctrl:
			for i in range(numOfFKctrl):
				LockHideAttr(objs=fkCtrls[i],attr='t')
				LockHideAttr(objs=fkCtrls[i],attr='s')
				LockHideAttr(objs=fkCtrls[i],attr='v')


		# create ik spline handle
		ikhStuff = pm.ikHandle ( solver = "ikSplineSolver" , startJoint = jnts[0]  , endEffector = jnts[-1] , curve=crv, freezeJoints=True, simplifyCurve = True, numSpans=numOfSpans  )  #, createCurve = False, rootOnCurve = True 

		if midCtrl:
			skinClust = pm.skinCluster( ikhStuff[2], startJnt , midJnt , endJnt)
		else:
			skinClust = pm.skinCluster( ikhStuff[2], startJnt ,  endJnt)

		
		# set skin weights for ik spline curve
		if midCtrl and numOfSpans==3:
			pm.skinPercent( skinClust , crv.cv[1], transformValue=[(startJnt, 0.8),(midJnt, 0.2)] )
			pm.skinPercent( skinClust , crv.cv[3], transformValue=[(midJnt, 0.8),(endJnt, 0.2)] )


		# rename IK stuff
		pm.rename (ikhStuff[0], "%s_ikh"%limbName )
		pm.rename (ikhStuff[1], "%s_eff"%limbName )
		ikCrv = pm.rename (ikhStuff[2], "%s_crv"%limbName )


		# outliner cleaup and hide extra objects
		pm.group( ikhStuff[::2],jnts[0], name='%s_skinJnts_grp'%limbName )
		pm.setAttr ( ikhStuff[2] + ".inheritsTransform" , 0 )
		LockHideAttr( objs=ikhStuff[::2],attr='vv')


		# stretchable back if ss in ON
		if ss :
			MakeSplineStretchy( ikCrv=crv, volume=True, stretchSwitch=True, thicknessPlace="mid" )
		pm.select (clear=True)
		
		# clean memory
		del ( self.spine_initJnts )
		del ( self.tmpCrv )
예제 #40
0
    def UI(self):

        # create window
        if pm.window('ehm_ReverseShape_UI', exists=True):
            pm.deleteUI('ehm_ReverseShape_UI')
        pm.window('ehm_ReverseShape_UI',
                  title='Reverse shape',
                  w=300,
                  h=80,
                  mxb=False,
                  mnb=True,
                  sizeable=True)

        # main layout
        #mainLayout = pm.rowColumnLayout()
        formLayout = pm.formLayout(w=300, h=80)
        frameLayout = pm.frameLayout(borderStyle='etchedIn',
                                     labelVisible=False)
        pm.setParent(formLayout)

        # radio buttons
        self.AxisText = pm.text(label='Axis: ', align='right')
        self.AxisRC = pm.radioCollection()
        self.xRB = pm.radioButton(label="x", select=True)
        self.yRB = pm.radioButton(label="y")
        self.zRB = pm.radioButton(label="z")

        # buttons
        self.applyButton = pm.button(label='Apply',
                                     h=30,
                                     c=partial(self.reverseShape, None, 'x'))

        # place frame layout
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(frameLayout, 'left', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(frameLayout, 'right', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(frameLayout, 'top', 3))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(frameLayout, 'bottom', 38))

        # place radio buttons
        #pm.formLayout( formLayout, edit=True, attachPosition=(self.AxisText,'left', 5, 0) )
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.AxisText, 'right', 0, 25))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(self.AxisText, 'top', 17))

        #pm.formLayout( formLayout, edit=True, attachPosition=(self.xRB,'left', 5, 25) )
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.xRB, 'right', 10, 50))
        pm.formLayout(formLayout, edit=True, attachForm=(self.xRB, 'top', 15))

        #pm.formLayout( formLayout, edit=True, attachPosition=(self.yRB,'left', 5, 50) )
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.yRB, 'right', 10, 75))
        pm.formLayout(formLayout, edit=True, attachForm=(self.yRB, 'top', 15))

        #pm.formLayout( formLayout, edit=True, attachPosition=(self.zRB,'left', 5, 75) )
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.zRB, 'right', 20, 100))
        pm.formLayout(formLayout, edit=True, attachForm=(self.zRB, 'top', 15))

        # place buttons
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.applyButton, 'left', 4, 25))
        pm.formLayout(formLayout,
                      edit=True,
                      attachPosition=(self.applyButton, 'right', 2, 75))
        pm.formLayout(formLayout,
                      edit=True,
                      attachForm=(self.applyButton, 'bottom', 5))

        # show window
        pm.showWindow('ehm_ReverseShape_UI')
예제 #41
0
    def uiCreate(self):

        self.onCloseClicked()

        self.window = pm.window(
            WIN_NAME,
            title='PyMel Window',
            maximizeButton=False
        )

        with self.window:
            with pm.formLayout() as uiLAY_mainForm:
                with pm.scrollLayout('uiLAY_mainScroll', childResizable=True) as self.uiLAY_mainScroll:
                    with pm.columnLayout(adjustableColumn=True):

                        with self.uiCreateFrame('uiLAY_frameCheckBoxes', 'Check Boxes (PMCheckBox)') as self.uiLAY_frameCheckBoxes:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiCHK_test1 = pm.checkBox('uiCHK_test1', label='test1')
                                    self.uiCHK_test2 = pm.checkBox('uiCHK_test2', label='test2')

                        with self.uiCreateFrame('uiLAY_frameCheckBoxGroups', 'Check Box Groups (PMCheckBoxGrp#)') as self.uiLAY_frameCheckBoxGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiCHKGRP_test1 = pm.checkBoxGrp(
                                    'uiCHKGRP_test1',
                                    numberOfCheckBoxes=1,
                                    label='PMCheckBoxGrp1',
                                    label1='test1'
                                )
                                self.uiCHKGRP_test2 = pm.checkBoxGrp(
                                    'uiCHKGRP_test2',
                                    numberOfCheckBoxes=2,
                                    label='PMCheckBoxGrp2',
                                    labelArray2=('test1', 'test2')
                                )
                                self.uiCHKGRP_test3 = pm.checkBoxGrp(
                                    'uiCHKGRP_test3',
                                    numberOfCheckBoxes=3,
                                    label='PMCheckBoxGrp3',
                                    labelArray3=('test1', 'test2', 'test3')
                                )
                                self.uiCHKGRP_test4 = pm.checkBoxGrp(
                                    'uiCHKGRP_test4',
                                    numberOfCheckBoxes=4,
                                    label='PMCheckBoxGrp4',
                                    labelArray4=('test1', 'test2', 'test3', 'test4')
                                )

                        with self.uiCreateFrame('uiLAY_frameColorSliders', 'Color Slider Groups (PMColorSliderGrp)') as self.uiLAY_frameColorSliders:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiCLRGRP_test1 = pm.colorSliderGrp(
                                    'uiCLRGRP_test1',
                                    label='test1'
                                )
                                self.uiCLRGRP_test2 = pm.colorSliderGrp(
                                    'uiCLRGRP_test2',
                                    label='test2'
                                )

                        with self.uiCreateFrame('uiLAY_frameFloatFields', 'Float Fields (PMFloatField)') as self.uiLAY_frameFloatFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiFLF_test1 = pm.floatField('uiFLF_test1')
                                    self.uiFLF_test2 = pm.floatField('uiFLF_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatFieldGroups', 'Float Field Groups (PMFloatFieldGrp#)') as self.uiLAY_frameFloatFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiFLFGRP_test1 = pm.floatFieldGrp(
                                    'uiFLFGRP_test1',
                                    numberOfFields=1,
                                    label='PMFloatFieldGrp1'
                                )
                                self.uiFLFGRP_test2 = pm.floatFieldGrp(
                                    'uiFLFGRP_test2',
                                    numberOfFields=2,
                                    label='PMFloatFieldGrp2'
                                )
                                self.uiFLFGRP_test3 = pm.floatFieldGrp(
                                    'uiFLFGRP_test3',
                                    numberOfFields=3,
                                    label='PMFloatFieldGrp3'
                                )
                                self.uiFLFGRP_test4 = pm.floatFieldGrp(
                                    'uiFLFGRP_test4',
                                    numberOfFields=4,
                                    label='PMFloatFieldGrp4'
                                )

                        with self.uiCreateFrame('uiLAY_frameFloatScrollBars', 'Float Scroll Bars (PMFloatScrollBar)') as self.uiLAY_frameFloatScrollBars:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiFLSCRL_test1 = pm.floatScrollBar('uiFLSCRL_test1')
                                self.uiFLSCRL_test2 = pm.floatScrollBar('uiFLSCRL_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatSliders', 'Float Sliders (PMFloatSlider)') as self.uiLAY_frameFloatSliders:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiFLTSLD_test1 = pm.floatSlider('uiFLTSLD_test1')
                                self.uiFLTSLD_test2 = pm.floatSlider('uiFLTSLD_test2')

                        with self.uiCreateFrame('uiLAY_frameFloatSliderGroups', 'Float Slider Groups (PMFloatSliderGrp)') as self.uiLAY_frameFloatSliderGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiFLSGRP_test1 = pm.floatSliderGrp(
                                    'uiFLSGRP_test1',
                                    label='test1',
                                    field=True
                                )
                                self.uiFLSGRP_test2 = pm.floatSliderGrp(
                                    'uiFLSGRP_test2',
                                    label='test2',
                                    field=True
                                )

                        with self.uiCreateFrame('uiLAY_frameIconTextCheckBoxes', 'Icon Text Check Boxes (PMIconTextCheckBox)') as self.uiLAY_frameIconTextCheckBoxes:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiITCHK_test1 = pm.iconTextCheckBox(
                                        'uiITCHK_test1',
                                        style='iconAndTextHorizontal',
                                        label='cube',
                                        image1='cube'
                                    )
                                    self.uiITCHK_test2 = pm.iconTextCheckBox(
                                        'uiITCHK_test2',
                                        style='iconAndTextHorizontal',
                                        label='cone',
                                        image1='cone'
                                    )

                        with self.uiCreateFrame('uiLAY_frameIconTextRadioButtons', 'Icon Text Radio Buttons (PMIconTextRadioButton)') as self.uiLAY_frameIconTextRadioButtons:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=4):
                                    pm.separator(style='none', width=140)
                                    pm.iconTextRadioCollection()
                                    self.uiITRAD_test1 = pm.iconTextRadioButton(
                                        'uiITRAD_test1',
                                        style='iconAndTextHorizontal',
                                        label='cube',
                                        image1='cube'
                                    )
                                    self.uiITRAD_test2 = pm.iconTextRadioButton(
                                        'uiITRAD_test2',
                                        style='iconAndTextHorizontal',
                                        label='cone',
                                        image1='cone'
                                    )
                                    self.uiITRAD_test3 = pm.iconTextRadioButton(
                                        'uiITRAD_test3',
                                        style='iconAndTextHorizontal',
                                        label='torus',
                                        image1='torus'
                                    )

                        with self.uiCreateFrame('uiLAY_frameIconTextScrollLists', 'Icon Text Scroll Lists (PMIconTextScrollList)') as self.uiLAY_frameIconTextScrollLists:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiITSLST_test1 = pm.iconTextScrollList(
                                        'uiITSLST_test1',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )
                                    self.uiITSLST_test2 = pm.iconTextScrollList(
                                        'uiITSLST_test2',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )

                        with self.uiCreateFrame('uiLAY_frameIntFields', 'Int Fields (PMIntField)') as self.uiLAY_frameIntFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiINF_test1 = pm.intField('uiINF_test1')
                                    self.uiINF_test2 = pm.intField('uiINF_test2')

                        with self.uiCreateFrame('uiLAY_frameIntFieldGroups', 'Int Field Groups (PMIntFieldGrp#)') as self.uiLAY_frameIntFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiINFGRP_test1 = pm.intFieldGrp(
                                    'uiINFGRP_test1',
                                    numberOfFields=1,
                                    label='PMIntFieldGrp1'
                                )
                                self.uiINFGRP_test2 = pm.intFieldGrp(
                                    'uiINFGRP_test2',
                                    numberOfFields=2,
                                    label='PMIntFieldGrp2'
                                )
                                self.uiINFGRP_test3 = pm.intFieldGrp(
                                    'uiINFGRP_test3',
                                    numberOfFields=3,
                                    label='PMIntFieldGrp3'
                                )
                                self.uiINFGRP_test4 = pm.intFieldGrp(
                                    'uiINFGRP_test4',
                                    numberOfFields=4,
                                    label='PMIntFieldGrp4'
                                )

                        with self.uiCreateFrame('uiLAY_frameIntScrollBars', 'Int Scroll Bars (PMIntScrollBar)') as self.uiLAY_frameIntScrollBars:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiINSCRL_test1 = pm.intScrollBar('uiINSCRL_test1')
                                self.uiINSCRL_test2 = pm.intScrollBar('uiINSCRL_test2')

                        with self.uiCreateFrame('uiLAY_frameIntSliders', 'Int Sliders (PMIntSlider)') as self.uiLAY_frameIntSliders:
                            with pm.columnLayout(adjustableColumn=True):
                                pm.separator(style='none', height=2)
                                self.uiINTSLD_test1 = pm.intSlider('uiINTSLD_test1')
                                self.uiINTSLD_test2 = pm.intSlider('uiINTSLD_test2')

                        with self.uiCreateFrame('uiLAY_frameIntSliderGroups', 'Int Slider Groups (PMIntSliderGrp)') as self.uiLAY_frameIntSliderGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiINSGRP_test1 = pm.intSliderGrp(
                                    'uiINSGRP_test1',
                                    label='test1',
                                    field=True
                                )
                                self.uiINSGRP_test2 = pm.intSliderGrp(
                                    'uiINSGRP_test2',
                                    label='test2',
                                    field=True
                                )

                        with self.uiCreateFrame('uiLAY_frameOptionMenus', 'Option Menus (PMOptionMenu)') as self.uiLAY_frameOptionMenus:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=110, style='none')
                                    self.uiOPTMNU_test1 = pm.optionMenu('uiOPTMNU_test1', label='test1')
                                    pm.menuItem(label='one')
                                    pm.menuItem(label='two')
                                    pm.menuItem(label='three')
                                    self.uiOPTMNU_test2 = pm.optionMenu('uiOPTMNU_test2', label='test2')
                                    pm.menuItem(label='four')
                                    pm.menuItem(label='five')
                                    pm.menuItem(label='six')

                        with self.uiCreateFrame('uiLAY_frameOptionMenuGroups', 'Option Menus Groups (PMOptionMenuGrp)') as self.uiLAY_frameOptionMenuGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiOPMGRP_test1 = pm.optionMenuGrp('uiOPMGRP_test1', label='test1', extraLabel='extraLabel')
                                pm.menuItem(label='one')
                                pm.menuItem(label='two')
                                pm.menuItem(label='three')
                                self.uiOPMGRP_test2 = pm.optionMenuGrp('uiOPMGRP_test2', label='test2', extraLabel='extraLabel')
                                pm.menuItem(label='four')
                                pm.menuItem(label='five')
                                pm.menuItem(label='six')

                        with self.uiCreateFrame('uiLAY_frameRadioButtons', 'Radio Buttons (PMRadioButton)') as self.uiLAY_frameRadioButtons:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=4):
                                    pm.separator(style='none', width=140)
                                    pm.radioCollection()
                                    self.uiRAD_test1 = pm.radioButton('uiRAD_test1', label='test1')
                                    self.uiRAD_test2 = pm.radioButton('uiRAD_test2', label='test2')
                                    self.uiRAD_test3 = pm.radioButton('uiRAD_test3', label='test3')

                        with self.uiCreateFrame('uiLAY_frameRadioButtonGroups', 'Radio Button Groups (PMRadioButtonGrp#)') as self.uiLAY_frameRadioButtonGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiRADGRP_test1 = pm.radioButtonGrp(
                                    'uiRADGRP_test1',
                                    numberOfRadioButtons=1,
                                    label='PMRadioButtonGrp1',
                                    label1='test1'
                                )
                                self.uiRADGRP_test2 = pm.radioButtonGrp(
                                    'uiRADGRP_test2',
                                    numberOfRadioButtons=2,
                                    label='PMRadioButtonGrp2',
                                    labelArray2=('test1', 'test2')
                                )
                                self.uiRADGRP_test3 = pm.radioButtonGrp(
                                    'uiRADGRP_test3',
                                    numberOfRadioButtons=3,
                                    label='PMRadioButtonGrp3',
                                    labelArray3=('test1', 'test2', 'test3')
                                )
                                self.uiRADGRP_test4 = pm.radioButtonGrp(
                                    'uiRADGRP_test4',
                                    numberOfRadioButtons=4,
                                    label='PMRadioButtonGrp4',
                                    labelArray4=('test1', 'test2', 'test3', 'test4')
                                )

                        with self.uiCreateFrame('uiLAY_frameSymbolCheckBoxes', 'Symbol Check Boxes (PMSymbolCheckBox)') as self.uiLAY_frameSymbolCheckBoxes:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSYMCHK_test1 = pm.symbolCheckBox(
                                        'uiSYMCHK_test1',
                                        image='polyCube'
                                    )
                                    self.uiSYMCHK_test2 = pm.symbolCheckBox(
                                        'uiSYMCHK_test2',
                                        image='polyCone'
                                    )

                        with self.uiCreateFrame('uiLAY_frameScriptTables', 'Script Tables (PMScriptTable)') as self.uiLAY_frameScriptTables:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSCRTBL_test1 = pm.scriptTable(
                                        'uiSCRTBL_test1',
                                        selectionMode=3,
                                        rows=4,
                                        columns=2
                                    )
                                    self.uiSCRTBL_test2 = pm.scriptTable(
                                        'uiSCRTBL_test2',
                                        selectionMode=3,
                                        rows=4,
                                        columns=2
                                    )

                        with self.uiCreateFrame('uiLAY_frameScrollField', 'Scroll Field (PMScrollField)') as self.uiLAY_frameScrollField:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiSCRFLD_test1 = pm.scrollField(
                                        'uiSCRFLD_test1',
                                        wordWrap=True
                                    )
                                    self.uiSCRFLD_test2 = pm.scrollField(
                                        'uiSCRFLD_test2',
                                        wordWrap=True
                                    )

                        with self.uiCreateFrame('uiLAY_frameShelfTabLayout', 'Shelf Tab Layout (PMShelfTabLayout)') as self.uiLAY_frameShelfTabLayout:
                            with pm.columnLayout(adjustableColumn=True):
                                with pm.shelfTabLayout('uiSHLTAB_test1') as self.uiSHLTAB_test1:
                                    with pm.shelfLayout('test1'):
                                        pass
                                    with pm.shelfLayout('test2'):
                                        pass
                                    with pm.shelfLayout('test3'):
                                        pass
                                with pm.shelfTabLayout('uiSHLTAB_test2') as self.uiSHLTAB_test2:
                                    with pm.shelfLayout('test4'):
                                        pass
                                    with pm.shelfLayout('test5'):
                                        pass
                                    with pm.shelfLayout('test6'):
                                        pass

                        with self.uiCreateFrame('uiLAY_frameTabLayout', 'Tab Layout (PMTabLayout)') as self.uiLAY_frameTabLayout:
                            with pm.columnLayout(adjustableColumn=True):
                                with pm.tabLayout('uiTAB_test1') as self.uiTAB_test1:

                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow1:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow2:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow3:
                                        pass

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

                                with pm.tabLayout('uiTAB_test2') as self.uiTAB_test2:

                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow4:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow5:
                                        pass
                                    with pm.rowLayout(numberOfColumns=1) as uiLAY_tabRow6:
                                        pass

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

                        with self.uiCreateFrame('uiLAY_frameTextFields', 'Text Fields (PMTextField)') as self.uiLAY_frameTextFields:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(width=140, style='none')
                                    self.uiTXT_test1 = pm.textField('uiTXT_test1')
                                    self.uiTXT_test2 = pm.textField('uiTXT_test2')

                        with self.uiCreateFrame('uiLAY_frameTextFieldButtonGroups', 'Text Field Button Groups (PMTextFieldButtonGrp)') as self.uiLAY_frameTextFieldButtonGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiTXBTGR_test1 = pm.textFieldButtonGrp(
                                    'uiTXBTGR_test1',
                                    label='test1',
                                    buttonLabel='button1'
                                )
                                self.uiTXBTGR_test2 = pm.textFieldButtonGrp(
                                    'uiTXBTGR_test2',
                                    label='test2',
                                    buttonLabel='button2'
                                )

                        with self.uiCreateFrame('uiLAY_frameTextFieldGroups', 'Text Field Groups (PMTextFieldGrp)') as self.uiLAY_frameTextFieldGroups:
                            with pm.columnLayout():
                                pm.separator(style='none', height=2)
                                self.uiTXTGRP_test1 = pm.textFieldGrp(
                                    'uiTXTGRP_test1',
                                    label='test1'
                                )
                                self.uiTXTGRP_test2 = pm.textFieldGrp(
                                    'uiTXTGRP_test2',
                                    label='test2'
                                )

                        with self.uiCreateFrame('uiLAY_frameTextScrollLists', 'Text Scroll Lists (PMTextScrollList)') as self.uiLAY_frameTextScrollLists:
                            with pm.columnLayout():
                                with pm.rowLayout(numberOfColumns=3):
                                    pm.separator(style='none', width=140)
                                    self.uiTXTLST_test1 = pm.textScrollList(
                                        'uiTXTLST_test1',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )
                                    self.uiTXTLST_test2 = pm.textScrollList(
                                        'uiTXTLST_test2',
                                        allowMultiSelection=True,
                                        append=('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten')
                                    )

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

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

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

                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'top', 2)
                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'left', 2)
                uiLAY_mainForm.attachForm(self.uiLAY_mainScroll, 'right', 2)
                uiLAY_mainForm.attachControl(self.uiLAY_mainScroll, 'bottom', 2, self.uiBTN_savePrefs)

                uiLAY_mainForm.attachNone(self.uiBTN_savePrefs, 'top')
                uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'left', 2)
                uiLAY_mainForm.attachPosition(self.uiBTN_savePrefs, 'right', 2, 33)
                uiLAY_mainForm.attachForm(self.uiBTN_savePrefs, 'bottom', 2)

                uiLAY_mainForm.attachNone(self.uiBTN_loadPrefs, 'top')
                uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'left', 2, 33)
                uiLAY_mainForm.attachPosition(self.uiBTN_loadPrefs, 'right', 2, 66)
                uiLAY_mainForm.attachForm(self.uiBTN_loadPrefs, 'bottom', 2)

                uiLAY_mainForm.attachNone(self.uiBTN_resetPrefs, 'top')
                uiLAY_mainForm.attachPosition(self.uiBTN_resetPrefs, 'left', 2, 66)
                uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'right', 2)
                uiLAY_mainForm.attachForm(self.uiBTN_resetPrefs, 'bottom', 2)

        self.window.setTitle(self.window.__class__)
예제 #42
0
    def spine_pack(self,
                   size=5.0,
                   limbName='spine',
                   mode='biped',
                   numOfJnts=4,
                   mainCtrl=None,
                   midCtrl=False,
                   ss=True,
                   stretchSwitch=True,
                   volume=True,
                   numOfFKctrl=None,
                   numOfSpans=3,
                   *args):

        try:  # if in UI mode, get number of joints from UI
            size = pm.floatSliderGrp(self.spineSizeF, q=True, value=True)
            limbName = pm.textField(self.limbNameTF, q=True, text=True)
            selectedMode = pm.radioCollection(self.characterModeRC,
                                              q=True,
                                              select=True)
            mode = pm.radioButton(selectedMode, q=True, label=True).lower()
            numOfJnts = pm.intSliderGrp(self.numOfJntsIS, q=True, value=True)
            numOfFKctrl = pm.intSliderGrp(self.numOfFKctrlIS,
                                          q=True,
                                          value=True)
            ss = pm.checkBox(self.ssCB, q=True, value=True)
            volume = pm.checkBox(self.volumeCB, q=True, value=True)
            stretchSwitch = pm.checkBox(self.stretchSwitchCB,
                                        q=True,
                                        value=True)
            midCtrl = pm.checkBox(self.midCtrlCB, q=True, value=True)
        except:
            pass

        # create spine curve and it's joints
        crv = pm.duplicate(self.tmpCrv, name=('%s_crv' % limbName))[0]
        crv.getShape().template.set(False)
        pm.rebuildCurve(crv, ch=False, s=numOfSpans)
        jnts = (JntOnCrv(numOfJnts=numOfJnts, crv=crv)).newJnts

        Renamer(objs=jnts, name="%s_###_jnt" % limbName)

        # orient spine joints
        pm.joint(jnts[0],
                 e=True,
                 oj='xzy',
                 secondaryAxisOrient='xup',
                 ch=True,
                 zso=True)

        # create joints which will drive the spine curve
        if not midCtrl:  # create base and end control joints
            controlJnts = (JntOnCrv(crv=crv, numOfJnts=2)).newJnts
            startJnt = pm.rename(controlJnts[0], 'hip_ctrl')
            endJnt = pm.rename(controlJnts[1], 'torso_ctrl')
            pm.parent(endJnt, world=True)

        else:  # create base, end and middle control joint
            controlJnts = (JntOnCrv(crv=crv, numOfJnts=3)).newJnts
            startJnt = pm.rename(controlJnts[0], 'hip_ctrl')
            midJnt = pm.rename(controlJnts[1], 'mid_ctrl')
            endJnt = pm.rename(controlJnts[2], 'torso_ctrl')
            pm.parent(midJnt, endJnt, world=True)

        # orient control joints
        for jnt in controlJnts:
            if mode == 'biped':
                jnt.jointOrient.set(90, 0, 90)
            elif mode == 'quadruped':
                jnt.jointOrient.set(180, -90, 0)

        # remove init joints and curve
        pm.delete(self.tmpCrv, self.spine_initJnts)

        # create body control
        body_ctrl = (pm.curve(d=1,
                              p=[(0, -size * .3, size * .3),
                                 (0, -size * .3, -size * .3),
                                 (0, size * .3, -size * .3),
                                 (0, size * .3, size * .3),
                                 (0, -size * .3, size * .3)],
                              k=[0, 1, 2, 3, 4],
                              name='body_ctrl'))
        body_ctrl.getShape().overrideEnabled.set(True)
        body_ctrl.getShape().overrideColor.set(17)
        pm.xform(body_ctrl,
                 ws=True,
                 t=pm.xform(startJnt, q=True, ws=True, t=True))
        pm.xform(body_ctrl,
                 ws=True,
                 ro=pm.xform(startJnt, q=True, ws=True, ro=True))

        # create IK controls
        JntToCrv(jnts=controlJnts, shape='circle', size=size * 0.25)
        for jnt in controlJnts:
            jnt.overrideEnabled.set(True)
            jnt.overrideColor.set(17)

        IKzeroGrps = ZeroGrp(objs=controlJnts)

        # create FK controls
        if numOfFKctrl:
            fkCtrls = []
            for i in range(numOfFKctrl):
                fkCtrls.append(
                    (pm.circle(c=(0, 0, 0),
                               nr=(1, 0, 0),
                               r=size * 0.25,
                               name="%s_FK_%s)ctrl" % (limbName, i)))[0])
                fkCtrls[i].getShape().overrideEnabled.set(True)
                fkCtrls[i].getShape().overrideColor.set(18)
                pm.xform(fkCtrls[i],
                         ws=True,
                         t=pm.xform(startJnt, q=True, ws=True, t=True))
                moveAmount = size * 0.07 + (size / float(numOfFKctrl) * i)
                if mode == 'biped':
                    pm.move(fkCtrls[i], (0, moveAmount, 0), r=True)
                    pm.rotate(fkCtrls[i], (90, 0, 90), r=True)
                elif mode == 'quadruped':
                    pm.move(fkCtrls[i], (0, 0, moveAmount), r=True)
                    pm.rotate(fkCtrls[i], (180, -90, 0), r=True)

            pm.parent(IKzeroGrps[0][-1], fkCtrls[-1])

            for i in range(numOfFKctrl - 1):
                fkCtrls[i + 1].setParent(fkCtrls[i])

            fkCtrlsZeroGrps = ZeroGrp(objs=fkCtrls[0])

        # keep mid control between first and last joints
        if midCtrl:
            startNull = pm.group(em=True, name='%s_start_null' % limbName)
            endNull = pm.group(em=True, name='%s_end_null' % limbName)
            startNull.setParent(startJnt)
            endNull.setParent(endJnt)
            pm.xform(startNull, t=(size * .3, 0, 0), ro=(0, 0, 0), os=True)
            pm.xform(endNull, t=(-size * .3, 0, 0), ro=(0, 0, 0), os=True)
            pm.pointConstraint(startNull, endNull, IKzeroGrps[0][1])
            midOriNull = pm.group(em=True, name='%s_midOrient_null' % limbName)
            pm.pointConstraint(startJnt, midOriNull)
            pm.aimConstraint(endJnt,
                             midOriNull,
                             aimVector=(1, 0, 0),
                             worldUpType="none")
            midOriNull.rotate >> IKzeroGrps[0][1].rotate

        # parent FK, IK and mid cotrol to body
        if midCtrl and numOfFKctrl:
            pm.parent(fkCtrlsZeroGrps[0], midOriNull, IKzeroGrps[0][:-1],
                      body_ctrl)
        elif numOfFKctrl:
            pm.parent(fkCtrlsZeroGrps[0], IKzeroGrps[0][:-1], body_ctrl)

        elif midCtrl:
            pm.parent(midOriNull, IKzeroGrps[0], body_ctrl)
        else:
            pm.parent(IKzeroGrps[0], body_ctrl)

        bodyCtrlZeroGrp = ZeroGrp(objs=body_ctrl)

        # lock and hide extra attributes
        if numOfFKctrl:
            for i in range(numOfFKctrl):
                LockHideAttr(objs=fkCtrls[i], attr='t')
                LockHideAttr(objs=fkCtrls[i], attr='s')
                LockHideAttr(objs=fkCtrls[i], attr='v')

        # create ik spline handle
        ikhStuff = pm.ikHandle(
            solver="ikSplineSolver",
            startJoint=jnts[0],
            endEffector=jnts[-1],
            curve=crv,
            freezeJoints=True,
            simplifyCurve=True,
            numSpans=numOfSpans)  #, createCurve = False, rootOnCurve = True

        if midCtrl:
            skinClust = pm.skinCluster(ikhStuff[2], startJnt, midJnt, endJnt)
        else:
            skinClust = pm.skinCluster(ikhStuff[2], startJnt, endJnt)

        # set skin weights for ik spline curve
        if midCtrl and numOfSpans == 3:
            pm.skinPercent(skinClust,
                           crv.cv[1],
                           transformValue=[(startJnt, 0.8), (midJnt, 0.2)])
            pm.skinPercent(skinClust,
                           crv.cv[3],
                           transformValue=[(midJnt, 0.8), (endJnt, 0.2)])

        # rename IK stuff
        pm.rename(ikhStuff[0], "%s_ikh" % limbName)
        pm.rename(ikhStuff[1], "%s_eff" % limbName)
        ikCrv = pm.rename(ikhStuff[2], "%s_crv" % limbName)

        # outliner cleaup and hide extra objects
        pm.group(ikhStuff[::2], jnts[0], name='%s_skinJnts_grp' % limbName)
        pm.setAttr(ikhStuff[2] + ".inheritsTransform", 0)
        LockHideAttr(objs=ikhStuff[::2], attr='vv')

        # stretchable back if ss in ON
        if ss:
            MakeSplineStretchy(ikCrv=crv,
                               volume=True,
                               stretchSwitch=True,
                               thicknessPlace="mid")
        pm.select(clear=True)

        # clean memory
        del (self.spine_initJnts)
        del (self.tmpCrv)
예제 #43
0
def makeSpringUI():
    global springButtonID
    global dynHairMagicFrameID
    global dynSpringMagicFrameID
    global dynHairMagicRadioID
    global dynSpringMagicRadioID
    #global progressControlID
    if pm.window('makeSpringWin',ex=True):
        pm.deleteUI('makeSpringWin',window=True)
        pm.windowPref('makeSpringWin',remove=True)
    pm.window('makeSpringWin',menuBar=True,t="Spring Magic Maya %s" % version)
    pm.menu(tearOff=False,l="Edit")
    pm.menuItem(l="Reset Settings",ann="Reset all",c=lambda *arg:makeSpringUI())
    pm.scrollLayout('scrollLayout')
    pm.frameLayout(lv=False)
    pm.columnLayout(adjustableColumn=1)
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,90),(2,90),(3,90)])
    pm.text(label="Pick Method: ")
    dynPickMethodID = pm.radioCollection()
    pm.radioButton(label="Hierachy",select=True,onc=lambda *arg:changeMethodVal(1))
    pm.radioButton(label="Selection",onc=lambda *arg:changeMethodVal(0))
    pm.text(label="Spring Method: ")
    dynSpringMethodID = pm.radioCollection()
    dynHairMagicRadioID= pm.radioButton(label="Hair Magic",select=True,onc=lambda *arg:changeSpringMethodVal(1))
    dynSpringMagicRadioID= pm.radioButton(label="Spring Magic",onc=lambda *arg:changeSpringMethodVal(0))
    pm.setParent('..')
    pm.separator(style='in')
    pm.rowColumnLayout(numberOfColumns=6,columnWidth=[(1,90),(2,60),(3,55),(4,45),(5,30),(6,45)],bgc=(0.5,0.5,0.5))
    pm.text(label="Key Range: ")
    dynkeyRange = pm.radioCollection()
    pm.radioButton(label="Active",select=True,onc=lambda *arg:changeTRangeVal(1))
    pm.radioButton(label="From: ",onc=lambda *arg:changeTRangeVal(0))
    pm.intField(value=startFrame,cc=changeSFVal)
    pm.text(label="To: ")
    pm.intField(value=endFrame,cc=changeEFVal)
    pm.setParent('..')
    pm.separator(style='out')
    pm.setParent('..')
    dynHairMagicFrameID=pm.frameLayout(label='Hair Magic',borderStyle='in')
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,90),(2,180)])
    pm.text(label="Hair Damping: ",align='right')
    pm.floatField(min=0.0, max=1, value=dampValue, step=0.1, cc=changeDaVal)
    pm.text(label="Hair Stiffness: ",align='right')
    pm.floatField(min=0.0, max=1, value=stiffValue, step=0.1, cc=changeStiffVal)
    pm.setParent('..')
    pm.rowColumnLayout(numberOfColumns=4,columnWidth=[(1,90),(2,60),(3,60),(4,85)])
    pm.text(label="Hair Stiffness : ",align='right')
    dynJointFalloffID = pm.radioCollection()
    pm.radioButton(label="Normal",select=True,onc=lambda *arg:changeFVal(0))
    pm.radioButton(label="Quick",onc=lambda *arg:changeFVal(1))
    pm.radioButton(label="Slow",onc=lambda *arg:changeFVal(2))
    pm.text(label="Hair Detail : ",align='right')
    dynJointDetailID = pm.radioCollection()
    pm.radioButton(label="Low",onc=lambda *arg:changeDVal(0))
    pm.radioButton(label="Medium",select=True,onc=lambda *arg:changeDVal(1))
    pm.radioButton(label="High",onc=lambda *arg:changeDVal(2))
    pm.setParent('..')
    pm.setParent('..')
    dynSpringMagicFrameID=pm.frameLayout(label='Spring Magic',borderStyle='in',vis=False)
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,120),(2,140),(3,60)])
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,60),(2,60)])
    pm.text(label="Spring : ",align='right')
    pm.floatField(minValue=0, maxValue=1, value=0.3,editable=True,cc=changeSprVal)
    pm.setParent('..')
    pm.rowColumnLayout(numberOfColumns=2,columnWidth=[(1,60),(2,60)])
    pm.text(label="Twist : ",align='right')
    pm.floatField(minValue=0, maxValue=1, value=0.3,editable=True,cc=changeTwsVal)
    pm.setParent('..')
    pm.checkBox(label="Loop",cc=changeLoopVal)
    pm.setParent('..')
    pm.setParent('..')
    pm.separator(style='in')
    pm.rowColumnLayout(numberOfColumns=3,columnWidth=[(1,112),(2,112),(3,112)])
    springButtonID= pm.button(label="Do",c="springIt(springMethod); pm.deleteUI('makeSpringWin',window=True)")
    pm.button(label= "Apply",c='springIt(springMethod)')
    pm.button(label= "Clear",c='clearAnim()')
    pm.setParent('..')
    #progressControlID=pm.textField(tx="...",ed=False,bgc=(0,.5,0.15),fn='boldLabelFont',h=20)
    pm.showWindow()
예제 #44
0
    def buildUI(self):
        """create main UI"""
        # window creation
        windowName = 'copyPasteWeight'
        title      = 'Copy Paste Weight'
        
        if (pmc.window(windowName, exists=True)):
            pmc.deleteUI(windowName)
        
        self.ui['window']   = pmc.window(windowName, title=title, width=self.uiSize[0], height=self.uiSize[1], resizeToFitChildren=True, sizeable=False, retain=False )

        
        self.ui['layMain']  = pmc.columnLayout( width=self.uiSize[0], height=self.uiSize[1] )
        pmc.columnLayout( width=self.uiSize[0], height=20, enableBackground=True, backgroundColor=[0.1,0.1,0.1] )
        pmc.text( label='Copy and Paste Skin Weight Data', align='center', width=self.uiSize[0], height=20 )
        pmc.setParent( '..' )
        pmc.separator( height=10, style='none' )
        
        self.ui['layTop']   = pmc.rowLayout( numberOfColumns=2, columnWidth2=(self.uiSize[0]/2-2, self.uiSize[0]/2-2), height=30 )
        self.ui['btnCopy']  = pmc.button( label='Copy', annotation='Copy skin weight data from current selection', width=self.uiSize[0]/2-3 )
        self.ui['btnPaste'] = pmc.button( label='Paste', annotation='Paste skin weight into current selection', width=self.uiSize[0]/2-3 )
        pmc.setParent( '..' )
        
        self.ui['layBtm']   = pmc.rowLayout( numberOfColumns=2, columnWidth2=(self.uiSize[0]/2-2, self.uiSize[0]/2-2), height=30 )
        self.ui['btnMiss']  = pmc.button( label='Add Influences', annotation='Add influence if needed', width=self.uiSize[0]/2-3 )
        self.ui['btnNorm']  = pmc.button( label='Normalize', annotation='Normalize skin weight on current selection', width=self.uiSize[0]/2-3 )
        pmc.setParent( '..' )
        pmc.separator( height=10, style='none' )
        
        self.ui['layBtm']   = pmc.frameLayout( label='Options', borderVisible=True, collapsable=True, collapse=False, width=self.uiSize[0], marginHeight=10, marginWidth=20 )
        self.ui['layOpt']   = pmc.formLayout( numberOfDivisions=100 )
        self.ui['flfAdd']   = pmc.floatField( value=0.2, minValue=0.0, maxValue=1.0, precision=4, step=.01, width=self.uiSize[0]/4 )
        self.ui['chbAdd']   = pmc.checkBox( label='Add weight', value=False )
        self.ui['chbMiss']  = pmc.checkBox( label='Add Bones if needed', value=True )
        self.ui['chbBone']  = pmc.checkBox( label='Unchange locked joint', value=False )
        self.ui['chbMeth']  = pmc.checkBox( label='Fast \'No Undo possible\'', value=False )

        pmc.setParent( '..' )
        
        pmc.formLayout( self.ui['layOpt'], edit=True, attachForm=[(self.ui['chbAdd'], 'left', 0), (self.ui['chbAdd'], 'top', 2)])
        pmc.formLayout( self.ui['layOpt'], edit=True, attachForm=[(self.ui['flfAdd'], 'top', 0)], attachControl=[(self.ui['flfAdd'], 'left', 5, self.ui['chbAdd'])])
        pmc.formLayout( self.ui['layOpt'], edit=True, attachForm=[(self.ui['chbMiss'], 'left', 0)], attachControl=[(self.ui['chbMiss'], 'top', 5, self.ui['chbAdd'])])
        pmc.formLayout( self.ui['layOpt'], edit=True, attachForm=[(self.ui['chbBone'], 'left', 0)], attachControl=[(self.ui['chbBone'], 'top', 5, self.ui['chbMiss'])])
        pmc.formLayout( self.ui['layOpt'], edit=True, attachForm=[(self.ui['chbMeth'], 'left', 0)], attachControl=[(self.ui['chbMeth'], 'top', 5, self.ui['chbBone'])])
        
        pmc.setParent( '..' )
        
        pmc.frameLayout( label='History', borderVisible=True, collapsable=True, collapse=False, width=self.uiSize[0] )
        self.ui['tslHist']   = pmc.textScrollList( numberOfRows=self._maxHist, allowMultiSelection=False, showIndexedItem=2)
        pmc.popupMenu()
        pmc.menuItem( label='Print Influences', annotation='Print Influences', command=pmc.Callback( self.__printInfluences__ ) )
        pmc.menuItem( divider=True)
        pmc.menuItem( label='Delete History', annotation='Delete History', command=pmc.Callback( self.__deleteHistory__ ) )
        pmc.setParent( '..' )
        
        pmc.frameLayout( label='Bones List', borderVisible=True, collapsable=True, collapse=True, width=self.uiSize[0], marginHeight=0, marginWidth=0, expandCommand=pmc.Callback( self.__getBonesInfluence__) )
        pmc.columnLayout( width=self.uiSize[0]-3 )
        pmc.radioCollection()
        pmc.rowLayout( numberOfColumns=3, columnWidth3=(self.uiSize[0]/3-10, self.uiSize[0]/3-2, self.uiSize[0]/3-2), height=25 )
        pmc.text( label='Order', align='center', width=self.uiSize[0]/3-10, height=25 )
        self.ui['rb1Bone']  = pmc.radioButton( label='by Id', select=True, changeCommand=pmc.Callback( self.__getBonesInfluence__) )
        self.ui['rb2Bone']  = pmc.radioButton( label='by Alpha', changeCommand=pmc.Callback( self.__getBonesInfluence__) )
        pmc.setParent( '..' )
        self.ui['tslBone']  = pmc.textScrollList( numberOfRows=20, allowMultiSelection=True, showIndexedItem=2, width=self.uiSize[0]-3, doubleClickCommand=pmc.Callback( self.__actionBonesInfluence__, 2 ) )
        pmc.popupMenu()
        pmc.menuItem( label='Lock',   annotation='Lock Bones',   command=pmc.Callback( self.__actionBonesInfluence__, 0) )
        pmc.menuItem( label='Unlock', annotation='Unlock Bones', command=pmc.Callback( self.__actionBonesInfluence__, 1) )
        pmc.menuItem( label='Swap',   annotation='Swap Bones',   command=pmc.Callback( self.__actionBonesInfluence__, 2) )
        pmc.menuItem( divider=True)
        pmc.menuItem( label='Refresh list', annotation='Refresh list', command=pmc.Callback( self.__getBonesInfluence__) )
        self.ui['btnBone']  = pmc.button( label='Refresh list', annotation='Refresh list', width=self.uiSize[0]-3, command=pmc.Callback( self.__getBonesInfluence__) )
        pmc.setParent( '..' )
        pmc.setParent( '..' )

        pmc.frameLayout( label='Shortcuts', borderVisible=True, collapsable=True, collapse=True, width=self.uiSize[0], marginHeight=10, marginWidth=15 )
        self.ui['layShort']  = pmc.formLayout( numberOfDivisions=100 )
        self.ui['btnSCco']   = pmc.button( label='Copy', annotation='Create short cut for Copy weight button', width=self.uiSize[0]/4 )
        self.ui['chbCoCtrl'] = pmc.checkBox( label='Ctrl', value=True )
        self.ui['chbCoAlt']  = pmc.checkBox( label='Alt',  value=False )
        self.ui['txfCopy']   = pmc.textField( text='C', width=20)
        
        self.ui['btnSCpa']   = pmc.button( label='Paste', annotation='Create short cut for Paste weight button', width=self.uiSize[0]/4 )
        self.ui['chbPaCtrl'] = pmc.checkBox( label='Ctrl', value=True )
        self.ui['chbPaAlt']  = pmc.checkBox( label='Alt',  value=False )
        self.ui['txfPaste']  = pmc.textField( text='V', width=20)
        
        
        pmc.formLayout( self.ui['layShort'], edit=True, attachForm=[(self.ui['chbCoCtrl'], 'top', 3), (self.ui['chbCoCtrl'], 'left', 0)])
        pmc.formLayout( self.ui['layShort'], edit=True, attachForm=[(self.ui['chbCoAlt'], 'top', 3)],  attachControl=[(self.ui['chbCoAlt'], 'left', 3, self.ui['chbCoCtrl'])])
        pmc.formLayout( self.ui['layShort'], edit=True, attachForm=[(self.ui['txfCopy'], 'top', 1)],   attachControl=[(self.ui['txfCopy'], 'left', 6, self.ui['chbCoAlt'])])
        pmc.formLayout( self.ui['layShort'], edit=True, attachForm=[(self.ui['btnSCco'], 'top', 0)], attachPosition=[(self.ui['btnSCco'], 'right', 0, 100), (self.ui['btnSCco'], 'left', 0, 70)]  )
        
        pmc.formLayout( self.ui['layShort'], edit=True, attachForm=[(self.ui['chbPaCtrl'], 'left', 0)],  attachControl=[(self.ui['chbPaCtrl'], 'top', 5, self.ui['btnSCco'])])
        pmc.formLayout( self.ui['layShort'], edit=True, attachControl=[(self.ui['chbPaAlt'], 'left', 3, self.ui['chbPaCtrl']), (self.ui['chbPaAlt'], 'top', 5, self.ui['btnSCco'])])
        pmc.formLayout( self.ui['layShort'], edit=True, attachControl=[(self.ui['txfPaste'], 'left', 6, self.ui['chbPaAlt']), (self.ui['txfPaste'], 'top', 2, self.ui['btnSCco'])])
        pmc.formLayout( self.ui['layShort'], edit=True, attachControl=[(self.ui['btnSCpa'], 'top', 2, self.ui['btnSCco'])], attachPosition=[(self.ui['btnSCpa'], 'right', 0, 100), (self.ui['btnSCpa'], 'left', 0, 70)]  )
        
        
        pmc.setParent( '..' )
        pmc.setParent( '..' )
        
        # add command
        self.ui['btnCopy'].setCommand(pmc.Callback( self.__copyWeight__ ))
        self.ui['btnPaste'].setCommand(pmc.Callback( self.__pasteWeight__ ))
        self.ui['btnMiss'].setCommand(pmc.Callback( self.__addInfluences__ ))
        self.ui['btnNorm'].setCommand(pmc.Callback( self.__normalize__ ))
        self.ui['btnSCco'].setCommand(pmc.Callback( self.__createShortcut__, 'copy' ))
        self.ui['btnSCpa'].setCommand(pmc.Callback( self.__createShortcut__, 'paste' ))
        
        # show window
        self.ui['window'].show()
예제 #45
0
	def bipedLimb_init( self, BipedLimbSize=10, mode='arm', side='L', *args  ):

		self.BipedLimbInitJnts = []
		
		try:# if in UI mode, get number of joints from UI
			BipedLimbSize = pm.floatSliderGrp( self.BipedLimbSizeF, q=True, value=True)
			selectedMode = pm.radioCollection( self.limbModeRC, q=True, select=True)
			mode = pm.radioButton( selectedMode, q=True, label=True ).lower()
		
		except:
			pass
		
		if mode == 'arm':
			pm.select( clear = True )
			self.BipedLimbInitJnts.append( pm.joint ( p = ( BipedLimbSize * 3 / 14.0     , BipedLimbSize*13 / 14.0 , 0) , name = "%s_uparm_initJnt"%side ) )
			
			self.BipedLimbInitJnts.append( pm.joint ( p = ( BipedLimbSize * 7 / 14.0      , BipedLimbSize*13 / 14.0 , 0) , name = "%s_elbow_initJnt"%side ) )
			pm.joint( self.BipedLimbInitJnts[0], e=True, zso=True, oj='xyz', sao='yup')
			
			self.BipedLimbInitJnts.append( pm.joint ( p = ( BipedLimbSize * 11 / 14.0     , BipedLimbSize*13 / 14.0 , 0) , name = "%s_hand_initJnt"%side ) )
			pm.joint( self.BipedLimbInitJnts[1], e=True, zso=True, oj='xyz', sao='yup')
			
			self.BipedLimbInitJnts.append( pm.joint ( p = ( BipedLimbSize * 12 / 14.0     , BipedLimbSize*13 / 14.0 , 0) , name = "%s_handEnd_initJnt"%side ) )
			pm.joint( self.BipedLimbInitJnts[2], e=True, zso=True, oj='xyz', sao='yup')
			
			pm.select ( clear=True )


		elif mode == 'leg':
			pm.select( clear = True )

			self.BipedLimbInitJnts.append( pm.joint(p=(BipedLimbSize*2/7.0, BipedLimbSize*7/7.0, 0), name = "L_initUplegJnt") )

			self.BipedLimbInitJnts.append( pm.joint(p=(BipedLimbSize*2/7.0, BipedLimbSize*4/7.0, 0), name = "L_initKneeJnt") )
			pm.joint( self.BipedLimbInitJnts[0], e=True, zso=True, oj='xzy', sao='xup' )

			self.BipedLimbInitJnts.append( pm.joint(p=(BipedLimbSize*2/7.0, BipedLimbSize*1/7.0, 0), name = "L_initAnkleJnt") )
			pm.joint( self.BipedLimbInitJnts[1], e=True, zso=True, oj='xzy', sao='xup')

			self.BipedLimbInitJnts.append( pm.joint(p=(BipedLimbSize*2/7.0,0,BipedLimbSize*-1/7.0), name = "L_initHeelJnt") )
			pm.joint( self.BipedLimbInitJnts[2], e=True, zso=True, oj='xzy', sao='xup')

			pm.pickWalk( d='up' )

			self.BipedLimbInitJnts.append( pm.joint(p=(BipedLimbSize* 2/7.0, BipedLimbSize*0.5/7.0, BipedLimbSize*1/7.0), name = "L_initBallJnt") )
			pm.joint( self.BipedLimbInitJnts[3], e=True, zso=True, oj='xzy', sao='xup')

			self.BipedLimbInitJnts.append( pm.joint(p=(BipedLimbSize*2/7.0,0,BipedLimbSize*2/7.0), name = "L_initToeEndJnt") )
			pm.joint( self.BipedLimbInitJnts[4], e=True, zso=True, oj='xzy', sao='xup')

			pm.pickWalk( d='up' )

			self.BipedLimbInitJnts.append( pm.joint(p=(BipedLimbSize*2.5/7.0,0,BipedLimbSize*1/7.0), name = "L_initOutFootJnt") )
			pm.joint( self.BipedLimbInitJnts[4], e=True, zso=True, oj='xzy', sao='xup')

			pm.pickWalk( d='up' )

			self.BipedLimbInitJnts.append( pm.joint(p=(BipedLimbSize*1.5/7.0,0,BipedLimbSize*1/7.0), name = "L_initInFootJnt") )
			pm.joint( self.BipedLimbInitJnts[4], e=True, zso=True, oj='xzy', sao='xup')

			pm.select ( clear=True )
예제 #46
0
    def build(self):
        """Constructs gui
        """
        if pm.window('goz', exists=True):
            pm.deleteUI('goz', window=True)

        self.gui_window = pm.window('goz', title="gozbruh", rtf=True,
                                    width=1000, height=700)

        pm.setUITemplate('attributeEditorTemplate', pushTemplate=True)

        main_layout = pm.frameLayout(label='gozbruh Options', cll=False)
        pm.setParent(main_layout)
        #======================================================================
        # GENERAL
        #======================================================================
                    #########SHARED
        pm.setParent(main_layout)
        general_framelayout = pm.frameLayout(label='General Options',
                                             cll=False)
        pm.setParent(general_framelayout)

        general_rcl = pm.rowColumnLayout(nc=2)
        pm.setParent(general_rcl)
        pm.text(label='Shared Dir\t')
        self.user_shared_dir = pm.textField(text=utils.get_shared_dir(),
                                            width=200)

        #======================================================================
        # SERVER
        #======================================================================
        pm.setParent(main_layout)
                    #########ZBRUSH
        zbrush_layout = pm.frameLayout(label='ZBrush', cll=False)
        pm.setParent(zbrush_layout)
        zbrush_rcl = pm.rowColumnLayout(nc=2)
        zbrush_host, zbrush_port = utils.get_net_info(utils.ZBRUSH_ENV)
        pm.text(label='ZBrush Host\t')
        self.user_zbrush_host = pm.textField(text=zbrush_host, width=200)
        pm.text(label='ZBrush Port\t')
        self.user_zbrush_port = pm.textField(text=zbrush_port, width=200)

        pm.setParent(zbrush_layout)
        self.send_btn = pm.button(label="Send Selection to ZBrush")
        self.conn_btn = pm.button(label="Check Connection to ZBrush")
        self.zbrush_status_ui = pm.text(label='Status: not connected',
                                        height=30,
                                        enableBackground=True,
                                        backgroundColor=(1.0, 0.0, 0.0))

                    #########MAYA
        pm.setParent(main_layout)
        pm.text(' ')
        maya_layout = pm.frameLayout(label='Maya', cll=False)
        pm.setParent(maya_layout)
        maya_rcl = pm.rowColumnLayout(nc=2)
        maya_host, maya_port = utils.get_net_info(utils.MAYA_ENV)
        pm.text(label='Maya Host\t')
        self.user_maya_host = pm.textField(text=maya_host, width=200)
        pm.text(label='Maya Port\t')
        self.user_maya_port = pm.textField(text=maya_port, width=200)

        pm.setParent(maya_layout)
        self.listen_btn = pm.button(label="Listen for Meshes from ZBrush")
        self.maya_status_ui = pm.text(label='Status: not listening',
                                      height=30,
                                      enableBackground=True,
                                      backgroundColor=(1.0, 0.0, 0.0))

        #======================================================================
        # MORE OPTIONS
        #======================================================================
        pm.setParent(main_layout)
        pm.text(' ')
        more_framelayout = pm.frameLayout(label='Maya-Specific Options',
                                          cll=False)
        pm.setParent(more_framelayout)
        more_rcl = pm.rowColumnLayout(nc=3)
        pm.text(label='Import Visual Smooth', width=200)
        self.smooth_radio_col = pm.radioCollection()
        self.smooth_radio_off = pm.radioButton(
            label='Off',
            onc=lambda x: pm.optionVar(iv=('gozbruh_smooth', 0)))
        self.smooth_radio_on = pm.radioButton(
            label='On',
            onc=lambda x: pm.optionVar(iv=('gozbruh_smooth', 1)))
        import_smooth = 0
        if pm.optionVar(ex='gozbruh_smooth'):
            import_smooth = pm.optionVar(q='gozbruh_smooth')
        pm.radioCollection(
            self.smooth_radio_col, e=True,
            sl=self.smooth_radio_on if import_smooth else self.smooth_radio_off)

        pm.text(label='Import Delete Old Mesh', width=200)
        self.delete_radio_col = pm.radioCollection()
        self.delete_radio_off = pm.radioButton(
            label='Off',
            onc=lambda x: pm.optionVar(iv=('gozbruh_delete', 0)))
        self.delete_radio_on = pm.radioButton(
            label='On',
            onc=lambda x: pm.optionVar(iv=('gozbruh_delete', 1)))
        import_delete = 0
        if pm.optionVar(ex='gozbruh_delete'):
            import_delete = pm.optionVar(q='gozbruh_delete')
        pm.radioCollection(
            self.delete_radio_col, e=True,
            sl=self.delete_radio_on if import_delete else self.delete_radio_off)

        pm.setParent(main_layout)
        self.retain_btn = pm.button(label="Save Settings", height=50)
        pm.text('\t')
        self.remove_btn = pm.button(label="Default Settings")

        self.gui_window.show()
예제 #47
0
	def UI(self):
		width = 570
		height = 280
		# create window
		if pm.window( 'ehm_BipedLimb_UI', exists=True ):
			pm.deleteUI( 'ehm_BipedLimb_UI' )
		pm.window( 'ehm_BipedLimb_UI', title='Rig Biped Limbs', w=width, h=height, mxb=False, mnb=False, sizeable=True )
		
		# main layout
		baseForm = pm.formLayout()
		frameLayout = pm.frameLayout(borderStyle='etchedIn', labelVisible=False)
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'left', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'right', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'top', 6) )
		pm.formLayout( baseForm, edit=True, attachForm=(frameLayout,'bottom', 38) )
		# pm.scrollLayout( horizontalScrollBarThickness=16, verticalScrollBarThickness=16)
		formLayout = pm.formLayout(w=width, h=height)
		
		
		# spine size
		self.BipedLimbSizeT = pm.text( label="Limb Size: ")	
		self.BipedLimbSizeF = pm.floatSliderGrp(adjustableColumn=4,min=0, max=20, fieldMaxValue=10000, value=5, field=True )

		
		# character mode radio buttons
		self.limbModeText = pm.text(label='Limb Mode: ', align='right')
		self.limbModeRC = pm.radioCollection()
		self.armRB = pm.radioButton(label="Arm", select=True )
		self.legRB = pm.radioButton(label="Leg")

		
		# number of joints
		self.numOfJntsText = pm.text( label='Number of joints: ', align='right')		
		self.numOfJntsIS = pm.intSliderGrp( field=True, value=6, maxValue=20, fieldMaxValue=1000 )		
		
		
		# extras check boxes
		self.extrasText = pm.text( label='Extras: ', align='right' )		
		self.bendyCB = pm.checkBox( label="Bendy", value=True )
		
		
		# buttons
		self.initButton = pm.button( label='Place joints',  h=30,  c=partial( self.bipedLimb_init, 10, 'arm', 'L' ), parent=baseForm  )
		self.packButton = pm.button( label='Finish Rig', h=30,  c=partial( self.bipedLimb_pack, 1.0, 'FKIK', True, 6, True, 'arm' ), parent=baseForm    )		
		self.closeButton = pm.button( label='Close', h=30,  c= self.closeUI , parent=baseForm    )		

		
		# place spine size
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BipedLimbSizeT,'right', 0, 28 ) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.BipedLimbSizeT,'top', 17 ) )

		pm.formLayout( formLayout, edit=True, attachPosition=(self.BipedLimbSizeF,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.BipedLimbSizeF,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachForm=(self.BipedLimbSizeF,'top', 15 ) )	
		
		# place character mode
		pm.formLayout( formLayout, edit=True, attachPosition=(self.limbModeText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.limbModeText,'top', 17, self.BipedLimbSizeT) )
		
		pm.formLayout( formLayout, edit=True, attachPosition=(self.armRB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.armRB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.armRB,'top', 15, self.BipedLimbSizeT) )		

		pm.formLayout( formLayout, edit=True, attachPosition=(self.legRB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.legRB,'right', 15, 100 ) )
		
		pm.formLayout( formLayout, edit=True, attachControl=(self.legRB,'top', 35, self.BipedLimbSizeT) )	
		
		
		# place number of joints
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfJntsText,'top', 17, self.legRB) )
	
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsIS,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.numOfJntsIS,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.numOfJntsIS,'top', 12, self.legRB ) )	

				
		
		# place check boxes
		pm.formLayout( formLayout, edit=True, attachPosition=(self.extrasText,'right', 0 , 28) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.extrasText,'top', 17, self.numOfJntsIS) )
	
		pm.formLayout( formLayout, edit=True, attachPosition=(self.bendyCB,'left', 0, 30 ) )
		pm.formLayout( formLayout, edit=True, attachPosition=(self.bendyCB,'right', 15, 100 ) )
		pm.formLayout( formLayout, edit=True, attachControl=(self.bendyCB,'top', 15, self.numOfJntsIS ) )	
		

		# place buttons		
		pm.formLayout( baseForm, edit=True, attachPosition=(self.initButton,'left', 3, 0) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.initButton,'right', 1, 33) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.initButton,'bottom', 3) )	

		pm.formLayout( baseForm, edit=True, attachPosition=(self.packButton,'left', 1, 33) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.packButton,'right', 3, 66) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.packButton,'bottom', 3) )	

		pm.formLayout( baseForm, edit=True, attachPosition=(self.closeButton,'left', 1, 66) )
		pm.formLayout( baseForm, edit=True, attachPosition=(self.closeButton,'right', 3, 100) )
		pm.formLayout( baseForm, edit=True, attachForm=(self.closeButton,'bottom', 3) )	

		# show window
		pm.showWindow( 'ehm_BipedLimb_UI' )
예제 #48
0
파일: mimic_ui.py 프로젝트: yazici/Mimic
def _build_general_settings_tab(parent_layout):
    # Create column Layout for General settings
    general_settings_tab_layout = pm.columnLayout('generalSettings',
                                                  adj=True,
                                                  width=100)
    pm.separator(height=3, style='none')

    pm.rowLayout(numberOfColumns=3,
                 columnWidth3=(55, 250, 30),
                 adjustableColumn=2,
                 columnAlign=[(1, 'left'), (2, 'left')],
                 columnAttach=[(1, 'both', -1), (2, 'both', 0),
                               (3, 'both', 0)])
    pm.text(label="Directory:")
    pm.textField('t_programDirectoryText', text='', ed=False, font=FONT)

    pm.symbolButton('b_directoryImage',
                    image="setDirectory_icon.png",
                    width=32,
                    height=20,
                    command=mimic_utils.set_program_dir)
    pm.setParent('..')

    pm.rowLayout(numberOfColumns=2,
                 adjustableColumn=2,
                 columnAttach=(1, 'left', -1),
                 columnWidth=[(1, 90), (2, 100)],
                 height=20)
    pm.text(label='Output name:')
    pm.textField('t_outputFileName',
                 text=postproc_config.DEFAULT_OUTPUT_NAME,
                 font=FONT)

    pm.setParent('..')

    pm.rowLayout(numberOfColumns=2,
                 adjustableColumn=2,
                 columnAttach=(1, 'left', -1),
                 columnWidth=[(1, 90), (2, 100)],
                 height=20)
    pm.text(label='Template name:')
    pm.textField('t_templateFileName',
                 text=postproc_config.DEFAULT_TEMPLATE_NAME,
                 font=FONT)

    pm.setParent('..')

    # Sample rate radio buttons
    pm.separator(height=3, style='none')
    selected_units = postproc_config.DEFAULT_SAMPLE_RATE_UNITS
    selected_value = postproc_config.DEFAULT_SAMPLE_RATE_VALUE
    radio_indent = 3
    pm.radioCollection('sample_rate_radio_collection')
    pm.rowLayout(numberOfColumns=3,
                 adjustableColumn=3,
                 columnAttach=(1, 'left', radio_indent),
                 columnWidth=[(1, 90), (2, 45)],
                 height=20)
    pm.radioButton('rb_timeInterval', label='Sample rate:', select=True)
    pm.textField('t_timeBetweenSamples', text=selected_value, font=FONT)
    pm.radioButtonGrp(
        'time_unit_radio_group',
        labelArray2=['s', 'f'],
        annotation='Sample rate units: seconds or frames',
        numberOfRadioButtons=2,
        columnWidth2=[32, 30],
        select=1 if selected_units == 'seconds' else 2)  # 1-based integer
    pm.setParent('..')

    pm.rowLayout(numberOfColumns=1,
                 adjustableColumn=1,
                 columnAttach=(1, 'left', radio_indent),
                 height=20)
    pm.radioButton('rb_keyframesOnly',
                   label='Sample keyframes only',
                   enable=True)
    pm.setParent('..')

    pm.rowLayout(numberOfColumns=3,
                 adjustableColumn=3,
                 columnAttach=(1, 'left', -1),
                 columnWidth=[(1, 132), (2, 40), (3, 30)],
                 height=20)
    pm.text(label='Animation frame range:')

    pm.intField("i_programStartFrame",
                value=pm.playbackOptions(animationStartTime=True, query=True),
                minValue=-10,
                maxValue=100000,
                step=1)

    pm.intField("i_programEndFrame",
                value=pm.playbackOptions(animationEndTime=True, query=True),
                minValue=-10,
                maxValue=100000,
                step=1)
    pm.setParent('..')

    pm.separator(height=5, style='none')

    # Post processor option menu list
    pm.optionMenu('postProcessorList',
                  label='Processor:',
                  height=18,
                  changeCommand=postproc_options.overwrite_options)

    # Get supported post-processors and fill option menu list
    supported_post_processors = postproc_setup.get_processor_names()
    for post in supported_post_processors:
        pm.menuItem(label=post)
    pm.separator(height=3, style='none')

    pm.setParent(parent_layout)
    return general_settings_tab_layout
예제 #49
0
 def __init__(self, button_info):
     info = button_info.split('==')
     self.label = info[0]
     self.state = info[1]
     self.radio_button = pm.radioButton(label= self.label)
예제 #50
0
	def BakeTransform( self, bakeOnNewLocator=True, *args ): # BakeTransform( bakeOnNewLocator=False )
		'''
		Useful for exporting translate and rotate animation to other 3D packages.	
		
		if bakeOnNewLocator in True: For every selected object, creates a locator and bakes object's animation on this locator.
		if bakeOnNewLocator in False: For every selected object, bakes their translate, rotate and scale animations in world space.
		
		'''
		objs = pm.ls( sl=True )
		
		if not objs:
			pm.warning( "ehm_tools...BakeAnimation: Select an object to bake it's transform animation." )
			return


		try: # get info from UI, if in UI mode
			selectedItem = pm.radioCollection( self.bakeModeRC, q=True, select=True )
			bakeOnNewLocatorState = pm.radioButton( selectedItem, q=True, label=True )
			
			if bakeOnNewLocatorState == 'Bake On New Locator':
				bakeOnNewLocator=True
			else:
				bakeOnNewLocator=False
		except:
			pass
		
		
		timeRange = self.getTimeRange()
	
	

		locs = []
		cons = []
		
		
					
		# for each selected object...
		for obj in objs: # bake it's animation on a new locator
			if obj.type() in [ 'transform', 'joint' ]:
				loc = pm.spaceLocator( name= '%s_SRT'%obj.name() )
				cons.append( pm.pointConstraint( obj, loc ) )
				cons.append( pm.orientConstraint( obj, loc ) )
				cons.append( pm.scaleConstraint( obj, loc ) )
				
				# hide all objects to increase speed of baking animation, 
				IsolateSelected(  state=True, showSelected=False  )
				
				locs.append( loc )				
		
			
		pm.bakeResults( locs , simulation=True, t=timeRange, disableImplicitControl=True, preserveOutsideKeys=True, removeBakedAttributeFromLayer=False, bakeOnOverrideLayer=False, controlPoints=False, shape=False )

		
		# unhide all objects
		allModelPanels = pm.getPanel( type='modelPanel' )
		for onePanel in allModelPanels:
			pm.isolateSelect( onePanel, state=False )
		
		pm.delete( cons )

		pm.select( locs )
		
		
		cons = []
		
		# for each selected object...	
		if not bakeOnNewLocator: # bake keys on selected objects themseleves not on new locators
			bakedObjects = pm.group( empty=True, name='baked_objects_grp')
			
			for i in range( len(objs) ):
				UnlockUnhideAttrs( objs = objs[i] )
				self.removeConnections( objs = objs[i] )
				pm.parent( objs[i], bakedObjects )
				
				cons.append( pm.pointConstraint( locs[i], objs[i] ) )
				cons.append( pm.orientConstraint( locs[i], objs[i] ) )
				cons.append( pm.scaleConstraint( locs[i], objs[i] ) )			
				
				# hide all objects to increase speed of baking animation, 
				IsolateSelected(  state=True, showSelected=False )
					

			pm.bakeResults( objs , simulation=True, t=timeRange, disableImplicitControl=True, preserveOutsideKeys=True, removeBakedAttributeFromLayer=False, bakeOnOverrideLayer=False, controlPoints=False, shape=False )
					
			
			# unhide all objects
			for onePanel in allModelPanels:
				pm.isolateSelect( onePanel, state=False )
		
			pm.delete( cons )
			pm.delete( locs )	
			pm.select( objs )