From 74e4ad20c9e8d19f85aaa2995652e3f65bdfc0c9 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 28 Jul 2009 16:33:02 +0000 Subject: 2.5: code cleanup, added CTX_wm_space_* for each space type, instead of casting everywhere. --- source/blender/blenkernel/intern/context.c | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'source/blender/blenkernel/intern/context.c') 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; -- cgit v1.2.3