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


Python NodeUtility.getDependNode方法代码示例

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


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

示例1: copyBitSettings

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import getDependNode [as 别名]
def copyBitSettings():
    '''
    Copies the bit shape settings (OpenGL stuff) from the second object to the
    first (in selection order).
    '''
    selList = cmds.ls( selection=True, long=True )
    depFn = OpenMaya.MFnDependencyNode()
    
    if len(selList) == 2:
        # First object is target.
        targetShape = cmds.listRelatives( selList[0], shapes=True, fullPath=True )[0]
        targetShapeMObj = NodeUtility.getDependNode( targetShape )
        depFn.setObject( targetShapeMObj )
        targetShapeType = depFn.typeName()
        
        # Second object is source.
        sourceShape = cmds.listRelatives( selList[1], shapes=True, fullPath=True )[0]
        sourceShapeMObj = NodeUtility.getDependNode( sourceShape )
        depFn.setObject( sourceShapeMObj )
        sourceShapeType = depFn.typeName()
        
        if targetShapeType == sourceShapeType:        
            # The types match. Do the copy of attribute settings.
            for attr in cmds.listAttr( sourceShape, multi=True, keyable=True ):
                # Get the plugs.
                sourcePlug = NodeUtility.getPlug( sourceShape, attr )
                targetPlug = NodeUtility.getPlug( targetShape, attr )
                
                # Get the source plug value.
                sourcePlugValue = NodeUtility.getPlugValue( sourcePlug )
                
                # Set the target's plug value.
                NodeUtility.setPlugValue( targetPlug, sourcePlugValue )
        else:
            raise ValueError( '{0} and {1} do not match.'.format( selList[0], selList[1] ) )
开发者ID:EriLee,项目名称:marigold,代码行数:37,代码来源:FrameUtility.py

示例2: createCompoundCurve

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import getDependNode [as 别名]
def createCompoundCurve(inCurves):
    """
    Merges all the controls into one transform node.
    
    @param inCurves: List of Strings. Names of curves to combine under one transform node.
                        The first curve in the list is considered the parent of all the others.
    @return: MObject. Compound curve transform node.
    """
    # List for creating the compound.
    compoundList = []

    # Get the nurbs curves of all curves in the list.
    for index in range(1, len(inCurves)):
        curve = NodeUtility.getDagPath(inCurves[index])
        for child in xrange(curve.childCount()):
            nurb = curve.child(child)
            nurbDagPath = OpenMaya.MDagPath.getAPathTo(nurb)
            if nurb.apiType() == OpenMaya.MFn.kNurbsCurve:
                compoundList.append(nurbDagPath.fullPathName())

    # Add the transform of the parent curve. This is the first curve passed into
    # the function.
    parent = NodeUtility.getDagPath(inCurves[0])
    compoundList.append(parent.fullPathName())

    # Now parent the shapes to the first curve's transform node.
    cmds.parent(compoundList, shape=True, relative=True)

    # Delete the remaining transform nodes of the other curves.
    for index in range(1, len(inCurves)):
        cmds.delete(inCurves[index])

    # Returns a MObject.
    return NodeUtility.getDependNode(parent.fullPathName())
开发者ID:EriLee,项目名称:marigold,代码行数:36,代码来源:NurbsCurveUtility.py

示例3: addPlug

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import getDependNode [as 别名]
def addPlug( inBit, inPlugName, inAttrType, inAttrDataType ):
    '''
    Adds a plug to the frame bit.
    
    @param inBit: String. Name of the bit to add the attribute to.
    @param inPlugName: String. Name of the plug to add.
    @param inAttrType: String. Type of attribute to add.
    @param inAttrDataType: String. The attribute data type.
    '''
    if inAttrType == 'attributeType':
        if inAttrDataType == 'float3':
            cmds.addAttr( inBit, longName=inPlugName, attributeType=inAttrDataType )
            cmds.addAttr( longName='{0}X'.format( inPlugName ), attributeType='float', parent=inPlugName )
            cmds.addAttr( longName='{0}Y'.format( inPlugName ), attributeType='float', parent=inPlugName )
            cmds.addAttr( longName='{0}Z'.format( inPlugName ), attributeType='float', parent=inPlugName )
        else:
            cmds.addAttr( inBit, longName=inPlugName, attributeType=inAttrDataType )
    elif inAttrType == 'dataType':
        if inAttrDataType == 'typed':
            # Make it a string.
            inAttrDataType = 'string'
        cmds.addAttr( inBit, longName=inPlugName, dataType=inAttrDataType )
    elif inAttrType == 'matrixType':
        mObj = NodeUtility.getDependNode( inBit )
        dgModifier = OpenMaya.MDGModifier()
        mAttr = OpenMaya.MFnMatrixAttribute()
        controlMatrix = mAttr.create( inPlugName, inPlugName, OpenMaya.MFnMatrixAttribute.kDouble )
        dgModifier.addAttribute( mObj, controlMatrix )
        dgModifier.doIt()
开发者ID:EriLee,项目名称:marigold,代码行数:31,代码来源:FrameUtility.py

示例4: createCurveCircle

# 需要导入模块: from marigold.utility import NodeUtility [as 别名]
# 或者: from marigold.utility.NodeUtility import getDependNode [as 别名]
def createCurveCircle(inName, inNormal=[0, 1, 0], inRadius=1):
    """
    @param inName: String. Name of curve circle.
    @param inNormal: List. Direction the curve faces.
    @param inRadius: Int. Radius of the circle.
    @return. MObject. Curve circle.
    """
    node = cmds.circle(name=inName, normal=inNormal, radius=inRadius)
    return NodeUtility.getDependNode(node[0])
开发者ID:EriLee,项目名称:marigold,代码行数:11,代码来源:NurbsCurveUtility.py


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