Message 1 of 12

Not applicable
10-06-2017
02:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I implemented a MPxCommand and try to add proper undo/redo support to it. Now I have the problem, that the redo function duplicates the actions.
Minimal example:
MStatus myCmd::doIt(const MArgList &args) { return redoIt() } MStatus myCmd::redoIt() { dagMod.createNode("mesh"); dagMod.doIt(); return MStatus::kSuccess; } MStatus myCmd::undoIt() { dagMod.undoIt(); return MStatus::kSuccess; }
bool MyCmd::isUndoable() const {
return true;
}
with MDagModifier dagMod as private member of the command class.
Is there some kind of .clear() function I need to call to make sure I do not add commands twice to dagMod? I thought undoIt will clear the action stack, but after each undo/redo I get one more shape than before.
Solved! Go to Solution.