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


Python OpenMaya.MFnTypedAttribute方法代码示例

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


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

示例1: nodeInitializer

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnTypedAttribute [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 ) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:26,代码来源:oyTrajectoryDrawer.py

示例2: initialize

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnTypedAttribute [as 别名]
def initialize():
        # First lets add the version number attribute so we can easily query the rig version number
        nAttr = om.MFnNumericAttribute()
        CharacterRoot.version = nAttr.create('version', 'ver', om.MFnNumericData.kInt, 0)
        nAttr.setStorable(True)

        # Then lets store the author of the rig as meta data as well.
        # Strings are a generic typed attribute
        tAttr = om.MFnTypedAttribute()
        # To create the default value we must create it from MFnStringData
        sData = om.MFnStringData()
        defaultValue = sData.create('Dhruv Govil')
        # Finally we make our attirbute
        CharacterRoot.author = tAttr.create('author', 'a', om.MFnData.kString, defaultValue)

        # Then lets add them to our node
        CharacterRoot.addAttribute(CharacterRoot.version)
        CharacterRoot.addAttribute(CharacterRoot.author) 
开发者ID:dgovil,项目名称:AdvancedPythonForMaya,代码行数:20,代码来源:characterRoot.py

示例3: initialize

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnTypedAttribute [as 别名]
def initialize(cls):
        fnTyped = api1.MFnTypedAttribute()
        fnNumeric = api1.MFnNumericAttribute()

        cls.aInCage = fnTyped.create('inCage', 'ic', api1.MFnData.kMesh)
        fnTyped.setStorable(False)
        fnTyped.setCached(False)
        cls.addAttribute(cls.aInCage)

        cls.aBaseCage = fnTyped.create('baseCage', 'bc', api1.MFnData.kMesh)
        cls.addAttribute(cls.aBaseCage)

        cls.aEnvelope = _deformerAttr('envelope')
        cls.aInput = _deformerAttr('input')
        cls.aOutputGeom = _deformerAttr('outputGeom')
        cls.attributeAffects(cls.aInCage, cls.aOutputGeom)
        cls.attributeAffects(cls.aBaseCage, cls.aOutputGeom) 
开发者ID:ryusas,项目名称:maya_greenCageDeformer,代码行数:19,代码来源:greenCageDeformer.py

示例4: _create_attribute

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnTypedAttribute [as 别名]
def _create_attribute():
    """Internal function for attribute create"""
    attr = oldOm.MFnTypedAttribute()
    mattr = attr.create(ICON_ATTRIBUTE,
                        ICON_ATTR,
                        oldOm.MFnData.kString)
    return mattr 
开发者ID:davidlatwe,项目名称:NodeSticker,代码行数:9,代码来源:sticker.py

示例5: _createAttribute

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnTypedAttribute [as 别名]
def _createAttribute(cls, mObj, name, dataType=None, shortName=None, default=None):
		""" Create a attribute on the provided object. Returns the attribute name and shortName. You 
		should provide dataType or default when calling this method so a valid dataType is selected. 
		MayaSceneWrapper._normalizeAttributeName is called on name to ensure it is storing the 
		attribute with a valid attribute name. If shortName is not provided, the name will have 
		MayaSceneWrapper._normalizeAttributeShortName called on it.
		:param mObj: The OpenMaya.MObject to create the attribute on
		:param name: The name used to access the attribute
		:param dataType: The type of data to store in the attribute. Defaults to None.
		:param shortName: The shortName used by scripting. Defaults to None.
		:param default: The default value assigned to the attribute. Defaults to None.
		:return: (name, short name) Because the attribute name and shortName are normalized, this
					returns the actual names used for attribute names.
		"""
		name = cls._normalizeAttributeName(name)
		if dataType == None and default != None:
			dataType == cls._getAttributeDataType(default)
			if dataType == om.MFnData.kInvalid:
				# No vaid dataType was found, default to None so we can handle it diffrently
				dataType == None
				cross3d.logger.debug('Unable To determine the attribute type.\n{}'.format(str(default)))
		if dataType == None:
			# MCH 09/17/14 # TODO Evaluate if this is a valid default?
			dataType = om.MFnData.kAny
		with ExceptionRouter():
			if shortName == None:
				shortName = cls._normalizeAttributeShortName(name, uniqueOnObj=mObj)
			depNode = om.MFnDependencyNode(mObj)
		sAttr = om.MFnTypedAttribute()
		if False: #if default:
			# TODO: Handle creating the default object
			attr = sAttr.create(name, shortName, dataType, default)
		else:
			attr = sAttr.create(name, shortName, dataType)

		# TODO MIKE: Problem with "|groundPlane_transform".
		try:
			depNode.addAttribute(attr)
		except RuntimeError:
			pass
			
		return name, shortName 
开发者ID:blurstudio,项目名称:cross3d,代码行数:44,代码来源:mayascenewrapper.py

示例6: nodeInitializer

# 需要导入模块: from maya import OpenMaya [as 别名]
# 或者: from maya.OpenMaya import MFnTypedAttribute [as 别名]
def nodeInitializer():
    """node initializer
    """
    
    # create attributes
    mAttrFn = OpenMaya.MFnMessageAttribute()
    tAttrFn = OpenMaya.MFnTypedAttribute()
    cAttrFn = OpenMaya.MFnCompoundAttribute()
    
    # lets try calculating with mesh vertices
    # so create an attribute like inMesh that accepts
    # mesh objects
    
    # ----------------------------------------------
    # ---- INPUTS ----

    # ----------------
    # objectList
    # 
    # object list should be an array that accepts mesh
    oyCenterOfMass.aInMesh = tAttrFn.create( "inMesh", "im", OpenMaya.MFnData.kMesh )
    tAttrFn.setStorable(False)
    tAttrFn.setKeyable(False)
    tAttrFn.setArray(True)
    oyCenterOfMass.addAttribute( oyCenterOfMass.aInMesh )
    
    # ----------------
    # input it self
    oyCenterOfMass.aInput = cAttrFn.create( "input", "in" )
    cAttrFn.addChild( oyCenterOfMass.aInMesh )
    oyCenterOfMass.addAttribute( oyCenterOfMass.aInput )
    
    # ----------------------------------------------
    # ---- OUTPUTS ----
    
    # ----------------
    # center of mass positions
    defaultVectorArray = OpenMaya.MVectorArray()
    vectorArrayDataFn = OpenMaya.MFnVectorArrayData()
    vectorArrayDataFn.crate( defaultVectorArray )
    
    oyCenterOfMass.aCOMPos = tAttrFn.create( "centerOfMass", "com", OpenMaya.MFnData.kVectorArray, vectorArrayDataFn.object() )
    tAttr.setWritable(False)
    tAttr.setStorable(False)
    oyCenterOfMass.addAttribute( oyCenterOfMass.aCOMPos )
    
    # output itself
    oyCenterOfMass.aOutput = cAttrFn.create( "output", "op" )
    oyCenterOfMass.addAttribute( oyCenterOfMass.aOutput )
    
    # set releations
    oyCenterOfMass.attributeAffects( oyCenterOfMass.aObjectList, oyCenterOfMass.aCOMPos )
    oyCenterOfMass.attributeAffects( oyCenterOfMass.aStartFrame, oyCenterOfMass.aCOMPos )
    oyCenterOfMass.attributeAffects( oyCenterOfMass.aEndFrame  , oyCenterOfMass.aCOMPos ) 
开发者ID:eoyilmaz,项目名称:anima,代码行数:56,代码来源:oyCenterOfMass.py


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