- Notes and links on how to create a Maya plug-in
- API module: import maya.openMaya
- Proxy class access: import maya.openMayaMPx
- Access to math module: import math
- Variable for node name: kPluginNodeTypeName = "nodeNameNode"
- ID number for Node: nodeNameNodeId = OpenMaya.MTypeId(0x00001)
- Define subclass of existing class: class nodeName(OpenMayaMPx.MPxNode)
- input = OpenMaya.MObject()
- output = OpenMaya.MObject()
- Override constructor using base: OpenMayaMPx.MPxNode.__init__(self)
- plug = current input: def compute(self,plug,dataBlock):
- Compute math example: result = math.sin( inputFloat )
- Recompute plug and flag as clean: dataBlock.setClean( plug )
- Maya pointer: return OpenMayaMPx.asMPxPtr( sineNode() )
- Initialize method - input and output: nodeInitializer():
- Add attribute here (ex- frequency or or amplitude): input = nAttr.create( "input", "in", ####)
- Causes compute method to re-calculate - sets relationship: sineNode.attributeAffects( sineNode.input, sineNode.output )
- Plug-in registration - Node Name/ID/Create Method/Initialize Method/Node Type: mplugin.registerNode( kPluginNodeTypeName, sineNodeId, nodeCreator, nodeInitializer )
- De-register plug-in: mplugin.deregisterNode( sineNodeId)
2. Some links to various resources:
- Creating a simple Maya node with python - Three render Monkeys
- Python Scripting for Maya artists 2.0 - Chad Vernon
- The Maya Autodesk Help Documentation
- Autodesk uses the "Simplified Wrapper and Interface Generator (SWIG) to create
- bindings between c++ and Python" - see: Practical Maya Programming with Python
- Complete Maya Programming - Book by David. A. D. Gould
- How did Python become a Data Science Powerhouse?
- Wrappers - math classes - m -(Quaternion, matrix, vector, points, vectors etc)
- MObjects - data encapsulation (meshes, skin clustter nodes, curves etc).
- Functions Sets - mfn - (access and manipulate data)
- Proxy Class - mpx - - (abstractions - create new object types - inheritance)
- Createing your first Maya Plug-in in Visual Studio
- A unified approach to compiling and maintaining Maya plug-ins across all platforms - in CMAKE
4. Mash Python node (Maya)
No comments:
Post a Comment