Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-06-08 18:04:54 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-06-08 18:23:25 +0300
commit3e86bb2d0bf1b13b4e482411dd176bac13e90961 (patch)
treec39469aa0af98e89dfbfac847e842c56a913cf92 /source/blender/editors/sculpt_paint
parent1ce55693f511013ceed962e8614aa61dd2dff4d5 (diff)
Sculpt/Paint: move PBVH building to use evaluated mesh instead of deprecated Derivedmesh.
Pretty straightforward changes, merely mimicking dm-related code, which was already essentially using either Mesh or BMesh data to build the PBVH... Note that we "lose" the subsurf (a.k.a. grid) PBVH case here, but that one was already dead code in current blender2.8, since final dm is always a cddm built from evaluated mesh. Proper fix is pending new code for subsurf/multires area.
Diffstat (limited to 'source/blender/editors/sculpt_paint')
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c7
-rw-r--r--source/blender/editors/sculpt_paint/paint_vertex.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c6
3 files changed, 7 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index b8bee42e53d..ac5b0624d56 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -369,7 +369,6 @@ static int hide_show_exec(bContext *C, wmOperator *op)
PartialVisArea area;
PBVH *pbvh;
PBVHNode **nodes;
- DerivedMesh *dm;
PBVHType pbvh_type;
float clip_planes[4][4];
rcti rect;
@@ -382,9 +381,9 @@ static int hide_show_exec(bContext *C, wmOperator *op)
clip_planes_from_rect(C, clip_planes, &rect);
- dm = mesh_get_derived_final(depsgraph, CTX_data_scene(C), ob, CD_MASK_BAREMESH);
- pbvh = dm->getPBVH(ob, dm);
- ob->sculpt->pbvh = pbvh;
+ Mesh *me_eval_deform = mesh_get_eval_deform(depsgraph, CTX_data_scene(C), ob, CD_MASK_BAREMESH);
+ pbvh = BKE_sculpt_object_pbvh_ensure(ob, me_eval_deform);
+ BLI_assert(ob->sculpt->pbvh == pbvh);
get_pbvh_nodes(pbvh, &nodes, &totnode, clip_planes, area);
pbvh_type = BKE_pbvh_type(pbvh);
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 5a5c76318f3..02dae51c594 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -1071,7 +1071,7 @@ static void ed_vwpaintmode_enter_generic(
/* Same as sculpt mode, make sure we don't have cached derived mesh which
* points to freed arrays.
*/
- BKE_object_free_derived_mesh_caches(ob);
+ BKE_object_free_derived_caches(ob);
if (mode_flag == OB_MODE_VERTEX_PAINT) {
const ePaintMode paint_mode = ePaintVertex;
@@ -1199,7 +1199,7 @@ static void ed_vwpaintmode_exit_generic(
}
/* Never leave derived meshes behind. */
- BKE_object_free_derived_mesh_caches(ob);
+ BKE_object_free_derived_caches(ob);
/* Flush object mode. */
DEG_id_tag_update(&ob->id, DEG_TAG_COPY_ON_WRITE);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 2e9d55a4c6f..3475aadd171 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5210,14 +5210,12 @@ static void sculpt_dynamic_topology_triangulate(BMesh *bm)
void sculpt_pbvh_clear(Object *ob)
{
SculptSession *ss = ob->sculpt;
- DerivedMesh *dm = ob->derivedFinal;
/* Clear out any existing DM and PBVH */
- if (ss->pbvh)
+ if (ss->pbvh) {
BKE_pbvh_free(ss->pbvh);
+ }
ss->pbvh = NULL;
- if (dm)
- dm->getPBVH(NULL, dm);
BKE_object_free_derived_caches(ob);
}