diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
9 files changed, 48 insertions, 42 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index d7e1b47d973..5852012891d 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -339,7 +339,7 @@ static int hide_show_exec(bContext *C, wmOperator *op) { ARegion *ar = CTX_wm_region(C); Object *ob = CTX_data_active_object(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Mesh *me = ob->data; PartialVisAction action; PartialVisArea area; diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index a0f578c04d0..f3a6cfa0d5c 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -1238,7 +1238,7 @@ void PAINT_OT_texture_paint_toggle(wmOperatorType *ot) ot->poll = texture_paint_toggle_poll; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int brush_colors_flip_exec(bContext *C, wmOperator *UNUSED(op)) diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index d7f618023be..38f8a6d7adf 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -4012,7 +4012,7 @@ static void project_paint_bleed_add_face_user(const ProjPaintState *ps, /* Return true if evaluated mesh can be painted on, false otherwise */ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *ps) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Object *ob = ps->ob; Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); @@ -5710,7 +5710,7 @@ void paint_proj_stroke(const bContext *C, /* clone gets special treatment here to avoid going through image initialization */ if (ps_handle->is_clone_cursor_pick) { Scene *scene = ps_handle->scene; - struct Depsgraph *depsgraph = CTX_data_depsgraph(C); + struct Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); View3D *v3d = CTX_wm_view3d(C); ARegion *ar = CTX_wm_region(C); float *cursor = scene->cursor.location; @@ -5779,7 +5779,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->rv3d = CTX_wm_region_view3d(C); ps->ar = CTX_wm_region(C); - ps->depsgraph = CTX_data_depsgraph(C); + ps->depsgraph = CTX_data_ensure_evaluated_depsgraph(C); ps->scene = scene; /* allow override of active object */ ps->ob = ob; @@ -6143,7 +6143,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) char filename[FILE_MAX]; Main *bmain = CTX_data_main(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); ToolSettings *settings = scene->toolsettings; int w = settings->imapaint.screen_grab_size[0]; @@ -6234,8 +6234,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) array += sizeof(rv3d->winmat) / sizeof(float); memcpy(array, rv3d->viewmat, sizeof(rv3d->viewmat)); array += sizeof(rv3d->viewmat) / sizeof(float); - is_ortho = ED_view3d_clip_range_get( - CTX_data_depsgraph(C), v3d, rv3d, &array[0], &array[1], true); + is_ortho = ED_view3d_clip_range_get(depsgraph, v3d, rv3d, &array[0], &array[1], true); /* using float for a bool is dodgy but since its an extra member in the array... * easier then adding a single bool prop */ array[2] = is_ortho ? 1.0f : 0.0f; diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c index c7e2b008d1f..74212058fc7 100644 --- a/source/blender/editors/sculpt_paint/paint_mask.c +++ b/source/blender/editors/sculpt_paint/paint_mask.c @@ -130,7 +130,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op) { ARegion *ar = CTX_wm_region(C); Object *ob = CTX_data_active_object(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); PaintMaskFloodMode mode; float value; PBVH *pbvh; @@ -277,7 +277,7 @@ static void mask_box_select_task_cb(void *__restrict userdata, bool ED_sculpt_mask_box_select(struct bContext *C, ViewContext *vc, const rcti *rect, bool select) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Sculpt *sd = vc->scene->toolsettings->sculpt; BoundBox bb; float clip_planes[4][4]; @@ -444,7 +444,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op) const int(*mcords)[2] = WM_gesture_lasso_path_to_array(C, op, &mcords_tot); if (mcords) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); float clip_planes[4][4], clip_planes_final[4][4]; BoundBox bb; Object *ob; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index c8ad1b5781d..0f37968f599 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -463,7 +463,7 @@ void paint_sample_color( bContext *C, ARegion *ar, int x, int y, bool texpaint_proj, bool use_palette) { Scene *scene = CTX_data_scene(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Paint *paint = BKE_paint_get_active_from_context(C); Palette *palette = BKE_paint_palette(paint); PaletteColor *color = NULL; diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index b599234907e..9215a90c446 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1377,7 +1377,7 @@ void PAINT_OT_weight_paint_toggle(wmOperatorType *ot) ot->poll = paint_poll_test; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /** \} */ @@ -1537,7 +1537,7 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo bool *defbase_sel; SculptSession *ss = ob->sculpt; VPaint *vp = CTX_data_tool_settings(C)->wpaint; - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); if (ED_wpaint_ensure_data(C, op->reports, WPAINT_ENSURE_MIRROR, &vgroup_index) == false) { return false; @@ -2550,7 +2550,7 @@ void PAINT_OT_vertex_paint_toggle(wmOperatorType *ot) ot->poll = paint_poll_test; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } /** \} */ @@ -2619,7 +2619,7 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f Object *ob = CTX_data_active_object(C); Mesh *me; SculptSession *ss = ob->sculpt; - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); /* context checks could be a poll() */ me = BKE_mesh_from_object(ob); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index b6a6c897606..1dc28328244 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -119,7 +119,7 @@ static bool weight_from_bones_poll(bContext *C) static int weight_from_bones_exec(bContext *C, wmOperator *op) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); Object *armob = modifiers_isDeformedByArmature(ob); @@ -161,7 +161,7 @@ void PAINT_OT_weight_from_bones(wmOperatorType *ot) ot->poll = weight_from_bones_poll; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ ot->prop = RNA_def_enum( @@ -746,7 +746,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) float sco_end[2] = {x_end, y_end}; const bool is_interactive = (gesture != NULL); - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); WPGradient_userData data = {NULL}; @@ -880,7 +880,7 @@ void PAINT_OT_weight_gradient(wmOperatorType *ot) ot->cancel = WM_gesture_straightline_cancel; /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; prop = RNA_def_enum(ot->srna, "type", gradient_types, 0, "Type", ""); RNA_def_property_flag(prop, PROP_SKIP_SAVE); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 094d9de5d84..c8709d40f96 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -4922,7 +4922,7 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob, const B SculptSession *ss = ob->sculpt; if (ss->kb || ss->modifiers_active) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); bool need_pmap = sculpt_any_smooth_mode(brush, ss->cache, 0); BKE_sculpt_update_object_for_edit(depsgraph, ob, need_pmap, false); } @@ -5135,7 +5135,7 @@ static void sculpt_brush_init_tex(const Scene *scene, Sculpt *sd, SculptSession static void sculpt_brush_stroke_init(bContext *C, wmOperator *op) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); Sculpt *sd = CTX_data_tool_settings(C)->sculpt; @@ -5183,7 +5183,7 @@ void sculpt_update_object_bounding_box(Object *ob) static void sculpt_flush_update_step(bContext *C) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; ARegion *ar = CTX_wm_region(C); @@ -5752,7 +5752,7 @@ static void sculpt_dynamic_topology_disable_ex( void sculpt_dynamic_topology_disable(bContext *C, SculptUndoNode *unode) { Main *bmain = CTX_data_main(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); sculpt_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, unode); @@ -5789,7 +5789,7 @@ static void sculpt_dynamic_topology_enable_with_undo(Main *bmain, static int sculpt_dynamic_topology_toggle_exec(bContext *C, wmOperator *UNUSED(op)) { Main *bmain = CTX_data_main(C); - Depsgraph *depsgraph = CTX_data_depsgraph(C); + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); SculptSession *ss = ob->sculpt; @@ -6244,7 +6244,7 @@ static void SCULPT_OT_sculptmode_toggle(wmOperatorType *ot) ot->exec = sculpt_mode_toggle_exec; ot->poll = ED_operator_object_active_editable_mesh; - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_USE_EVAL_DATA; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static bool sculpt_and_constant_or_manual_detail_poll(bContext *C) diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index e9d17b11ccc..dde1e51e764 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -127,11 +127,10 @@ static bool sculpt_undo_restore_deformed( } } -static bool sculpt_undo_restore_coords(bContext *C, SculptUndoNode *unode) +static bool sculpt_undo_restore_coords(bContext *C, Depsgraph *depsgraph, SculptUndoNode *unode) { ViewLayer *view_layer = CTX_data_view_layer(C); Object *ob = OBACT(view_layer); - Depsgraph *depsgraph = CTX_data_depsgraph(C); SculptSession *ss = ob->sculpt; SubdivCCG *subdiv_ccg = ss->subdiv_ccg; MVert *mvert; @@ -455,13 +454,12 @@ static int sculpt_undo_bmesh_restore(bContext *C, return false; } -static void sculpt_undo_restore_list(bContext *C, ListBase *lb) +static void sculpt_undo_restore_list(bContext *C, Depsgraph *depsgraph, ListBase *lb) { Scene *scene = CTX_data_scene(C); ViewLayer *view_layer = CTX_data_view_layer(C); View3D *v3d = CTX_wm_view3d(C); Object *ob = OBACT(view_layer); - Depsgraph *depsgraph = CTX_data_depsgraph(C); SculptSession *ss = ob->sculpt; SubdivCCG *subdiv_ccg = ss->subdiv_ccg; SculptUndoNode *unode; @@ -512,7 +510,7 @@ static void sculpt_undo_restore_list(bContext *C, ListBase *lb) switch (unode->type) { case SCULPT_UNDO_COORDS: - if (sculpt_undo_restore_coords(C, unode)) { + if (sculpt_undo_restore_coords(C, depsgraph, unode)) { update = true; } break; @@ -1062,21 +1060,27 @@ static bool sculpt_undosys_step_encode(struct bContext *UNUSED(C), return true; } -static void sculpt_undosys_step_decode_undo_impl(struct bContext *C, SculptUndoStep *us) +static void sculpt_undosys_step_decode_undo_impl(struct bContext *C, + Depsgraph *depsgraph, + SculptUndoStep *us) { BLI_assert(us->step.is_applied == true); - sculpt_undo_restore_list(C, &us->data.nodes); + sculpt_undo_restore_list(C, depsgraph, &us->data.nodes); us->step.is_applied = false; } -static void sculpt_undosys_step_decode_redo_impl(struct bContext *C, SculptUndoStep *us) +static void sculpt_undosys_step_decode_redo_impl(struct bContext *C, + Depsgraph *depsgraph, + SculptUndoStep *us) { BLI_assert(us->step.is_applied == false); - sculpt_undo_restore_list(C, &us->data.nodes); + sculpt_undo_restore_list(C, depsgraph, &us->data.nodes); us->step.is_applied = true; } -static void sculpt_undosys_step_decode_undo(struct bContext *C, SculptUndoStep *us) +static void sculpt_undosys_step_decode_undo(struct bContext *C, + Depsgraph *depsgraph, + SculptUndoStep *us) { SculptUndoStep *us_iter = us; while (us_iter->step.next && (us_iter->step.next->type == us_iter->step.type)) { @@ -1086,12 +1090,14 @@ static void sculpt_undosys_step_decode_undo(struct bContext *C, SculptUndoStep * us_iter = (SculptUndoStep *)us_iter->step.next; } while (us_iter != us) { - sculpt_undosys_step_decode_undo_impl(C, us_iter); + sculpt_undosys_step_decode_undo_impl(C, depsgraph, us_iter); us_iter = (SculptUndoStep *)us_iter->step.prev; } } -static void sculpt_undosys_step_decode_redo(struct bContext *C, SculptUndoStep *us) +static void sculpt_undosys_step_decode_redo(struct bContext *C, + Depsgraph *depsgraph, + SculptUndoStep *us) { SculptUndoStep *us_iter = us; while (us_iter->step.prev && (us_iter->step.prev->type == us_iter->step.type)) { @@ -1101,7 +1107,7 @@ static void sculpt_undosys_step_decode_redo(struct bContext *C, SculptUndoStep * us_iter = (SculptUndoStep *)us_iter->step.prev; } while (us_iter && (us_iter->step.is_applied == false)) { - sculpt_undosys_step_decode_redo_impl(C, us_iter); + sculpt_undosys_step_decode_redo_impl(C, depsgraph, us_iter); if (us_iter == us) { break; } @@ -1112,6 +1118,8 @@ static void sculpt_undosys_step_decode_redo(struct bContext *C, SculptUndoStep * static void sculpt_undosys_step_decode( struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool UNUSED(is_final)) { + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); + /* Ensure sculpt mode. */ { Scene *scene = CTX_data_scene(C); @@ -1120,7 +1128,6 @@ static void sculpt_undosys_step_decode( BKE_scene_view_layer_graph_evaluated_ensure(bmain, scene, view_layer); Object *ob = OBACT(view_layer); if (ob && (ob->type == OB_MESH)) { - Depsgraph *depsgraph = CTX_data_depsgraph(C); if (ob->mode & OB_MODE_SCULPT) { /* pass */ } @@ -1142,10 +1149,10 @@ static void sculpt_undosys_step_decode( SculptUndoStep *us = (SculptUndoStep *)us_p; if (dir < 0) { - sculpt_undosys_step_decode_undo(C, us); + sculpt_undosys_step_decode_undo(C, depsgraph, us); } else { - sculpt_undosys_step_decode_redo(C, us); + sculpt_undosys_step_decode_redo(C, depsgraph, us); } } |