[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53445] trunk/blender/source/blender/ editors/sculpt_paint/paint_hide.c: Hiding support for dynamic topology
Nicholas Bishop
nicholasbishop at gmail.com
Sun Dec 30 19:29:56 CET 2012
Revision: 53445
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53445
Author: nicholasbishop
Date: 2012-12-30 18:29:56 +0000 (Sun, 30 Dec 2012)
Log Message:
-----------
Hiding support for dynamic topology
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c 2012-12-30 18:29:41 UTC (rev 53444)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_hide.c 2012-12-30 18:29:56 UTC (rev 53445)
@@ -232,6 +232,75 @@
}
}
+static void partialvis_update_bmesh_verts(BMesh *bm,
+ GHash *verts,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4],
+ int *any_changed,
+ int *any_visible)
+{
+ GHashIterator gh_iter;
+
+ GHASH_ITER (gh_iter, verts) {
+ BMVert *v = BLI_ghashIterator_getKey(&gh_iter);
+ float *vmask = CustomData_bmesh_get(&bm->vdata,
+ v->head.data,
+ CD_PAINT_MASK);
+
+ /* hide vertex if in the hide volume */
+ if (is_effected(area, planes, v->co, *vmask)) {
+ if (action == PARTIALVIS_HIDE)
+ BM_elem_flag_enable(v, BM_ELEM_HIDDEN);
+ else
+ BM_elem_flag_disable(v, BM_ELEM_HIDDEN);
+ (*any_changed) = TRUE;
+ }
+
+ if (!BM_elem_flag_test(v, BM_ELEM_HIDDEN))
+ (*any_visible) = TRUE;
+ }
+}
+
+static void partialvis_update_bmesh(Object *ob,
+ PBVH *pbvh,
+ PBVHNode *node,
+ PartialVisAction action,
+ PartialVisArea area,
+ float planes[4][4])
+{
+ BMesh *bm;
+ GHash *unique, *other;
+ int any_changed = 0, any_visible = 0;
+
+ bm = BLI_pbvh_get_bmesh(pbvh);
+ unique = BLI_pbvh_bmesh_node_unique_verts(node);
+ other = BLI_pbvh_bmesh_node_other_verts(node);
+
+ sculpt_undo_push_node(ob, node, SCULPT_UNDO_HIDDEN);
+
+ partialvis_update_bmesh_verts(bm,
+ unique,
+ action,
+ area,
+ planes,
+ &any_changed,
+ &any_visible);
+
+ partialvis_update_bmesh_verts(bm,
+ other,
+ action,
+ area,
+ planes,
+ &any_changed,
+ &any_visible);
+
+ if (any_changed) {
+ BLI_pbvh_node_mark_rebuild_draw(node);
+ BLI_pbvh_node_fully_hidden_set(node, !any_visible);
+ }
+}
+
static void rect_from_props(rcti *rect, PointerRNA *ptr)
{
rect->xmin = RNA_int_get(ptr, "xmin");
@@ -330,6 +399,9 @@
case PBVH_GRIDS:
partialvis_update_grids(ob, pbvh, nodes[i], action, area, clip_planes);
break;
+ case PBVH_BMESH:
+ partialvis_update_bmesh(ob, pbvh, nodes[i], action, area, clip_planes);
+ break;
}
}
More information about the Bf-blender-cvs
mailing list