WIP: Fix #113377: Pass edit mesh pointer through modifiers #120999

Draft
Hans Goudey wants to merge 13 commits from HooglyBoogly/blender:fix-mesh-edit-mapped-extract-edit-mesh into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.

13 Commits

Author SHA1 Message Date
Hans Goudey c8428c91ad Merge branch 'main' into fix-mesh-edit-mapped-extract-edit-mesh 2024-05-20 13:55:25 -04:00
Hans Goudey 03b5836d33 Progress 2024-04-23 16:06:49 -04:00
Hans Goudey 5ff6d32d5f Cleanup 2024-04-23 15:37:31 -04:00
Hans Goudey 8d9f7dbbd5 Merge branch 'main' into fix-mesh-edit-mapped-extract-edit-mesh 2024-04-23 15:10:01 -04:00
Hans Goudey a186bfcf1d Progress 2024-04-22 16:10:08 -04:00
Hans Goudey 517f895b48 Fix 2024-04-22 16:09:54 -04:00
Hans Goudey d64d4fdb9f Cleanup 2024-04-22 16:01:51 -04:00
Hans Goudey b8cb68d1c2 Merge branch 'main' into fix-mesh-edit-mapped-extract-edit-mesh 2024-04-22 15:36:13 -04:00
Hans Goudey 310c0f6728 Cleanup 2024-04-22 15:29:51 -04:00
Hans Goudey cbfbe14f7b Progress 2024-04-22 15:29:46 -04:00
Hans Goudey cd434c09fa Merge branch 'main' into fix-mesh-edit-mapped-extract-edit-mesh 2024-04-22 15:16:59 -04:00
Hans Goudey 53dd169209 Fix #113377: Track edit mesh pointer through modifiers 2024-04-05 07:54:21 -04:00
Hans Goudey a2b0628521 Mesh: Store BMEditMesh in shared pointer
buildbot/vexp-code-patch-lint Build done. Details
buildbot/vexp-code-patch-linux-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-x86_64 Build done. Details
buildbot/vexp-code-patch-darwin-arm64 Build done. Details
buildbot/vexp-code-patch-windows-amd64 Build done. Details
buildbot/vexp-code-patch-coordinator Build done. Details
The main motivation for this is that it's part of a fix for #113377,
where I want to propagate the edit mesh pointers through copied mesh
in the modifier stack and geometry nodes, instead of just setting the
mesh's edit mesh pointer at the end of the modifier stack. That would
have two main benefits:
1. We avoid the need to write to the evaluated mesh, which means it
   can be shared directly among evaluated objects.
2. When an object's mesh is completely replaced by the mesh from another
   object during evaluation (with the object info node), the final edit
   mesh pointer will not be incorrect, allowing us to skip index-mapped
   GPU data extraction.

Beyond that, using a shared pointer just makes things more automatic.
Handling of edit mesh data is already complicated enough, this way some
of the worry and complexity can be handled by RAII.

One thing to keep in mind is that the edit mesh's BMesh is still freed
manually with `EDBM_mesh_free_data` when leaving edit mode. I figured
that was a more conservative approach for now. Maybe eventually that
could be handled automatically with RAII too.
2024-04-04 17:49:31 -04:00