We've all done it:) On Fri, Jan 28, 2011 at 2:05 PM, Paul Molodowitch <[email protected]>wrote:
> Never mind, I'm being dumb - just forgetting the 5th arg to registerNode, > which specifies the type MPx type. >( > > Move along, move along... > > - Paul > > > On Thu, Jan 27, 2011 at 6:30 PM, Paul Molodowitch <[email protected]>wrote: > >> I was wondering if anyone else has been able to make >> an MPxParticleAttributeMapperNode in a python plugin... or perhaps have >> someone else verify that it isn't working. >> >> I boiled down the script to the bare minimum: >> >> import maya.OpenMaya as om >> import maya.OpenMayaMPx as mpx >> >> class ParticleAttributeMapperNode(mpx.MPxParticleAttributeMapperNode): >> id = om.MTypeId(0x870350) >> >> def initialize(): >> pass >> >> def creator(): >> return mpx.asMPxPtr( ParticleAttributeMapperNode() ) >> >> >> def initializePlugin(mobject): >> mplugin = mpx.MFnPlugin(mobject) >> mplugin.registerNode( 'dummyParticleAttr', >> ParticleAttributeMapperNode.id, >> creator, >> initialize ) >> >> def uninitializePlugin(mobject): >> mplugin = mpx.MFnPlugin(mobject) >> mplugin.deregisterNode( ParticleAttributeMapperNode.id ) >> >> >> >> ... and it still isn't working. It will import fine, but if you try to >> actually create an instance of such a node, it fails: >> >> if not cmds.pluginInfo(plugin, loaded=1, q=1): >> >> cmds.loadPlugin(plugin) >> >> cmds.createNode('dummyParticleAttr') >> >> >> Note that this script will work with pretty much ANY other MPxNode type - >> just swap out the MPxParticleAttributeMapperNode for, say, an >> MPxSurfaceShape, or MPxDeformerNode, and it can create one. >> Anyone else have any success with this, or at least want to confirm if it >> is / isn't working for them? >> >> Thanks, >> >> - Paul >> > > -- > http://groups.google.com/group/python_inside_maya > -- http://groups.google.com/group/python_inside_maya
