本文整理汇总了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] ) )
示例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())
示例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()
示例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])