Steps to reproduce:
1) Right click on any PartDesign feature (testing needs to be done on others features). With PR #4959, will also happen with datum objects.
2) Make changes and press OK.
Expected: The undo tree has an entry of this change.
Observed: It doesn't.
The complication here is best described by @openbrain
I tried to look at how straightforward it would be to implement these methods. Option 1 is clearly the simplest, but will need some duplicate removal. I couldn't find a way to make option 2 or 3 available to the context menu (though more knowledgeable people probably can).openbrain wrote: In the past, the 'Edit OBJECT' command from the context menu was opening a command and it has been removed. This is what introduces the regression at the current state of the PR -- notice that other commands such as Pad/Pocket/... suffers this bug --.
The problem is that the 'setEdit()' command is called without possibility to know the context (typically we don't know here if it's creation time, or post-edit).
I see several possibilities :
- Re-enable the command opening in Tree.cpp that has been disabled in the past. That would eventually create duplicates in undo stack, but it seems a better case to me and we can fix it in the future
- Add an optional argument to 'setEdit()' that can be used at call time to give a context
- Add another function in the ViewProvider template that would be called by the context menu item instead of 'setEdit()' directly so it would be possible to process pre-actions -- same principle as 'doubleClicked()' is called when double-clicking an item, and this last calls 'setEdit()' --
Instead, I went with adding an extra WithCommand enum to Gui::ViewProvider::EditMode that explicitly asks to open a command when running setEdit(). The changes are stored here: https://github.com/AjinkyaDahale/FreeCA ... ntext-edit. Please let me know if anyone has an opinion on these.
Straight off the bat, it does have a possibility to interrupt the Std UserEditMode. Here, I'd suppose the default mode could be replaced with the WithCommand mode. The name of this new mode could also be better.
I'll shortly put in an issue on Mantis to track this as well [EDIT] See issue #4742.