예제 #1
0
     def gatherInfluenceData(self, dagPath, components):
         """
         Get the influence data
         """
         weights = self.__getCurrentWeights(dagPath, components)
 
         influencePaths = OM.MDagPathArray()
         numInfluences = self.fn.influenceObjects(influencePaths)
         numComponentsPerInfluence = weights.length() / numInfluences
         
         self.progressBar_start(stepMaxValue=influencePaths.length(), 
                                statusMessage='Calculating....', 
                                interruptableState=False)
         _d_influenceData = {}            
         for i in range(influencePaths.length()):
             _k = str(i)
             influenceName = influencePaths[i].partialPathName()
             influenceWithoutNamespace = names.getBaseName(influenceName)
             
             _d_influenceData[_k] = {'name': influenceWithoutNamespace,
                                     'position':distance.returnWorldSpacePosition(influenceName)}
             
             # store weights by influence & not by namespace so it can be imported with different namespaces.
             self.progressBar_iter(status = 'Getting {0}...data'.format(influenceName))                                
             self._d_data['weights'][_k] = \
                 [weights[jj*numInfluences+i] for jj in range(numComponentsPerInfluence)]
             
         self._d_data['influences']['data'] = _d_influenceData  
         self.progressBar_end()
예제 #2
0
파일: skinDat.py 프로젝트: liudger/cgmTools
     def gatherInfluenceData(self, dagPath, components):
         """
         Get the influence data
         """
         weights = self.__getCurrentWeights(dagPath, components)
 
         influencePaths = OM.MDagPathArray()
         numInfluences = self.fn.influenceObjects(influencePaths)
         numComponentsPerInfluence = weights.length() / numInfluences
         
         self.progressBar_start(stepMaxValue=influencePaths.length(), 
                                statusMessage='Calculating....', 
                                interruptableState=False)
         _d_influenceData = {}            
         for i in range(influencePaths.length()):
             _k = str(i)
             influenceName = influencePaths[i].partialPathName()
             influenceWithoutNamespace = names.getBaseName(influenceName)
             
             _d_influenceData[_k] = {'name': influenceWithoutNamespace,
                                     'position':distance.returnWorldSpacePosition(influenceName)}
             
             # store weights by influence & not by namespace so it can be imported with different namespaces.
             self.progressBar_iter(status = 'Getting {0}...data'.format(influenceName))                                
             self._d_data['weights'][_k] = \
                 [weights[jj*numInfluences+i] for jj in range(numComponentsPerInfluence)]
             
         self._d_data['influences']['data'] = _d_influenceData  
         self.progressBar_end()
예제 #3
0
def sortChildrenByName(obj):
    _l = search.returnChildrenObjects(obj,fullPath = True)
    if not _l:
        log.error("sortChildrenByName>> No children found.")
        return False
    
    _d = {}
    for i,o in enumerate(_l):
        _bfr = names.getBaseName(o)
        if _bfr not in _d.keys():
            _d[_bfr] = o
        else:
            _d[names.getShortName(o)] = o
    
    l_keys = _d.keys()
    l_keys.sort()
    
    for k in l_keys:
        o = _d[k]
        o = doParentToWorld(o)
        mc.parent(o,obj)
    
    return True
예제 #4
0
def sortChildrenByName(obj):
    _l = search.returnChildrenObjects(obj, fullPath=True)
    if not _l:
        log.error("sortChildrenByName>> No children found.")
        return False

    _d = {}
    for i, o in enumerate(_l):
        _bfr = names.getBaseName(o)
        if _bfr not in _d.keys():
            _d[_bfr] = o
        else:
            _d[names.getShortName(o)] = o

    l_keys = _d.keys()
    l_keys.sort()

    for k in l_keys:
        o = _d[k]
        o = doParentToWorld(o)
        mc.parent(o, obj)

    return True
예제 #5
0
        def _fnc_skinCluster(self):
            self.log_toDo("Add ability to check exisiting targets skin")
            self.log_toDo("Add more than just skincluster ability?...")  
            #..........................................................
            _targetMesh = self.mData.d_target['mesh']

            #...See if we have a skin cluster...
            _targetSkin = skinning.querySkinCluster(_targetMesh) or False
            if _targetSkin:
                if self._l_missingInfluences:
                    self.log_info("Adding influences...")                    
                    for infl in self._l_missingInfluences:
                        mc.skinCluster(_targetSkin, edit = True, ai = infl)
                #try:mc.delete(_targetSkin)
                #except:pass
            else:
                #...create our skin cluster                
                _l_bind = copy.copy(self.l_jointsToUse)
                _l_bind.append(_targetMesh)                
                _targetSkin = mc.skinCluster(_l_bind,tsb=True,n=(names.getBaseName(_targetMesh)+'_skinCluster'))[0]                
            

            self.mData.d_target['skin'] = _targetSkin#...update the stored data
            self.log_info("Created '{0}'".format(_targetSkin) + cgmGeneral._str_subLine)
예제 #6
0
def get_objNameDict(obj, ignore=[False]):
    """ 
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    DESCRIPTION:
    Returns a generated dictionary of name info

    ARGUMENTS:
    obj(string) - object
    ignore(string) - default is 'none', only culls out cgmtags that are 
                     generated via returnCGMOrder() function

    RETURNS:
    namesDict(string)
    >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    """
    try:
        _str_funcName = "get_objNameDict"
        log.debug(">>> %s >>> " % (_str_funcName) + "=" * 75)

        if type(ignore) is not list: ignore = [ignore]

        namesDict = {}
        divider = returnCGMDivider()
        order = returnCGMOrder()
        nameBuilder = []
        #>>> Get our cgmVar_iables
        #userAttrs = attributes.returnUserAttributes(obj)
        #cgmAttrs = lists.returnMatchList(userAttrs,order)
        #>>> Tag ignoring
        if ignore:
            for i in ignore:
                if i in order:
                    order.remove(i)

        #>>> Geting our data
        for tag in order:
            tagInfo = SEARCH.get_tagInfo(obj, tag)
            if tagInfo is not False:
                namesDict[tag] = (tagInfo)

        if 'cgmIterator' in order:
            _iterator = ATTR.get(obj, 'cgmIterator')
            if _iterator is not False:
                log.debug("Iterator found")
                namesDict['cgmIterator'] = (_iterator)

        # remove tags up stream that we don't want if they don't exist on the actual object"""
        if not mc.objExists(obj + '.cgmTypeModifier'):
            if namesDict.get('cgmTypeModifier') != None:
                namesDict.pop('cgmTypeModifier')

        log.debug("%s >>> initial nameDict: %s " % (_str_funcName, namesDict))

        #>>> checks if the names exist as objects or it's a shape node
        ChildNameObj = False

        nameObj = False
        cgmNameAttrType = ATTR.get_type(obj, 'cgmName')
        log.debug("cgmNameAttrType: {0}".format(cgmNameAttrType))

        if cgmNameAttrType == 'message':
            #nameObj = SEARCH.get_nodeTagInfo(obj,'cgmName')
            nameObj = ATTR.get_message(
                obj, 'cgmName',
                simple=True)  #SEARCH.get_nodeTagInfo(obj,'cgmName')
            if nameObj:
                nameObj = nameObj[0]
                nameObjDict = get_objNameDict(nameObj)
                #pprint.pprint(nameObjDict)
                for k in 'cgmDirection', 'cgmPosition':
                    #if nameObjDict.get(k) and namesDict.get(k):
                    try:
                        namesDict.pop(k)
                    except:
                        pass
                log.debug("nameObj: {0}".format(nameObj))
                namesDict['cgmName'] = names.getBaseName(nameObj)
                return namesDict

        typeTag = SEARCH.get_nodeTagInfo(obj, 'cgmType')
        isType = SEARCH.VALID.get_mayaType(obj)
        isShape = SEARCH.VALID.is_shape(obj)
        """first see if it's a group """
        if isType == 'group' and typeTag == False:
            childrenObjects = TRANS.children_get(obj, False)
            log.debug("%s >>> group and no typeTag..." % (_str_funcName))
            """ if it's a transform group """
            groupNamesDict = {}
            if not nameObj:
                groupNamesDict['cgmName'] = childrenObjects[0]
            else:
                groupNamesDict['cgmName'] = nameObj
            groupNamesDict['cgmType'] = CORESHARE.d_cgmTypes.get('transform')
            if namesDict.get('cgmTypeModifier') != None:
                groupNamesDict['cgmTypeModifier'] = namesDict.get(
                    'cgmTypeModifier')
            return groupNamesDict
            """ see if there's a name tag"""
        elif isType in ['joint']:
            return namesDict
        elif isShape:
            #If we have a name object or shape
            log.debug("%s >>> nameObj not None or isType is 'shape'..." %
                      (_str_funcName))

            if isShape:
                #log.debug("%s >>> nameObj exists: '%s'..."%(_str_funcName,nameObj))
                #Basic child object with cgmName tag
                childNamesDict = {}
                childNamesDict['cgmName'] = namesDict.get('cgmName')
                childNamesDict['cgmType'] = namesDict.get('cgmType')
                if namesDict.get('cgmTypeModifier') != None:
                    childNamesDict['cgmTypeModifier'] = namesDict.get(
                        'cgmTypeModifier')
                if namesDict.get('cgmIterator') != None:
                    childNamesDict['cgmIterator'] = namesDict.get(
                        'cgmIterator')

                return childNamesDict
            elif isShape or 'Constraint' in isType:
                """if so, it's a child name object"""
                log.debug("%s >>> child name object..." % (_str_funcName))
                childNamesDict = {}
                childNamesDict['cgmName'] = TRANS.parent_get(obj, False)
                childNamesDict['cgmType'] = namesDict.get('cgmType')
                return childNamesDict
            else:
                log.debug("%s >>> No special case found. %s" %
                          (_str_funcName, namesDict))
                return namesDict
        else:
            return namesDict
    except Exception, err:
        raise cgmGEN.cgmExceptCB(Exception, err, msg=vars())
예제 #7
0
        def _fnc_processData(self):
            '''
            Sort out the components
            '''            
            #...check if our vtx counts match...
            self.log_toDo("Remap dictionary argument")
            self.log_toDo("Non matching mesh types")   
            self.mData.d_target = data.validateMeshArg(self.mData.d_target['mesh'])#...update
            
            _int_sourceCnt = int(self.mData.d_source['pointCount'])
            _int_targetCnt = int(self.mData.d_target['pointCount'])
            _type_source = self.mData.d_source['meshType']
            _type_target = self.mData.d_target['meshType']
            _target = self.mData.d_target['mesh']
            _component = self.mData.d_target['component']
            self.log_infoDict(self.mData.d_target,'target dict...')
            
            #if int(_int_sourceCnt) != int(_int_targetCnt):
                #return self._FailBreak_("Haven't implemented non matching component counts | source: {0} | target: {1}".format(_int_sourceCnt,_int_targetCnt))              
            if not _type_source == _type_target:
                return self._FailBreak_("Haven't implemented non matching mesh types | source: {0} | target: {1}".format(_type_source,_type_target))              
            
            #...generate a processed list...
            #[[jntIdx,v],[jntIdx,v]....] -- the count in the list is the vert count
            _raw_componentWeights = self.mData.d_sourceInfluences['componentWeights']
            _raw_blendweights = self.mData.d_sourceInfluences['blendWeights']
            
            _l_cleanData = []
            
            #...First loop is to only initially clean the data...
            for i in range(_int_sourceCnt):#...for each vert
                _str_i = str(i)
                _subL = []
                
                _bfr_raw = _raw_componentWeights[_str_i]
                
                _bfr_toNormalize = []
                _bfr_clean = {}
                _d_normalized = {}
                for k,value in _bfr_raw.iteritems():
                    _bfr_clean[int(k)] = float(value)
                    _d_normalized[int(k)] = None
                    
                #normalize the values...
                for k,value in _bfr_clean.iteritems():
                    _bfr_toNormalize.append(value)
                    
                _bfr_normalized = cgmMath.normSumList(_bfr_toNormalize,1.0)
                #self.log_info("To Normalize: {0}".format(_bfr_toNormalize))                
                #self.log_info("Normalized: {0}".format(_bfr_normalized))
                #self.log_info("{0} pre sum: {1}".format(i,sum(_bfr_toNormalize)))                
                #self.log_info("{0} sum: {1}".format(i,sum(_bfr_normalized)))
                
                for ii,k in enumerate(_d_normalized.keys()):
                    _d_normalized[k] = _bfr_normalized[ii]
                #self.log_info("clean: {0}".format(_bfr_clean))                
                #self.log_info("norm:  {0}".format(_d_normalized))                
                    
                if not cgmMath.isFloatEquivalent(1.0, sum(_bfr_normalized) ):
                    self.log_info("vert {0} not normalized".format(i))
                #self.log_info("vert {0} base: {1}".format(i,_bfr_toNormalize))
                #self.log_info("vert {0} norm: {1}".format(i,_bfr_normalized))
                _l_cleanData.append(_d_normalized)
                #if i == 3:return self._FailBreak_("stop")
            self._l_processed = _l_cleanData#...initial push data
            
            
            #...nameMatch ------------------------------------------------------------------------
            if self._b_nameMatch:
                self.log_info("nameMatch attempt...")
                _l_configInfluenceList = self.l_configInfluenceList
                _l_jointsToUseBaseNames = [names.getBaseName(n) for n in self.l_jointsToUse]
                
                for n in _l_jointsToUseBaseNames:#...see if all our names are there
                    if not n in _l_configInfluenceList:
                        #return self._FailBreak_
                        self.log_warning("nameMatch... joint '{0}' from joints to use list not in config list".format(n))                        
                        #self._FailBreak_("nameMatch... joint '{0}' from joints to use list not in config list".format(n))              
                        #return False
                        #return False
                    
                _d_rewire = {}       
                
                for i,n in enumerate(_l_configInfluenceList):
                    _idx_base = _l_jointsToUseBaseNames.index(n)
                    
                    #self.log_error("Rewire. Name:{0} | config idx:{1} ===> currentIdx: {2}".format(n,_idx_config,i))
                    _d_rewire[i] = _idx_base
                    
                """
                for i,n in enumerate(_l_configInfluenceList):
                    if _l_jointsToUseBaseNames[i] != n:
                        self.log_error("Name mismatch. idx:{0} | config:{1} | useJoint:{2}".format(i,n,_l_jointsToUseBaseNames[i]))
                        
                        #_d_rewire[i] = _l_configInfluenceList.index(_l_jointsToUseBaseNames[i])
                        _d_rewire[i] = _l_configInfluenceList.index(_l_jointsToUseBaseNames[_l_jointsToUseBaseNames.index(n)])
                        """
                self.log_infoDict(_d_rewire,"Rewire...")
                for i,d in enumerate(self._l_processed):
                    _d_dup = copy.copy(d)
                    #self.log_info("{0} before remap: {1}".format(i,d))                    
                    for r1,r2 in _d_rewire.iteritems():#...{1:2, 2:1}
                        if r1 in _d_dup.keys():#...1,2
                            if r2 in _d_dup.keys():
                                _bfr1 = _d_dup[r1]
                                _bfr2 = _d_dup[r2]
                                d[r1] = _bfr2
                                d[r2] = _bfr1
                            else:
                                d[r2] = d.pop(r1)
                    #self.log_info("{0} after remap: {1}".format(i,d))

                    
            if int(_int_sourceCnt) != int(_int_targetCnt) or self._b_forceClosestComponent:
                try:#closest to remap ------------------------------------------------------------------------
                    self.log_warning("Non matching component counts. Using closestTo method to remap")
                    _l_closestRetarget = []
                    #...generate a posList of the source data
                    l_source_pos = []
                    _d_pos = self.mData.d_source['d_vertPositions']
                    for i in range(_int_sourceCnt):
                        l_source_pos.append([float(v) for v in _d_pos[str(i)]])#...turn our strings to values
                       
                    self.progressBar_start(stepMaxValue=_int_targetCnt, 
                                           statusMessage='Calculating....', 
                                           interruptableState=False)  
                    
                    for i in range(_int_targetCnt):
                        _str_vert = "{0}.{1}[{2}]".format(_target,_component,i)
                        self.progressBar_iter(status = "Finding closest to '{0}'".format(_str_vert))                                        
                        
                        #self.log_info(_str_vert)
                        _pos = distance.returnWorldSpacePosition(_str_vert)#...get position       
                        _closestPos = distance.returnClosestPoint(_pos, l_source_pos)#....get closest
                        _closestIdx = l_source_pos.index(_closestPos)
                        #self.log_info("target idx: {0} | Closest idx: {1} | value{2}".format(i,_closestIdx,_l_cleanData[_closestIdx]))
                        _l_closestRetarget.append(_l_cleanData[_closestIdx])
                    self.progressBar_end()
                        
                    self._l_processed = _l_closestRetarget#...push it backs
                    self._b_smooth = True
                    
                    if _int_targetCnt >= _int_sourceCnt:
                        self._f_smoothWeightsValue = .00005
                    else:
                        self._f_smoothWeightsValue = .5
                        
                    self.log_info("closestTo remap complete...")
                except Exception,error:
                    raise Exception,"closestTo remap failure | {0}".format(error)
예제 #8
0
파일: skinDat.py 프로젝트: liudger/cgmTools
        def _fnc_processData(self):
            '''
            Sort out the components
            '''            
            #...check if our vtx counts match...
            self.log_toDo("Remap dictionary argument")
            self.log_toDo("Non matching mesh types")   
            self.mData.d_target = data.validateMeshArg(self.mData.d_target['mesh'])#...update
            
            _int_sourceCnt = int(self.mData.d_source['pointCount'])
            _int_targetCnt = int(self.mData.d_target['pointCount'])
            _type_source = self.mData.d_source['meshType']
            _type_target = self.mData.d_target['meshType']
            _target = self.mData.d_target['mesh']
            _component = self.mData.d_target['component']
            self.log_infoDict(self.mData.d_target,'target dict...')
            
            #if int(_int_sourceCnt) != int(_int_targetCnt):
                #return self._FailBreak_("Haven't implemented non matching component counts | source: {0} | target: {1}".format(_int_sourceCnt,_int_targetCnt))              
            if not _type_source == _type_target:
                return self._FailBreak_("Haven't implemented non matching mesh types | source: {0} | target: {1}".format(_type_source,_type_target))              
            
            #...generate a processed list...
            #[[jntIdx,v],[jntIdx,v]....] -- the count in the list is the vert count
            _raw_componentWeights = self.mData.d_sourceInfluences['componentWeights']
            _raw_blendweights = self.mData.d_sourceInfluences['blendWeights']
            
            _l_cleanData = []
            
            #...First loop is to only initially clean the data...
            for i in range(_int_sourceCnt):#...for each vert
                _str_i = str(i)
                _subL = []
                
                _bfr_raw = _raw_componentWeights[_str_i]
                
                _bfr_toNormalize = []
                _bfr_clean = {}
                _d_normalized = {}
                for k,value in _bfr_raw.iteritems():
                    _bfr_clean[int(k)] = float(value)
                    _d_normalized[int(k)] = None
                    
                #normalize the values...
                for k,value in _bfr_clean.iteritems():
                    _bfr_toNormalize.append(value)
                    
                _bfr_normalized = cgmMath.normSumList(_bfr_toNormalize,1.0)
                #self.log_info("To Normalize: {0}".format(_bfr_toNormalize))                
                #self.log_info("Normalized: {0}".format(_bfr_normalized))
                #self.log_info("{0} pre sum: {1}".format(i,sum(_bfr_toNormalize)))                
                #self.log_info("{0} sum: {1}".format(i,sum(_bfr_normalized)))
                
                for ii,k in enumerate(_d_normalized.keys()):
                    _d_normalized[k] = _bfr_normalized[ii]
                #self.log_info("clean: {0}".format(_bfr_clean))                
                #self.log_info("norm:  {0}".format(_d_normalized))                
                    
                if not cgmMath.isFloatEquivalent(1.0, sum(_bfr_normalized) ):
                    self.log_info("vert {0} not normalized".format(i))
                #self.log_info("vert {0} base: {1}".format(i,_bfr_toNormalize))
                #self.log_info("vert {0} norm: {1}".format(i,_bfr_normalized))
                _l_cleanData.append(_d_normalized)
                #if i == 3:return self._FailBreak_("stop")
            self._l_processed = _l_cleanData#...initial push data
            
            
            #...nameMatch ------------------------------------------------------------------------
            if self._b_nameMatch:
                self.log_info("nameMatch attempt...")
                _l_configInfluenceList = self.l_configInfluenceList
                _l_jointsToUseBaseNames = [names.getBaseName(n) for n in self.l_jointsToUse]
                
                for n in _l_jointsToUseBaseNames:#...see if all our names are there
                    if not n in _l_configInfluenceList:
                        #return self._FailBreak_
                        self.log_warning("nameMatch... joint '{0}' from joints to use list not in config list".format(n))                        
                        #self._FailBreak_("nameMatch... joint '{0}' from joints to use list not in config list".format(n))              
                        #return False
                        #return False
                    
                _d_rewire = {}       
                
                for i,n in enumerate(_l_configInfluenceList):
                    _idx_base = _l_jointsToUseBaseNames.index(n)
                    #self.log_error("Rewire. Name:{0} | config idx:{1} ===> currentIdx: {2}".format(n,_idx_config,i))
                    _d_rewire[i] = _idx_base
                    
                """
                for i,n in enumerate(_l_configInfluenceList):
                    if _l_jointsToUseBaseNames[i] != n:
                        self.log_error("Name mismatch. idx:{0} | config:{1} | useJoint:{2}".format(i,n,_l_jointsToUseBaseNames[i]))
                        
                        #_d_rewire[i] = _l_configInfluenceList.index(_l_jointsToUseBaseNames[i])
                        _d_rewire[i] = _l_configInfluenceList.index(_l_jointsToUseBaseNames[_l_jointsToUseBaseNames.index(n)])
                        """
                self.log_infoDict(_d_rewire,"Rewire...")
                for i,d in enumerate(self._l_processed):
                    _d_dup = copy.copy(d)
                    #self.log_info("{0} before remap: {1}".format(i,d))                    
                    for r1,r2 in _d_rewire.iteritems():#...{1:2, 2:1}
                        if r1 in _d_dup.keys():#...1,2
                            if r2 in _d_dup.keys():
                                _bfr1 = _d_dup[r1]
                                _bfr2 = _d_dup[r2]
                                d[r1] = _bfr2
                                d[r2] = _bfr1
                            else:
                                d[r2] = d.pop(r1)
                    #self.log_info("{0} after remap: {1}".format(i,d))

                    
            if int(_int_sourceCnt) != int(_int_targetCnt) or self._b_forceClosestComponent:
                try:#closest to remap ------------------------------------------------------------------------
                    self.log_warning("Non matching component counts. Using closestTo method to remap")
                    _l_closestRetarget = []
                    #...generate a posList of the source data
                    l_source_pos = []
                    _d_pos = self.mData.d_source['d_vertPositions']
                    for i in range(_int_sourceCnt):
                        l_source_pos.append([float(v) for v in _d_pos[str(i)]])#...turn our strings to values
                       
                    self.progressBar_start(stepMaxValue=_int_targetCnt, 
                                           statusMessage='Calculating....', 
                                           interruptableState=False)  
                    
                    for i in range(_int_targetCnt):
                        _str_vert = "{0}.{1}[{2}]".format(_target,_component,i)
                        self.progressBar_iter(status = "Finding closest to '{0}'".format(_str_vert))                                        
                        
                        #self.log_info(_str_vert)
                        _pos = distance.returnWorldSpacePosition(_str_vert)#...get position       
                        _closestPos = distance.returnClosestPoint(_pos, l_source_pos)#....get closest
                        _closestIdx = l_source_pos.index(_closestPos)
                        #self.log_info("target idx: {0} | Closest idx: {1} | value{2}".format(i,_closestIdx,_l_cleanData[_closestIdx]))
                        _l_closestRetarget.append(_l_cleanData[_closestIdx])
                    self.progressBar_end()
                        
                    self._l_processed = _l_closestRetarget#...push it backs
                    self._b_smooth = True
                    
                    if _int_targetCnt >= _int_sourceCnt:
                        self._f_smoothWeightsValue = .00005
                    else:
                        self._f_smoothWeightsValue = .5
                        
                    self.log_info("closestTo remap complete...")
                except Exception,error:
                    raise Exception,"closestTo remap failure | {0}".format(error)
예제 #9
0
파일: skinDat.py 프로젝트: liudger/cgmTools
            #...See if we have a skin cluster...
            _targetSkin = skinning.querySkinCluster(_targetMesh) or False
            if _targetSkin:
                if self._l_missingInfluences:
                    self.log_info("Adding influences...")                    
                    for infl in self._l_missingInfluences:
                        try:mc.skinCluster(_targetSkin, edit = True, ai = infl)
                        except Exception,err:
                            log.error(err)
                #try:mc.delete(_targetSkin)
                #except:pass
            else:
                #...create our skin cluster                
                _l_bind = copy.copy(self.l_jointsToUse)
                _l_bind.append(_targetMesh)                
                _targetSkin = mc.skinCluster(_l_bind,tsb=True,n=(names.getBaseName(_targetMesh)+'_skinCluster'))[0]                
            

            self.mData.d_target['skin'] = _targetSkin#...update the stored data
            self.log_info("Created '{0}'".format(_targetSkin) + cgmGeneral._str_subLine)
            
            #...Does this skin cluster have our expected targets?
            
        def _fnc_applyData(self):
            '''
            '''    
            _targetSkin = self.mData.d_target['skin']      
            mi_skinCluster = cgmMeta.cgmNode(_targetSkin)
            skinFn = OMA.MFnSkinCluster( mi_skinCluster.mNodeMObject )
            
            #...get some api stuff
예제 #10
0
                    self.log_info("Adding influences...")
                    for infl in self._l_missingInfluences:
                        try:
                            mc.skinCluster(_targetSkin, edit=True, ai=infl)
                        except Exception, err:
                            log.error(err)
                #try:mc.delete(_targetSkin)
                #except:pass
            else:
                #...create our skin cluster
                _l_bind = copy.copy(self.l_jointsToUse)
                _l_bind.append(_targetMesh)
                _targetSkin = mc.skinCluster(
                    _l_bind,
                    tsb=True,
                    n=(names.getBaseName(_targetMesh) + '_skinCluster'))[0]

            self.mData.d_target[
                'skin'] = _targetSkin  #...update the stored data
            self.log_info("Created '{0}'".format(_targetSkin) +
                          cgmGeneral._str_subLine)

            #...Does this skin cluster have our expected targets?

        def _fnc_applyData(self):
            '''
            '''
            _targetSkin = self.mData.d_target['skin']
            mi_skinCluster = cgmMeta.cgmNode(_targetSkin)
            skinFn = OMA.MFnSkinCluster(mi_skinCluster.mNodeMObject)