[Bf-blender-cvs] [d3695eb12c0] temp_bmesh_multires: * Fix corner case in last commit
Joseph Eagar
noreply at git.blender.org
Mon May 17 23:24:19 CEST 2021
Commit: d3695eb12c0c80533fa5128f450dcf55b649dba1
Author: Joseph Eagar
Date: Mon May 17 14:23:02 2021 -0700
Branches: temp_bmesh_multires
https://developer.blender.org/rBd3695eb12c0c80533fa5128f450dcf55b649dba1
* Fix corner case in last commit
===================================================================
M source/blender/blenkernel/BKE_pbvh.h
M source/blender/blenkernel/intern/pbvh.c
M source/blender/bmesh/intern/bmesh_log.c
M source/blender/editors/sculpt_paint/sculpt_undo.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index f2c8cb1eade..9bfa706bc27 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -718,6 +718,7 @@ struct BMFace *BKE_pbvh_face_create_bmesh(PBVH *pbvh,
struct BMVert *BKE_pbvh_vert_create_bmesh(
PBVH *pbvh, float co[3], float no[3], PBVHNode *node, struct BMVert *v_example);
PBVHNode *BKE_pbvh_node_from_face_bmesh(PBVH *pbvh, struct BMFace *f);
+PBVHNode *BKE_pbvh_node_from_index(PBVH *pbvh, int node_i);
struct BMesh *BKE_pbvh_reorder_bmesh(PBVH *pbvh);
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index 94ecfcc9796..21bd6839d73 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -3291,6 +3291,11 @@ void BKE_pbvh_get_nodes(PBVH *pbvh, int flag, PBVHNode ***r_array, int *r_totnod
BKE_pbvh_search_gather(pbvh, update_search_cb, POINTER_FROM_INT(flag), r_array, r_totnode);
}
+PBVHNode *BKE_pbvh_node_from_index(PBVH *pbvh, int node_i)
+{
+ return pbvh->nodes + node_i;
+}
+
#ifdef PROXY_ADVANCED
// TODO: if this really works, make sure to pull the neighbor iterator out of sculpt.c and put it
// here
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index b9b335e39b0..f1b42072a86 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -608,10 +608,10 @@ static void bm_log_vert_values_swap(
}
}
-static void bm_log_face_values_swap(BMLog *log,
- GHash *faces,
- BMLogEntry *entry,
- BMLogCallbacks *callbacks)
+ATTR_NO_OPT static void bm_log_face_values_swap(BMLog *log,
+ GHash *faces,
+ BMLogEntry *entry,
+ BMLogCallbacks *callbacks)
{
void *scratch = log->bm->pdata.pool ? BLI_mempool_alloc(log->bm->pdata.pool) : NULL;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index aacec721a1b..602edcb3223 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -487,6 +487,9 @@ static void bmesh_undo_on_vert_change(BMVert *v, void *userdata, void *old_custo
int oldnode_i = BM_ELEM_CD_GET_INT(&h, data->cd_vert_node_offset);
BM_ELEM_CD_SET_INT(v, data->cd_vert_node_offset, oldnode_i);
+
+ PBVHNode *node = BKE_pbvh_node_from_index(data->pbvh, oldnode_i);
+ BKE_pbvh_node_mark_update(node);
}
static void bmesh_undo_on_face_change(BMFace *f, void *userdata, void *old_customdata)
@@ -510,6 +513,12 @@ static void bmesh_undo_on_face_change(BMFace *f, void *userdata, void *old_custo
int oldnode_i = BM_ELEM_CD_GET_INT(&h, data->cd_face_node_offset);
BM_ELEM_CD_SET_INT(f, data->cd_face_node_offset, oldnode_i);
+
+ if (oldnode_i > 0) {
+ PBVHNode *node = BKE_pbvh_node_from_index(data->pbvh, oldnode_i);
+
+ BKE_pbvh_node_mark_update(node);
+ }
}
static void sculpt_undo_bmesh_restore_generic(SculptUndoNode *unode, Object *ob, SculptSession *ss)
More information about the Bf-blender-cvs
mailing list