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


Python NodeUtility.connectPlugs方法代码示例

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


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

示例1: addComponentToObject

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import connectPlugs [as 别名]
def addComponentToObject( inClassType, **kwargs ):    
    if kwargs.has_key('inObject'):
        targetObj = kwargs['inObject']
        print 'targetObj: {0}'.format( targetObj )
        del kwargs['inObject']
        prevSel = None
    else:
        selList = cmds.ls( selection=True, long=True )
        if len( selList ) is 1:
            targetObj = selList[0]
            prevSel = selList[0]
    
    if targetObj is not None:
        component_class = str_to_class( inClassType )
        newNode = component_class.createCompNode( inClassType, **kwargs )
        
        # Add the component attribute to the object.
        NodeUtility.addPlug( targetObj, newNode.name(), 'attributeType', 'message' )
        nodePlug = '{0}.parentName'.format( newNode.name() )
        objectPlug = '{0}.{1}'.format( targetObj, newNode.name() )
        NodeUtility.connectPlugs( objectPlug, nodePlug )
        if prevSel is not None:
            cmds.select( prevSel )
            
        return newNode
开发者ID:EriLee,项目名称:marigold,代码行数:27,代码来源:__init__.py

示例2: addComponentToObject

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import connectPlugs [as 别名]
 def addComponentToObject( self, inClassType ):
     selList = cmds.ls( selection=True, long=True )
     if len( selList ) is 1:
         prevSel = selList[0]
         component_class = Components.str_to_class( inClassType )
         newNode = component_class.createCompNode( inClassType )
         
         # Add the component attribute to the object.
         FrameUtility.addPlug( selList[0], newNode.name(), 'attributeType', 'message' )
         nodePlug = '{0}.parentName'.format( newNode.name() )
         objectPlug = '{0}.{1}'.format( selList[0], newNode.name() )
         NodeUtility.connectPlugs( objectPlug, nodePlug )
         cmds.select( prevSel )
开发者ID:EriLee,项目名称:marigold,代码行数:15,代码来源:qtui.py

示例3: addComponentToObject

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import connectPlugs [as 别名]
 def addComponentToObject( self, inClassType ):
     '''
     '''
     selList = cmds.ls( selection=True, long=True )
     if len( selList ) is 1:
         prevSel = selList[0]
         newNode = componentNodes.jointComponentNode().createCompNode( inClassType )
         # Add the component attribute to the object.
         FrameUtility.addPlug( selList[0], newNode.name(), 'attributeType', 'message' )
         #cmds.addAttr( inObject, longName='jointComponent', attributeType='message', storable=False )
         nodePlug = '{0}.parentName'.format( newNode.name() )
         objectPlug = '{0}.{1}'.format( selList[0], newNode.name() )
         NodeUtility.connectPlugs( objectPlug, nodePlug )
         cmds.select( prevSel )
开发者ID:EriLee,项目名称:marigold,代码行数:16,代码来源:mainGUI.py

示例4: buildFrameModule

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import connectPlugs [as 别名]
def buildFrameModule( inDir=None, inXMLFile=None ):
    from marigold.meta.metaNode import MetaNode
    
    # Get the XML settings for the frame module.
    dirPath = XMLUtility.getPresetPath( XMLUtility.FRAME_PRESETS_PATH+inDir )
    fullPath = dirPath+'/'+inXMLFile+'.xml'
    xmlDict = readFrameModuleXML( fullPath )
    
    # Get the metanode.
    metanode = xmlDict['metanode']
    meta = metanode['name']
    metaPlugs = metanode['plugs']
    metaType = metanode['metaType']
    metaClass = metanode['metaClass']
    
    metanode = MetaNode( inNodeName=meta, inNodeMetaType=metaType )
    metanode = cmds.ls( selection=True )[0]
    
    metaPlugs = xmlDict['metanode']['plugs']
    for plug in metaPlugs:
        if not NodeUtility.attributeCheck( metanode, plug['name'] ):
            addPlug( metanode, plug['name'], plug['attrType'], plug['attrDataType'] )
        if plug['connected'] == 'False':
            setPlug( metanode, plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
    
    # Get the bits.
    bits = xmlDict['bits']
    
    # Make a group for the module.
    for bit in bits:
        if bit['name'] == 'frame_root':
            for plug in bit['plugs']:
                if plug['name'] == 'prefix':
                    modulePrefix = plug['value']
                    break
                
    moduleGroup = '|{0}'.format( cmds.group( em=True, name=modulePrefix+'_'+metaClass ) )

    # Make each bit.
    tick = 0
    storeBitConnections = []

    while tick < len(bits):
        bitName = bits[0]['name']
        if bits[0]['parent'] == 'None':
            # This is the root bit. The | is there to represent this. We don't need it now.
            # Plus it causes problems with the full path name stuff (double ||). So we
            # remove it.
            bitParent = moduleGroup
        else:
            bitParent = moduleGroup+bits[0]['parent']
        bitPlugs = bits[0]['plugs']
        bitShape = bits[0]['shape']
        
        # 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 )
            # Get the frame_root for the module. We want to return this at the very end.
            if bitName == 'frame_root':
                rootFullName = fullBitName
            
            # Setup plugs for transform and custom attributes.
            for plug in bitPlugs:
                if not NodeUtility.attributeCheck( fullBitName, plug['name'] ):
                    addPlug( fullBitName, plug['name'], plug['attrType'], plug['attrDataType'] )
                    if plug['value'] is not None:
                        setPlug( fullBitName, plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
                else:          
                    # Setup position and rotation.
                    setPlug( fullBitName, plug['name'], plug['value'] )
            
                # Connect plug to meta node.
                for mplug in metaPlugs:
                    if '{0}.{1}'.format(bitName, plug['name']) == mplug['value']:
                        inSourcePlug = fullBitName+'.'+plug['name']
                        inDestinationPlug = metanode+'.'+mplug['name']
                        NodeUtility.connectPlugs( inSourcePlug, inDestinationPlug )
                        
            # Setup plugs for shape attributes.
            shapeName = cmds.listRelatives( fullBitName, shapes=True )
            fullShapeName = '{0}|{1}'.format( fullBitName, shapeName[0] )
            for plug in bitShape:
                if plug['attrDataType'] == 'TdataCompound':
                    # 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 } )
                else:
                    setPlug( fullShapeName, plug['name'], plug['value'], inAttrDataType=plug['attrDataType'] )
                           
            bits.remove( bits[0] )
        else:
            tick = tick+1
            pass
    
#.........这里部分代码省略.........
开发者ID:EriLee,项目名称:marigold,代码行数:103,代码来源:FrameUtility.py


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