|09 September 2009||#1|
Los Angeles, USA
Join Date: Mar 2008
API: simple enough I think?
I have what seems like a trivial question.. but I'm just hacking my way to learning still.. :-)
I have an MObject attribute created on a custom locator node
in maya I want to connect another nodes output to it (say translate from a sphere)
so I do a connectAttr blah blah blah..
within the API I want to traverse to the connected node (the sphere's translate )
and be able to run a set value command on the sphere's translate directly..
how do I get from the MObject attr on my locator to an MObject attr on the connected sphere?
any help would be much appreciated. thinking I could just use api calls to listConnections mel commands if I needed to , but that seems kinda sloppy.. is there a "list connections" equiv in the API?
|09 September 2009||#2|
Join Date: Aug 2005
You'd want to use MPlug.
You need to keep clear the understanding that the MObject attribute is just a structure that defines the attribute characteristics across all nodes of that type. Eg. "All nodes of this type will have an attribute called 'myData'."
In order to look at an instance of that attribute on a specific node, you would use MPlug. Eg. To access, "myNode1.myData", you create an MPlug.
So you want to get an MObject to the instance of the node that you want to query, say myNode1, and then pass in which attribute on that node you're looking for:
|Thread Closed share thread|