diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-18 05:56:48 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-12-18 05:56:48 +0300 |
commit | ecc4e55b6666bdb20ed8e2e8e9a7fc2fbeff3731 (patch) | |
tree | 35b5a56c8b43fdf6d61a01302b2e458f6245bfe8 /source/blender/editors/space_time/time_ops.c | |
parent | 241dbe6e85a916cc55b5e749596aaf0ef3dffd90 (diff) |
2.5
Context API
This adds the context API as described here. The main practical change
now is that C is not longer directly accessible but has to be accessed
through accessor functions. This basically adds the implementation of
the API and adaption of existing code with some minor changes. The next
task of course is to actually use this design to cleanup of bad level
calls and global access, in blenkernel, blenloader.
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/Context
Error, Warning and Debug Info Reporting
This adds the error reporting API as described here. It should help
clean up error() calls in non-ui code, but eventually can become used
for gathering messages for a console window, and throwing exceptions
in python scripts when an error happens executing something.
http://wiki.blender.org/index.php/BlenderDev/Blender2.5/Reports
Diffstat (limited to 'source/blender/editors/space_time/time_ops.c')
-rw-r--r-- | source/blender/editors/space_time/time_ops.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c index 599594a3ec0..30b0e808e05 100644 --- a/source/blender/editors/space_time/time_ops.c +++ b/source/blender/editors/space_time/time_ops.c @@ -38,7 +38,7 @@ #include "BLI_blenlib.h" -#include "BKE_global.h" +#include "BKE_context.h" #include "BKE_utildefines.h" #include "UI_interface.h" @@ -56,7 +56,7 @@ static int change_frame_init(bContext *C, wmOperator *op) { - SpaceTime *stime= C->area->spacedata.first; + SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); stime->flag |= TIME_CFRA_NUM; @@ -65,6 +65,7 @@ static int change_frame_init(bContext *C, wmOperator *op) static void change_frame_apply(bContext *C, wmOperator *op) { + Scene *scene= CTX_data_scene(C); int cfra; cfra= RNA_int_get(op->ptr, "frame"); @@ -83,8 +84,8 @@ static void change_frame_apply(bContext *C, wmOperator *op) else PIL_sleep_ms(30); #endif - if(cfra!=CFRA) - CFRA= cfra; + if(cfra!=scene->r.cfra) + scene->r.cfra= cfra; WM_event_add_notifier(C, WM_NOTE_WINDOW_REDRAW, 0, NULL); /* XXX: add WM_NOTE_TIME_CHANGED? */ @@ -92,7 +93,7 @@ static void change_frame_apply(bContext *C, wmOperator *op) static void change_frame_exit(bContext *C, wmOperator *op) { - SpaceTime *stime= C->area->spacedata.first; + SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); stime->flag &= ~TIME_CFRA_NUM; } @@ -109,7 +110,7 @@ static int change_frame_exec(bContext *C, wmOperator *op) static int frame_from_event(bContext *C, wmEvent *event) { - ARegion *region= C->region; + ARegion *region= CTX_wm_region(C); int x, y; float viewx; @@ -127,7 +128,7 @@ static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event) change_frame_apply(C, op); /* add temp handler */ - WM_event_add_modal_handler(C, &C->window->handlers, op); + WM_event_add_modal_handler(C, &CTX_wm_window(C)->handlers, op); return OPERATOR_RUNNING_MODAL; } @@ -182,12 +183,12 @@ static int toggle_time_exec(bContext *C, wmOperator *op) { SpaceTime *stime; - if (ELEM(NULL, C->area, C->area->spacedata.first)) + if (ELEM(NULL, CTX_wm_area(C), CTX_wm_space_data(C))) return OPERATOR_CANCELLED; /* simply toggle draw frames flag for now */ // XXX in past, this displayed menu to choose... (for later!) - stime= C->area->spacedata.first; + stime= (SpaceTime*)CTX_wm_space_data(C); stime->flag ^= TIME_DRAWFRAMES; return OPERATOR_FINISHED; |