Commit: 96f303392be1b8f87a00c0217c459a8731f9f792 Author: Antony Riakiotakis Date: Thu May 29 05:22:44 2014 +0300 https://developer.blender.org/rB96f303392be1b8f87a00c0217c459a8731f9f792
Fix T40381 and revert previous commit. Looks like the normal update flag is used internally in the modifier itself. So as a workaround just pass normal update to the nodes when flood filling =================================================================== M source/blender/blenkernel/BKE_pbvh.h M source/blender/blenkernel/intern/pbvh.c M source/blender/editors/sculpt_paint/paint_mask.c =================================================================== diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 619b1af..d762226 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 a60f732..9bffdd8 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 4264c81..a5f0fcd 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(); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs