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:
-rw-r--r--source/blender/blenkernel/BKE_pbvh.h1
-rw-r--r--source/blender/blenkernel/intern/pbvh.c13
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c19
3 files changed, 23 insertions, 10 deletions
diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h
index 619b1afe765..d7622260416 100644
--- a/source/blender/blenkernel/BKE_pbvh.h
+++ b/source/blender/blenkernel/BKE_pbvh.h
@@ -166,6 +166,7 @@ typedef enum {
void BKE_pbvh_node_mark_update(PBVHNode *node);
void BKE_pbvh_node_mark_rebuild_draw(PBVHNode *node);
void BKE_pbvh_node_mark_redraw(PBVHNode *node);
+void BKE_pbvh_node_mark_normals_update(PBVHNode *node);
void BKE_pbvh_node_mark_topology_update(PBVHNode *node);
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden);
diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c
index a60f7326b2b..9bffdd8a4e6 100644
--- a/source/blender/blenkernel/intern/pbvh.c
+++ b/source/blender/blenkernel/intern/pbvh.c
@@ -948,13 +948,8 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes,
return;
}
- if (bvh->type != PBVH_FACES) {
- /* make sure we clean up the flag! */
- for (n = 0; n < totnode; n++) {
- nodes[n]->flag &= ~PBVH_UpdateNormals;
- }
+ if (bvh->type != PBVH_FACES)
return;
- }
/* could be per node to save some memory, but also means
* we have to store for each vertex which node it is in */
@@ -1334,6 +1329,12 @@ void BKE_pbvh_node_mark_redraw(PBVHNode *node)
node->flag |= PBVH_UpdateDrawBuffers | PBVH_UpdateRedraw;
}
+void BKE_pbvh_node_mark_normals_update(PBVHNode *node)
+{
+ node->flag |= PBVH_UpdateNormals;
+}
+
+
void BKE_pbvh_node_fully_hidden_set(PBVHNode *node, int fully_hidden)
{
BLI_assert(node->flag & PBVH_Leaf);
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 4264c813001..a5f0fcd3b53 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -91,14 +91,15 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
PBVH *pbvh;
PBVHNode **nodes;
int totnode, i;
+ bool multires;
Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
mode = RNA_enum_get(op->ptr, "mode");
value = RNA_float_get(op->ptr, "value");
BKE_sculpt_update_mesh_elements(scene, sd, ob, false, true);
-
pbvh = ob->sculpt->pbvh;
+ multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS);
BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);
@@ -115,9 +116,11 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
} BKE_pbvh_vertex_iter_end;
BKE_pbvh_node_mark_redraw(nodes[i]);
+ if (multires)
+ BKE_pbvh_node_mark_normals_update(nodes[i]);
}
- if (BKE_pbvh_type(pbvh) == PBVH_GRIDS)
+ if (multires)
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
sculpt_undo_push_end();
@@ -193,6 +196,7 @@ int do_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, rcti *rect, b
Object *ob = vc->obact;
PaintMaskFloodMode mode;
float value;
+ bool multires;
PBVH *pbvh;
PBVHNode **nodes;
int totnode, i, symmpass;
@@ -208,6 +212,7 @@ int do_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, rcti *rect, b
BKE_sculpt_update_mesh_elements(scene, sd, ob, false, true);
pbvh = ob->sculpt->pbvh;
+ multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS);
sculpt_undo_push_begin("Mask box fill");
@@ -239,6 +244,8 @@ int do_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, rcti *rect, b
sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);
BKE_pbvh_node_mark_redraw(nodes[i]);
+ if (multires)
+ BKE_pbvh_node_mark_normals_update(nodes[i]);
}
mask_flood_fill_set_elem(vi.mask, mode, value);
}
@@ -250,7 +257,7 @@ int do_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, rcti *rect, b
}
}
- if (BKE_pbvh_type(pbvh) == PBVH_GRIDS)
+ if (multires)
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
sculpt_undo_push_end();
@@ -322,6 +329,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
PBVH *pbvh;
PBVHNode **nodes;
int totnode, i, symmpass;
+ bool multires;
PaintMaskFloodMode mode = PAINT_MASK_FLOOD_VALUE;
bool select = true; /* TODO: see how to implement deselection */
float value = select ? 1.0 : 0.0;
@@ -351,6 +359,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
BKE_sculpt_update_mesh_elements(scene, sd, ob, false, true);
pbvh = ob->sculpt->pbvh;
+ multires = (BKE_pbvh_type(pbvh) == PBVH_GRIDS);
sculpt_undo_push_begin("Mask lasso fill");
@@ -385,6 +394,8 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
sculpt_undo_push_node(ob, nodes[i], SCULPT_UNDO_MASK);
BKE_pbvh_node_mark_redraw(nodes[i]);
+ if (multires)
+ BKE_pbvh_node_mark_normals_update(nodes[i]);
}
mask_flood_fill_set_elem(vi.mask, mode, value);
@@ -397,7 +408,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
}
}
- if (BKE_pbvh_type(pbvh) == PBVH_GRIDS)
+ if (multires)
multires_mark_as_modified(ob, MULTIRES_COORDS_MODIFIED);
sculpt_undo_push_end();