( "Failed to register node: %s" % kPluginNodeTypeName ) Mplugin.registerNode( kPluginNodeTypeName, sineNodeId, nodeCreator, nodeInitializer ) SineNode.attributeAffects( sineNode.input, sineNode.output ) SineNode.output = nAttr.create( "output", "out",, 0.0 ) SineNode.input = nAttr.create( "input", "in",, 0.0 ) Return OpenMayaMPx.asMPxPtr( sineNode() ) OutputHandle = dataBlock.outputValue( sineNode.output ) Python strings are passed and returned in place of the MString wrapper class.ĭataHandle = dataBlock.inputValue( sineNode.input ).Although Python is a typeless language, you must instantiate the correct type in order.MObjects can be created using node = OpenMaya.MObject().To instantiate a class, use the fn = OpenMaya.MFnFunctionSet() notation.The example above demonstrates the following: Print "Plug value %g" % translatePlug.asDouble()) Print "Plug name: %s" % translatePlug.name() TranslatePlug = nameToNodePlug( "translateX", perspNode ) Print "APItype string %s" % perspNode.apiTypeStr() Plug = OpenMaya.MPlug( nodeObject, attrObject ) # function that finds a plug given a node object and plug nameĭef nameToNodePlug( attrName, nodeObject ):ĭepNodeFn = OpenMaya.MFnDependencyNode( nodeObject )ĪttrObject = depNodeFn.attribute( attrName ) SelectionList = OpenMaya.MSelectionList() # function that returns a node object given a name
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |