当前位置: 首页>>代码示例>>Python>>正文


Python NodeUtility.connectNodes方法代码示例

本文整理汇总了Python中marigold.utility.NodeUtility.connectNodes方法的典型用法代码示例。如果您正苦于以下问题:Python NodeUtility.connectNodes方法的具体用法?Python NodeUtility.connectNodes怎么用?Python NodeUtility.connectNodes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在marigold.utility.NodeUtility的用法示例。


在下文中一共展示了NodeUtility.connectNodes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connectModules

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import connectNodes [as 别名]
 def connectModules(self):
     '''
     Connects a module to the character component.
     '''
     # Get modules selected from disList
     selList = self.disList.selectedItems()
     for module in selList:
         NodeUtility.connectNodes( self.charNode, 'modules', self.disMods[module.text()], 'characterRoot' )
         
     # Refresh the lists.
     self.updateLists()
开发者ID:EriLee,项目名称:marigold,代码行数:13,代码来源:UIEditCharacterModules.py

示例2: makeGroups

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import connectNodes [as 别名]
    def makeGroups( self ):
        # Create character group.
        characterGroup = cmds.createNode( 'transform', name='character' )
        cmds.addAttr( characterGroup, longName='metaParent', dataType='string')
        NodeUtility.connectNodes( self.inNodeName, 'characterGroup', 'character', 'metaParent' )
                
        # Create frame group.
        frameGroup = cmds.createNode( 'transform', name='frame', parent='character' )     
        cmds.addAttr( frameGroup, longName='metaParent', dataType='string' )
        NodeUtility.connectNodes( self.inNodeName, 'frameGroup', 'frame', 'metaParent' )

        # Create rig group.
        rigGroup = cmds.createNode( 'transform', name='rig', parent='character' )
        cmds.addAttr( rigGroup, longName='metaParent', dataType='string' )
        NodeUtility.connectNodes( self.inNodeName, 'rigGroup', 'rig', 'metaParent' )
        
        # Create skeleton group.
        skeletonGroup = cmds.createNode( 'transform', name='skeleton', parent='character' )
        cmds.addAttr( skeletonGroup, longName='metaParent', dataType='string' )
        NodeUtility.connectNodes( self.inNodeName, 'skeletonGroup', 'skeleton', 'metaParent' )
开发者ID:EriLee,项目名称:marigold,代码行数:22,代码来源:metaNode.py

示例3: loadModule

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import connectNodes [as 别名]
def loadModule( inFolder, inFileName ):
    '''
    Loads a module into the scene.
    
    @param inFolder: String. Name for the sub-folder the module XML is located.
    @param inFileName: String. Name of the module XML. 
    '''
    dirPath = getPresetPath( FRAME_PRESETS_PATH+inFolder )
    fullPath = dirPath+'/'+inFileName+'.xml'
    xmlFile = readModuleXML( fullPath )
    
    # Create a temp group to put the module inside while creating.
    moduleGroup = '|{0}'.format( cmds.group( em=True, name='TEMP' ) )
    
    # Grab all the bits.
    bits = xmlFile['bits']
    
    # Make each bit.
    tick = 0
    storeBitConnections = []

    while tick < len(bits):
        if bits[0]['parent'] == 'None':
            bitParent = moduleGroup
        else:
            bitParent = moduleGroup+bits[0]['parent']
        
        bitName = bits[0]['name']
        bitPlugs = bits[0]['plugs']
        shapePlugs = bits[0]['shape']
        bitComponents = bits[0]['components']
        
        # Make the bit.
        if cmds.objExists( bitParent ):
            newBit = cmds.makeGLBit( name=bitName, objecttype=bits[0]['shapeType'] )            
            cmds.parent( newBit, bitParent )
            
            # From this point we use the long name for the bit. This avoids any
            # name clashes.
            fullBitName = '{0}{1}'.format( bitParent, newBit )
            
            # Setup plugs for transform and custom attributes.
            for plug in bitPlugs:
                if not NodeUtility.attributeCheck( fullBitName, plug['name'] ):
                    NodeUtility.addPlug( fullBitName, plug['name'], plug['attrType'], plug['attrDataType'] )
                    if plug['value'] is not None:
                        NodeUtility.setPlug( fullBitName, plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
                else:          
                    # Setup position and rotation.
                    NodeUtility.setPlug( fullBitName, plug['name'], plug['value'] )
            
            # Setup plugs for shape attributes.
            shapeName = cmds.listRelatives( fullBitName, shapes=True )
            fullShapeName = '{0}|{1}'.format( fullBitName, shapeName[0] )
            for plug in shapePlugs:
                if plug['attrDataType'] == 'TdataCompound' or plug['attrDataType'] == 'matrix':
                    # We skip compound nodes at this stage. They are for the child arrow drawing and must be
                    # hooked up after all the objects are created.
                    connectionChild = '{0}{1}'.format( moduleGroup, plug['value'] )
                    storeBitConnections.append( { 'parent':fullBitName, 'child':connectionChild } )
                elif plug['attrDataType'] == 'message':
                    print 'MESSAGE'
                else:
                    NodeUtility.setPlug( fullShapeName, plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
            
            # Setup bit components.
            for comp in bitComponents:
                compType = comp['name']
                
                # We have to special case components that have additional kwargs.
                if compType == 'CurveControlComponent':
                    # Handle curve control component type.
                    for plug in comp['plugs']:
                        if plug['name'] == 'curveType':
                            curveType = plug['value']
                    newComp = components.addComponentToObject( compType, inObject=fullBitName, curveType=curveType )
                else:
                    # Handle basic component.
                    newComp = components.addComponentToObject( compType, inObject=fullBitName )

                for plug in comp['plugs']:
                    # Bit of a hack with the parentName attribute. This attr is setup when the component is created.
                    # So there is no need to apply the stored plug value from the XML.
                    if plug['attrDataType'] == 'message':
                        if plug['name'] != 'parentName':
                            if plug['value'] != 'None':
                                sourcePlug = plug['value'].split('.')
                                NodeUtility.connectNodes( sourcePlug[0], sourcePlug[1], newComp.name(), plug['name'] )
                    else:
                        NodeUtility.setPlug( newComp.name(), plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
                    
            # Remove the bit from the list
            bits.remove( bits[0] )
        #tick = tick+1
            
    # Now do the hook ups for the child arrows.
    for i in storeBitConnections:
        NodeUtility.setBitChild( i['parent'], i['child'] )
开发者ID:EriLee,项目名称:marigold,代码行数:100,代码来源:XMLUtility.py


注:本文中的marigold.utility.NodeUtility.connectNodes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。