Afternoon all,
I was hoping someone might be able to help me with a few issues i’m having with some Maya API python scripting. I only started learning it tuesday, and i think i’ve managed to grasp the fundamentals pretty well in a few days, but due to the lack of documentation that makes much sense, and the lack of any nice small code examples, i’ve run into an issue i don’t seem to be able to fix.
I’ve created a simple custom node with various attributes types, to use a sample base to work from. Passing data in and out through some numerical inputs seems to work ok. And it has various strings, enums etc in there too that seem to work as expected. Some in compound attributes. Everything seemed to be going swimmingly until…
I run into a small issue using the OpenMaya.MFnMessageAttribute() command. I can use it to create and add the attribute fine. It runs ok, with no errors, and i can connect in the node editor fine, a ‘.listConnections’ on the attribute returns the correct information. BUT the ‘map’ button thats usually selectable is greyed out, and so is the ‘>’ once its connected to something.
Now from my understand of all this so far (god the documentation for some of this stuff is hard to follow sometimes), i assume the issue is something like…
[ul]
[li]I need to use the compute function to pass the information in and out the node as needed, which i’m not doing at the moment.
[/li][li]Or theres a flag i need to set on the attribute when i create it to allow access to the button?
[/li][li]Or i need to use ‘.attributeAffects’ ?
[/li][/ul]
I’m creating the attribute as follows:
msgAttr = OpenMaya.MFnMessageAttribute()
testNode.testMessage= msgAttr.create( "testMessage", "testmsg" )
msgAttr.setStorable( True )
msgAttr.setReadable( True )
msgAttr.setWritable( True )
msgAttr.setConnectable( True )
testNode.addAttribute ( testNode.testMessage )
Any help would be gratefully received, and possibly rewarded with a beer!
-Simon Scott