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.
This commit is contained in:
Jeroen Bakker 2022-04-20 13:42:51 +02:00
parent 5b8a3ccd37
commit 0385e2f1f9
3 changed files with 7 additions and 16 deletions

View File

@ -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);

View File

@ -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<PBVHNode *> nodes_to_update;
@ -287,14 +283,14 @@ static void update_pixels(PBVH *pbvh,
return;
}
MLoopUV *ldata_uv = static_cast<MLoopUV *>(CustomData_get_layer(ldata, CD_MLOOPUV));
MLoopUV *ldata_uv = static_cast<MLoopUV *>(CustomData_get_layer(&mesh->ldata, CD_MLOOPUV));
if (ldata_uv == nullptr) {
return;
}
for (PBVHNode *node : nodes_to_update) {
NodeData *node_data = static_cast<NodeData *>(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)

View File

@ -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);
}
/** \} */