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:
authorAntony Riakiotakis <kalast@gmail.com>2014-04-10 23:31:39 +0400
committerAntony Riakiotakis <kalast@gmail.com>2014-04-10 23:31:39 +0400
commit6292b60a3f5b1c224ec78301c7830045560fa3b4 (patch)
tree389d6deeb90764c9c83d940ddd74066d627b215a /source/blender/editors/sculpt_paint/paint_hide.c
parent7bf62f0c602a59cc661c04243cca6ea9b9e3cfed (diff)
Dyntopo: Minor display optimization.
While hiding, flush the hidden flags to the faces. This avoids iterating through all the loops while updating the GPU buffers.
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_hide.c')
-rw-r--r--source/blender/editors/sculpt_paint/paint_hide.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index 6542bb2ca9b..fb3fd10a5f1 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -253,6 +253,20 @@ static void partialvis_update_bmesh_verts(BMesh *bm,
}
}
+static void partialvis_update_bmesh_faces(GSet *faces, PartialVisAction action)
+{
+ GSetIterator gs_iter;
+
+ GSET_ITER (gs_iter, faces) {
+ BMFace *f = BLI_gsetIterator_getKey(&gs_iter);
+
+ if ((action == PARTIALVIS_HIDE) && paint_is_bmesh_face_hidden(f))
+ BM_elem_flag_enable(f, BM_ELEM_HIDDEN);
+ else
+ BM_elem_flag_disable(f, BM_ELEM_HIDDEN);
+ }
+}
+
static void partialvis_update_bmesh(Object *ob,
PBVH *pbvh,
PBVHNode *node,
@@ -261,12 +275,13 @@ static void partialvis_update_bmesh(Object *ob,
float planes[4][4])
{
BMesh *bm;
- GSet *unique, *other;
+ GSet *unique, *other, *faces;
bool any_changed = false, any_visible = false;
bm = BKE_pbvh_get_bmesh(pbvh);
unique = BKE_pbvh_bmesh_node_unique_verts(node);
other = BKE_pbvh_bmesh_node_other_verts(node);
+ faces = BKE_pbvh_bmesh_node_faces(node);
sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
@@ -286,6 +301,9 @@ static void partialvis_update_bmesh(Object *ob,
&any_changed,
&any_visible);
+ /* finally loop over node faces and tag the ones that are fully hidden */
+ partialvis_update_bmesh_faces(faces, action);
+
if (any_changed) {
BKE_pbvh_node_mark_rebuild_draw(node);
BKE_pbvh_node_fully_hidden_set(node, !any_visible);