<s> """<STR_LIT>""" <EOL> from common . core import globalVariables as gv <EOL> from common . diagnostic import pcsLogger <EOL> from common . fileIO import parser_schema , pcsPath , fileManip <EOL> from copy import copy <EOL> from pymel . all import * <EOL> from pymel . internal . plogging import pymelLogger <EOL> from re import search <EOL> import getpass <EOL> import time <EOL> class Maya ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( Maya , self ) . __init__ ( ) <EOL> self . mayaVer = self . getMayaVersion ( ) <EOL> self . logger = None <EOL> self . setLogger ( ) <EOL> @ property <EOL> def teamA ( self ) : <EOL> return gv . teamA <EOL> @ property <EOL> def teamB ( self ) : <EOL> return gv . teamB <EOL> def getMayaVersion ( self , strVersion = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> if search ( '<STR_LIT>' , about ( version = <NUM_LIT:1> ) ) : <EOL> if strVersion : <EOL> return about ( version = <NUM_LIT:1> ) . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:0> ] <EOL> else : <EOL> return float ( about ( version = <NUM_LIT:1> ) . split ( '<STR_LIT:U+0020>' ) [ <NUM_LIT:0> ] ) <EOL> else : <EOL> if strVersion : <EOL> return about ( version = <NUM_LIT:1> ) <EOL> else : <EOL> return float ( about ( version = <NUM_LIT:1> ) ) <EOL> def makeLogger ( self , filePathName = '<STR_LIT>' % ( gv . logLocation , getpass . getuser ( ) , getpass . getuser ( ) ) , <EOL> name = '<STR_LIT>' , fresh = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> return pcsLogger . pcs_logger ( filePathName , pymelLogger , name , fresh ) <EOL> def setLogger ( self , filePathName = '<STR_LIT>' % ( gv . logLocation , getpass . getuser ( ) , getpass . getuser ( ) ) , <EOL> name = '<STR_LIT>' , fresh = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> self . logger = pcsLogger . pcs_logger ( filePathName = filePathName , name = name , fresh = fresh ) <EOL> def getEnv ( self , sPrint = <NUM_LIT:1> , unformattedReturn = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> scriptPaths = mel . getenv ( "<STR_LIT>" ) <EOL> plugInPaths = mel . getenv ( "<STR_LIT>" ) <EOL> pythonPaths = mel . getenv ( "<STR_LIT>" ) <EOL> iconPaths = mel . getenv ( "<STR_LIT>" ) <EOL> pathPaths = mel . getenv ( "<STR_LIT>" ) <EOL> sysPaths = sys . path <EOL> envReturn = [ ] <EOL> splitString = '<STR_LIT:;>' <EOL> if os . name == '<STR_LIT>' : <EOL> splitString = '<STR_LIT::>' <EOL> allPythonPaths = pythonPaths . split ( splitString ) <EOL> envReturn . append ( "<STR_LIT>" ) <EOL> for pythonPath in allPythonPaths : <EOL> envReturn . append ( '<STR_LIT>' % pythonPath ) <EOL> allIconPaths = iconPaths . split ( splitString ) <EOL> envReturn . append ( "<STR_LIT>" ) <EOL> for iconPath in allIconPaths : <EOL> envReturn . append ( '<STR_LIT>' % iconPath ) <EOL> allPathPaths = pathPaths . split ( splitString ) <EOL> envReturn . append ( "<STR_LIT>" ) <EOL> for pathPath in allPathPaths : <EOL> envReturn . append ( '<STR_LIT>' % pathPath ) <EOL> envReturn . append ( "<STR_LIT>" ) <EOL> for sysPath in sysPaths : <EOL> envReturn . append ( '<STR_LIT>' % sysPath ) <EOL> allScriptPaths = scriptPaths . split ( splitString ) <EOL> envReturn . append ( "<STR_LIT>" ) <EOL> for scriptPath in allScriptPaths : <EOL> envReturn . append ( '<STR_LIT>' % scriptPath ) <EOL> allPlugInPaths = plugInPaths . split ( splitString ) <EOL> envReturn . append ( "<STR_LIT>" ) <EOL> for plugInPath in allPlugInPaths : <EOL> envReturn . append ( '<STR_LIT>' % plugInPath ) <EOL> if sPrint : <EOL> print '<STR_LIT:\n>' <EOL> pArr = [ pArr for pArr in envReturn if pArr . strip ( ) ] <EOL> for p in pArr : <EOL> if p . split ( '<STR_LIT:\n>' ) [ <NUM_LIT:0> ] : <EOL> print p . split ( '<STR_LIT:\n>' ) [ <NUM_LIT:0> ] <EOL> elif p . split ( '<STR_LIT:\n>' ) [ <NUM_LIT:1> ] != '<STR_LIT>' : <EOL> print '<STR_LIT:\n>' <EOL> print p . split ( '<STR_LIT:\n>' ) [ <NUM_LIT:1> ] <EOL> else : <EOL> if unformattedReturn : <EOL> pArr = [ pArr for pArr in envReturn if pArr . strip ( ) ] <EOL> uReturn = [ ] <EOL> for l in pArr : <EOL> if l != '<STR_LIT>' : <EOL> uReturn . append ( str ( l . replace ( '<STR_LIT:\n>' , '<STR_LIT>' ) ) ) <EOL> return uReturn <EOL> else : <EOL> return envReturn <EOL> def getMayaEnvFile ( self ) : <EOL> """<STR_LIT>""" <EOL> return pcsPath . Path ( about ( environmentFile = True ) ) <EOL> def getMayaUserSetupFile ( self ) : <EOL> """<STR_LIT>""" <EOL> usf = '<STR_LIT>' % ( cmds . internalVar ( userScriptDir = True ) , '<STR_LIT>' ) <EOL> return pcsPath . Path ( usf ) <EOL> def loadPlugIn ( self , plugName ) : <EOL> """<STR_LIT>""" <EOL> result = <NUM_LIT:1> <EOL> if not cmds . pluginInfo ( plugName , q = True , l = True ) : <EOL> cmds . loadPlugin ( plugName ) <EOL> result = cmds . pluginInfo ( plugName , q = True , l = True ) <EOL> return result <EOL> class MayaPrintCore ( Maya ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaPrintCore , self ) . __init__ ( ) <EOL> def debugInfo ( self , loud , text , title = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> if not self . logger : <EOL> self . setLogger ( ) <EOL> self . logger . debug ( text ) <EOL> if loud == <NUM_LIT:1> : <EOL> print "<STR_LIT>" % text <EOL> cmds . refresh ( ) <EOL> if loud == <NUM_LIT:2> : <EOL> result = cmds . confirmDialog ( t = "<STR_LIT>" % title , m = text , b = [ '<STR_LIT:OK>' , '<STR_LIT>' ] , db = '<STR_LIT:OK>' , cb = '<STR_LIT>' , <EOL> ds = '<STR_LIT>' ) ; <EOL> if result == "<STR_LIT>" : <EOL> print "<STR_LIT>" <EOL> sys . exit ( ) <EOL> class MayaSceneCore ( Maya ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaSceneCore , self ) . __init__ ( ) <EOL> def getAllControls ( self , ns = None ) : <EOL> """<STR_LIT>""" <EOL> allControls = None <EOL> setName = '<STR_LIT>' <EOL> if ns : <EOL> setName = '<STR_LIT>' % ( ns , setName ) <EOL> if objExists ( setName ) : <EOL> allControls = setName <EOL> else : <EOL> for oSet in ls ( type = '<STR_LIT>' ) : <EOL> if re . search ( setName , oSet ) : <EOL> allControls = oSet <EOL> if objExists ( allControls ) : <EOL> select ( allControls ) <EOL> else : <EOL> self . logger . warning ( "<STR_LIT>" % setName ) <EOL> return allControls <EOL> def getTopGroups ( self ) : <EOL> topGroups = [ grp for grp in ls ( type = '<STR_LIT>' ) if not grp . getParent ( ) and not grp . getShape ( ) ] <EOL> newTopGroups = [ ] <EOL> if self . mayaVer >= <NUM_LIT> : <EOL> newTopGroups = copy . copy ( topGroups ) <EOL> else : <EOL> newTopGroups = copy ( topGroups ) <EOL> for cam in topGroups : <EOL> for child in cam . getChildren ( ) : <EOL> self . check4Dup ( child , <NUM_LIT:1> , '<STR_LIT>' ) <EOL> if len ( cam . getChildren ( ) ) == <NUM_LIT:1> and objectType ( cam . getChildren ( ) ) == '<STR_LIT>' : <EOL> newTopGroups . remove ( cam ) <EOL> return newTopGroups <EOL> def getFosterParents ( self ) : <EOL> """<STR_LIT>""" <EOL> fParents = [ ] <EOL> tNodes = ls ( type = '<STR_LIT>' ) <EOL> if tNodes : <EOL> for e in tNodes : <EOL> if re . search ( '<STR_LIT>' , e . name ( ) ) : <EOL> fParents . append ( e ) <EOL> if fParents : <EOL> return fParents <EOL> def getMeshGrps ( self , meshes = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> meshGrps = [ ] <EOL> allMeshes = [ ] <EOL> for grp in self . getTopGroups ( ) : <EOL> for child in self . meshesInGroup ( grp ) : <EOL> if isinstance ( child , nt . Mesh ) or re . search ( '<STR_LIT>' , child . name ( ) , re . I ) : <EOL> meshGrps . append ( Transform ( grp ) ) <EOL> allMeshes . append ( child ) <EOL> assert ( len ( meshGrps ) > <NUM_LIT:0> ) , "<STR_LIT>" <EOL> if meshes : <EOL> assert ( len ( allMeshes ) > <NUM_LIT:0> ) , '<STR_LIT>' <EOL> return allMeshes <EOL> return meshGrps <EOL> def getActorMeshes ( self ) : <EOL> return self . getMeshGrps ( <NUM_LIT:1> ) <EOL> def getDefaultExportMeshes ( self ) : <EOL> """<STR_LIT>""" <EOL> grGrps = [ ] <EOL> eMeshes = [ ] <EOL> for grp in [ grp for grp in self . getTopGroups ( ) if self . getTopGroups ( ) ] : <EOL> if re . search ( '<STR_LIT>' , grp . name ( ) , re . I ) : <EOL> grGrps . append ( grp ) <EOL> if grGrps : <EOL> for g in grGrps : <EOL> for msh in [ msh for msh in self . meshesInGroup ( g ) if self . meshesInGroup ( g ) ] : <EOL> if re . search ( '<STR_LIT>' , msh . name ( ) , re . I ) : <EOL> eMeshes . append ( msh ) <EOL> else : <EOL> for msh in [ msh for msh in self . gimmeMeshes ( ) if self . gimmeMeshes ( ) ] : <EOL> if re . search ( '<STR_LIT>' , msh . name ( ) , re . I ) : <EOL> eMeshes . append ( msh ) <EOL> if eMeshes : <EOL> return eMeshes <EOL> else : <EOL> self . logger . error ( '<STR_LIT>' ) <EOL> def getRigRootObj ( self ) : <EOL> for grp in self . getTopGroups ( ) : <EOL> for child in grp . getChildren ( ) : <EOL> if isinstance ( child , nt . Joint ) : <EOL> return Transform ( grp ) <EOL> def getRigRootJoint ( self ) : <EOL> """<STR_LIT>""" <EOL> topGrp = self . getRigRootObj ( ) <EOL> for child in [ child for child in topGrp . getChildren ( ) if isinstance ( child , nt . Joint ) ] : <EOL> if objectType ( child ) == '<STR_LIT>' : <EOL> return child <EOL> def getFBIKcharacter ( self ) : <EOL> for char in ls ( type = '<STR_LIT>' ) : <EOL> if char . name ( ) [ char . name ( ) . rfind ( '<STR_LIT::>' ) + <NUM_LIT:1> : ] == '<STR_LIT>' : <EOL> return char <EOL> def getSkeletonObj ( self ) : <EOL> for grp in self . getTopGroups ( ) : <EOL> for child in grp . getChildren ( ) : <EOL> if isinstance ( child , nt . Joint ) : <EOL> return child <EOL> def getLocatorObj ( self ) : <EOL> rigRoot = self . getRigRootObj ( ) <EOL> for grp in rigRoot . getChildren ( ) : <EOL> if grp == '<STR_LIT>' : <EOL> for child in grp . getChildren ( ) : <EOL> if objectType ( child ) == '<STR_LIT>' and child == '<STR_LIT>' : <EOL> return child <EOL> def getSceneBaseName ( self , extension = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> if ( extension ) : <EOL> return sceneName ( ) . name <EOL> else : <EOL> return sceneName ( ) . namebase <EOL> def parentSingleNode ( self , child , prnt ) : <EOL> """<STR_LIT>""" <EOL> result = PyNode ( parent ( child , prnt ) [ <NUM_LIT:0> ] ) <EOL> return result <EOL> class MayaNodeCore ( Maya ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaNodeCore , self ) . __init__ ( ) <EOL> def isGroup ( self , node ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> if nodeType ( node ) == '<STR_LIT>' and not node . getShapes ( ) : <EOL> return <NUM_LIT:1> ; <EOL> else : <EOL> return <NUM_LIT:0> <EOL> def isMesh ( self , node ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> if nodeType ( node ) == '<STR_LIT>' : <EOL> if nodeType ( node . getShape ( ) ) == '<STR_LIT>' : <EOL> return <NUM_LIT:1> <EOL> else : <EOL> return <NUM_LIT:0> <EOL> class MayaMiscCore ( Maya ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaMiscCore , self ) . __init__ ( ) <EOL> @ staticmethod <EOL> def addAttr ( object_ , attributes ) : <EOL> for attribute in attributes : <EOL> object_ . addAttr ( attribute [ '<STR_LIT>' ] , at = attribute [ '<STR_LIT:type>' ] , k = <NUM_LIT:1> ) <EOL> if attribute [ '<STR_LIT>' ] : <EOL> addAttr ( '<STR_LIT>' % ( object_ , attribute [ '<STR_LIT>' ] ) , e = <NUM_LIT:1> , minValue = float ( attribute [ '<STR_LIT>' ] ) ) <EOL> if attribute [ '<STR_LIT>' ] : <EOL> addAttr ( '<STR_LIT>' % ( object_ , attribute [ '<STR_LIT>' ] ) , e = <NUM_LIT:1> , maxValue = float ( attribute [ '<STR_LIT>' ] ) ) <EOL> if attribute [ '<STR_LIT:default>' ] : <EOL> object_ . attr ( attribute [ '<STR_LIT>' ] ) . set ( float ( attribute [ '<STR_LIT:default>' ] ) ) <EOL> def average ( self , evalNodes ) : <EOL> """<STR_LIT>""" <EOL> if not evalNodes : <EOL> evalNodes = selected ( fl = <NUM_LIT:1> ) <EOL> select ( cl = <NUM_LIT:1> ) <EOL> filteredEval = [ ] <EOL> if evalNodes : <EOL> for e in evalNodes : <EOL> select ( e , r = <NUM_LIT:1> ) <EOL> if len ( e . split ( '<STR_LIT:.>' ) ) > <NUM_LIT:1> : <EOL> if not search ( '<STR_LIT>' , str ( type ( e ) ) ) : <EOL> mel . ConvertSelectionToVertices ( ) <EOL> for a in selected ( fl = <NUM_LIT:1> ) : <EOL> filteredEval . append ( a ) <EOL> select ( cl = <NUM_LIT:1> ) <EOL> else : <EOL> filteredEval . append ( e ) <EOL> else : <EOL> if nodeType ( e ) == '<STR_LIT>' : <EOL> filteredEval . append ( e ) <EOL> if filteredEval : <EOL> divFactor = float ( len ( filteredEval ) ) <EOL> xComp = float ( <NUM_LIT> ) <EOL> yComp = float ( <NUM_LIT> ) <EOL> zComp = float ( <NUM_LIT> ) <EOL> for each in filteredEval : <EOL> if len ( each . split ( '<STR_LIT:.>' ) ) > <NUM_LIT:1> : <EOL> xComp = xComp + float ( each . getPosition ( '<STR_LIT>' ) [ <NUM_LIT:0> ] ) <EOL> yComp = yComp + float ( each . getPosition ( '<STR_LIT>' ) [ <NUM_LIT:1> ] ) <EOL> zComp = zComp + float ( each . getPosition ( '<STR_LIT>' ) [ <NUM_LIT:2> ] ) <EOL> else : <EOL> if nodeType ( each ) == '<STR_LIT>' : <EOL> xComp = xComp + float ( each . getTranslation ( '<STR_LIT>' ) [ <NUM_LIT:0> ] ) <EOL> yComp = yComp + float ( each . getTranslation ( '<STR_LIT>' ) [ <NUM_LIT:1> ] ) <EOL> zComp = zComp + float ( each . getTranslation ( '<STR_LIT>' ) [ <NUM_LIT:2> ] ) <EOL> self . logger . debug ( '<STR_LIT>' % xComp ) <EOL> self . logger . debug ( '<STR_LIT>' % yComp ) <EOL> self . logger . debug ( '<STR_LIT>' % zComp ) <EOL> self . logger . debug ( '<STR_LIT>' % str ( xComp / divFactor ) ) <EOL> self . logger . debug ( '<STR_LIT>' % str ( yComp / divFactor ) ) <EOL> self . logger . debug ( '<STR_LIT>' % str ( zComp / divFactor ) ) <EOL> return [ xComp / divFactor , yComp / divFactor , zComp / divFactor ] <EOL> @ property <EOL> def mathAvgSelected ( self ) : <EOL> return self . average ( ) <EOL> @ staticmethod <EOL> def pyNodeString ( node ) : <EOL> """<STR_LIT>""" <EOL> if re . search ( '<STR_LIT>' , str ( node . __class__ ) ) : <EOL> return node . name ( ) <EOL> else : <EOL> return node <EOL> def check4Dup ( self , node , quit = <NUM_LIT:0> , message = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> if len ( ls ( node ) ) > <NUM_LIT:1> : <EOL> self . logger . warning ( "<STR_LIT>" % ( message , node ) ) <EOL> select ( ls ( node ) , r = <NUM_LIT:1> ) <EOL> if quit : <EOL> sys . exit ( ) <EOL> return <NUM_LIT:1> <EOL> return <NUM_LIT:0> <EOL> def cleaner ( self , node , channels = [ '<STR_LIT>' ] ) : <EOL> """<STR_LIT>""" <EOL> if node . __class__ == list : <EOL> node = node [ <NUM_LIT:0> ] <EOL> if not objExists ( node ) : <EOL> if objExists : <EOL> pass <EOL> self . logger . warning ( "<STR_LIT>" % node ) <EOL> return <EOL> node = self . convertToPyNode ( node ) <EOL> keyableList = listAttr ( node , keyable = <NUM_LIT:1> ) <EOL> nonKeyableList = listAttr ( node , channelBox = <NUM_LIT:1> ) <EOL> if keyableList : <EOL> for keyable in keyableList : <EOL> if len ( keyable . split ( '<STR_LIT:.>' ) ) == <NUM_LIT:1> : <EOL> if channels . count ( keyable ) == <NUM_LIT:0> : <EOL> setAttr ( '<STR_LIT>' % ( node , keyable ) , lock = True , keyable = False ) <EOL> if nonKeyableList : <EOL> for nonKeyable in nonKeyableList : <EOL> node . attr ( nonKeyable ) . lock ( ) <EOL> node . attr ( nonKeyable ) . showInChannelBox ( <NUM_LIT:0> ) <EOL> def convertToPyNode ( self , node ) : <EOL> """<STR_LIT>""" <EOL> if not self . isPyNode ( node ) : <EOL> if not node . __class__ == str and re . search ( '<STR_LIT:Meta>' , str ( node ) ) : <EOL> return node <EOL> return PyNode ( node ) <EOL> else : <EOL> return node <EOL> @ staticmethod <EOL> def dateAsDecimal ( ) : <EOL> tokenizedTime = time . localtime ( time . time ( ) ) <EOL> month = tokenizedTime [ <NUM_LIT:1> ] <EOL> day = tokenizedTime [ <NUM_LIT:2> ] <EOL> if month < <NUM_LIT:10> : <EOL> month = '<STR_LIT>' % month <EOL> monthDay = '<STR_LIT>' % ( month , day ) <EOL> return float ( monthDay ) <EOL> @ staticmethod <EOL> def isPyNode ( node ) : <EOL> """<STR_LIT>""" <EOL> if re . search ( '<STR_LIT>' , str ( node . __class__ ) ) : <EOL> return <NUM_LIT:1> <EOL> else : <EOL> return <NUM_LIT:0> <EOL> @ staticmethod <EOL> def isMetaNode ( node ) : <EOL> """<STR_LIT>""" <EOL> if re . search ( '<STR_LIT:Meta>' , str ( node . __class__ ) ) : <EOL> return <NUM_LIT:1> <EOL> else : <EOL> return <NUM_LIT:0> <EOL> def copyWorldXform ( self , source = '<STR_LIT>' , target = '<STR_LIT>' ) : <EOL> if not source : <EOL> if len ( selected ( ) ) == <NUM_LIT:2> : <EOL> source = selected ( ) [ <NUM_LIT:0> ] <EOL> target = selected ( ) [ <NUM_LIT:1> ] <EOL> else : <EOL> self . logger . error ( '<STR_LIT>' ) <EOL> if not target : <EOL> self . logger . error ( '<STR_LIT>' ) <EOL> xform ( target , ws = <NUM_LIT:1> , t = source . getTranslation ( ws = <NUM_LIT:1> ) ) <EOL> xform ( target , ws = <NUM_LIT:1> , ro = source . getRotation ( ws = <NUM_LIT:1> ) ) <EOL> @ staticmethod <EOL> def findAvailbleNodeName ( nameBase , numberBase = <NUM_LIT:3> ) : <EOL> """<STR_LIT>""" <EOL> nBase = <NUM_LIT:1> <EOL> strRep = fileManip . FileManip ( ) . strNumberGenerator ( nBase , numberBase ) <EOL> while ( objExists ( nameBase . replace ( '<STR_LIT:@>' , strRep ) ) ) : <EOL> nBase = nBase + <NUM_LIT:1> <EOL> strRep = fileManip . FileManip ( ) . strNumberGenerator ( nBase , numberBase ) <EOL> return nameBase . replace ( '<STR_LIT:@>' , strRep ) <EOL> def listcP ( self , nodeWplug , quiet = <NUM_LIT:0> , all = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> try : <EOL> if listConnections ( nodeWplug ) : <EOL> allConnections = listConnections ( nodeWplug ) <EOL> if all : <EOL> return map ( lambda x : PyNode ( x ) , allConnections ) <EOL> return PyNode ( allConnections [ <NUM_LIT:0> ] ) <EOL> except : <EOL> if not quiet : <EOL> self . logger . warning ( "<STR_LIT>" % nodeWplug ) <EOL> return <NUM_LIT:0> <EOL> @ staticmethod <EOL> def mi ( node = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> if not node : <EOL> makeIdentity ( apply = True , s = <NUM_LIT:1> , r = <NUM_LIT:1> , t = <NUM_LIT:1> , n = <NUM_LIT:0> , jo = <NUM_LIT:1> ) <EOL> else : <EOL> makeIdentity ( node , apply = True , s = <NUM_LIT:1> , r = <NUM_LIT:1> , t = <NUM_LIT:1> , n = <NUM_LIT:0> , jo = <NUM_LIT:1> ) <EOL> def groupTo ( self , mNode = '<STR_LIT>' , mGrp = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> if mNode : <EOL> mNode = self . convertToPyNode ( mNode ) <EOL> else : <EOL> if self . verifyMeshSelection ( ) : <EOL> mNode = selected ( ) [ <NUM_LIT:0> ] <EOL> if mNode : <EOL> if mGrp : <EOL> mGrp = self . convertToPyNode ( mGrp ) <EOL> if mNode . getParent ( ) : <EOL> if not mNode . getParent ( ) == mGrp . name ( ) : <EOL> parent ( mNode . name ( ) , mGrp . name ( ) ) <EOL> else : <EOL> self . logger . info ( '<STR_LIT>' ) <EOL> else : <EOL> parent ( mNode . name ( ) , mGrp . name ( ) ) <EOL> else : <EOL> if mNode . getParent ( ) : <EOL> parent ( mNode . name ( ) , world = <NUM_LIT:1> ) <EOL> else : <EOL> self . logger . info ( '<STR_LIT>' ) <EOL> @ staticmethod <EOL> def pymelVersion ( ) : <EOL> """<STR_LIT>""" <EOL> version = <NUM_LIT> <EOL> if re . search ( '<STR_LIT>' , PyNode . __module__ ) : <EOL> version = <NUM_LIT:1.0> <EOL> return version <EOL> class MayaReferenceCore ( Maya ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaReferenceCore , self ) . __init__ ( ) <EOL> def refreshRefs ( self , node = '<STR_LIT>' , sync = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> allRefs = self . getRefs ( node = node ) <EOL> for er in allRefs : <EOL> if sync : <EOL> if self . apParseObj . isp4Active : <EOL> self . verifyP4 ( ) <EOL> self . p4 . filename = er . path <EOL> self . p4 . p4Sync ( ) <EOL> else : <EOL> self . logger . warning ( '<STR_LIT>' ) <EOL> er . load ( ) <EOL> @ staticmethod <EOL> def getNestedRefs ( ref = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> searchRefs = [ ] <EOL> if not ref : <EOL> topRefs = getReferences ( ) <EOL> if topRefs : <EOL> for refNode , ref in topRefs . iteritems ( ) : <EOL> searchRefs . append ( ref ) <EOL> else : <EOL> searchRefs . append ( ref ) <EOL> subRefs = [ ] <EOL> if searchRefs : <EOL> for r in searchRefs : <EOL> sub = getReferences ( parentReference = r ) <EOL> for rn , rf in sub . iteritems ( ) : <EOL> if sub : <EOL> subRefs . append ( rf ) <EOL> return subRefs <EOL> @ property <EOL> def sceneHasNestedRefs ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . getNestedRefs ( ) : <EOL> return <NUM_LIT:1> <EOL> else : <EOL> return <NUM_LIT:0> <EOL> def nodeIsNested ( self , node ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> if node . isReferenced ( ) : <EOL> fRefObj = FileReference ( referenceQuery ( node , referenceNode = <NUM_LIT:1> ) , namespace = node . parentNamespace ( ) ) <EOL> for n in self . getNestedRefs ( ) : <EOL> if n . refNode == fRefObj . refNode : <EOL> return <NUM_LIT:1> <EOL> break <EOL> return <NUM_LIT:0> <EOL> else : <EOL> return <NUM_LIT:0> <EOL> def getTopLevelRef ( self , node ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> if node . isReferenced ( ) : <EOL> fRefObj = FileReference ( referenceQuery ( node , referenceNode = <NUM_LIT:1> ) , namespace = node . parentNamespace ( ) ) <EOL> if self . nodeIsNested ( node ) : <EOL> topRefs = getReferences ( ) <EOL> for nSpace , rPath in topRefs . iteritems ( ) : <EOL> fRef = FileReference ( referenceQuery ( rPath , referenceNode = <NUM_LIT:1> ) , namespace = nSpace ) <EOL> if fRefObj . refNode in fRef . nodes ( ) : <EOL> for g in fRef . nodes ( ) : <EOL> if fRefObj . refNode == g and objExists ( g ) : <EOL> self . logger . debug ( '<STR_LIT>' % fRef . path ) <EOL> return fRef <EOL> else : <EOL> self . logger . debug ( '<STR_LIT>' % fRefObj . path ) <EOL> return fRefObj <EOL> else : <EOL> self . logger . debug ( '<STR_LIT>' ) <EOL> def getRefs ( self , includeNested = <NUM_LIT:1> , node = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> allRefs = [ ] <EOL> if node : <EOL> node = self . convertToPyNode ( node ) <EOL> topLevel = self . getTopLevelRef ( node ) <EOL> if topLevel : <EOL> allRefs . append ( topLevel ) <EOL> else : <EOL> self . logger . warning ( '<STR_LIT>' % node ) <EOL> if self . nodeIsNested ( node ) : <EOL> nested = self . getNestedRefs ( topLevel ) <EOL> if nested : <EOL> self . logger . info ( '<STR_LIT>' ) <EOL> for n in nested : <EOL> allRefs . append ( n ) <EOL> else : <EOL> topRefs = getReferences ( ) <EOL> for rn , ref in topRefs . iteritems ( ) : <EOL> allRefs . append ( ref ) <EOL> if includeNested : <EOL> nested = self . getNestedRefs ( ref ) <EOL> if nested : <EOL> for n in nested : <EOL> allRefs . append ( n ) <EOL> return allRefs <EOL> def importReferences ( self , includeNested = <NUM_LIT:1> , removeNamespaces = <NUM_LIT:1> , returnNodes = <NUM_LIT:0> , node = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> rNodes = [ ] <EOL> cleanNS = [ ] <EOL> initError = <NUM_LIT:0> <EOL> if removeNamespaces : <EOL> if removeNamespaces == <NUM_LIT:2> and not includeNested : <EOL> self . logger . error ( <EOL> '<STR_LIT>' ) <EOL> initError = <NUM_LIT:1> <EOL> if not initError : <EOL> allRefs = self . getRefs ( includeNested = includeNested , node = node ) <EOL> for each in allRefs : <EOL> ns = each . namespace <EOL> subRefs = self . getNestedRefs ( each ) <EOL> if subRefs : <EOL> for cns in subRefs : <EOL> cleanNS . append ( [ cns . namespace , ns ] ) <EOL> nodes = each . nodes ( ) <EOL> each . importContents ( ) <EOL> if removeNamespaces : <EOL> if removeNamespaces == <NUM_LIT:1> : <EOL> namespace ( mv = ( ns , '<STR_LIT::>' ) , f = <NUM_LIT:1> ) <EOL> Namespace ( ns ) . remove ( ) <EOL> if returnNodes : <EOL> rNodes . extend ( nodes ) <EOL> if removeNamespaces : <EOL> if removeNamespaces == <NUM_LIT:2> : <EOL> for c in cleanNS : <EOL> Namespace . create ( c [ <NUM_LIT:0> ] ) <EOL> self . logger . info ( '<STR_LIT>' % ( c [ <NUM_LIT:1> ] , c [ <NUM_LIT:0> ] , c [ <NUM_LIT:0> ] ) ) <EOL> namespace ( mv = ( '<STR_LIT>' % ( c [ <NUM_LIT:1> ] , c [ <NUM_LIT:0> ] ) , c [ <NUM_LIT:0> ] ) , f = <NUM_LIT:1> ) <EOL> for delC in cleanNS : <EOL> Namespace ( '<STR_LIT>' % ( delC [ <NUM_LIT:1> ] , delC [ <NUM_LIT:0> ] ) ) . remove ( ) <EOL> for unused in cleanNS : <EOL> if '<STR_LIT>' % delC [ <NUM_LIT:1> ] in listNamespaces ( ) : <EOL> Namespace ( '<STR_LIT>' % delC [ <NUM_LIT:1> ] ) . remove ( ) <EOL> removed = '<STR_LIT>' <EOL> if removeNamespaces : <EOL> removed = '<STR_LIT>' <EOL> self . logger . info ( '<STR_LIT>' % removed ) <EOL> if returnNodes : <EOL> existingRNodes = [ ] <EOL> for r in rNodes : <EOL> if objExists ( r ) : <EOL> existingRNodes . append ( r ) <EOL> if existingRNodes : <EOL> return existingRNodes <EOL> class MayaNamespaceCore ( Maya ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaNamespaceCore , self ) . __init__ ( ) <EOL> @ staticmethod <EOL> def nameSpaces ( case ) : <EOL> """<STR_LIT>""" <EOL> sceneNameSpaces = listNamespaces ( recursive = False , internal = False ) <EOL> if case == '<STR_LIT>' : <EOL> for ga in sceneNameSpaces : <EOL> namespace ( set = ga ) <EOL> if not namespaceInfo ( listOnlyDependencyNodes = True ) : <EOL> ga . remove ( ) <EOL> namespace ( set = '<STR_LIT::>' ) <EOL> @ staticmethod <EOL> def giveNameSpace ( node ) : <EOL> """<STR_LIT>""" <EOL> return ( '<STR_LIT::>' . join ( node . split ( '<STR_LIT::>' ) [ : - <NUM_LIT:1> ] ) ) + '<STR_LIT::>' <EOL> @ staticmethod <EOL> def nameRoot ( node ) : <EOL> """<STR_LIT>""" <EOL> result = node . replace ( mel . eval ( '<STR_LIT>' % node ) , "<STR_LIT>" ) <EOL> sn = result . replace ( mel . eval ( '<STR_LIT>' % result ) , "<STR_LIT>" ) <EOL> return sn <EOL> @ staticmethod <EOL> def removeNameSpace ( ns , nuke = <NUM_LIT:0> ) : <EOL> parentNS , childNS = ns . split ( '<STR_LIT::>' ) <EOL> if childNS not in namespaceInfo ( lon = <NUM_LIT:1> ) : <EOL> Namespace . create ( childNS ) <EOL> namespace ( set = '<STR_LIT::>' ) <EOL> if nuke : <EOL> childNS = '<STR_LIT::>' <EOL> namespace ( mv = ( ns , childNS ) , f = <NUM_LIT:1> ) <EOL> Namespace ( ns ) . remove ( ) <EOL> try : <EOL> nss = listNamespaces ( recursive = True , internal = False ) <EOL> if not [ ns for ns in nss if re . search ( '<STR_LIT>' % parentNS , ns ) ] : <EOL> Namespace ( parentNS ) . clean ( ) <EOL> Namespace ( parentNS ) . remove ( ) <EOL> except : <EOL> pass <EOL> def removePrefix ( self , node ) : <EOL> """<STR_LIT>""" <EOL> nRoot = self . nameRoot ( node ) <EOL> if not re . search ( '<STR_LIT:_>' , nRoot ) : <EOL> return nRoot <EOL> else : <EOL> return nRoot [ nRoot . find ( '<STR_LIT:_>' ) + <NUM_LIT:1> : ] <EOL> @ staticmethod <EOL> def stripNameSpace ( node ) : <EOL> """<STR_LIT>""" <EOL> return node . split ( '<STR_LIT::>' ) [ - <NUM_LIT:1> ] <EOL> class MayaVisibilityCore ( Maya ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaVisibilityCore , self ) . __init__ ( ) <EOL> def jpHideAndLock ( self , nodes , keyT = <NUM_LIT:1> , keyR = <NUM_LIT:1> , keyS = <NUM_LIT:1> , keyV = <NUM_LIT:1> , LockT = <NUM_LIT:1> , LockR = <NUM_LIT:1> , LockS = <NUM_LIT:1> , LockV = <NUM_LIT:1> , all = <NUM_LIT:2> , keyAll = <NUM_LIT:2> , <EOL> lockAll = <NUM_LIT:2> ) : <EOL> """<STR_LIT>""" <EOL> if str ( nodes . __class__ ) == "<STR_LIT>" : <EOL> for node_ in nodes : <EOL> self . jpHideAndLock ( node_ , keyT , keyR , keyS , keyV , LockT , LockR , LockS , LockV , all , keyAll , lockAll ) <EOL> return <EOL> else : <EOL> node = nodes <EOL> if not objExists ( node ) : <EOL> self . logger . warning ( "<STR_LIT>" % node ) <EOL> return <EOL> if all == <NUM_LIT:1> : <EOL> keyT , keyR , keyS , keyV , LockT , LockR , LockS , LockV = [ <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] <EOL> elif all == <NUM_LIT:0> : <EOL> keyT , keyR , keyS , keyV , LockT , LockR , LockS , LockV = [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ] <EOL> if keyAll == <NUM_LIT:1> : <EOL> keyT , keyR , keyS , keyV = [ <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] <EOL> if keyAll == <NUM_LIT:0> : <EOL> keyT , keyR , keyS , keyV = [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ] <EOL> if lockAll == <NUM_LIT:1> : <EOL> LockT , LockR , LockS , LockV = [ <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> ] <EOL> if lockAll == <NUM_LIT:0> : <EOL> LockT , LockR , LockS , LockV = [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ] <EOL> node = self . convertToPyNode ( node ) <EOL> node . tx . setKeyable ( keyT - <NUM_LIT:1> ) <EOL> node . ty . setKeyable ( keyT - <NUM_LIT:1> ) <EOL> node . tz . setKeyable ( keyT - <NUM_LIT:1> ) <EOL> node . rx . setKeyable ( keyR - <NUM_LIT:1> ) <EOL> node . ry . setKeyable ( keyR - <NUM_LIT:1> ) <EOL> node . rz . setKeyable ( keyR - <NUM_LIT:1> ) <EOL> node . sx . setKeyable ( keyS - <NUM_LIT:1> ) <EOL> node . sy . setKeyable ( keyS - <NUM_LIT:1> ) <EOL> node . sz . setKeyable ( keyS - <NUM_LIT:1> ) <EOL> node . v . setKeyable ( keyV - <NUM_LIT:1> ) <EOL> node . tx . setLocked ( LockT ) <EOL> node . ty . setLocked ( LockT ) <EOL> node . tz . setLocked ( LockT ) <EOL> node . rx . setLocked ( LockR ) <EOL> node . ry . setLocked ( LockR ) <EOL> node . rz . setLocked ( LockR ) <EOL> node . sx . setLocked ( LockS ) <EOL> node . sy . setLocked ( LockS ) <EOL> node . sz . setLocked ( LockS ) <EOL> node . v . setLocked ( LockV ) <EOL> if objExists ( '<STR_LIT>' % node ) : <EOL> node . radius . lock ( ) <EOL> node . radius . setKeyable ( <NUM_LIT:0> ) <EOL> node . radius . showInChannelBox ( <NUM_LIT:0> ) <EOL> transformLimits ( node , erx = ( <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> transformLimits ( node , ery = ( <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> transformLimits ( node , erz = ( <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> def jpHideAndLockPCons ( self , nodes ) : <EOL> """<STR_LIT>""" <EOL> if nodes . __class__ == list : <EOL> for node_ in nodes : <EOL> self . jpHideAndLockPCons ( node_ ) <EOL> return <EOL> else : <EOL> node = nodes <EOL> node . nds . set ( lock = True , keyable = False ) <EOL> node . int . set ( lock = True , keyable = False ) <EOL> node . w0 . set ( lock = True , keyable = False ) <EOL> @ staticmethod <EOL> def jpHideAndLockDetailed ( node , keyTX = <NUM_LIT:1> , keyTY = <NUM_LIT:1> , keyTZ = <NUM_LIT:1> , keyRX = <NUM_LIT:1> , keyRY = <NUM_LIT:1> , keyRZ = <NUM_LIT:1> , keySX = <NUM_LIT:1> , keySY = <NUM_LIT:1> , <EOL> keySZ = <NUM_LIT:1> , keyV = <NUM_LIT:1> , LockTX = <NUM_LIT:1> , LockTY = <NUM_LIT:1> , LockTZ = <NUM_LIT:1> , LockRX = <NUM_LIT:1> , LockRY = <NUM_LIT:1> , LockRZ = <NUM_LIT:1> , LockSX = <NUM_LIT:1> , <EOL> LockSY = <NUM_LIT:1> , LockSZ = <NUM_LIT:1> , LockV = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> node = PyNode ( node ) <EOL> node . tx . setKeyable ( keyTX - <NUM_LIT:1> ) <EOL> node . ty . setKeyable ( keyTY - <NUM_LIT:1> ) <EOL> node . tz . setKeyable ( keyTZ - <NUM_LIT:1> ) <EOL> node . rx . setKeyable ( keyRX - <NUM_LIT:1> ) <EOL> node . ry . setKeyable ( keyRY - <NUM_LIT:1> ) <EOL> node . rz . setKeyable ( keyRZ - <NUM_LIT:1> ) <EOL> node . sx . setKeyable ( keySX - <NUM_LIT:1> ) <EOL> node . sy . setKeyable ( keySY - <NUM_LIT:1> ) <EOL> node . sz . setKeyable ( keySZ - <NUM_LIT:1> ) <EOL> node . v . setKeyable ( keyV - <NUM_LIT:1> ) <EOL> node . tx . setLocked ( LockTX ) <EOL> node . ty . setLocked ( LockTY ) <EOL> node . tz . setLocked ( LockTZ ) <EOL> node . rx . setLocked ( LockRX ) <EOL> node . ry . setLocked ( LockRY ) <EOL> node . rz . setLocked ( LockRZ ) <EOL> node . sx . setLocked ( LockSX ) <EOL> node . sy . setLocked ( LockSY ) <EOL> node . sz . setLocked ( LockSZ ) <EOL> node . v . setLocked ( LockV ) <EOL> if objExists ( '<STR_LIT>' % node ) : <EOL> node . radius . lock ( ) <EOL> node . radius . setKeyable ( <NUM_LIT:0> ) <EOL> node . radius . showInChannelBox ( <NUM_LIT:0> ) <EOL> transformLimits ( node , erx = ( <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> transformLimits ( node , ery = ( <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> transformLimits ( node , erz = ( <NUM_LIT:0> , <NUM_LIT:0> ) ) <EOL> @ staticmethod <EOL> def jpHideAndLockIK ( node , keyPX = <NUM_LIT:1> , keyPY = <NUM_LIT:1> , keyPZ = <NUM_LIT:1> , keyO = <NUM_LIT:1> , keyR = <NUM_LIT:1> , keyT = <NUM_LIT:1> , keyB = <NUM_LIT:1> , lockPX = <NUM_LIT:1> , lockPY = <NUM_LIT:1> , <EOL> lockPZ = <NUM_LIT:1> , lockO = <NUM_LIT:1> , lockR = <NUM_LIT:1> , lockT = <NUM_LIT:1> , lockB = <NUM_LIT:1> , all = <NUM_LIT:2> ) : <EOL> """<STR_LIT>""" <EOL> if all == <NUM_LIT:1> : <EOL> keyPX , keyPY , keyPZ , keyO , keyR , keyT , keyB , lockPX , lockPY , lockPZ , lockO , lockR , lockT , lockB = [ <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <EOL> <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <EOL> <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <EOL> <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , <EOL> <NUM_LIT:1> , <NUM_LIT:1> ] <EOL> elif all == <NUM_LIT:0> : <EOL> keyPX , keyPY , keyPZ , keyO , keyR , keyT , keyB , lockPX , lockPY , lockPZ , lockO , lockR , lockT , lockB = [ <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <EOL> <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <EOL> <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <EOL> <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <EOL> <NUM_LIT:0> , <NUM_LIT:0> ] <EOL> node = PyNode ( node ) <EOL> node . poleVectorX . setKeyable ( keyPX - <NUM_LIT:1> ) <EOL> node . poleVectorY . setKeyable ( keyPY - <NUM_LIT:1> ) <EOL> node . poleVectorZ . setKeyable ( keyPZ - <NUM_LIT:1> ) <EOL> node . offset . setKeyable ( keyO - <NUM_LIT:1> ) <EOL> node . roll . setKeyable ( keyR - <NUM_LIT:1> ) <EOL> node . twist . setKeyable ( keyT - <NUM_LIT:1> ) <EOL> node . ikBlend . setKeyable ( keyB - <NUM_LIT:1> ) <EOL> node . poleVectorX . setLocked ( lockPX ) <EOL> node . poleVectorY . setLocked ( lockPY ) <EOL> node . poleVectorZ . setLocked ( lockPZ ) <EOL> node . offset . setLocked ( lockO ) <EOL> node . roll . setLocked ( lockR ) <EOL> node . twist . setLocked ( lockT ) <EOL> node . ikBlend . setLocked ( lockB ) <EOL> def lockAndHideAttributes ( self , node , attrs ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> for attr in attrs : <EOL> setAttr ( ( node . name ( ) + "<STR_LIT:.>" + attr ) , k = False , l = True ) <EOL> def lockVisibleAttrs ( self , node ) : <EOL> """<STR_LIT>""" <EOL> if not len ( ls ( node ) ) : <EOL> self . logger . error ( "<STR_LIT>" % node ) <EOL> node = self . convertToPyNode ( node ) <EOL> keyableAttrs = node . listAttr ( k = <NUM_LIT:1> ) <EOL> if keyableAttrs : <EOL> for kAttr in keyableAttrs : <EOL> try : <EOL> kAttr . lock ( ) <EOL> except : <EOL> pass <EOL> def unlockVisibleAttrs ( self , node ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> keyableAttrs = node . listAttr ( k = <NUM_LIT:1> ) <EOL> if keyableAttrs : <EOL> for kAttr in keyableAttrs : <EOL> try : <EOL> kAttr . unlock ( ) <EOL> except : <EOL> pass <EOL> class MayaMeshCore ( Maya ) : <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaMeshCore , self ) . __init__ ( ) <EOL> def checkHier4Mesh ( self , metaRoot ) : <EOL> """<STR_LIT>""" <EOL> offending = [ ] <EOL> result = [ <NUM_LIT:0> , <NUM_LIT:0> ] <EOL> if objExists ( metaRoot ) : <EOL> metaRoot = self . convertToPyNode ( metaRoot ) <EOL> rootJoint = self . listcP ( metaRoot . rootJoint ) <EOL> if rootJoint : <EOL> for child in rootJoint . getChildren ( ad = <NUM_LIT:1> ) : <EOL> try : <EOL> if objectType ( child ) == '<STR_LIT>' : <EOL> if child . getParent ( ) . attr ( '<STR_LIT:type>' ) . get ( ) == <NUM_LIT:5> : <EOL> offending . append ( child ) <EOL> except : <EOL> pass <EOL> if offending : <EOL> result = [ <NUM_LIT:1> , offending ] <EOL> select ( offending , r = <NUM_LIT:1> ) <EOL> return result <EOL> def checkUnmergedVerts ( self , meshes = [ ] , precision = <NUM_LIT:4> , merge = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> if not meshes : <EOL> meshes = self . gimmeMeshes ( ) <EOL> allSharedVerts = [ ] <EOL> for meshCheck in meshes : <EOL> sharedVerts = [ ] <EOL> boundaryVerts = [ ] <EOL> vts = meshCheck . getShape ( ) . verts <EOL> for v in vts : <EOL> if v . isOnBoundary ( ) : <EOL> boundaryVerts . append ( v ) <EOL> if boundaryVerts : <EOL> for bv in boundaryVerts : <EOL> for bCompare in boundaryVerts : <EOL> if not bCompare == bv : <EOL> if round ( bv . getPosition ( ) [ <NUM_LIT:0> ] , precision ) == round ( bCompare . getPosition ( ) [ <NUM_LIT:0> ] , <EOL> precision ) and round ( bv . getPosition ( ) [ <NUM_LIT:1> ] , <EOL> precision ) == round ( <EOL> bCompare . getPosition ( ) [ <NUM_LIT:1> ] , precision ) and round ( bv . getPosition ( ) [ <NUM_LIT:2> ] , <EOL> precision ) == round ( <EOL> bCompare . getPosition ( ) [ <NUM_LIT:2> ] , precision ) : <EOL> sharedVerts . append ( bv ) <EOL> sharedVerts . append ( bCompare ) <EOL> allSharedVerts . append ( bv ) <EOL> allSharedVerts . append ( bCompare ) <EOL> if sharedVerts : <EOL> if merge : <EOL> polyMergeVertex ( sharedVerts , d = float ( <NUM_LIT:1> / ( <NUM_LIT:10> ** float ( precision ) ) ) ) <EOL> if not merge : <EOL> if allSharedVerts : <EOL> select ( sharedVerts ) <EOL> def cleanNetworkNodes ( self , all = <NUM_LIT:0> , withinProtectedName = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> nNodes = ls ( type = '<STR_LIT>' ) <EOL> protectedNames = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' ] <EOL> if nNodes : <EOL> for nNode in nNodes : <EOL> if not nNode . isReferenced ( ) : <EOL> if withinProtectedName : <EOL> for p in protectedNames : <EOL> if search ( p , nNode . name ( ) ) : <EOL> if not nNode . name ( ) == p : <EOL> self . disconnectAttrs ( nNode ) <EOL> delete ( nNode ) <EOL> else : <EOL> if not all : <EOL> if not nNode . name ( ) in protectedNames : <EOL> self . disconnectAttrs ( nNode ) <EOL> delete ( nNode ) <EOL> else : <EOL> self . disconnectAttrs ( nNode ) <EOL> delete ( nNode ) <EOL> def disconnectInputs ( self , node ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> if not node . isReferenced ( ) : <EOL> input = node . inputs ( c = <NUM_LIT:1> , p = <NUM_LIT:1> ) <EOL> for i in input : <EOL> disconnectAttr ( i [ <NUM_LIT:1> ] , i [ <NUM_LIT:0> ] ) <EOL> def disconnectOutputs ( self , node ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> if not node . isReferenced ( ) : <EOL> output = node . outputs ( c = <NUM_LIT:1> , p = <NUM_LIT:1> ) <EOL> for o in output : <EOL> disconnectAttr ( o [ <NUM_LIT:0> ] , o [ <NUM_LIT:1> ] ) <EOL> def disconnectAttrs ( self , node ) : <EOL> """<STR_LIT>""" <EOL> node = self . convertToPyNode ( node ) <EOL> if not node . isReferenced ( ) : <EOL> input = node . inputs ( c = <NUM_LIT:1> , p = <NUM_LIT:1> ) <EOL> output = node . outputs ( c = <NUM_LIT:1> , p = <NUM_LIT:1> ) <EOL> for i in input : <EOL> disconnectAttr ( i [ <NUM_LIT:1> ] , i [ <NUM_LIT:0> ] ) <EOL> for o in output : <EOL> disconnectAttr ( o [ <NUM_LIT:0> ] , o [ <NUM_LIT:1> ] ) <EOL> def cleanMeshes ( self , meshes = [ ] ) : <EOL> """<STR_LIT>""" <EOL> if not meshes : <EOL> meshes = self . gimmeMeshes ( ) <EOL> if meshes : <EOL> for m in meshes : <EOL> if not m . isReferenced ( ) : <EOL> shapes = m . getShapes ( ) <EOL> for s in shapes : <EOL> if s . intermediateObject . get ( ) : <EOL> if not s . outputs ( ) : <EOL> delete ( s ) <EOL> rename ( m . getShape ( ) , '<STR_LIT>' % m . name ( ) ) <EOL> @ staticmethod <EOL> def getDisplayLayer ( node ) : <EOL> """<STR_LIT>""" <EOL> if node . listConnections ( type = '<STR_LIT>' ) : <EOL> return node . listConnections ( type = '<STR_LIT>' ) [ <NUM_LIT:0> ] <EOL> def getNodeFromSchema ( self , varName , listName = None ) : <EOL> if listName : <EOL> result = parser_schema . ParseSchema ( ) . getWellFormed ( varName , listName ) <EOL> else : <EOL> result = parser_schema . ParseSchema ( ) . getWellFormed ( varName ) <EOL> if result . __class__ is float : <EOL> return result <EOL> else : <EOL> if result : <EOL> if objExists ( result ) : <EOL> self . check4Dup ( result , <NUM_LIT:1> ) <EOL> return self . convertToPyNode ( result ) <EOL> else : <EOL> self . logger . debug ( "<STR_LIT>" % result ) <EOL> return result <EOL> else : <EOL> self . logger . error ( "<STR_LIT>" % varName ) <EOL> @ staticmethod <EOL> def gimmeMeshes ( ) : <EOL> """<STR_LIT>""" <EOL> allMeshes = [ ] <EOL> for t in ( ls ( type = '<STR_LIT>' ) ) : <EOL> if t . getShape ( ) : <EOL> if isinstance ( t . getShape ( ) , nt . Mesh ) : <EOL> allMeshes . append ( t ) <EOL> if allMeshes : <EOL> return allMeshes <EOL> def meshesInGroup ( self , grp ) : <EOL> """<STR_LIT>""" <EOL> gMeshes = [ ] <EOL> grp = self . convertToPyNode ( grp ) <EOL> if self . isGroup ( grp ) : <EOL> for m in grp . listRelatives ( ad = <NUM_LIT:1> , typ = '<STR_LIT>' ) : <EOL> if not self . isGroup ( m ) : <EOL> gMeshes . append ( m ) <EOL> if gMeshes : <EOL> return gMeshes <EOL> def polyMergePlus ( self ) : <EOL> """<STR_LIT>""" <EOL> if selected ( ) : <EOL> if len ( selected ( ) ) > <NUM_LIT:1> : <EOL> if self . verifyMeshSelection ( <NUM_LIT:1> ) : <EOL> oSelection = selected ( ) <EOL> nName = selected ( ) [ <NUM_LIT:0> ] . name ( ) <EOL> nPiv = xform ( selected ( ) [ <NUM_LIT:0> ] . name ( ) , q = <NUM_LIT:1> , a = <NUM_LIT:1> , ws = <NUM_LIT:1> , rp = <NUM_LIT:1> ) <EOL> dLayer = self . getDisplayLayer ( selected ( ) [ <NUM_LIT:0> ] ) <EOL> nParent = '<STR_LIT>' <EOL> if selected ( ) [ <NUM_LIT:0> ] . getParent ( ) : <EOL> nParent = selected ( ) [ <NUM_LIT:0> ] . getParent ( ) <EOL> select ( oSelection , r = <NUM_LIT:1> ) <EOL> cResult = PyNode ( polyUnite ( ch = <NUM_LIT:0> ) [ <NUM_LIT:0> ] ) <EOL> cResult . rename ( nName ) <EOL> cResult . setPivots ( nPiv ) <EOL> select ( cResult , r = <NUM_LIT:1> ) <EOL> if dLayer : <EOL> editDisplayLayerMembers ( dLayer . name ( ) , cResult . name ( ) ) <EOL> if nParent : <EOL> cResult . setParent ( nParent ) <EOL> @ staticmethod <EOL> def swapShapeNode ( shapeTransform , node ) : <EOL> """<STR_LIT>""" <EOL> shapeTransform = PyNode ( shapeTransform ) <EOL> shapeVisSource = '<STR_LIT>' <EOL> if node . getShape ( ) : <EOL> shapeVisSource = listConnections ( node . getShape ( ) . visibility , p = <NUM_LIT:1> ) <EOL> makeIdentity ( shapeTransform , apply = True , s = <NUM_LIT:1> , r = <NUM_LIT:0> , t = <NUM_LIT:0> , n = <NUM_LIT:0> ) <EOL> shapes = listRelatives ( shapeTransform , pa = <NUM_LIT:1> , s = <NUM_LIT:1> ) <EOL> shape = '<STR_LIT>' <EOL> for testShape in map ( lambda x : PyNode ( x ) , shapes ) : <EOL> if not testShape . intermediateObject . get ( ) : <EOL> shape = testShape <EOL> shape = PyNode ( parent ( shape , node , add = <NUM_LIT:1> , s = <NUM_LIT:1> ) [ <NUM_LIT:0> ] ) <EOL> shape = rename ( shape , '<STR_LIT>' % shape [ : shape . find ( '<STR_LIT:|>' ) ] ) <EOL> if shapeVisSource : <EOL> shape . v . unlock ( ) <EOL> shapeVisSource [ <NUM_LIT:0> ] . connect ( shape . v ) <EOL> shape . v . lock ( ) <EOL> delete ( shapeTransform ) <EOL> reorder ( shape , f = <NUM_LIT:1> ) <EOL> return shape <EOL> def turnOffDoubleSided ( self ) : <EOL> """<STR_LIT>""" <EOL> oTurnOff = [ ] <EOL> if selected ( ) : <EOL> if self . verifyMeshSelection ( <NUM_LIT:1> ) : <EOL> for each in selected ( ) : <EOL> oTurnOff . append ( each ) <EOL> else : <EOL> oTurnOff = self . gimmeMeshes ( ) <EOL> if oTurnOff : <EOL> for offObj in oTurnOff : <EOL> offObj . getShape ( ) . doubleSided . set ( <NUM_LIT:0> ) <EOL> offObj . getShape ( ) . opposite . set ( <NUM_LIT:0> ) <EOL> @ staticmethod <EOL> def verifyMeshSelection ( all = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> if not selected ( ) : <EOL> return <NUM_LIT:0> <EOL> allSelected = [ ] <EOL> error = <NUM_LIT:0> <EOL> if all : <EOL> allSelected = selected ( ) <EOL> else : <EOL> allSelected . append ( selected ( ) [ <NUM_LIT:0> ] ) <EOL> if allSelected : <EOL> for each in allSelected : <EOL> if nodeType ( each ) == '<STR_LIT>' and nodeType ( each . getShape ( ) ) == '<STR_LIT>' : <EOL> pass <EOL> else : <EOL> error = <NUM_LIT:1> <EOL> else : <EOL> error = <NUM_LIT:1> <EOL> if error : <EOL> return <NUM_LIT:0> <EOL> else : <EOL> return <NUM_LIT:1> <EOL> class MayaCore ( MayaSceneCore , MayaNodeCore , MayaMiscCore , MayaPrintCore , MayaNamespaceCore , MayaReferenceCore , <EOL> MayaVisibilityCore , MayaMeshCore ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( MayaCore , self ) . __init__ ( ) <EOL> mCore = MayaCore ( ) <EOL> print "<STR_LIT>" </s>
