Fix #117338: Texture paint sampling broken with modifiers
commit3ed4e51437f1074402e35dd3b8a39af7948da595
authorHans Goudey <hans@blender.org>
Fri, 5 Apr 2024 12:17:43 +0000 (5 14:17 +0200)
committerHans Goudey <hooglyboogly@noreply.localhost>
Fri, 5 Apr 2024 12:17:43 +0000 (5 14:17 +0200)
treea458dae0036eb05cdb67ee43c1210b231e0adfb4
parent548df007a59a8c63ffde6771fffbd7623cd550d5
Fix #117338: Texture paint sampling broken with modifiers

e64b3c821252fc8707b4 worked to complete a transition started during 2.8
development to avoid dynamically re-evaluating objects outside of the
dependency graph's control. However, that behavior was used to make
sure the original index mapping was available for the texture paint
sample operator.

Conceptually, sampling a texture on an arbitrary evaluated mesh should
not require original indices at all. All we need to know is the UV map
value under the mouse. This commit changes from using GPU index textures
to a BVH tree raycast. This significantly simplifies the code and makes
it work with GPU subdivision too. Though it may be slower to build the
BVH tree, that should be okay because it's cached and only needs to be
built once, and that's something we're want to optimize anyway.

Removing the reliance on original indices also means we could paint
textures on completely procedurally generated meshes, which may be
an interesting feature in the future.

Pull Request: https://projects.blender.org/blender/blender/pulls/120259
source/blender/editors/sculpt_paint/paint_utils.cc