From a2c8b9950bd8cc0976b17b6e9ce50102f62ccd99 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Wed, 20 Apr 2022 13:42:51 +0200 Subject: PBVH: Pass Mesh to extract internals. More mesh data is required when extracting the UV seams. This is an API change for to support this future enhancement. --- source/blender/blenkernel/BKE_pbvh.h | 3 +-- source/blender/blenkernel/intern/pbvh_pixels.cc | 18 +++++------------- source/blender/editors/sculpt_paint/sculpt.c | 2 +- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index bb918fcfdcb..978e52d8003 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -143,8 +143,7 @@ void BKE_pbvh_build_bmesh(PBVH *pbvh, int cd_face_node_offset); void BKE_pbvh_build_pixels(PBVH *pbvh, - const struct MLoop *mloop, - struct CustomData *ldata, + struct Mesh *mesh, struct Image *image, struct ImageUser *image_user); void BKE_pbvh_free(PBVH *pbvh); diff --git a/source/blender/blenkernel/intern/pbvh_pixels.cc b/source/blender/blenkernel/intern/pbvh_pixels.cc index 1c1e9254157..5623cac44ac 100644 --- a/source/blender/blenkernel/intern/pbvh_pixels.cc +++ b/source/blender/blenkernel/intern/pbvh_pixels.cc @@ -275,11 +275,7 @@ static void apply_watertight_check(PBVH *pbvh, Image *image, ImageUser *image_us BKE_image_partial_update_mark_full_update(image); } -static void update_pixels(PBVH *pbvh, - const struct MLoop *mloop, - struct CustomData *ldata, - struct Image *image, - struct ImageUser *image_user) +static void update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image_user) { Vector nodes_to_update; @@ -287,14 +283,14 @@ static void update_pixels(PBVH *pbvh, return; } - MLoopUV *ldata_uv = static_cast(CustomData_get_layer(ldata, CD_MLOOPUV)); + MLoopUV *ldata_uv = static_cast(CustomData_get_layer(&mesh->ldata, CD_MLOOPUV)); if (ldata_uv == nullptr) { return; } for (PBVHNode *node : nodes_to_update) { NodeData *node_data = static_cast(node->pixels.node_data); - init_triangles(pbvh, node, node_data, mloop); + init_triangles(pbvh, node, node_data, mesh->mloop); } EncodePixelsUserData user_data; @@ -377,13 +373,9 @@ void BKE_pbvh_pixels_mark_image_dirty(PBVHNode &node, Image &image, ImageUser &i extern "C" { using namespace blender::bke::pbvh::pixels; -void BKE_pbvh_build_pixels(PBVH *pbvh, - const struct MLoop *mloop, - struct CustomData *ldata, - struct Image *image, - struct ImageUser *image_user) +void BKE_pbvh_build_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image_user) { - update_pixels(pbvh, mloop, ldata, image, image_user); + update_pixels(pbvh, mesh, image, image_user); } void pbvh_pixels_free(PBVHNode *node) diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 8807032bf69..d576d529ce5 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2780,7 +2780,7 @@ static void sculpt_pbvh_update_pixels(PaintModeSettings *paint_mode_settings, return; } - BKE_pbvh_build_pixels(ss->pbvh, mesh->mloop, &mesh->ldata, image, image_user); + BKE_pbvh_build_pixels(ss->pbvh, mesh, image, image_user); } /** \} */ -- cgit v1.2.3