QUOTE
just some clarification about what I want to do. Basically, I want to retrieve the translate information from some transform in the scene and set an internal C++ Object of mine.
Well ok then your not after a node! Your after a event! Now you can bind events into your node BUt best just bind events out.
But really this blows mayas pipe.
See when maya does anything it triggers events. maya potentially triggers a lot of events. This can slow maya to CRAWL, seriously your comfy 20-50fps things depend on this not being done.
QUOTE
Adding an attributeChanged callback. Well, it is not called when the transform is translated;
Yes maya suspends the full network updating while it is in a tool mode. Theres not much you can do about that. What you should use is the MPxNode:: setDependentsDirty or
Now this gets called when you get informed the plug got marked up for compute.
You can then set up a message thet it got changed to your own code. But beware its not advisable to compute a lot here just pass messages. Ideally youd just pass a message saying well yes you know it got changed then update at next convieniant redraw or so, later in anycase to avid a huge cascade of updates during a very short timespan of doing.
Or even better you should implement it as a locator that draws nothing. Thisway you will get a chance to draw your locator just liek you were a shape.
A alternate solution would be to make the node thread safe and do the computation by force.
QUOTE
? I am not a full time maya programmer so please be simple (and nice^^).
It odes not matter much, either you play ball with maya or you do not. In either case maya has a a additional thing in nodes.
QUOTE
, it updates my internal C++ object:
Yes but irrespectuively if the node is a gui or not maya will send out a LOT of events and potenttially your update will just eat up 50-99% of your performance. So does your c object realy need to update real time. Would it not be enough to update on dirty each 1/10 of a second or so. Thsi would save maya form supending redraw just because you like to update every time maya does something. Trust me its very easy to swamp even the most powerful computer with something like this.
So even if you now think you want to force you might come to the conclusion you dont want later. Ive cetaily found out that theres NEVER EVER A GOOD TIME TO FORE MAYA TO UPDATE on events, no matter how hard i try to find one reason to do so. Trust me ive been thinking 5 years.