diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-01 16:47:49 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-08-01 16:47:49 +0400 |
commit | 5fa7d1c1b4e7bde1d173caa60af0e273c86b6f0b (patch) | |
tree | 186a794aef722993c7067a657b4d007c62dd669b /source/blender/editors/object/object_constraint.c | |
parent | c34f831757e0985b7523b6e5bbfadd7dd6a2c161 (diff) |
2.5: code changes to reduce the usage of G.main and pass it along
or get it from the context instead.
Diffstat (limited to 'source/blender/editors/object/object_constraint.c')
-rw-r--r-- | source/blender/editors/object/object_constraint.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index b1dc41531ef..8f83a412c96 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -779,12 +779,12 @@ void ED_object_constraint_update(Object *ob) else DAG_id_flush_update(&ob->id, OB_RECALC_OB); } -void ED_object_constraint_dependency_update(Scene *scene, Object *ob) +void ED_object_constraint_dependency_update(Main *bmain, Scene *scene, Object *ob) { ED_object_constraint_update(ob); if(ob->pose) ob->pose->flag |= POSE_RECALC; // checks & sorts pose channels - DAG_scene_sort(scene); + DAG_scene_sort(bmain, scene); } static int constraint_poll(bContext *C) @@ -931,8 +931,9 @@ void CONSTRAINT_OT_move_up (wmOperatorType *ot) static int pose_constraints_clear_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_active_object(C); + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); + Object *ob= CTX_data_active_object(C); /* free constraints for all selected bones */ CTX_DATA_BEGIN(C, bPoseChannel*, pchan, selected_pose_bones) @@ -943,7 +944,7 @@ static int pose_constraints_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ /* do updates */ DAG_id_flush_update(&ob->id, OB_RECALC_DATA); @@ -967,6 +968,7 @@ void POSE_OT_constraints_clear(wmOperatorType *ot) static int object_constraints_clear_exec(bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); /* do freeing */ @@ -978,7 +980,7 @@ static int object_constraints_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since relationships removed */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ /* do updates */ WM_event_add_notifier(C, NC_OBJECT|ND_CONSTRAINT, NULL); @@ -1002,8 +1004,9 @@ void OBJECT_OT_constraints_clear(wmOperatorType *ot) static int pose_constraint_copy_exec(bContext *C, wmOperator *op) { - bPoseChannel *pchan = CTX_data_active_pose_bone(C); + Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); + bPoseChannel *pchan = CTX_data_active_pose_bone(C); /* don't do anything if bone doesn't exist or doesn't have any constraints */ if (ELEM(NULL, pchan, pchan->constraints.first)) { @@ -1021,7 +1024,7 @@ static int pose_constraint_copy_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects/bones */ + DAG_scene_sort(bmain, scene); /* sort order of objects/bones */ return OPERATOR_FINISHED; } @@ -1043,8 +1046,9 @@ void POSE_OT_constraints_copy(wmOperatorType *ot) static int object_constraint_copy_exec(bContext *C, wmOperator *op) { - Object *obact = ED_object_active_context(C); + Main *bmain= CTX_data_main(C); Scene *scene = CTX_data_scene(C); + Object *obact = ED_object_active_context(C); /* copy all constraints from active object to all selected objects */ CTX_DATA_BEGIN(C, Object*, ob, selected_editable_objects) @@ -1056,7 +1060,7 @@ static int object_constraint_copy_exec(bContext *C, wmOperator *op) CTX_DATA_END; /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ return OPERATOR_FINISHED; } @@ -1219,6 +1223,7 @@ static short get_new_constraint_target(bContext *C, int con_type, Object **tar_o /* used by add constraint operators to add the constraint required */ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase *list, int type, short setTarget) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); bPoseChannel *pchan; bConstraint *con; @@ -1316,7 +1321,7 @@ static int constraint_add_exec(bContext *C, wmOperator *op, Object *ob, ListBase /* force depsgraph to get recalculated since new relationships added */ - DAG_scene_sort(scene); /* sort order of objects */ + DAG_scene_sort(bmain, scene); /* sort order of objects */ if ((ob->type==OB_ARMATURE) && (pchan)) { ob->pose->flag |= POSE_RECALC; /* sort pose channels */ |