This is a first attempt at writing a Maya node using the API with Python. I have been following some tutorials on Chad Vernon‘s site and http://www.rtrowbridge.com to help me get started. I also had to dig into the Maya documentation to understand things a little better. The following node is designed to accept transform information (as worldMatrix) from two different objects and spit out a translation value (x,y,z) that can be connected to a third object. The third object stays positioned between the first two at 50 percent, this can be tweaked using a percentage input in the node as well. It is very simple but helps getting started with the API. *Use at your own risk.
import maya.OpenMayaMPx as OpenMayaMPx import maya.OpenMaya as OpenMaya class DoublerNode(OpenMayaMPx.MPxNode): kPluginNodeId = OpenMaya.MTypeId(0x00047251) aInputA = OpenMaya.MObject() aInputB = OpenMaya.MObject() aOutput = OpenMaya.MObject() aPercent = OpenMaya.MObject() def __init__(self): OpenMayaMPx.MPxNode.__init__(self) def compute(self, plug, data): if plug != DoublerNode.aOutput: return OpenMaya.MStatus.kUnknownParameter worldMatrixA = data.inputValue(DoublerNode.aInputA).asMatrix() worldMatrixB = data.inputValue(DoublerNode.aInputB).asMatrix() multi = data.inputValue(DoublerNode.aPercent).asFloat() # MTransformationMatrix mTMA = OpenMaya.MTransformationMatrix(worldMatrixA) mTMB = OpenMaya.MTransformationMatrix(worldMatrixB) # Get the translation from world matrix transA = mTMA.getTranslation( OpenMaya.MSpace.kTransform ) transB = mTMB.getTranslation( OpenMaya.MSpace.kTransform ) #setting the output hOutput = data.outputValue(DoublerNode.aOutput) resultTrans = OpenMaya.MFloatVector((transA.x + transB.x)*multi, (transA.y + transB.y)*multi, (transA.z + transB.z)*multi) hOutput.setMFloatVector(resultTrans) data.setClean(plug) return OpenMaya.MStatus.kSuccess def creator(): return OpenMayaMPx.asMPxPtr(DoublerNode()) #define new attributes here def initialize(): nAttr = OpenMaya.MFnNumericAttribute() nMAttr = OpenMaya.MFnMatrixAttribute() DoublerNode.aPercent = nAttr.create('percent', 'per',OpenMaya.MFnNumericData.kFloat, 0.5) nAttr.setWritable(True) nAttr.setStorable(True) nAttr.setReadable(True) nAttr.setKeyable(True) DoublerNode.aInputA = nMAttr.create('inMatrixA', 'inA',OpenMaya.MFnMatrixAttribute.kDouble) nMAttr.setWritable(True) nMAttr.setStorable(True) nMAttr.setReadable(True) nMAttr.setKeyable(True) DoublerNode.aInputB = nMAttr.create('inMatrixB', 'inB',OpenMaya.MFnMatrixAttribute.kDouble) nMAttr.setWritable(True) nMAttr.setStorable(True) nMAttr.setReadable(True) nMAttr.setKeyable(True) DoublerNode.aOutput = nAttr.createPoint("outputTranslate", "ot" ) nAttr.setWritable(False) nAttr.setStorable(False) nAttr.setReadable(True) DoublerNode.addAttribute(DoublerNode.aPercent) DoublerNode.addAttribute(DoublerNode.aOutput) DoublerNode.addAttribute(DoublerNode.aInputA) DoublerNode.addAttribute(DoublerNode.aInputB) DoublerNode.attributeAffects(DoublerNode.aPercent, DoublerNode.aOutput) DoublerNode.attributeAffects(DoublerNode.aInputA, DoublerNode.aOutput) DoublerNode.attributeAffects(DoublerNode.aInputB, DoublerNode.aOutput) def initializePlugin(obj): plugin = OpenMayaMPx.MFnPlugin(obj, 'Asim', '1.0', 'Any') try: plugin.registerNode('doublerNode', DoublerNode.kPluginNodeId, creator, initialize) except: raise RuntimeError, 'Failed to register node' def uninitializePlugin(obj): plugin = OpenMayaMPx.MFnPlugin(obj) try: plugin.deregisterNode(DoublerNode.kPluginNodeId) except: raise RuntimeError, 'Failed to register node'
This is the current feature I have been working on here in Vancouver since January 2011 as a Creature TD. It is slated for release February 14, 2013. I have been involved in character setup, weighting, and rigging hero characters as well as props and vehicles. I have also been doing R&D to add various procedures to our procedural rigging system that allow adding secondary deformation and controls to characters.
I just started using this new software called Sculptris and am enjoying it much more than Zbrush and Mudbox. Its simplicity makes it more enjoyable to just start sculpting without worrying about getting too technical. If you have an idea, this may be a quick way to get it out. Anyways, here is my current work in progress using this software. Still a long way to go but it seems to be coming along nicely. Any feedback is welcome…
I have recently been working as a Modeler, Rigger, and Scripter on a kids TV show called The Adventures of Chuck and Friends – Season 1. I have scripted an auto rigging system that generates a fully animation ready rig in under 30 seconds and adjusts the rig to the unique proportions of whatever character is passed into it. This system allows the riggers on the team to have the base rig ready to use very fast and gives them more time to focus on additional features unique to the character. For instance, the blue character above was run through the auto rigger, his arm however was manually rigged by me. I have also been responsible for modeling/rigging a large number of characters that appear on the show including sets and props. Throughout this process I have also helped develop tools for animators to animate auto steering and auto tire rotation for all characters so they can focus more on the acting and performance. More information about the show and upcoming episodes can be found here.
Click here to see a short clip of how the character rigs function in the show and what type of animation they support. All characters on the show use the auto rigging system.