Undo an operation via Maya C++ API

Not applicable
11-13-2019
06:06 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
In my Maya .mll file I have the following:
void doIt()
{
MGlobal::executeCommand("polyMapCut -ch 1 pCube1.e[2];");
}
void undoIt()
{
MStreamUtils::stdOutStream() << "Undo is called";
MGlobal::executeCommand("undo;");
}
This are all registered to the command `runCut` inside an MEL script.
Inside the Maya script editor, after executing `runCut` and then trying to undo it:
`"Undo is called"` is displayed, meaning `UndoIt()` works, but I then get an error saying that `"The undo queue is turned off."`
Is it the way that I call `undo` that is incorrect?