Refactor: Simplify mesh edit mode modifier evaluation #108637

Merged
Hans Goudey merged 38 commits from HooglyBoogly/blender:cleanup-modifier-edit-mode-eval into main 2023-07-07 13:07:22 +02:00

38 Commits

Author SHA1 Message Date
Hans Goudey 97aca032cf Fix poly build crash
The evaluated mesh temporarily had the old vertex array size,
we can't use the coordinates in that case. That was already checked
before but the `edit_data != null` check.
2023-07-05 13:47:16 -04:00
Hans Goudey 4407b3eb55 Make "get vertexCos for write" function private to modifier stack 2023-07-05 13:31:25 -04:00
Hans Goudey adced8e58f Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-07-05 12:49:14 -04:00
Hans Goudey 460a7bad5d Fix crash in code that assumed the edit data cache existed 2023-06-30 13:09:11 -04:00
Hans Goudey 8bbcf68357 Revert unnecessary change 2023-06-30 12:52:08 -04:00
Hans Goudey c6c18ad95d Free edit data cached SoA normals and poly coords when changing positions 2023-06-30 12:47:12 -04:00
Hans Goudey 7594f38970 Fix memory leak
Free the edit data when creating a proper mesh from a mesh wrapper
2023-06-30 12:43:29 -04:00
Hans Goudey d1eb0f61c7 Cleanup 2023-06-30 12:14:30 -04:00
Hans Goudey d436b3e098 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-30 11:58:36 -04:00
Hans Goudey 848da9c9d5 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-26 08:59:31 -04:00
Hans Goudey 93d1ede87b Add wrapper functions for wrapper vert coords access 2023-06-23 07:43:26 -04:00
Hans Goudey 1df1b36197 Improve comment 2023-06-22 23:02:25 -04:00
Hans Goudey 3bbf334b68 Remove now incorrect comments 2023-06-22 22:01:24 -04:00
Hans Goudey d83c0c62ab Fix redundant copying and wrong comment
The vertexCos array is now completely owned by EditMeshData,
that's part of the point of the changes in this branch
2023-06-22 21:54:33 -04:00
Hans Goudey a17850a25d Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-22 21:25:43 -04:00
Hans Goudey 402c9fc2e9 Cleanup: Remove timer
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-21 16:33:58 -04:00
Hans Goudey 0f5f14224f Fix "manually" created wrapper Mesh didn't have 'is original bmesh" set 2023-06-21 16:33:48 -04:00
Hans Goudey 2689b41206 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-21 16:10:11 -04:00
Hans Goudey a41ff691e7 Fix continuing to modify the cage mesh after the cage index 2023-06-20 11:33:07 -04:00
Hans Goudey 4f2025bdaa Fix knife tool ignoring cage coordinates from non-bmesh-wrapper evaluated mesh 2023-06-20 11:32:50 -04:00
Hans Goudey eefb2666d1 Cleanup 2023-06-20 11:12:37 -04:00
Hans Goudey 6c6bbf8ea9 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-20 10:40:06 -04:00
Hans Goudey 36e0ebcdae Fix cage option node working 2023-06-20 10:05:38 -04:00
Hans Goudey db50a0cf1a Cleanup 2023-06-20 09:37:00 -04:00
Hans Goudey cda5728341 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-20 08:39:56 -04:00
Hans Goudey a8cb9466d6 Cleanup 2023-06-20 08:37:19 -04:00
Hans Goudey 3ff6121492 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-20 06:27:53 -04:00
Hans Goudey e9a29f3ad3 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-19 22:36:12 -04:00
Hans Goudey 51e0d8773e Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-18 21:48:28 -04:00
Hans Goudey 17894b4bac Fix performance regression with all modifiers disabled 2023-06-16 11:52:34 -04:00
Hans Goudey e87f3a9718 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-16 09:29:59 -04:00
Hans Goudey 12bf5a91b5 Fix null check 2023-06-16 08:48:57 -04:00
Hans Goudey 38d34449b4 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-16 08:47:14 -04:00
Hans Goudey 3b1fac15be Merge branch 'main' into cleanup-modifier-edit-mode-eval
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-13 17:51:04 -04:00
Hans Goudey 061c0adbaa Fix detection of non-deform modifiers 2023-06-08 13:43:41 -04:00
Hans Goudey 212594f280 Merge branch 'main' into cleanup-modifier-edit-mode-eval 2023-06-08 13:36:31 -04:00
Hans Goudey ada04b5327 Merge branch 'main' into cleanup-modifier-edit-mode-eval
buildbot/vexp-code-patch-coordinator Build done. Details
2023-06-06 12:54:40 -04:00
Hans Goudey 973b3981b7 Refactor: Simplify mesh edit mode modifier evaluation
buildbot/vexp-code-patch-coordinator Build done. Details
Instead of keeping track of a local array of positions in the modifier
stack itself, use the existing edit mode SoA "edit cache" which already
contains a contiguous array of positions. Combined with positions as a
generic attribute, this means the state is contained just in the mesh
(and the geometry set) making the code much easier to follow.

To do this we make more use of the mesh wrapper system, where we can
pass a `Mesh` that's actually stored with a `BMesh` and the extra
cached array of positions. This also resolves some confusion-- it was
weird to have the mesh wrapper system for this purpose but not use it.

Since we always created a wrapped mesh in edit mode, there's no need
for `MOD_deform_mesh_eval_get` at all anymore. That function was quite
confusing with "eval" in its name when it really retrieved the original
mesh.

Many deform modifiers had placeholder edit mode evaluation functions.
Since these didn't do anything and since the priority is node-based
deformation now, I removed these. The case is documented more in the
modifier type struct callbacks.

It's worth landing this early in Bcon1 because there are probably some
edge cases I'm missing and this area isn't covered well by tests. But I
think the modifier stack simplification is absolutely worth it, and
opens other cleanup opportunities as well.
2023-06-05 17:09:59 -04:00