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/editors/animation/anim_ops.c | 14 +++++++------- source/blender/editors/animation/keyframing.c | 9 +++------ 2 files changed, 10 insertions(+), 13 deletions(-) (limited to 'source/blender/editors/animation') 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 */ -- cgit v1.2.3