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_outliner | |
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_outliner')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_header.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/space_outliner.c | 15 |
2 files changed, 13 insertions, 12 deletions
diff --git a/source/blender/editors/space_outliner/outliner_header.c b/source/blender/editors/space_outliner/outliner_header.c index 5a56e8ef0f1..fd2f6fc7576 100644 --- a/source/blender/editors/space_outliner/outliner_header.c +++ b/source/blender/editors/space_outliner/outliner_header.c @@ -38,7 +38,7 @@ #include "BLI_blenlib.h" -#include "BKE_global.h" +#include "BKE_context.h" #include "BKE_screen.h" #include "ED_screen.h" @@ -66,7 +66,7 @@ static void do_viewmenu(bContext *C, void *arg, int event) static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused) { - ScrArea *curarea= C->area; + ScrArea *curarea= CTX_wm_area(C); uiBlock *block; short yco= 0, menuwidth=120; @@ -99,8 +99,8 @@ static void do_outliner_buttons(bContext *C, void *arg, int event) void outliner_header_buttons(const bContext *C, ARegion *ar) { - ScrArea *sa= C->area; - SpaceOops *soutliner= sa->spacedata.first; + ScrArea *sa= CTX_wm_area(C); + SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); uiBlock *block; int xco, yco= 3; char *path; @@ -117,7 +117,7 @@ void outliner_header_buttons(const bContext *C, ARegion *ar) uiBlockSetEmboss(block, UI_EMBOSSP); xmax= GetButStringLength("View"); - uiDefPulldownBut(block, dummy_viewmenu, C->area, + uiDefPulldownBut(block, dummy_viewmenu, CTX_wm_area(C), "View", xco, yco-2, xmax-3, 24, ""); xco += xmax; diff --git a/source/blender/editors/space_outliner/space_outliner.c b/source/blender/editors/space_outliner/space_outliner.c index 36afb206ab6..4fa10adcd91 100644 --- a/source/blender/editors/space_outliner/space_outliner.c +++ b/source/blender/editors/space_outliner/space_outliner.c @@ -47,7 +47,7 @@ #include "BLI_rand.h" #include "BKE_colortools.h" -#include "BKE_global.h" +#include "BKE_context.h" #include "BKE_screen.h" #include "BKE_texture.h" #include "BKE_utildefines.h" @@ -108,15 +108,16 @@ void UI_table_free(uiTable *table) void UI_table_draw(const bContext *C, uiTable *table) { + ARegion *ar= CTX_wm_region(C); uiBlock *block; View2D *v2d; rcti *rct, cellrct; int y, row, col; - v2d= &C->region->v2d; + v2d= &ar->v2d; rct= &table->rct; - block= uiBeginBlock(C, C->region, "table outliner", UI_EMBOSST, UI_HELV); + block= uiBeginBlock(C, ar, "table outliner", UI_EMBOSST, UI_HELV); for(y=rct->ymax, row=0; y>rct->ymin; y-=ROW_HEIGHT, row++) { if(row%2 == 0) { @@ -161,7 +162,7 @@ typedef struct CellRNA { static void rna_back_cb(bContext *C, void *arg_unused, void *arg_unused2) { - SpaceOops *soutliner= C->area->spacedata.first; + SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); char *newpath; newpath= RNA_path_back(soutliner->rnapath); @@ -172,7 +173,7 @@ static void rna_back_cb(bContext *C, void *arg_unused, void *arg_unused2) static void rna_pointer_cb(bContext *C, void *arg_prop, void *arg_index) { - SpaceOops *soutliner= C->area->spacedata.first; + SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); PropertyRNA *prop= arg_prop; char *newpath; int index= GET_INT_FROM_POINTER(arg_index);; @@ -406,7 +407,7 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar) PointerRNA newptr; float col[3]; int rows, cols, awidth, aheight, width, height; - SpaceOops *soutliner= C->area->spacedata.first; + SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); View2D *v2d= &ar->v2d; View2DScrollers *scrollers; @@ -421,7 +422,7 @@ static void outliner_main_area_draw(const bContext *C, ARegion *ar) /* create table */ cell.space= soutliner; cell.lastrow= -1; - RNA_main_pointer_create(G.main, &cell.ptr); + RNA_main_pointer_create(CTX_data_main(C), &cell.ptr); cell.prop= NULL; /* solve RNA path or reset if fails */ |