本文整理汇总了Python中maya.OpenMaya.MFnUnitAttribute方法的典型用法代码示例。如果您正苦于以下问题:Python OpenMaya.MFnUnitAttribute方法的具体用法?Python OpenMaya.MFnUnitAttribute怎么用?Python OpenMaya.MFnUnitAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类maya.OpenMaya
的用法示例。
在下文中一共展示了OpenMaya.MFnUnitAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: nodeInitializer
# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnUnitAttribute [as 别名]
def nodeInitializer():
'''initializer
'''
# create the size attr
uAttrFn = OpenMaya.MFnUnitAttribute()
oyTrajectoryDrawer.aSize = uAttrFn.create( "size", "in", OpenMaya.MFnUnitAttribute.kDistance )
uAttrFn.setDefault(1.0)
oyTrajectoryDrawer.addAttribute( oyTrajectoryDrawer.aSize )
# create the trajectory positions attr
nAttrFn = OpenMaya.MFnNumericAttribute()
tAttrFn = OpenMaya.MFnTypedAttribute()
mAttrFn = OpenMaya.MFnMessageAttribute()
defaultVectorArray = OpenMaya.MVectorArray()
vectorArrayDataFn = OpenMaya.MFnVectorArrayData()
vectorArrayDataFn.create( defaultVectorArray )
oyTrajectoryDrawer.aTPos = tAttrFn.create( "trajectoryPosition", "tp", OpenMaya.MFnData.kVectorArray, vectorArrayDataFn.object() )
tAttrFn.setWritable(True)
tAttrFn.setStorable(True)
oyTrajectoryDrawer.addAttribute( oyTrajectoryDrawer.aTPos )
示例2: addCompoundVector3Attribute
# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnUnitAttribute [as 别名]
def addCompoundVector3Attribute(cls, compoundAttribute, attributeName, unitType, arrayAttr, inputAttr, defaultValue):
# Schematic view of compound attribute:
# compoundAttribute[?]
# compoundAttributeX
# compoundAttributeY
# compoundAttributeZ
unitAttr = OpenMaya.MFnUnitAttribute()
nAttr = OpenMaya.MFnNumericAttribute()
compoundAttribute.x = unitAttr.create(attributeName + "X", attributeName + "X", unitType, defaultValue.x)
unitAttr.setWritable( inputAttr )
cls.addAttribute(compoundAttribute.x)
compoundAttribute.y = unitAttr.create(attributeName + "Y", attributeName + "Y", unitType, defaultValue.y)
unitAttr.setWritable( inputAttr )
cls.addAttribute(compoundAttribute.y)
compoundAttribute.z = unitAttr.create(attributeName + "Z", attributeName + "Z", unitType, defaultValue.z)
unitAttr.setWritable( inputAttr )
cls.addAttribute(compoundAttribute.z)
# Output compound
compoundAttribute.compound = nAttr.create(attributeName, attributeName,
compoundAttribute.x, compoundAttribute.y, compoundAttribute.z)
nAttr.setWritable( inputAttr )
nAttr.setArray( arrayAttr )
nAttr.setUsesArrayDataBuilder( arrayAttr )
nAttr.setDisconnectBehavior(OpenMaya.MFnAttribute.kDelete)
cls.addAttribute(compoundAttribute.compound)
示例3: addCurveAxisHandleAttribute
# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnUnitAttribute [as 别名]
def addCurveAxisHandleAttribute(cls, curveAxisHandleAttr, attributeName, defaultAxisValue):
# Schematic view of compound attribute:
# curveAxisHandle[]
# curveAxisHandleParameter
# curveAxisHandleAngle
nAttr = OpenMaya.MFnNumericAttribute()
cmpAttr = OpenMaya.MFnCompoundAttribute()
curveAxisHandleAttr.parameter = nAttr.create(attributeName + "Parameter", attributeName + "Parameter", OpenMaya.MFnNumericData.kDouble, 0.0)
nAttr.setWritable( True )
cls.addAttribute(curveAxisHandleAttr.parameter)
curveAxisHandleAttr.angle = nAttr.create(attributeName + "Angle", attributeName + "Angle", OpenMaya.MFnNumericData.kDouble, 0.0)
nAttr.setWritable( True )
cls.addAttribute(curveAxisHandleAttr.angle)
# cls.addCompoundVector3Attribute(curveAxisHandleAttr.axis, attributeName + "Axis", OpenMaya.MFnUnitAttribute.kAngle, False, True, defaultAxisValue)
# Build compound array attribute
curveAxisHandleAttr.compound = cmpAttr.create(attributeName, attributeName)
cmpAttr.addChild(curveAxisHandleAttr.parameter)
cmpAttr.addChild(curveAxisHandleAttr.angle)
cmpAttr.setWritable( True )
cmpAttr.setArray( True )
cmpAttr.setUsesArrayDataBuilder( True )
cls.addAttribute(curveAxisHandleAttr.compound)
示例4: nodeInitializer
# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnUnitAttribute [as 别名]
def nodeInitializer():
nAttr = OpenMaya.MFnNumericAttribute()
uAttr = OpenMaya.MFnUnitAttribute()
# input
ShakeNode.amp = nAttr.create( "amplitude", "amp", OpenMaya.MFnNumericData.k3Float, 1.0 )
nAttr.setStorable(True)
nAttr.setKeyable(True)
ShakeNode.freq = nAttr.create( "frequency", "freq", OpenMaya.MFnNumericData.k3Float, 1.0 )
nAttr.setStorable(True)
nAttr.setKeyable(True)
ShakeNode.seed = nAttr.create( "randomSeed", "seed", OpenMaya.MFnNumericData.kLong, 1000 )
nAttr.setStorable(True)
nAttr.setKeyable(False)
nAttr.setMin(0)
ShakeNode.octaves = nAttr.create( "octaves", "oct", OpenMaya.MFnNumericData.kInt, 3 )
nAttr.setStorable(True)
nAttr.setKeyable(True)
nAttr.setMin(2)
# the time attribute should be connected to the default "time1" node
# or any time node to provide a changing time value
ShakeNode.time = uAttr.create( "currentTime", "time" , OpenMaya.MFnUnitAttribute.kTime, 0.0 )
uAttr.setHidden(True)
nAttr.setStorable(False)
# output
ShakeNode.output = nAttr.create( "output", "out", OpenMaya.MFnNumericData.k3Float, 0.0 )
nAttr.setStorable(False)
nAttr.setWritable(False)
nAttr.setHidden(False)
# add attributes to the node
ShakeNode.addAttribute( ShakeNode.amp )
ShakeNode.addAttribute( ShakeNode.freq )
ShakeNode.addAttribute( ShakeNode.seed )
ShakeNode.addAttribute( ShakeNode.time )
ShakeNode.addAttribute( ShakeNode.octaves )
ShakeNode.addAttribute( ShakeNode.output )
# when one attribute is changed, it will cause
# the other to become "dirty", meaning that its value
# should be computed again
ShakeNode.attributeAffects( ShakeNode.amp, ShakeNode.output )
ShakeNode.attributeAffects( ShakeNode.freq, ShakeNode.output )
ShakeNode.attributeAffects( ShakeNode.seed, ShakeNode.output )
ShakeNode.attributeAffects( ShakeNode.octaves, ShakeNode.output )
ShakeNode.attributeAffects( ShakeNode.time, ShakeNode.output )
# initialize the script plug-in