I guess it is known issue and undo system limitation that if you edit some property when you’re in edit mode (for example if you change object’s location) and then undo (and if the last undo operation wasn’t edit mode toggle) those properties won’t be affected by undo.
My questions is what properties are affected by undo in EDIT mode? Maybe it’s possible to store data somewhere else in blender I guess besides scene/object properties and expect it to be restored on undo?
Or in edit mode undo system stores only edit mesh / bmesh changes?
Have you tested it in the Blender 3.6.0? I just tested it in there, switched to the Edit Mode, changed object’s location and then pressed CTRL+Z and it works
I think you’ve missed important step “the last undo operation shouldn’t be edit mode toggle”. If you add some other operator after toggle you’d be able to reproduce the issue.
I’ve noticed that whether you’re gonna be in an Edit Mode or Sculpt, if you will press CTRL+Z it will take you back to an Object Mode even if you haven’t added any of changes.
You can disable this feature by unchecking Undo option in your Keymap settings. But, it will also disable undo functionality as well. Dunno why. It seems to me like both these functions are split with each other using by the same key.
Based on that, I can assume that maybe it’s just how it should be working, or, if you think that it’s a bug or something - you can report about it straightly from Blender interface:
It’s already reported to blender and it’s considered not a bug but an undo system limitation.
What I’m looking for is to understand more specifically the limits of this issue.
First of all, as undo problems in EDIT mode is a known limitation then preferably in edit mode user should be doing only edit mode related operations to avoid meething those kind of issues.
But I think there could be a workaround for your case, you can try to create a new undo step (see bpy.ops.ed.undo_push) after you switched to OBJECT mode, so this undo step won’t be related to EDIT mode and won’t have the limitation. Haven’t tested it though, just an idea.
This works, but it’s not suitable for my use case because it makes the operator produce 2 undo steps rather than 1—
The user needs to undo twice to undo what the operator did.
The “last operator adjustment” panel only goes back 1 undo step when its properties are adjusted, so—since the operator creates 2 undo steps per execution—sliding a slider in the panel causes the undo history to rapidly fill up with steps, ruining the user’s undo history.
That’s interesting. You added bpy.ops.ed.undo_push to the some property update callback or why this occurs? Maybe there’s some workaround to make sliding create just 1 undo step as it does usually in OBJECT mode.