Currently, there are two issues related to Edit Mode and Undo that I am trying to improve:
When in edit mode, almost all changes made outside the active object/ID are not pushed to the undo stack. An example would be changing a node tree while in mesh edit mode. Some changes can’t be undone, sometimes multiple changes may update all at once during a specific undo step.
While in edit mode, auto-save does not work. Generally, you have to switch out of edit mode in order for an auto-save to trigger.
The PR adds a new experimental option called Use Global Undo In Edit Mode. This disables the “specialized” edit mode undo systems for Meshes, (Hair) Curves, Grease Pencil, and Point Clouds, and instead uses the global undo system (also known as memfile undo). This should resolve the two issues mentioned above for the listed object types.
From the testing that I have done so far, the undo performance is comparable. Sometimes a few milliseconds slower, sometimes a few milliseconds faster even.
However, for mesh edit mode, memory usage can be quite a bit higher. This is because the global undo system will (in the worst case) save the entire ID data that changed to memory. This can get especially noticeable e.g. when editing a high-poly mesh.
What help is needed?
I need help with:
trying to find potential bugs in the PR related to edit mode & undo.
testing to see if the performance is comparable (between the setting being turned off vs. on) in real world files. It would be good to know if there are any cases where it is (much) slower.
testing the memory consumption (between the setting being turned off vs. on). You can use the status bar info to get an estimate for how much memory blender is consuming.
You don’t need to restart Blender after toggling the setting. It’s a good idea to switch to object mode to avoid mixing undo steps of different systems though.
Mesh with 43k verts and curve hair with 85k verts, with a lot of objects in the background.
I can see the Ram go up just by pressing A repeatedly to select all
This is kinda hard to test, with the setting off the Ram is all over the place. I randomly moved the mesh and the Ram usage sometimes went down, but with it on, it was constantly going up. That said, it didn’t matter whether I only edited 1 vert or all 43k with proportional editing, each action gave me a + 300 MB Ram usage. The size of the file is 460mb so I think that explains it when you chalk it up to rounding)
Speed wise this is where I differ from your experience. I saw a noticeable performance decrease with the new setting on. The 43k vert mesh was the least noticeable but it was there. The 85k vert curve hair was ridiculous. With the setting off it was instant to undo. With the setting on it took a bit under 1 second. Same with any other more performant non primitive mesh I tested. Actually adding a default cube and editing it, then undoing took a bit under half a second, it was instant without the setting.
I tested both mesh edit and curve hair edit for a bit and I didn’t find a single instance where the new undo was faster
It’s interesting however to see that the mesh that is slower to undo with the setting off is the closest speed wise with the setting on.
Can’t say anything about bugs. I didn’t encounter any but my testing wasn’t extensive enough for that I’d say, unless something from the previous points is caused by a bug.
The size of the file shouldn’t have an impact. Global undo shouldn’t need to save the whole file unless everything in the file changed. Is the 43k mesh the largest in your scene?
Okay. I didn’t test hair curves yet, so I’ll try and replicate this.
That is interesting. Would it be possible to share the file with me privately?
Not density wise but performance wise it’s the slowest yeah, probably due to having a lot of attributes, vertex groups, even non manifold geometry.
Okay. I didn’t test hair curves yet, so I’ll try and replicate this.
I went back to test again. The blend file itself is slow. I tested both a cube primitive and the same hair appended without anything else in a clean file. It was instant. It’s an issue with the blend file itself being “heavy”. Pretty sure that if that wasn’t the case I would have the same experience as you.
That is interesting. Would it be possible to share the file with me privately?
Sure. I have a feeling this is not gonna be an isolated situation.
Interesting thing to check too is performance of undo in object mode versus in edit mode with that new option, in heavy files.
That should tell us if the synchronization between normal and edit data mesh adds a significant overhead, or if it’s just global undo that is slow in this file.
Oh I see. I compared the heaviest object with a move for edit mode and a GN setup toggle for object mode. The object mode change was faster. For a different, more performant model it’s the same delay on both. However, on this model, the old mode had no delay in edit mode, but had delay in object mode, about the same as the new mode has in both.
I think the problem comes from the fact that the current edit mode undo only handles the edited mesh(es), while global undo has to handle all data in the blend file. At least for detecting if there has been changes.