From 1e18da32fb3df5d491201770d10992f0b975650b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 2 Jan 2012 17:15:24 +0000 Subject: replace: CTX_data_pointer_get_type(C, "object", &RNA_Object).data with api call: ED_object_context(C) ... since getting the context object is such a common operation. --- source/blender/editors/armature/editarmature.c | 5 ++--- source/blender/editors/armature/poselib.c | 3 ++- source/blender/editors/armature/poseobject.c | 23 ++++++++++++----------- 3 files changed, 16 insertions(+), 15 deletions(-) (limited to 'source/blender/editors/armature') diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 48f3f78b849..becc7e9b68f 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -5067,7 +5067,6 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op) { int action = RNA_enum_get(op->ptr, "action"); - Object *ob = NULL; Scene *scene= CTX_data_scene(C); int multipaint = scene->toolsettings->multipaint; @@ -5100,8 +5099,8 @@ static int pose_de_select_all_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_OBJECT|ND_BONE_SELECT, NULL); - if(multipaint) { - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + if (multipaint) { + Object *ob = ED_object_context(C); DAG_id_tag_update(&ob->id, OB_RECALC_DATA); } diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 064defb1aef..5cdb9c76396 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -77,6 +77,7 @@ #include "ED_keyframing.h" #include "ED_keyframes_edit.h" #include "ED_screen.h" +#include "ED_object.h" #include "armature_intern.h" @@ -171,7 +172,7 @@ static Object *get_poselib_object (bContext *C) sa = CTX_wm_area(C); if (sa && (sa->spacetype == SPACE_BUTS)) - return CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + return ED_object_context(C); else return object_pose_armature_get(CTX_data_active_object(C)); } diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 8d35122650f..832ee55997b 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -73,6 +73,7 @@ #include "ED_keyframing.h" #include "ED_mesh.h" #include "ED_screen.h" +#include "ED_object.h" #include "UI_interface.h" #include "UI_resources.h" @@ -207,7 +208,7 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op) /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); @@ -283,7 +284,7 @@ static int pose_clear_paths_exec (bContext *C, wmOperator *UNUSED(op)) /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); @@ -1221,7 +1222,7 @@ static int pose_group_add_exec (bContext *C, wmOperator *UNUSED(op)) /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); @@ -1261,7 +1262,7 @@ static int pose_group_remove_exec (bContext *C, wmOperator *UNUSED(op)) /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); @@ -1309,7 +1310,7 @@ static int pose_groups_menu_invoke (bContext *C, wmOperator *op, wmEvent *UNUSED /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); @@ -1358,7 +1359,7 @@ static int pose_group_assign_exec (bContext *C, wmOperator *op) /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); @@ -1421,7 +1422,7 @@ static int pose_group_unassign_exec (bContext *C, wmOperator *UNUSED(op)) /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); @@ -1466,7 +1467,7 @@ void POSE_OT_group_unassign (wmOperatorType *ot) static int group_move_exec(bContext *C, wmOperator *op) { - Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *ob = ED_object_context(C); bPose *pose= (ob) ? ob->pose : NULL; bPoseChannel *pchan; bActionGroup *grp; @@ -1564,7 +1565,7 @@ static int compare_agroup(const void *sgrp_a_ptr, const void *sgrp_b_ptr) static int group_sort_exec(bContext *C, wmOperator *UNUSED(op)) { - Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Object *ob = ED_object_context(C); bPose *pose= (ob) ? ob->pose : NULL; bPoseChannel *pchan; tSortActionGroup *agrp_array; @@ -1656,7 +1657,7 @@ static int pose_group_select_exec (bContext *C, wmOperator *UNUSED(op)) /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); @@ -1694,7 +1695,7 @@ static int pose_group_deselect_exec (bContext *C, wmOperator *UNUSED(op)) /* since this call may also be used from the buttons window, we need to check for where to get the object */ if (sa->spacetype == SPACE_BUTS) - ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + ob= ED_object_context(C); else ob= object_pose_armature_get(CTX_data_active_object(C)); -- cgit v1.2.3