diff options
Diffstat (limited to 'source/blender/editors/curve/editcurve.c')
-rw-r--r-- | source/blender/editors/curve/editcurve.c | 79 |
1 files changed, 43 insertions, 36 deletions
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 0dbe526117c..1787e559913 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -45,11 +45,11 @@ #include "BKE_context.h" #include "BKE_curve.h" -#include "BKE_depsgraph.h" #include "BKE_displist.h" #include "BKE_fcurve.h" #include "BKE_global.h" #include "BKE_key.h" +#include "BKE_layer.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_report.h" @@ -57,6 +57,9 @@ #include "BKE_action.h" #include "BKE_modifier.h" +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" + #include "WM_api.h" #include "WM_types.h" @@ -1275,6 +1278,7 @@ static int separate_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); Scene *scene = CTX_data_scene(C); + ViewLayer *view_layer = CTX_data_view_layer(C); Object *oldob, *newob; Base *oldbase, *newbase; Curve *oldcu, *newcu; @@ -1302,8 +1306,8 @@ static int separate_exec(bContext *C, wmOperator *op) } /* 2. duplicate the object and data */ - newbase = ED_object_add_duplicate(bmain, scene, oldbase, 0); /* 0 = fully linked */ - DAG_relations_tag_update(bmain); + newbase = ED_object_add_duplicate(bmain, scene, view_layer, oldbase, 0); /* 0 = fully linked */ + DEG_relations_tag_update(bmain); newob = newbase->object; newcu = newob->data = BKE_curve_copy(bmain, oldcu); @@ -1322,8 +1326,8 @@ static int separate_exec(bContext *C, wmOperator *op) ED_curve_editnurb_free(newob); curve_delete_segments(oldob, true); - DAG_id_tag_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */ - DAG_id_tag_update(&newob->id, OB_RECALC_DATA); /* this is the separated one */ + DEG_id_tag_update(&oldob->id, OB_RECALC_DATA); /* this is the original one */ + DEG_id_tag_update(&newob->id, OB_RECALC_DATA); /* this is the separated one */ WM_event_add_notifier(C, NC_GEOM | ND_DATA, oldob->data); WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, newob); @@ -1371,7 +1375,7 @@ static int curve_split_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); } else { BKE_report(op->reports, RPT_ERROR, "Cannot split current selection"); @@ -2317,7 +2321,7 @@ static int switch_direction_exec(bContext *C, wmOperator *UNUSED(op)) if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); return OPERATOR_FINISHED; @@ -2365,7 +2369,7 @@ static int set_goal_weight_exec(bContext *C, wmOperator *op) } } - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); return OPERATOR_FINISHED; @@ -2418,7 +2422,7 @@ static int set_radius_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -2570,7 +2574,7 @@ static int smooth_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -2761,7 +2765,7 @@ static int curve_smooth_weight_exec(bContext *C, wmOperator *UNUSED(op)) curve_smooth_value(editnurb, offsetof(BezTriple, weight), offsetof(BPoint, weight)); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -2789,7 +2793,7 @@ static int curve_smooth_radius_exec(bContext *C, wmOperator *UNUSED(op)) curve_smooth_value(editnurb, offsetof(BezTriple, radius), offsetof(BPoint, radius)); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -2817,7 +2821,7 @@ static int curve_smooth_tilt_exec(bContext *C, wmOperator *UNUSED(op)) curve_smooth_value(editnurb, offsetof(BezTriple, alfa), offsetof(BPoint, alfa)); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -2889,7 +2893,7 @@ static int hide_exec(bContext *C, wmOperator *op) } } - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); BKE_curve_nurb_vert_active_validate(obedit->data); @@ -2952,7 +2956,7 @@ static int reveal_exec(bContext *C, wmOperator *op) } } - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data); return OPERATOR_FINISHED; @@ -3373,7 +3377,7 @@ static int subdivide_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -3568,7 +3572,7 @@ static int set_spline_type_exec(bContext *C, wmOperator *op) if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); if (changed_size) { @@ -3622,7 +3626,7 @@ static int set_handle_type_exec(bContext *C, wmOperator *op) BKE_nurbList_handles_set(editnurb, RNA_enum_get(op->ptr, "type")); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -3667,7 +3671,7 @@ static int curve_normals_make_consistent_exec(bContext *C, wmOperator *op) BKE_nurbList_handles_recalculate(editnurb, calc_length, SELECT); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -4055,7 +4059,7 @@ static int merge_nurb(bContext *C, wmOperator *op) BKE_curve_nurb_active_set(obedit->data, NULL); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -4262,7 +4266,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -4506,7 +4510,7 @@ static int spin_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -4961,7 +4965,7 @@ static int add_vertex_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -5006,14 +5010,14 @@ static int add_vertex_invoke(bContext *C, wmOperator *op, const wmEvent *event) const float mval[2] = {UNPACK2(event->mval)}; struct SnapObjectContext *snap_context = ED_transform_snap_object_context_create_view3d( - CTX_data_main(C), vc.scene, 0, + CTX_data_main(C), vc.scene, vc.view_layer, vc.engine_type, 0, vc.ar, vc.v3d); ED_transform_snap_object_project_view3d_mixed( snap_context, SCE_SELECT_FACE, &(const struct SnapObjectParams){ - .snap_select = (vc.scene->obedit != NULL) ? SNAP_NOT_ACTIVE : SNAP_ALL, + .snap_select = (vc.obedit != NULL) ? SNAP_NOT_ACTIVE : SNAP_ALL, .use_object_edit_cage = false, }, mval, NULL, true, @@ -5116,7 +5120,7 @@ static int curve_extrude_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); } return OPERATOR_FINISHED; @@ -5215,7 +5219,7 @@ static int toggle_cyclic_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -5733,7 +5737,7 @@ static int curve_delete_exec(bContext *C, wmOperator *op) if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return retval; } @@ -5877,7 +5881,7 @@ static int curve_dissolve_exec(bContext *C, wmOperator *UNUSED(op)) if (ED_curve_updateAnimPaths(obedit->data)) WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, obedit); WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); } return OPERATOR_FINISHED; @@ -5953,7 +5957,7 @@ static int curve_decimate_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); } return OPERATOR_FINISHED; @@ -5998,7 +6002,7 @@ static int shade_smooth_exec(bContext *C, wmOperator *op) } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -6112,7 +6116,7 @@ int join_curve_exec(bContext *C, wmOperator *op) } } - ED_base_object_free_and_unlink(bmain, scene, base); + ED_object_base_free_and_unlink(bmain, scene, base->object); } } } @@ -6126,9 +6130,9 @@ int join_curve_exec(bContext *C, wmOperator *op) BKE_curve_curve_dimension_update(cu); } - DAG_relations_tag_update(bmain); // because we removed object(s), call before editmode! + DEG_relations_tag_update(bmain); // because we removed object(s), call before editmode! - DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA); + DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA); WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); @@ -6168,7 +6172,7 @@ static int clear_tilt_exec(bContext *C, wmOperator *UNUSED(op)) } WM_event_add_notifier(C, NC_GEOM | ND_DATA, obedit->data); - DAG_id_tag_update(obedit->data, 0); + DEG_id_tag_update(obedit->data, 0); return OPERATOR_FINISHED; } @@ -6233,12 +6237,15 @@ static int match_texture_space_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *object = CTX_data_active_object(C); + EvaluationContext eval_ctx; Curve *curve = (Curve *) object->data; float min[3], max[3], size[3], loc[3]; int a; + CTX_data_eval_ctx(C, &eval_ctx); + if (object->curve_cache == NULL) { - BKE_displist_make_curveTypes(scene, object, false); + BKE_displist_make_curveTypes(&eval_ctx, scene, object, false); } INIT_MINMAX(min, max); |