コード例 #1
0
ファイル: skinning.py プロジェクト: griffinanimator/MPR
    def processInitialSelection(self):
        selection = cmds.ls(selection=True)

        setupContents = []

        geometry = self.findGeometry(selection)

        characterContainer = turbineUtils.getCharacterInfo()[1]
        characterName = turbineUtils.getCharacterInfo()[0]
        # exportName will define the name of the export node and can also be used
        # for the namespace the export node resides in

        setupNode = turbineUtils.getCharacterInfo()[3]

        # Use the joint class to identify the joints in the scene
        import tsapi.core.maya.joint as joint
        reload(joint)

        joint = joint.joint()
        #ignoreBones = joint.GetGameJointInfo()[2]
        gameJoints = joint.GetGameJointInfo()[0]

        geoNode = ("Geometry")

        if geometry == None:
            cmds.headsUpMessage(
                "please select the geometry you wish to attach to the specified blueprint joint."
            )
        else:
            self.doSkin(geometry, gameJoints, geoNode, setupNode)

        return (geometry, characterContainer, characterName, gameJoints,
                geoNode, setupNode)
コード例 #2
0
    def __init__(self):
        """ Get the ArtPath """
        

        self.paths = {}
        
        self.characterName = 'Character__tmp'
       
        # Use the character name to determine the name of the setup node
        try:
            self.characterName = turbineUtils.getCharacterInfo()[0]
            self.characterPrefix = turbineUtils.getCharacterInfo()[2]
            self.exportPrefix = self.characterPrefix.replace('Character__', 'Export__')
        except: pass
     
        self.paths = {}
       
        """ Set the path to the animLib """
        self.paths['animLib'] = (self.artPath + "/character/GEPPETTO/Animation/animLib/")
        self.paths['userRigSetting'] = (self.artPath + "/character/GEPPETTO/Data/UserSettings/")
        self.paths['characters'] = (self.artPath + "character/")

        self.paths['charPath'] = (self.artPath + '/character/' + self.characterName)
        
        self.paths['animationPath'] = (self.paths['charPath'] + '/animation/')
        self.paths['setupPath'] = (self.paths['charPath'] + '/rig/setup/')
        self.paths['rigPath'] = (self.paths['charPath'] + '/rig/')
        self.paths['exportPath'] = (self.paths['charPath'] + '/export/')
        self.paths['ragdollPath'] = (self.paths['charPath'] + '/ragdoll/')
        #self.paths['setupPath'] = (self.charPath + '/setup/' + self.characterName)
        self.paths['wipPath'] = (self.paths['rigPath'] + '/wip/')
        
        self.paths['rigDir'] = (self.artPath + "/character/GEPPETTO/Rig/")
        self.paths['jointInfo'] = (self.artPath + "/character/GEPPETTO/Data/Character/")
コード例 #3
0
ファイル: skinning.py プロジェクト: griffinanimator/MPR
    def processInitialSelection(self):
        selection = cmds.ls(selection=True)
        
        setupContents = []
        
        geometry = self.findGeometry(selection)
        
        characterContainer = turbineUtils.getCharacterInfo()[1]
        characterName = turbineUtils.getCharacterInfo()[0]
        # exportName will define the name of the export node and can also be used 
        # for the namespace the export node resides in
        
        setupNode = turbineUtils.getCharacterInfo()[3]

        # Use the joint class to identify the joints in the scene
        import System.jointUtils as jntUtils
        
        joint = jntUtils.gameJoint_Utils()
        gameJoints = joint.getGameJoints()
        
        geoNode = ("Geometry")
        
        if geometry == None:
            cmds.headsUpMessage("please select the geometry you wish to attach to the specified blueprint joint.")
        else:      
            self.doSkin(geometry, gameJoints, geoNode, setupNode) 
       
        return (geometry, characterContainer, characterName, gameJoints, geoNode, setupNode)
コード例 #4
0
 def __init__(self):
     print 'init batch tools'
     self.characterName = turbineUtils.getCharacterInfo()[0]
     self.characterPrefix = turbineUtils.getCharacterInfo()[2]
     
     import System.directoryExtension as dirExt
     dirExt = dirExt.DirectoryExtension()
     self.animDir = dirExt.paths['animLib']
コード例 #5
0
    def doSkin(self, geometry, gameJoints, geoNode, setupNode):
        # Set the namespace to the export namespace
        characterName = turbineUtils.getCharacterInfo()[0]

        exportName = turbineUtils.getCharacterInfo()[3]

        cmds.namespace(set=":")

        # Create a geometry container

        if cmds.objExists(geoNode):
            print "Geo node exists"
        else:
            geoGrp = cmds.group(n=geoNode, empty=True)

        cmds.lockNode(setupNode, lock=False, lockUnpublished=False)

        for geo in geometry:
            cmds.select(d=True)
            import maya.mel as mel

            cmds.select(gameJoints, geo)

            skinClust = cmds.skinCluster(gameJoints,
                                         geo,
                                         tsb=True,
                                         maximumInfluences=2,
                                         omi=True,
                                         rui=False,
                                         sm=0,
                                         normalizeWeights=1,
                                         n=geo + "_skinCluster")
            try:
                cmds.parent(geo, geoNode)
            except:
                pass
            try:
                cmds.container(setupNode,
                               edit=True,
                               addNode=geoGrp,
                               inc=True,
                               ihb=True,
                               it=True,
                               ish=True,
                               isd=True)
            except:
                pass

        cmds.lockNode(setupNode, lock=True, lockUnpublished=True)
        # Set the namespace back to default
        cmds.namespace(set=":")
コード例 #6
0
ファイル: altSetupTools.py プロジェクト: griffinanimator/MPR
    def __init__(self):
        """ Initialize class and variables """
        # Use the character name to determine the name of the setup node
        self.characterName = turbineUtils.getCharacterInfo()[0]
        self.characterPrefix = turbineUtils.getCharacterInfo()[2]
        self.exportPrefix = self.characterPrefix.replace('Character__', 'Export__')
        
        self.dirExt = dirExt.DirectoryExtension() 
        
        """ Define the character_container """
        self.characterContainer = (self.characterPrefix + ':character_container')

        """ Define the export_container """
        self.exportContainer = (self.exportPrefix + ':Setup')
コード例 #7
0
 def __init__(self):
     self.containers = {}
     
     try:
         self.characterName = turbineUtils.getCharacterInfo()[0]
         self.characterPrefix = turbineUtils.getCharacterInfo()[2]
         self.exportPrefix = self.characterPrefix.replace('Character__', 'Export__')
     except: pass
     
     """ Run all the functions to collect the container names """
     self.characterContainers() 
     self.blueprintContainers()
     self.animationModContainers()
     self.allContainers()
     
     print self.containers['characterContainer']
コード例 #8
0
    def __init__(self):
        self.containers = {}

        try:
            self.characterName = turbineUtils.getCharacterInfo()[0]
            self.characterPrefix = turbineUtils.getCharacterInfo()[2]
            self.exportPrefix = self.characterPrefix.replace(
                'Character__', 'Export__')
        except:
            pass
        """ Run all the functions to collect the container names """
        self.characterContainers()
        self.blueprintContainers()
        self.animationModContainers()
        self.allContainers()

        print self.containers['characterContainer']
コード例 #9
0
ファイル: skinning.py プロジェクト: griffinanimator/MPR
    def doSkin(self, geometry, gameJoints, geoNode, setupNode):
        # Set the namespace to the export namespace
        characterName = turbineUtils.getCharacterInfo()[0]
        
        exportName = turbineUtils.getCharacterInfo()[3]
        
        cmds.namespace(set=":")
        
        # Create a geometry container

        if cmds.objExists(geoNode):
            print "Geo node exists"
        else:
            geoGrp = cmds.group(n=geoNode, empty=True)
            cmds.setAttr("Geometry.overrideEnabled", 1)

        cmds.lockNode(setupNode, lock=False, lockUnpublished=False)
        try:     
            """ Publish the displayType attribute to the setup container """
            cmds.container(setupNode, edit=True, publishAndBind=["Geometry.overrideDisplayType", "GeoDisplay"]) 
        except: print 'Attribute exists'
            
        for geo in geometry:
            cmds.select(d=True)
            import maya.mel as mel
            
            cmds.select(gameJoints, geo)
            
            """ I need to find out if the skin cluster exists.  If so, index the name +1"""
            skinClusterName = (geo+"_skinCluster")                
            skinClust = cmds.skinCluster(gameJoints, geo, tsb=True, maximumInfluences=4, omi=True, rui=False, sm=0, normalizeWeights=1, n=skinClusterName)
            try:
                cmds.parent(geo, geoNode)
            except: pass
            try:
                cmds.container(setupNode, edit=True, addNode=geoGrp, inc=True, ihb=True, it=True, ish=True, isd=True)
            except: pass           
            
        #cmds.lockNode(setupNode, lock=True, lockUnpublished=True)
        # Set the namespace back to default
        cmds.namespace(set=":")
コード例 #10
0
ファイル: skinning.py プロジェクト: griffinanimator/MPR
    def editModeToggle(self, *args):

        setupNode = turbineUtils.getCharacterInfo()[3]
   
        labelVal = cmds.button(self.UIElements["editBtn"], q=True, l=True )
        if labelVal == "Edit Mode On":
            cmds.button(self.UIElements["editBtn"], edit=True, l="Edit Mode Off" )
            cmds.lockNode(setupNode, lock=True, lockUnpublished=True)
                
        else:
            cmds.button(self.UIElements["editBtn"], edit=True, l="Edit Mode On" )
            cmds.lockNode(setupNode, lock=False, lockUnpublished=False)
コード例 #11
0
ファイル: skinning.py プロジェクト: griffinanimator/MPR
    def editModeToggle(self, *args):

        setupNode = turbineUtils.getCharacterInfo()[3]

        labelVal = cmds.button(self.UIElements["editBtn"], q=True, l=True)
        if labelVal == "Edit Mode On":
            cmds.button(self.UIElements["editBtn"],
                        edit=True,
                        l="Edit Mode Off")
            cmds.lockNode(setupNode, lock=True, lockUnpublished=True)

        else:
            cmds.button(self.UIElements["editBtn"],
                        edit=True,
                        l="Edit Mode On")
            cmds.lockNode(setupNode, lock=False, lockUnpublished=False)
コード例 #12
0
def findAnimContainers():
    # Get the character name frome turbineUtils
    fullCharName = turbineUtils.getCharacterInfo()[2]
    # Find the root character container
    characterContainer = (fullCharName + ":character_container")
    cmds.select(characterContainer)
    
    # Get all the module_containers
    allContainers = []
    containerNodes = cmds.container(characterContainer, q=True, nl=True)
    
    for container in containerNodes:
        selContainer = container.encode("ascii","ignore")
  
        suffix = "module_container"
        
        result = selContainer.endswith(suffix)
        
        if result == True:
            allContainers.append(selContainer)

    return allContainers
コード例 #13
0
def findAnimContainers():
    # Get the character name frome turbineUtils
    fullCharName = turbineUtils.getCharacterInfo()[2]
    # Find the root character container
    characterContainer = (fullCharName + ":character_container")
    cmds.select(characterContainer)

    # Get all the module_containers
    allContainers = []
    containerNodes = cmds.container(characterContainer, q=True, nl=True)

    for container in containerNodes:
        selContainer = container.encode("ascii", "ignore")

        suffix = "module_container"

        result = selContainer.endswith(suffix)

        if result == True:
            allContainers.append(selContainer)

    return allContainers
コード例 #14
0
    def setupInstallProc(self, characterName):
        # Return the directory names from setupDirs
        projectDirs = turbineUtils.setupDirs(characterName, create=False)
        setupDir = projectDirs[1]
        xmlDir = projectDirs[2]
        rigDir = projectDirs[3]
        characterFileName = projectDirs[5]
        xmlFileName = projectDirs[7]

        selItem = cmds.textScrollList(
            self.SaveTemplateUIElements["characterList"], q=True, si=True)

        setupFileName = (setupDir + selItem[0] + ".ma")

        # use turbineUtils to find out the namespaces.
        fullCharName = turbineUtils.getCharacterInfo()[2]

        characterNamespace = fullCharName
        exportNamespace = fullCharName.replace("Character", "Export")

        try:
            cmds.namespace(add=exportNamespace)
        except:
            pass

        characterNameString = (characterNamespace + ":")

        # Unlock
        characterContainer = (characterNamespace + ":character_container")
        cmds.lockNode(characterContainer, lock=False, lockUnpublished=False)
        """ Check to see if a setup container already exists."""
        """If a setup_grp exists, delete it."""

        setupContainer = turbineUtils.getCharacterInfo()[3]

        # Delete the contents of the setup container
        if cmds.objExists(setupContainer):
            cmds.select(setupContainer)
            cmds.lockNode(lock=False, lu=False)
            setupNodes = cmds.container(setupContainer, q=True, nl=True)
            cmds.delete(setupNodes)

        # Import the setup
        # If the setup file exists on disk, import it.  Else we should build the setup
        if cmds.file(setupFileName, q=True, ex=True):
            cmds.file(setupFileName, i=True)
            #Setup_grp vis to 0
            cmds.setAttr("Setup_grp.visibility", 0)
            """ Create the setup container if it does not exist """
            if cmds.objExists(setupContainer):
                pass
            else:
                cmds.container(n=setupContainer)
        """ Add the setup and geometry groups to the setup container """
        cmds.container(setupContainer,
                       edit=True,
                       addNode="Setup_grp",
                       ihb=True,
                       force=True)
        try:
            cmds.container(setupContainer,
                           edit=True,
                           addNode="Geometry",
                           ihb=True,
                           force=True)
        except:
            pass

        constraints = turbineUtils.parentToBlueprint(xmlFileName,
                                                     characterNameString)
        parentConstraints = constraints[0]
        scaleConstraints = constraints[1]
        """ Add the game_joint_parentConstraints to the Setup container """
        for constraint in parentConstraints:
            cmds.container(setupContainer,
                           edit=True,
                           addNode=constraint,
                           ihb=True,
                           force=True)
        for constraint in scaleConstraints:
            cmds.container(setupContainer,
                           edit=True,
                           addNode=constraint,
                           ihb=True,
                           force=True)

        # Use turbineUtils to set bone marking and holding locations.
        turbineUtils.boneMarking()

        holdLocs = turbineUtils.loadHoldLocs()

        # add holding locs to the setup container
        cmds.container(setupContainer,
                       edit=True,
                       addNode=holdLocs,
                       inc=True,
                       ihb=True,
                       includeNetwork=True,
                       force=True)

        cmds.namespace(set=":")

        cmds.lockNode(characterContainer, lock=True, lockUnpublished=True)
        cmds.lockNode(setupContainer, lock=True, lockUnpublished=True)
        cmds.deleteUI(self.SaveTemplateUIElements["window"])

        # Get the user name and inform the user
        currentUser = getUser()
        niceName = (currentUser)[1]
        cmds.headsUpMessage(self.characterName + " has been installed " +
                            niceName)

        return (characterContainer, setupContainer)
コード例 #15
0
    def doSkin(self, geometry, gameJoints, geoNode, setupNode):
        # Set the namespace to the export namespace
        characterName = turbineUtils.getCharacterInfo()[0]

        exportName = turbineUtils.getCharacterInfo()[3]

        cmds.namespace(set=":")

        # Create a geometry container

        if cmds.objExists(geoNode):
            print "Geo node exists"
        else:
            geoGrp = cmds.group(n=geoNode, empty=True)
            cmds.setAttr("Geometry.overrideEnabled", 1)

        cmds.lockNode(setupNode, lock=False, lockUnpublished=False)
        try:
            """ Publish the displayType attribute to the setup container """
            cmds.container(
                setupNode,
                edit=True,
                publishAndBind=["Geometry.overrideDisplayType", "GeoDisplay"])
        except:
            print 'Attribute exists'

        for geo in geometry:
            cmds.select(d=True)
            import maya.mel as mel

            cmds.select(gameJoints, geo)
            """ I need to find out if the skin cluster exists.  If so, index the name +1"""
            skinClusterName = (geo + "_skinCluster")
            skinClust = cmds.skinCluster(gameJoints,
                                         geo,
                                         tsb=True,
                                         maximumInfluences=4,
                                         omi=True,
                                         rui=False,
                                         sm=0,
                                         normalizeWeights=1,
                                         n=skinClusterName)
            try:
                cmds.parent(geo, geoNode)
            except:
                pass
            try:
                cmds.container(setupNode,
                               edit=True,
                               addNode=geoGrp,
                               inc=True,
                               ihb=True,
                               it=True,
                               ish=True,
                               isd=True)
            except:
                pass

        #cmds.lockNode(setupNode, lock=True, lockUnpublished=True)
        # Set the namespace back to default
        cmds.namespace(set=":")
コード例 #16
0
ファイル: skinning.py プロジェクト: griffinanimator/MPR
 def __init__(self):
     self.characterName = turbineUtils.getCharacterInfo()[0]
     self.fullCharName = turbineUtils.getCharacterInfo()[2]
コード例 #17
0
 def __init__(self):
     self.characterName = turbineUtils.getCharacterInfo()[0]
     self.fullCharName = turbineUtils.getCharacterInfo()[2]
コード例 #18
0
 def __init__(self):
     """ Initialize class and variables """
     # Use the character name to determine the name of the setup node
     self.characterName = turbineUtils.getCharacterInfo()[0]
     self.fullCharName = turbineUtils.getCharacterInfo()[2]