diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-17 19:07:47 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-07-27 22:58:59 +0300 |
commit | 4f3233dd536e8839c304dd34cd8aec89bfd8ca34 (patch) | |
tree | 24555d7d01abca66a1d1e473cb963ce73dee203a /source/blender/editors/sculpt_paint/sculpt_filter_color.c | |
parent | 2584a2a4e7b2cb657c863e35a62afd83e5bbafb8 (diff) |
Fix T78242: Crash when using a Sculpt color tools that needs connectivity for the first time
When there is no color layer available,
BKE_sculpt_update_object_for_edit creates a new one and tags the mesh
with ID_RECLAC_GEOMETRY, so this layer is inmediatly available when the
tool starts. This also deletes the PBVH and when it is created again in
BKE_sculpt_update_object_after_eval, the pmap is not initialized, making
the tool crash.
This moves the color layer creation to a separate function outside
BKE_sculpt_update_object_for_edit, which now runs after the color
layer is available, so it won't need to update again and the pmap will
still be available when the tool is used.
Reviewed By: sergey
Maniphest Tasks: T78242
Differential Revision: https://developer.blender.org/D8135
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_filter_color.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_filter_color.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c b/source/blender/editors/sculpt_paint/sculpt_filter_color.c index 556b73b0ea5..59d82825740 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c @@ -265,7 +265,6 @@ static int sculpt_color_filter_modal(bContext *C, wmOperator *op, const wmEvent static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { Object *ob = CTX_data_active_object(C); - Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; SculptSession *ss = ob->sculpt; int mode = RNA_enum_get(op->ptr, "type"); @@ -285,6 +284,11 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent SCULPT_undo_push_begin("color filter"); + BKE_sculpt_color_layer_create_if_needed(ob); + + /* CTX_data_ensure_evaluated_depsgraph should be used at the end to include the updates of + * earlier steps modifying the data. */ + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); bool needs_pmap = mode == COLOR_FILTER_SMOOTH; BKE_sculpt_update_object_for_edit(depsgraph, ob, needs_pmap, false, true); |