In the real plugin, I do declare "Author Name", "Plug Version", etc. The point of my example was to remove all that code (which Maya allows- it gets initialized to default values) to make it clear to myself, and others, what the problem is. Hence I cut out the normal try/except error stuff as well- cleaner examples are nice.
*> then In your compute method there is no code to write some value on your output and also no setClean call. * Doesn't matter matter if I set it clean- compute never gets called in my example, so adding in setClean() or any other function call isn't relevant as far as I can tell- it never gets dirtied. *> Your node must also be connected to another node.* Does it always? There are nodes that update on attribute change without being connected. My first example does this. Change 'input' int attribute and compute() gets called, and 'output' updates. The dirty/clean stuff works a charm- I told Maya that attributeAffects(MyNode.aInput, MyNode. aOutput) and boom- input did indeed affect output as advertised! So saying it must be connected is untrue for this case of kInt or KFloat, both of which I've tested. Now if I do attributeAffects(MyNode.aInput, MyNode.aOutput) with aOutput being an MFnTypedAttribute, compute() never gets called. attributeAffects() does not work as described in the API docs (for this simple one node case) and I want to know why. I assume there is a logical, maybe even obvious, explanation; maybe it's an optimization on Maya's part because I haven't actually created an array of data for the aOutput attr yet? *> Do you have any prior experience with the API?* Mostly writing translators, compiling others' c++ nodes to work with my version of maya/environment. Just got into python api stuff though. *> Have you a basic understanding of the concept of hierarchy , connections , attributes and plug ?( DAG versus dependency nodes )* I would say that I definitely have at least basic understanding, but I came here for the people with the advanced understanding. :) Thanks again for your patience. I really want to resolve this simple example before I start porting my code to Maya nodes. -shawn On Friday, June 8, 2012 4:29:55 PM UTC-4, cedric bazillou wrote: > > first In your plugin declaration with the kDoubleArray output I would > rather correct those lines( things can be done in a lot of different ways, > this is how i do it ): > " > > def initializePlugin(mobject): > fnPlugin = omMPx.MFnPlugin(mobject) > fnPlugin.registerNode(nodeType, nodeId, nodeCreator, nodeInitializer) > " > by > " > kPluginNodeName = "spaceSwitch" #<-- replace by your plugin name > > kPluginNodeId = OpenMaya.MTypeId(your_Custom_ID_number here) > def initializePlugin(mobject): > mplugin = OpenMayaMPx.MFnPlugin(mobject, "AuthorName", "VersionNum", > "Any") > mplugin.registerNode( kPluginNodeName, kPluginNodeId, nodeCreator, > nodeInitializer, OpenMayaMPx.MPxNode.kDependNode)# <-- As you can see I use > the type of the node here a dependency node > " > > > then In your compute method there is no code to write some value on your > output and also no setClean call. > Your node must also be connected to another node. just few question bellow, > Are your example the complete code for your nodes? > Do you have an ascii maya file that can be used as an example? > Do you have any prior experience with the API? > Have you a basic understanding of the concept of hierarchy , connections , > attributes and plug ?( DAG versus dependency nodes ) > > Le vendredi 8 juin 2012 19:51:19 UTC+2, WhileRomeBurns a écrit : >> >> Thanks for the quick replies! So he basically tricks Maya into dirtying >> his plug in the draw method? Nice. So in my example, I would query the >> value of a third dummy attribute- something lighter weight than an array >> like a float or int and use that to force the eval? Can do! >> >> >> * > how about writing a node to compute your pointList and plug it to >> your locator that will only draw from * >> Absolutely the way to go, but I thought I would save time and test the >> idea in one node. But then nothing worked :) >> >> >> Additionally, I'm now fighting python just to call compute with * >> MFnTypedAttributes*. Two examples, slightly modified versions of >> Farsheed's skeleton code. The first one has MFnNumericAttribute as the >> output attribute and it calls the compute method as expected. The second >> one is bunk though and I cannot figure out why. Hmm. Take a look: >> >> nodeNumeric.py: >> http://pastebin.ubuntu.com/1030758/ >> Works a charm, compute gets called. >> >> nodeTyped.py >> http://pastebin.ubuntu.com/1030764/ >> Compute never gets called. Silently fails? Only changed the attr type to >> TypedAttr and kDoubleArray. Nada. Zilch. Zippo! >> >> Did I miss something obvious? Thanks. >> -shawn >> >> >> -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe