QUOTE(yl2000 @ 11/20/07, 05:45 AM) [snapback]276715[/snapback]
Hi, maybe I wasn't very clear in my last post. I mean, if I want something running in the background that responds to user events, such as changing current time or selecting objects, how can I achieve this? the MPxCommand runs only when the user types in the command in the script editor, but not "listening to" what's happening in the scene.
Thank you!
Hi yl2000,
First, we may define some functions which are responsible for each specified event respectively.
Then, we need to tell the system their association by "add*Callback" functions in "M*Message" classes.
After we invoke "add*Callback", system would listen to the events and dispatch them to the functions we associates before.
(M*Message stands for all related Message classes in Maya, such as MEventMessage, MDagMessage, MModelMessage, ... etc.)
In your case, you could invoke "add*Callback" in the "doIt()" procedure of your derived class. Then, after user execute your command, the system would start to dispatch the events to the associated function you defined.
Hope this helps~
Ryan47