Hi! It seem that when executing commands, they are added to the undo queue even if they don't affect the scene. For example settings the selection via scripting add undos even if the selection is unchanged. This result in artists needing to perform excessive undo operations.
Steps to Reproduce (via Script):
1) cmds.createNode("transform")
2) cmds.select([]) (multiple times)
3) Perform undos until the created node is deleted.
Steps to Reproduce (via UI):
1) Click Create > Empty Group
2) Click Select > Deselect All (multiple times)
3) Perform undos until the empty group is deleted.
In these scenarios, only two operations actually modify the scene (creating a group and deselecting it), yet more than two undos are registered.
There's already an option in Windows > Settings/Preferences > Preferences > Settings > Undo > Consolidate Undo steps for Time Changes. Would it be possible to have the same thing for selection?
Ideally Maya commands should be able to "compress" their undos automatically.
See Qt QUndoCommand.id for inspiration.
https://doc.qt.io/qt-6/qundocommand.html#id
Thanks!