Call for Submission
NAB 2012 Best of the Best Show Reel
Submit your work today!
  • 1/3
You are here: Forum Home / Autodesk® Maya® / SDK / [solved] how to call mel command in SDK?
  RSS 2.0 ATOM  

[solved] how to call mel command in SDK?
Rate this thread
 
35128
 
Permlink of this thread   Subscribe to this thread
avatar
  • yaoyansi
  • Posted: 01 October 2009 03:57 PM
  • Total Posts: 26
  • Joined: 29 September 2009 06:37 AM

hi, all
i want to wirte a plugin with sdk, is it possible to call mel command in my plugin? and how?
Thanks in advance.



Replies: 0
avatar
  • yaoyansi
  • Posted: 01 October 2009 05:29 PM

see here
http://ewertb.soundlinker.com/api/api.019.htm

How do I execute MEL commands from the API? And why would I want or need to execute MEL from the API?

Yes, it is possible to execute MEL commands from the API. Sometimes it’s a convenience, but there are times you have no other choice. There are two methods in the API for this purpose:

MGlobal::executeCommand()
MDGModifier::commandToExecute()

The difference between these two is how the Undo is handled. Refer to this useful reply from Dean Edmonds in the Maya Developer’s Mailing List:

http://www.highend3d.com/maya/devarchive/sp.3d?mail_id=3583

To précis: You can use MDGModifier::commandToExecute() to “stack” MEL commands so that a series is controllable through a single undo/redo event. Using MGlobal::executeCommand(), each MEL command creates an additional undo/redo event. If you are executing many small or iterative commands it would be inconvenient for the user to require multiple undos, and filling up the queue means that it would be impossible for the user to completely undo to a previous state.



Replies: 0




   
  Settings Choose Theme color: