diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-21 23:33:04 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2013-02-21 23:33:04 +0400 |
commit | 20220d47e38c4ad22ad89481fd40b804cc2fd1ef (patch) | |
tree | 5e01f917fa80465bb6401d63f8057641813983d9 /source/blender/editors/space_view3d/view3d_snap.c | |
parent | 074565330db93ceb2304247f9bf6499b05cb3b80 (diff) |
Dependency Graph: some refactoring which should have no user visible impact
besides performance in some cases.
* DAG_scene_sort is now removed and replaced by DAG_relations_tag_update in
most cases. This will clear the dependency graph, and only rebuild it right
before it's needed again when the scene is re-evaluated.
This is done because DAG_scene_sort is slow when called many times from
python operators. Further the scene argument is not needed because most
operations can potentially affect more than the current scene.
* DAG_scene_relations_update will now rebuild the dependency graph if it's not
there yet, and DAG_scene_relations_rebuild will force a rebuild for the rare
cases that need it.
* Remove various places where ob->recalc was set manually. This should go
through DAG_id_tag_update() in nearly all cases instead since this is now
a fast operation. Also removed DAG_ids_flush_update that goes along with
such manual tagging of ob->recalc.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_snap.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index f570ec38ae3..6edcf980d58 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -532,7 +532,6 @@ static void make_trans_verts(Object *obedit, float min[3], float max[3], int mod static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain = CTX_data_main(C); Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); RegionView3D *rv3d = CTX_wm_region_data(C); @@ -623,8 +622,6 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } else { - ob->recalc |= OB_RECALC_OB; - vec[0] = -ob->obmat[3][0] + gridf * floorf(0.5f + ob->obmat[3][0] / gridf); vec[1] = -ob->obmat[3][1] + gridf * floorf(0.5f + ob->obmat[3][1] / gridf); vec[2] = -ob->obmat[3][2] + gridf * floorf(0.5f + ob->obmat[3][2] / gridf); @@ -644,12 +641,13 @@ static int snap_sel_to_grid(bContext *C, wmOperator *UNUSED(op)) /* auto-keyframing */ ED_autokeyframe_object(C, scene, ob, ks); + + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } CTX_DATA_END; } - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -674,7 +672,6 @@ void VIEW3D_OT_snap_selected_to_grid(wmOperatorType *ot) static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) { - Main *bmain = CTX_data_main(C); Object *obedit = CTX_data_edit_object(C); Scene *scene = CTX_data_scene(C); View3D *v3d = CTX_wm_view3d(C); @@ -748,8 +745,6 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } else { - ob->recalc |= OB_RECALC_OB; - vec[0] = -ob->obmat[3][0] + curs[0]; vec[1] = -ob->obmat[3][1] + curs[1]; vec[2] = -ob->obmat[3][2] + curs[2]; @@ -769,12 +764,13 @@ static int snap_sel_to_curs(bContext *C, wmOperator *UNUSED(op)) /* auto-keyframing */ ED_autokeyframe_object(C, scene, ob, ks); + + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } } CTX_DATA_END; } - DAG_ids_flush_update(bmain, 0); WM_event_add_notifier(C, NC_OBJECT | ND_TRANSFORM, NULL); return OPERATOR_FINISHED; |