From 74e4ad20c9e8d19f85aaa2995652e3f65bdfc0c9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 28 Jul 2009 16:33:02 +0000 Subject: [PATCH] 2.5: code cleanup, added CTX_wm_space_* for each space type, instead of casting everywhere. --- source/blender/blenkernel/BKE_context.h | 11 +++ source/blender/blenkernel/intern/context.c | 77 +++++++++++++++++++ source/blender/editors/animation/anim_ops.c | 14 ++-- source/blender/editors/animation/keyframing.c | 9 +-- .../blender/editors/armature/editarmature.c | 4 +- source/blender/editors/screen/screen_ops.c | 10 +-- .../editors/sculpt_paint/paint_image.c | 9 +-- .../editors/space_action/action_header.c | 6 +- .../editors/space_action/space_action.c | 4 +- .../editors/space_buttons/buttons_context.c | 8 +- .../editors/space_buttons/buttons_header.c | 7 +- .../editors/space_buttons/buttons_ops.c | 2 +- .../editors/space_buttons/space_buttons.c | 4 +- .../editors/space_graph/graph_buttons.c | 2 +- .../editors/space_graph/graph_header.c | 4 +- .../blender/editors/space_graph/graph_ops.c | 2 +- .../blender/editors/space_graph/space_graph.c | 4 +- .../editors/space_image/image_buttons.c | 24 +++--- .../editors/space_image/image_header.c | 2 +- .../blender/editors/space_image/image_ops.c | 66 ++++++++-------- .../blender/editors/space_image/space_image.c | 6 +- .../editors/space_logic/logic_buttons.c | 7 +- .../editors/space_logic/logic_header.c | 6 +- .../editors/space_logic/logic_window.c | 8 +- .../blender/editors/space_logic/space_logic.c | 6 +- source/blender/editors/space_nla/nla_header.c | 4 +- source/blender/editors/space_nla/space_nla.c | 4 +- source/blender/editors/space_node/node_draw.c | 6 +- source/blender/editors/space_node/node_edit.c | 14 ++-- .../blender/editors/space_node/node_header.c | 20 ++--- .../blender/editors/space_node/node_select.c | 4 +- .../blender/editors/space_node/node_state.c | 4 +- .../blender/editors/space_node/space_node.c | 2 +- .../blender/editors/space_outliner/outliner.c | 47 ++++++----- .../editors/space_outliner/outliner_header.c | 2 +- .../blender/editors/space_time/space_time.c | 2 +- .../blender/editors/space_time/time_header.c | 12 +-- .../editors/space_view3d/view3d_header.c | 2 +- .../editors/transform/transform_conversions.c | 2 +- source/blender/editors/uvedit/uvedit_ops.c | 20 ++--- 40 files changed, 267 insertions(+), 180 deletions(-) diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index 83cac0adf93..e47ad969b91 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -122,6 +122,17 @@ struct RegionView3D *CTX_wm_region_view3d(const bContext *C); struct SpaceText *CTX_wm_space_text(const bContext *C); struct SpaceImage *CTX_wm_space_image(const bContext *C); struct SpaceConsole *CTX_wm_space_console(const bContext *C); +struct SpaceButs *CTX_wm_space_buts(const bContext *C); +struct SpaceFile *CTX_wm_space_file(const bContext *C); +struct SpaceSeq *CTX_wm_space_seq(const bContext *C); +struct SpaceOops *CTX_wm_space_outliner(const bContext *C); +struct SpaceNla *CTX_wm_space_nla(const bContext *C); +struct SpaceTime *CTX_wm_space_time(const bContext *C); +struct SpaceNode *CTX_wm_space_node(const bContext *C); +struct SpaceLogic *CTX_wm_space_logic(const bContext *C); +struct SpaceIpo *CTX_wm_space_graph(const bContext *C); +struct SpaceAction *CTX_wm_space_action(const bContext *C); +struct SpaceInfo *CTX_wm_space_info(const bContext *C); void CTX_wm_manager_set(bContext *C, struct wmWindowManager *wm); void CTX_wm_window_set(bContext *C, struct wmWindow *win); diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 08182dc873b..78c29a96bff 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -256,6 +256,83 @@ struct SpaceImage *CTX_wm_space_image(const bContext *C) return NULL; } +struct SpaceButs *CTX_wm_space_buts(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_BUTS) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceFile *CTX_wm_space_file(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_FILE) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceSeq *CTX_wm_space_seq(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_SEQ) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceOops *CTX_wm_space_outliner(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_OUTLINER) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceNla *CTX_wm_space_nla(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_NLA) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceTime *CTX_wm_space_time(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_TIME) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceNode *CTX_wm_space_node(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_NODE) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceLogic *CTX_wm_space_logic(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_LOGIC) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceIpo *CTX_wm_space_graph(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_IPO) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceAction *CTX_wm_space_action(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_ACTION) + return C->wm.area->spacedata.first; + return NULL; +} + +struct SpaceInfo *CTX_wm_space_info(const bContext *C) +{ + if(C->wm.area && C->wm.area->spacetype==SPACE_INFO) + return C->wm.area->spacedata.first; + return NULL; +} + void CTX_wm_manager_set(bContext *C, wmWindowManager *wm) { C->wm.manager= wm; diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 7107639b036..9c039693b72 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -67,7 +67,7 @@ static int change_frame_init(bContext *C, wmOperator *op) return 0; if (curarea->spacetype == SPACE_TIME) { - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); /* timeline displays frame number only when dragging indicator */ // XXX make this more in line with other anim editors? @@ -103,7 +103,7 @@ static void change_frame_exit(bContext *C, wmOperator *op) return; if (curarea->spacetype == SPACE_TIME) { - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); /* timeline displays frame number only when dragging indicator */ // XXX make this more in line with other anim editors? @@ -322,31 +322,31 @@ static int toggle_time_exec(bContext *C, wmOperator *op) switch (curarea->spacetype) { case SPACE_TIME: /* TimeLine */ { - SpaceTime *stime= (SpaceTime *)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); stime->flag ^= TIME_DRAWFRAMES; } break; case SPACE_ACTION: /* Action Editor */ { - SpaceAction *saction= (SpaceAction *)CTX_wm_space_data(C); + SpaceAction *saction= CTX_wm_space_action(C); saction->flag ^= SACTION_DRAWTIME; } break; case SPACE_IPO: /* Graph Editor */ { - SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C); + SpaceIpo *sipo= CTX_wm_space_graph(C); sipo->flag ^= SIPO_DRAWTIME; } break; case SPACE_NLA: /* NLA Editor */ { - SpaceNla *snla= (SpaceNla *)CTX_wm_space_data(C); + SpaceNla *snla= CTX_wm_space_nla(C); snla->flag ^= SNLA_DRAWTIME; } break; case SPACE_SEQ: /* Sequencer */ { - SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C); + SpaceSeq *sseq= CTX_wm_space_seq(C); sseq->flag ^= SEQ_DRAWFRAMES; } break; diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 60d0aa2c7bd..7bee57708ec 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -965,18 +965,15 @@ static int modify_key_op_poll(bContext *C) { ScrArea *sa= CTX_wm_area(C); Scene *scene= CTX_data_scene(C); + SpaceOops *so= CTX_wm_space_outliner(C); /* if no area or active scene */ if (ELEM(NULL, sa, scene)) return 0; /* if Outliner, only allow in DataBlocks view */ - if (sa->spacetype == SPACE_OUTLINER) { - SpaceOops *so= (SpaceOops *)CTX_wm_space_data(C); - - if ((so->outlinevis != SO_DATABLOCKS)) - return 0; - } + if (so && (so->outlinevis != SO_DATABLOCKS)) + return 0; /* TODO: checks for other space types can be added here */ diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index 95d4e263490..a5028973e4b 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2033,7 +2033,7 @@ static EnumPropertyItem prop_calc_roll_types[] = { static int armature_calc_roll_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - View3D *v3d= (View3D *)CTX_wm_space_data(C); + View3D *v3d= CTX_wm_view3d(C); Object *ob= CTX_data_edit_object(C); void (*roll_func)(Scene *, View3D *, EditBone *) = NULL; @@ -2851,7 +2851,7 @@ static int armature_fill_bones_exec (bContext *C, wmOperator *op) Object *obedit= CTX_data_edit_object(C); bArmature *arm= (obedit) ? obedit->data : NULL; Scene *scene= CTX_data_scene(C); - View3D *v3d= (View3D *)CTX_wm_space_data(C); + View3D *v3d= CTX_wm_view3d(C); EditBone *newbone=NULL; ListBase points = {NULL, NULL}; int count; diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index 55668c5e9be..f5c639745a3 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -168,11 +168,11 @@ int ED_operator_buttons_active(bContext *C) int ED_operator_node_active(bContext *C) { - if(ed_spacetype_test(C, SPACE_NODE)) { - SpaceNode *snode= (SpaceNode *)CTX_wm_space_data(C); - if(snode->edittree) - return 1; - } + SpaceNode *snode= CTX_wm_space_node(C); + + if(snode && snode->edittree) + return 1; + return 0; } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index b190b76a81e..48e07b7a489 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -4387,10 +4387,9 @@ static int image_paint_poll(bContext *C) return 1; } else { - ScrArea *sa= CTX_wm_area(C); - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); - if(sa && sa->spacetype==SPACE_IMAGE) { + if(sima) { ARegion *ar= CTX_wm_region(C); if((sima->flag & SI_DRAWTOOL) && ar->regiontype==RGN_TYPE_WINDOW) @@ -4507,7 +4506,7 @@ static int paint_init(bContext *C, wmOperator *op) view3d_set_viewcontext(C, &pop->vc); } else { - pop->s.sima= (SpaceImage*)CTX_wm_space_data(C); + pop->s.sima= CTX_wm_space_image(C); pop->s.v2d= &CTX_wm_region(C)->v2d; } @@ -4815,7 +4814,7 @@ static int get_imapaint_zoom(bContext *C, float *zoomx, float *zoomy) RegionView3D *rv3d= CTX_wm_region_view3d(C); if(!rv3d) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); ED_space_image_zoom(sima, ar, zoomx, zoomy); diff --git a/source/blender/editors/space_action/action_header.c b/source/blender/editors/space_action/action_header.c index 7820b231212..43e91ea6bb5 100644 --- a/source/blender/editors/space_action/action_header.c +++ b/source/blender/editors/space_action/action_header.c @@ -77,7 +77,7 @@ static void act_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) { bScreen *sc= CTX_wm_screen(C); ScrArea *sa= CTX_wm_area(C); - SpaceAction *sact= (SpaceAction*)CTX_wm_space_data(C); + SpaceAction *sact= CTX_wm_space_action(C); PointerRNA spaceptr; /* retrieve state */ @@ -248,7 +248,7 @@ static void do_action_buttons(bContext *C, void *arg, int event) static void saction_idpoin_handle(bContext *C, ID *id, int event) { - SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C); + SpaceAction *saction= CTX_wm_space_action(C); Object *obact= CTX_data_active_object(C); printf("actedit do id: \n"); @@ -296,7 +296,7 @@ static void saction_idpoin_handle(bContext *C, ID *id, int event) void action_header_buttons(const bContext *C, ARegion *ar) { ScrArea *sa= CTX_wm_area(C); - SpaceAction *saction= (SpaceAction *)CTX_wm_space_data(C); + SpaceAction *saction= CTX_wm_space_action(C); bAnimContext ac; uiBlock *block; int xco, yco= 3, xmax; diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index 0b06499693c..55e035cfced 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -165,7 +165,7 @@ static void action_main_area_init(wmWindowManager *wm, ARegion *ar) static void action_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C); + SpaceAction *saction= CTX_wm_space_action(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DGrid *grid; @@ -228,7 +228,7 @@ static void action_channel_area_init(wmWindowManager *wm, ARegion *ar) static void action_channel_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceAction *saction= (SpaceAction*)CTX_wm_space_data(C); + SpaceAction *saction= CTX_wm_space_action(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 1bc663a789b..614017cc4c6 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -416,7 +416,7 @@ static int buttons_context_path_texture(ButsContextPath *path) static int buttons_context_path(const bContext *C, ButsContextPath *path, int mainb, int flag) { - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); ID *id; int found; @@ -546,7 +546,7 @@ void buttons_context_compute(const bContext *C, SpaceButs *sbuts) int buttons_context(const bContext *C, const char *member, bContextDataResult *result) { - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); ButsContextPath *path= sbuts?sbuts->path:NULL; if(!path) @@ -713,7 +713,7 @@ int buttons_context(const bContext *C, const char *member, bContextDataResult *r static void pin_cb(bContext *C, void *arg1, void *arg2) { - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); ButsContextPath *path= sbuts->path; PointerRNA *ptr; int a; @@ -738,7 +738,7 @@ static void pin_cb(bContext *C, void *arg1, void *arg2) void buttons_context_draw(const bContext *C, uiLayout *layout) { - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); ButsContextPath *path= sbuts->path; uiLayout *row; uiBlock *block; diff --git a/source/blender/editors/space_buttons/buttons_header.c b/source/blender/editors/space_buttons/buttons_header.c index b5af1ab598c..a1041bc5106 100644 --- a/source/blender/editors/space_buttons/buttons_header.c +++ b/source/blender/editors/space_buttons/buttons_header.c @@ -65,7 +65,10 @@ static void do_buttons_buttons(bContext *C, void *arg, int event) { - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); + + if(!sbuts) /* window type switch */ + return; switch(event) { case B_CONTEXT_SWITCH: @@ -87,7 +90,7 @@ static void do_buttons_buttons(bContext *C, void *arg, int event) void buttons_header_buttons(const bContext *C, ARegion *ar) { - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); uiBlock *block; int xco, yco= 3; diff --git a/source/blender/editors/space_buttons/buttons_ops.c b/source/blender/editors/space_buttons/buttons_ops.c index fee79c6d9c2..b1ffc7249f4 100644 --- a/source/blender/editors/space_buttons/buttons_ops.c +++ b/source/blender/editors/space_buttons/buttons_ops.c @@ -910,7 +910,7 @@ void SCENE_OT_render_layer_remove(wmOperatorType *ot) static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) { bScreen *sc= CTX_wm_screen(C); - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); PointerRNA ptr; uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 1d478514779..0195ba4b18d 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -149,7 +149,7 @@ static void buttons_main_area_init(wmWindowManager *wm, ARegion *ar) static void buttons_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); int vertical= (sbuts->align == BUT_VERTICAL); buttons_context_compute(C, sbuts); @@ -267,7 +267,7 @@ static void buttons_context_area_init(wmWindowManager *wm, ARegion *ar) static void buttons_context_area_draw(const bContext *C, ARegion *ar) { - SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); + SpaceButs *sbuts= CTX_wm_space_buts(C); uiStyle *style= U.uistyles.first; uiBlock *block; uiLayout *layout; diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index 0e48d56ac90..82babb70c53 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -242,7 +242,7 @@ static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v) /* drivers panel poll */ static int graph_panel_drivers_poll(const bContext *C, PanelType *pt) { - SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C); + SpaceIpo *sipo= CTX_wm_space_graph(C); if(sipo->mode != SIPO_MODE_DRIVERS) return 0; diff --git a/source/blender/editors/space_graph/graph_header.c b/source/blender/editors/space_graph/graph_header.c index a0ac64e3672..1b8b579326f 100644 --- a/source/blender/editors/space_graph/graph_header.c +++ b/source/blender/editors/space_graph/graph_header.c @@ -69,7 +69,7 @@ static void graph_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) { bScreen *sc= CTX_wm_screen(C); ScrArea *sa= CTX_wm_area(C); - SpaceIpo *sipo= (SpaceIpo*)CTX_wm_space_data(C); + SpaceIpo *sipo= CTX_wm_space_graph(C); PointerRNA spaceptr; /* retrieve state */ @@ -252,7 +252,7 @@ static void do_graph_buttons(bContext *C, void *arg, int event) void graph_header_buttons(const bContext *C, ARegion *ar) { ScrArea *sa= CTX_wm_area(C); - SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C); + SpaceIpo *sipo= CTX_wm_space_graph(C); uiBlock *block; int xco, yco= 3; diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 68f4db555f8..fc4c05915c9 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -68,7 +68,7 @@ static int view_toggle_handles_exec (bContext *C, wmOperator *op) { - SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C); + SpaceIpo *sipo= CTX_wm_space_graph(C); ARegion *ar= CTX_wm_region(C); if (sipo == NULL) diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index c36d790f0be..31daee2187e 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -217,7 +217,7 @@ static void graph_main_area_init(wmWindowManager *wm, ARegion *ar) static void graph_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceIpo *sipo= (SpaceIpo*)CTX_wm_space_data(C); + SpaceIpo *sipo= CTX_wm_space_graph(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DGrid *grid; @@ -294,7 +294,7 @@ static void graph_channel_area_init(wmWindowManager *wm, ARegion *ar) static void graph_channel_area_draw(const bContext *C, ARegion *ar) { - SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C); + SpaceIpo *sipo= CTX_wm_space_graph(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 2294c9e73ce..4dcaa96caf7 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -127,7 +127,7 @@ static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block static void do_image_panel_events(bContext *C, void *arg, int event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); switch(event) { @@ -234,7 +234,7 @@ static void image_transform_but_attr(SpaceImage *sima, int *imx, int *imy, int * /* is used for both read and write... */ static void image_editvertex_buts(const bContext *C, uiBlock *block) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); static float ocent[2]; float cent[2]= {0.0, 0.0}; @@ -347,7 +347,7 @@ static void image_editvertex_buts(const bContext *C, uiBlock *block) /* is used for both read and write... */ static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); static float ocent[2]; int imx= 256, imy= 256; int step, digits; @@ -386,7 +386,7 @@ static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block #if 0 static void image_panel_view_properties(const bContext *C, Panel *pa) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); Object *obedit= CTX_data_edit_object(C); uiBlock *block; @@ -448,7 +448,7 @@ void brush_buttons(const bContext *C, uiBlock *block, short fromsima, int evt_del, int evt_keepdata, int evt_texbrowse, int evt_texdel) { -// SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); +// SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *settings= CTX_data_tool_settings(C); Brush *brush= settings->imapaint.brush; ID *id; @@ -565,14 +565,14 @@ void brush_buttons(const bContext *C, uiBlock *block, short fromsima, static int image_panel_paint_poll(const bContext *C, PanelType *pt) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); return (sima->image && (sima->flag & SI_DRAWTOOL)); } static void image_panel_paintcolor(const bContext *C, Panel *pa) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *settings= CTX_data_tool_settings(C); Brush *brush= settings->imapaint.brush; uiBlock *block; @@ -591,7 +591,7 @@ static void image_panel_paintcolor(const bContext *C, Panel *pa) static void image_panel_paint(const bContext *C, Panel *pa) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); uiBlock *block; if(!sima->image || (sima->flag & SI_DRAWTOOL)==0) @@ -605,7 +605,7 @@ static void image_panel_paint(const bContext *C, Panel *pa) static void image_panel_curves_reset(bContext *C, void *cumap_v, void *ibuf_v) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); CurveMapping *cumap = cumap_v; int a; @@ -625,7 +625,7 @@ static void image_panel_curves_reset(bContext *C, void *cumap_v, void *ibuf_v) static void image_panel_curves(const bContext *C, Panel *pa) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf; uiBlock *block; uiBut *bt; @@ -1201,7 +1201,7 @@ void ED_image_uiblock_panel(const bContext *C, uiBlock *block, Image **ima_pp, I short redraw, short imagechanged) { Scene *scene= CTX_data_scene(C); - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Image *ima= *ima_pp; uiBut *but; char str[128], *strp; @@ -1397,7 +1397,7 @@ void uiTemplateImageLayers(uiLayout *layout, bContext *C, Image *ima, ImageUser static void image_panel_properties(const bContext *C, Panel *pa) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); uiBlock *block; block= uiLayoutFreeBlock(pa->layout); diff --git a/source/blender/editors/space_image/image_header.c b/source/blender/editors/space_image/image_header.c index 35088f0e4d1..e0fd652bf92 100644 --- a/source/blender/editors/space_image/image_header.c +++ b/source/blender/editors/space_image/image_header.c @@ -416,7 +416,7 @@ static void do_image_buttons(bContext *C, void *arg, int event) static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); uiPopupMenu *pup; uiLayout *layout; diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index a429de65610..723d3eeaf82 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -109,7 +109,7 @@ static void sima_zoom_set_factor(SpaceImage *sima, ARegion *ar, float zoomfac) static int space_image_poll(bContext *C) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); if(sima && sima->spacetype==SPACE_IMAGE) if(ED_space_image_buffer(sima)) return 1; @@ -119,7 +119,7 @@ static int space_image_poll(bContext *C) static int space_image_file_exists_poll(bContext *C) { if(space_image_poll(C)) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf= ED_space_image_buffer(sima); if(ibuf && BLI_exists(ibuf->name) && BLI_is_writable(ibuf->name)) @@ -131,10 +131,10 @@ static int space_image_file_exists_poll(bContext *C) int space_image_main_area_poll(bContext *C) { - SpaceLink *slink= CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); // XXX ARegion *ar= CTX_wm_region(C); - if(slink && (slink->spacetype == SPACE_IMAGE)) + if(sima) return 1; // XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW); return 0; @@ -149,7 +149,7 @@ typedef struct ViewPanData { static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ViewPanData *vpd; op->customdata= vpd= MEM_callocN(sizeof(ViewPanData), "ImageViewPanData"); @@ -165,7 +165,7 @@ static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event) static void view_pan_exit(bContext *C, wmOperator *op, int cancel) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ViewPanData *vpd= op->customdata; if(cancel) { @@ -180,7 +180,7 @@ static void view_pan_exit(bContext *C, wmOperator *op, int cancel) static int view_pan_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); float offset[2]; RNA_float_get_array(op->ptr, "offset", offset); @@ -209,7 +209,7 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event) static int view_pan_modal(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ViewPanData *vpd= op->customdata; float offset[2]; @@ -269,7 +269,7 @@ typedef struct ViewZoomData { static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ViewZoomData *vpd; op->customdata= vpd= MEM_callocN(sizeof(ViewZoomData), "ImageViewZoomData"); @@ -284,7 +284,7 @@ static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event) static void view_zoom_exit(bContext *C, wmOperator *op, int cancel) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ViewZoomData *vpd= op->customdata; if(cancel) { @@ -298,7 +298,7 @@ static void view_zoom_exit(bContext *C, wmOperator *op, int cancel) static int view_zoom_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); sima_zoom_set_factor(sima, ar, RNA_float_get(op->ptr, "factor")); @@ -325,7 +325,7 @@ static int view_zoom_invoke(bContext *C, wmOperator *op, wmEvent *event) static int view_zoom_modal(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); ViewZoomData *vpd= op->customdata; float factor; @@ -392,7 +392,7 @@ static int view_all_exec(bContext *C, wmOperator *op) int width, height; /* retrieve state */ - sima= (SpaceImage*)CTX_wm_space_data(C); + sima= CTX_wm_space_image(C); ar= CTX_wm_region(C); scene= (Scene*)CTX_data_scene(C); obedit= CTX_data_edit_object(C); @@ -449,7 +449,7 @@ static int view_selected_exec(bContext *C, wmOperator *op) int width, height; /* retrieve state */ - sima= (SpaceImage*)CTX_wm_space_data(C); + sima= CTX_wm_space_image(C); ar= CTX_wm_region(C); scene= (Scene*)CTX_data_scene(C); obedit= CTX_data_edit_object(C); @@ -493,7 +493,7 @@ void IMAGE_OT_view_selected(wmOperatorType *ot) static int view_zoom_in_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); sima_zoom_set_factor(sima, ar, 1.25f); @@ -516,7 +516,7 @@ void IMAGE_OT_view_zoom_in(wmOperatorType *ot) static int view_zoom_out_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); sima_zoom_set_factor(sima, ar, 0.8f); @@ -541,7 +541,7 @@ void IMAGE_OT_view_zoom_out(wmOperatorType *ot) static int view_zoom_ratio_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); sima_zoom_set(sima, ar, RNA_float_get(op->ptr, "ratio")); @@ -620,7 +620,7 @@ static void image_filesel(bContext *C, wmOperator *op, const char *path) static int open_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); Image *ima= NULL; @@ -640,7 +640,7 @@ static int open_exec(bContext *C, wmOperator *op) static int open_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); char *path= (sima->image)? sima->image->name: U.textudir; if(RNA_property_is_set(op->ptr, "filename")) @@ -711,7 +711,7 @@ static int replace_exec(bContext *C, wmOperator *op) static int replace_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); char *path= (sima->image)? sima->image->name: U.textudir; if(!sima->image) @@ -816,7 +816,7 @@ static void save_image_doit(bContext *C, SpaceImage *sima, Scene *scene, wmOpera static int save_as_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); Image *ima = ED_space_image(sima); char str[FILE_MAX]; @@ -834,7 +834,7 @@ static int save_as_exec(bContext *C, wmOperator *op) static int save_as_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Image *ima = ED_space_image(sima); ImBuf *ibuf= ED_space_image_buffer(sima); Scene *scene= CTX_data_scene(C); @@ -941,7 +941,7 @@ void IMAGE_OT_save(wmOperatorType *ot) static int save_sequence_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf; int tot= 0; char di[FILE_MAX], fi[FILE_MAX]; @@ -1020,7 +1020,7 @@ static int reload_exec(bContext *C, wmOperator *op) SpaceImage *sima; /* retrieve state */ - sima= (SpaceImage*)CTX_wm_space_data(C); + sima= CTX_wm_space_image(C); if(!sima->image) return OPERATOR_CANCELLED; @@ -1062,7 +1062,7 @@ static int new_exec(bContext *C, wmOperator *op) int width, height, floatbuf, uvtestgrid; /* retrieve state */ - sima= (SpaceImage*)CTX_wm_space_data(C); + sima= CTX_wm_space_image(C); scene= (Scene*)CTX_data_scene(C); obedit= CTX_data_edit_object(C); @@ -1127,7 +1127,7 @@ static int pack_test(bContext *C, wmOperator *op) static int pack_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Image *ima= ED_space_image(sima); ImBuf *ibuf= ED_space_image_buffer(sima); int as_png= RNA_boolean_get(op->ptr, "as_png"); @@ -1150,7 +1150,7 @@ static int pack_exec(bContext *C, wmOperator *op) static int pack_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf= ED_space_image_buffer(sima); uiPopupMenu *pup; uiLayout *layout; @@ -1336,7 +1336,7 @@ typedef struct ImageSampleInfo { static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ImBuf *ibuf= ED_space_image_buffer(sima); ImageSampleInfo *info= arg_info; @@ -1349,7 +1349,7 @@ static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) static void sample_apply(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); ImBuf *ibuf= ED_space_image_buffer(sima); ImageSampleInfo *info= op->customdata; @@ -1464,7 +1464,7 @@ static void sample_exit(bContext *C, wmOperator *op) static int sample_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ARegion *ar= CTX_wm_region(C); ImBuf *ibuf= ED_space_image_buffer(sima); ImageSampleInfo *info; @@ -1557,7 +1557,7 @@ typedef struct RecordCompositeData { int record_composite_apply(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); RecordCompositeData *rcd= op->customdata; Scene *scene= CTX_data_scene(C); ImBuf *ibuf; @@ -1585,7 +1585,7 @@ int record_composite_apply(bContext *C, wmOperator *op) static int record_composite_init(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); RecordCompositeData *rcd; @@ -1607,7 +1607,7 @@ static int record_composite_init(bContext *C, wmOperator *op) static void record_composite_exit(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); RecordCompositeData *rcd= op->customdata; scene->r.cfra= rcd->old_cfra; diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 709fbb6299b..aaea875a005 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -246,7 +246,7 @@ void image_keymap(struct wmWindowManager *wm) static void image_refresh(const bContext *C, ScrArea *sa) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); Image *ima; @@ -306,7 +306,7 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) static int image_context(const bContext *C, const char *member, bContextDataResult *result) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); if(CTX_data_dir(member)) { static const char *dir[] = {"edit_image", NULL}; @@ -416,7 +416,7 @@ static void image_main_area_init(wmWindowManager *wm, ARegion *ar) static void image_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Object *obedit= CTX_data_edit_object(C); Scene *scene= CTX_data_scene(C); View2D *v2d= &ar->v2d; diff --git a/source/blender/editors/space_logic/logic_buttons.c b/source/blender/editors/space_logic/logic_buttons.c index db6922f304c..58c1eddb6c1 100644 --- a/source/blender/editors/space_logic/logic_buttons.c +++ b/source/blender/editors/space_logic/logic_buttons.c @@ -80,7 +80,7 @@ static void do_logic_panel_events(bContext *C, void *arg, int event) static void logic_panel_properties(const bContext *C, Panel *pa) { -// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C); +// SpaceLogic *slogic= CTX_wm_space_logic(C); uiBlock *block; block= uiLayoutFreeBlock(pa->layout); @@ -90,7 +90,7 @@ static void logic_panel_properties(const bContext *C, Panel *pa) static void logic_panel_view_properties(const bContext *C, Panel *pa) { - // SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C); + // SpaceLogic *slogic= CTX_wm_space_logic(C); uiBlock *block; block= uiLayoutFreeBlock(pa->layout); @@ -101,8 +101,9 @@ static void logic_panel_view_properties(const bContext *C, Panel *pa) void logic_buttons_register(ARegionType *art) { - PanelType *pt; #if 0 + PanelType *pt; + pt= MEM_callocN(sizeof(PanelType), "spacetype logic panel properties"); strcpy(pt->idname, "LOGIC_PT_properties"); strcpy(pt->label, "Logic Properties"); diff --git a/source/blender/editors/space_logic/logic_header.c b/source/blender/editors/space_logic/logic_header.c index d0e905728be..9444e3893d1 100644 --- a/source/blender/editors/space_logic/logic_header.c +++ b/source/blender/editors/space_logic/logic_header.c @@ -63,12 +63,12 @@ static void do_logic_buttons(bContext *C, void *arg, int event) { -// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C); +// SpaceLogic *slogic= CTX_wm_space_logic(C); } static uiBlock *logic_addmenu(bContext *C, ARegion *ar, void *arg_unused) { -// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C); +// SpaceLogic *slogic= CTX_wm_space_logic(C); uiBlock *block; short yco= 0, menuwidth=120; @@ -87,7 +87,7 @@ static uiBlock *logic_addmenu(bContext *C, ARegion *ar, void *arg_unused) void logic_header_buttons(const bContext *C, ARegion *ar) { ScrArea *sa= CTX_wm_area(C); -// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C); +// SpaceLogic *slogic= CTX_wm_space_logic(C); uiBlock *block; short xco, yco= 3; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index ab4574d5940..03b4a2b84f4 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -2751,7 +2751,7 @@ static short draw_actuatorbuttons(Object *ob, bActuator *act, uiBlock *block, sh static void do_sensor_menu(bContext *C, void *arg, int event) { - SpaceLogic *slogic= (SpaceLogic *)CTX_wm_space_data(C); + SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; Object *ob; bSensor *sens; @@ -2800,7 +2800,7 @@ static uiBlock *sensor_menu(bContext *C, ARegion *ar, void *arg_unused) static void do_controller_menu(bContext *C, void *arg, int event) { - SpaceLogic *slogic= (SpaceLogic *)CTX_wm_space_data(C); + SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; Object *ob; bController *cont; @@ -2849,7 +2849,7 @@ static uiBlock *controller_menu(bContext *C, ARegion *ar, void *arg_unused) static void do_actuator_menu(bContext *C, void *arg, int event) { - SpaceLogic *slogic= (SpaceLogic *)CTX_wm_space_data(C); + SpaceLogic *slogic= CTX_wm_space_logic(C); ID **idar; Object *ob; bActuator *act; @@ -3011,7 +3011,7 @@ static int is_sensor_linked(uiBlock *block, bSensor *sens) void logic_buttons(bContext *C, ARegion *ar) { - SpaceLogic *slogic= (SpaceLogic *)CTX_wm_space_data(C); + SpaceLogic *slogic= CTX_wm_space_logic(C); Object *ob= CTX_data_active_object(C); ID **idar; bSensor *sens; diff --git a/source/blender/editors/space_logic/space_logic.c b/source/blender/editors/space_logic/space_logic.c index a593cfd1e7f..9f458bd8129 100644 --- a/source/blender/editors/space_logic/space_logic.c +++ b/source/blender/editors/space_logic/space_logic.c @@ -188,7 +188,7 @@ void logic_keymap(struct wmWindowManager *wm) static void logic_refresh(const bContext *C, ScrArea *sa) { -// SpaceLogic *slogic= (SpaceImage*)CTX_wm_space_data(C); +// SpaceLogic *slogic= CTX_wm_space_logic(C); // Object *obedit= CTX_data_edit_object(C); } @@ -215,7 +215,7 @@ static void logic_listener(ARegion *ar, wmNotifier *wmn) static int logic_context(const bContext *C, const char *member, bContextDataResult *result) { -// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C); +// SpaceLogic *slogic= CTX_wm_space_logic(C); return 0; @@ -239,7 +239,7 @@ static void logic_main_area_init(wmWindowManager *wm, ARegion *ar) static void logic_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ -// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C); +// SpaceLogic *slogic= CTX_wm_space_logic(C); View2D *v2d= &ar->v2d; View2DScrollers *scrollers; float col[3]; diff --git a/source/blender/editors/space_nla/nla_header.c b/source/blender/editors/space_nla/nla_header.c index 3f504441108..20343adef03 100644 --- a/source/blender/editors/space_nla/nla_header.c +++ b/source/blender/editors/space_nla/nla_header.c @@ -83,7 +83,7 @@ static void nla_viewmenu(bContext *C, uiLayout *layout, void *arg_unused) { bScreen *sc= CTX_wm_screen(C); ScrArea *sa= CTX_wm_area(C); - SpaceNla *snla= (SpaceNla*)CTX_wm_space_data(C); + SpaceNla *snla= CTX_wm_space_nla(C); PointerRNA spaceptr; /* retrieve state */ @@ -213,7 +213,7 @@ static void do_nla_buttons(bContext *C, void *arg, int event) void nla_header_buttons(const bContext *C, ARegion *ar) { - SpaceNla *snla= (SpaceNla *)CTX_wm_space_data(C); + SpaceNla *snla= CTX_wm_space_nla(C); ScrArea *sa= CTX_wm_area(C); uiBlock *block; int xco, yco= 3; diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index 923208f3b35..09ca1d6ee19 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -223,7 +223,7 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar) /* draw entirely, view changes should be handled here */ static void nla_channel_area_draw(const bContext *C, ARegion *ar) { - SpaceNla *snla= (SpaceNla*)CTX_wm_space_data(C); + SpaceNla *snla= CTX_wm_space_nla(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -268,7 +268,7 @@ static void nla_main_area_init(wmWindowManager *wm, ARegion *ar) static void nla_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceNla *snla= (SpaceNla*)CTX_wm_space_data(C); + SpaceNla *snla= CTX_wm_space_nla(C); bAnimContext ac; View2D *v2d= &ar->v2d; View2DGrid *grid; diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index f2e2486075b..70e2167c1e4 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -473,7 +473,7 @@ static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v) /* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */ static uiBlock *socket_vector_menu(bContext *C, ARegion *ar, void *socket_v) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ScrArea *sa= CTX_wm_area(C); bNode *node; bNodeSocket *sock= socket_v; @@ -577,7 +577,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv) static void do_node_internal_buttons(bContext *C, void *node_v, int event) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); if(event==B_NODE_EXEC) { if(snode->treetype==NTREE_SHADER) { @@ -1050,7 +1050,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d) { float col[3]; View2DScrollers *scrollers; - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); UI_GetThemeColor3fv(TH_BACK, col); glClearColor(col[0], col[1], col[2], 0); diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 0384965e49e..fe68a56dea5 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1089,7 +1089,7 @@ typedef struct NodeSizeWidget { static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); bNode *node= editnode_get_active(snode->edittree); NodeSizeWidget *nsw= op->customdata; @@ -1132,7 +1132,7 @@ static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event) static int node_resize_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); bNode *node= editnode_get_active(snode->edittree); @@ -1691,7 +1691,7 @@ void node_mute(SpaceNode *snode) int node_duplicate_exec(bContext *C, wmOperator *op) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ntreeCopyTree(snode->edittree, 1); /* 1 == internally selected nodes */ @@ -1833,7 +1833,7 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeSocket *tsock, bNodeL /* in_out = starting socket */ static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); NodeLinkDrag *nldrag= op->customdata; bNode *tnode, *node; @@ -1970,7 +1970,7 @@ static int node_link_init(SpaceNode *snode, NodeLinkDrag *nldrag) static int node_link_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); NodeLinkDrag *nldrag= MEM_callocN(sizeof(NodeLinkDrag), "drag link op customdata"); @@ -2166,7 +2166,7 @@ static int cut_links_intersect(bNodeLink *link, float mcoords[][2], int tot) static int cut_links_exec(bContext *C, wmOperator *op) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); float mcoords[256][2]; int i= 0; @@ -2573,7 +2573,7 @@ void winqreadnodespace(ScrArea *sa, void *spacedata, BWinEvent *evt) static int node_delete_selection_exec(bContext *C, wmOperator *op) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); node_delete(snode); diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 8c48d4b54e1..367242d1262 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -67,7 +67,7 @@ static void do_node_selectmenu(bContext *C, void *arg, int event) { ScrArea *curarea= CTX_wm_area(C); - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); /* functions in editnode.c assume there's a tree */ if(snode->nodetree==NULL) @@ -124,7 +124,7 @@ static uiBlock *node_selectmenu(bContext *C, ARegion *ar, void *arg_unused) void do_node_addmenu(bContext *C, void *arg, int event) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); bNode *node; /* store selection in temp test flag */ @@ -144,7 +144,7 @@ void do_node_addmenu(bContext *C, void *arg, int event) static void node_make_addmenu(bContext *C, int nodeclass, uiBlock *block) { Main *bmain= CTX_data_main(C); - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); bNodeTree *ntree; int tot= 0, a; short yco= 0, menuwidth=120; @@ -393,7 +393,7 @@ static uiBlock *node_add_dynamicmenu(bContext *C, ARegion *ar, void *arg_unused) static uiBlock *node_addmenu(bContext *C, ARegion *ar, void *arg_unused) { ScrArea *curarea= CTX_wm_area(C); - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); uiBlock *block; short yco= 0, menuwidth=120; @@ -449,7 +449,7 @@ static uiBlock *node_addmenu(bContext *C, ARegion *ar, void *arg_unused) static void do_node_nodemenu(bContext *C, void *arg, int event) { ScrArea *curarea= CTX_wm_area(C); - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); int fromlib=0; /* functions in editnode.c assume there's a tree */ @@ -514,7 +514,7 @@ static void do_node_nodemenu(bContext *C, void *arg, int event) static uiBlock *node_nodemenu(bContext *C, ARegion *ar, void *arg_unused) { ScrArea *curarea= CTX_wm_area(C); - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); uiBlock *block; short yco= 0, menuwidth=120; @@ -574,7 +574,7 @@ static uiBlock *node_nodemenu(bContext *C, ARegion *ar, void *arg_unused) static void do_node_viewmenu(bContext *C, void *arg, int event) { -// SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); +// SpaceNode *snode= CTX_wm_space_node(C); // ARegion *ar= CTX_wm_region(C); ScrArea *sa= CTX_wm_area(C); @@ -598,7 +598,7 @@ static void do_node_viewmenu(bContext *C, void *arg, int event) static uiBlock *node_viewmenu(bContext *C, ARegion *ar, void *arg_unused) { ScrArea *curarea= CTX_wm_area(C); - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); uiBlock *block; short yco= 0, menuwidth=120; @@ -641,7 +641,7 @@ static void do_node_buttons(bContext *C, void *arg, int event) { // NODE_FIX_ME : instead of using "current material/texture/scene", node editor can also pin context? // note: scene context better not gets overridden, that'll clash too much (ton) - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); Scene *scene= CTX_data_scene(C); Material *ma; Tex *tx; @@ -687,7 +687,7 @@ static void do_node_buttons(bContext *C, void *arg, int event) void node_header_buttons(const bContext *C, ARegion *ar) { ScrArea *sa= CTX_wm_area(C); - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); Scene *scene= CTX_data_scene(C); uiBlock *block; short xco, yco= 3; diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index 450b17e69bb..73becc1ebe8 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -107,7 +107,7 @@ static void node_mouse_select(SpaceNode *snode, ARegion *ar, short *mval, short static int node_select_exec(bContext *C, wmOperator *op) { // XXX wmWindow *window= CTX_wm_window(C); - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); int select_type; short mval[2]; @@ -232,7 +232,7 @@ static EnumPropertyItem prop_select_types[] = { static int node_borderselect_exec(bContext *C, wmOperator *op) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); bNode *node; rcti rect; diff --git a/source/blender/editors/space_node/node_state.c b/source/blender/editors/space_node/node_state.c index f05a24ef05a..8d805490942 100644 --- a/source/blender/editors/space_node/node_state.c +++ b/source/blender/editors/space_node/node_state.c @@ -140,7 +140,7 @@ static int node_toggle_visibility(SpaceNode *snode, ARegion *ar, short *mval) static int node_toggle_visibility_exec(bContext *C, wmOperator *op) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); ARegion *ar= CTX_wm_region(C); short mval[2]; @@ -187,7 +187,7 @@ static int node_fit_all_exec(bContext *C, wmOperator *op) { ScrArea *sa= CTX_wm_area(C); ARegion *ar= CTX_wm_region(C); - SpaceNode *snode= (SpaceNode *)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); snode_home(sa, ar, snode); ED_region_tag_redraw(ar); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 2e84a8b2c15..773c61f14d6 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -285,7 +285,7 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn) static int node_context(const bContext *C, const char *member, bContextDataResult *result) { - SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); + SpaceNode *snode= CTX_wm_space_node(C); if(CTX_data_dir(member)) { static const char *dir[] = {"selected_nodes", NULL}; diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 589feac6226..21ba9cfa707 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -1489,7 +1489,7 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, Tre static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op) { - SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -1528,7 +1528,7 @@ static void object_toggle_selectability_cb(bContext *C, Scene *scene, TreeElemen static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op) { - SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -1567,7 +1567,7 @@ void object_toggle_renderability_cb(bContext *C, Scene *scene, TreeElement *te, static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op) { - SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); @@ -1596,7 +1596,7 @@ void OUTLINER_OT_renderability_toggle(wmOperatorType *ot) static int outliner_toggle_expanded_exec(bContext *C, wmOperator *op) { - SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); if (outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1)) @@ -1627,7 +1627,7 @@ void OUTLINER_OT_expanded_toggle(wmOperatorType *ot) static int outliner_toggle_selected_exec(bContext *C, wmOperator *op) { - SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1)) @@ -1680,7 +1680,7 @@ static void outliner_openclose_level(SpaceOops *soops, ListBase *lb, int curleve static int outliner_one_level_exec(bContext *C, wmOperator *op) { - SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); int add= RNA_boolean_get(op->ptr, "open"); int level; @@ -2367,7 +2367,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); TreeElement *te; float fmval[2]; int extend= RNA_boolean_get(op->ptr, "extend"); @@ -2447,7 +2447,7 @@ static int do_outliner_item_openclose(bContext *C, SpaceOops *soops, TreeElement static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); TreeElement *te; float fmval[2]; int all= RNA_boolean_get(op->ptr, "all"); @@ -2514,7 +2514,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T static int outliner_item_rename(bContext *C, wmOperator *op, wmEvent *event) { ARegion *ar= CTX_wm_region(C); - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); TreeElement *te; float fmval[2]; @@ -2592,7 +2592,7 @@ static TreeElement *outliner_find_id(SpaceOops *soops, ListBase *lb, ID *id) static int outliner_show_active_exec(bContext *C, wmOperator *op) { - SpaceOops *so= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *so= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); View2D *v2d= &ar->v2d; @@ -2822,7 +2822,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase /* show entire object level hierarchy */ static int outliner_show_hierarchy_exec(bContext *C, wmOperator *op) { - SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); ARegion *ar= CTX_wm_region(C); Scene *scene= CTX_data_scene(C); @@ -3247,7 +3247,7 @@ static EnumPropertyItem prop_object_op_types[] = { static int outliner_object_operation_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); int event; char *str; @@ -3329,7 +3329,7 @@ static EnumPropertyItem prop_group_op_types[] = { static int outliner_group_operation_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); int event; /* check for invalid states */ @@ -3386,7 +3386,7 @@ static EnumPropertyItem prop_id_op_types[] = { static int outliner_id_operation_exec(bContext *C, wmOperator *op) { Scene *scene= CTX_data_scene(C); - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0; int event; @@ -3453,7 +3453,7 @@ static EnumPropertyItem prop_data_op_types[] = { static int outliner_data_operation_exec(bContext *C, wmOperator *op) { - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); int scenelevel=0, objectlevel=0, idlevel=0, datalevel=0; int event; @@ -3517,7 +3517,6 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot) static int outliner_drag_invoke(bContext *C, wmOperator *op, wmEvent *event) { - wmWindow *win= CTX_wm_window(C); Object *ob= CTX_data_active_object(C); PointerRNA ptr; @@ -3626,7 +3625,7 @@ static int outliner_operation(bContext *C, wmOperator *op, wmEvent *event) { Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); TreeElement *te; float fmval[2]; @@ -3660,7 +3659,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C) { ScrArea *sa= CTX_wm_area(C); if ((sa) && (sa->spacetype==SPACE_OUTLINER)) { - SpaceOops *so= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *so= CTX_wm_space_outliner(C); return (so->outlinevis == SO_DATABLOCKS); } return 0; @@ -3873,7 +3872,7 @@ static void do_outliner_drivers_editop(SpaceOops *soops, ListBase *tree, short m static int outliner_drivers_addsel_exec(bContext *C, wmOperator *op) { - SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soutliner= CTX_wm_space_outliner(C); /* check for invalid states */ if (soutliner == NULL) @@ -3908,7 +3907,7 @@ void OUTLINER_OT_drivers_add(wmOperatorType *ot) static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op) { - SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soutliner= CTX_wm_space_outliner(C); /* check for invalid states */ if (soutliner == NULL) @@ -4043,7 +4042,7 @@ static void do_outliner_keyingset_editop(SpaceOops *soops, KeyingSet *ks, ListBa static int outliner_keyingset_additems_exec(bContext *C, wmOperator *op) { - SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soutliner= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= verify_active_keyingset(scene, 1); @@ -4083,7 +4082,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot) static int outliner_keyingset_removeitems_exec(bContext *C, wmOperator *op) { - SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soutliner= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks= verify_active_keyingset(scene, 1); @@ -4765,7 +4764,7 @@ static void restrictbutton_bone_cb(bContext *C, void *poin, void *poin2) static void namebutton_cb(bContext *C, void *tsep, char *oldname) { - SpaceOops *soops= (SpaceOops *)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); TreeStore *ts= soops->treestore; @@ -5294,7 +5293,7 @@ void draw_outliner(const bContext *C) Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); View2D *v2d= &ar->v2d; - SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soops= CTX_wm_space_outliner(C); uiBlock *block; int sizey= 0, sizex= 0, sizex_rna= 0; diff --git a/source/blender/editors/space_outliner/outliner_header.c b/source/blender/editors/space_outliner/outliner_header.c index 0743a447298..0c7859ed4e2 100644 --- a/source/blender/editors/space_outliner/outliner_header.c +++ b/source/blender/editors/space_outliner/outliner_header.c @@ -209,7 +209,7 @@ void outliner_header_buttons(const bContext *C, ARegion *ar) { ScrArea *sa= CTX_wm_area(C); Scene *scene= CTX_data_scene(C); - SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); + SpaceOops *soutliner= CTX_wm_space_outliner(C); uiBlock *block; int xco, yco= 3, xmax; diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index 24afd24740a..61488db0007 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -214,7 +214,7 @@ static void time_main_area_init(wmWindowManager *wm, ARegion *ar) static void time_main_area_draw(const bContext *C, ARegion *ar) { /* draw entirely, view changes should be handled here */ - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); View2D *v2d= &ar->v2d; View2DGrid *grid; View2DScrollers *scrollers; diff --git a/source/blender/editors/space_time/time_header.c b/source/blender/editors/space_time/time_header.c index f79e04755e2..436a841deb8 100644 --- a/source/blender/editors/space_time/time_header.c +++ b/source/blender/editors/space_time/time_header.c @@ -96,7 +96,7 @@ static void do_time_redrawmenu(bContext *C, void *arg, int event) if(event < 1001) { bScreen *screen= CTX_wm_screen(C); - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); stime->redraws ^= event; @@ -116,7 +116,7 @@ static void do_time_redrawmenu(bContext *C, void *arg, int event) static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused) { ScrArea *curarea= CTX_wm_area(C); - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); uiBlock *block; short yco= 0, menuwidth=120, icon; @@ -171,7 +171,7 @@ static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused) static void do_time_viewmenu(bContext *C, void *arg, int event) { ScrArea *curarea= CTX_wm_area(C); - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); View2D *v2d= UI_view2d_fromcontext_rwin(C); Scene *scene= CTX_data_scene(C); int first; @@ -229,7 +229,7 @@ static void do_time_viewmenu(bContext *C, void *arg, int event) static uiBlock *time_viewmenu(bContext *C, ARegion *ar, void *arg_unused) { ScrArea *curarea= CTX_wm_area(C); - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); View2D *v2d= UI_view2d_fromcontext_rwin(C); uiBlock *block; short yco= 0, menuwidth=120; @@ -375,7 +375,7 @@ static uiBlock *time_framemenu(bContext *C, ARegion *ar, void *arg_unused) void do_time_buttons(bContext *C, void *arg, int event) { bScreen *screen= CTX_wm_screen(C); - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); Scene *scene= CTX_data_scene(C); switch(event) { @@ -445,7 +445,7 @@ void do_time_buttons(bContext *C, void *arg, int event) void time_header_buttons(const bContext *C, ARegion *ar) { ScrArea *sa= CTX_wm_area(C); - SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); + SpaceTime *stime= CTX_wm_space_time(C); Scene *scene= CTX_data_scene(C); uiBlock *block; uiBut *but; diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index ae2b600f8f4..218011054d5 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -205,7 +205,7 @@ static void handle_view3d_lock(bContext *C) { Scene *scene= CTX_data_scene(C); ScrArea *sa= CTX_wm_area(C); - View3D *v3d= (View3D *)CTX_wm_space_data(C); + View3D *v3d= CTX_wm_view3d(C); if (v3d != NULL && sa != NULL) { if(v3d->localview==0 && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 1a0b16695e1..c14b8c8a646 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -2416,7 +2416,7 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f static void createTransUVs(bContext *C, TransInfo *t) { - SpaceImage *sima = (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima = CTX_wm_space_image(C); Image *ima = CTX_data_edit_image(C); Scene *scene = CTX_data_scene(C); TransData *td = NULL; diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 801da08e611..bb5a8b1dd40 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -1132,7 +1132,7 @@ static int stitch_exec(bContext *C, wmOperator *op) Image *ima; MTFace *tf; - sima= (SpaceImage*)CTX_wm_space_data(C); + sima= CTX_wm_space_image(C); scene= CTX_data_scene(C); obedit= CTX_data_edit_object(C); em= BKE_mesh_get_editmesh((Mesh*)obedit->data); @@ -1451,7 +1451,7 @@ static int sticky_select(float *limit, int hitv[4], int v, float *hituv[4], floa static int mouse_select(bContext *C, float co[2], int extend, int loop) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); @@ -1815,7 +1815,7 @@ void UV_OT_select_loop(wmOperatorType *ot) static int select_linked_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); @@ -2050,7 +2050,7 @@ static void uv_faces_do_sticky(bContext *C, SpaceImage *sima, Scene *scene, Obje static int border_select_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); @@ -2223,7 +2223,7 @@ static void select_uv_inside_ellipse(SpaceImage *sima, Scene *scene, int select, int circle_select_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); @@ -2313,7 +2313,7 @@ static int snap_cursor_to_selection(Scene *scene, Image *ima, Object *obedit, Vi static int snap_cursor_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); Image *ima= CTX_data_edit_image(C); @@ -2545,7 +2545,7 @@ static int snap_uvs_to_pixels(SpaceImage *sima, Scene *scene, Object *obedit) static int snap_selection_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Scene *scene= CTX_data_scene(C); Object *obedit= CTX_data_edit_object(C); Image *ima= CTX_data_edit_image(C); @@ -2694,7 +2694,7 @@ void UV_OT_select_pinned(wmOperatorType *ot) static int hide_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); @@ -2837,7 +2837,7 @@ void UV_OT_hide(wmOperatorType *ot) static int reveal_exec(bContext *C, wmOperator *op) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); ToolSettings *ts= CTX_data_tool_settings(C); Object *obedit= CTX_data_edit_object(C); EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); @@ -3029,7 +3029,7 @@ static int set_tile_exec(bContext *C, wmOperator *op) static int set_tile_invoke(bContext *C, wmOperator *op, wmEvent *event) { - SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); + SpaceImage *sima= CTX_wm_space_image(C); Image *ima= CTX_data_edit_image(C); ARegion *ar= CTX_wm_region(C); float fx, fy;