2.5: code cleanup, added CTX_wm_space_* for each space type,

instead of casting everywhere.
This commit is contained in:
Brecht Van Lommel 2009-07-28 16:33:02 +00:00
parent f4f3a9b08b
commit 74e4ad20c9
40 changed files with 267 additions and 180 deletions

@ -122,6 +122,17 @@ struct RegionView3D *CTX_wm_region_view3d(const bContext *C);
struct SpaceText *CTX_wm_space_text(const bContext *C); struct SpaceText *CTX_wm_space_text(const bContext *C);
struct SpaceImage *CTX_wm_space_image(const bContext *C); struct SpaceImage *CTX_wm_space_image(const bContext *C);
struct SpaceConsole *CTX_wm_space_console(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_manager_set(bContext *C, struct wmWindowManager *wm);
void CTX_wm_window_set(bContext *C, struct wmWindow *win); void CTX_wm_window_set(bContext *C, struct wmWindow *win);

@ -256,6 +256,83 @@ struct SpaceImage *CTX_wm_space_image(const bContext *C)
return NULL; 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) void CTX_wm_manager_set(bContext *C, wmWindowManager *wm)
{ {
C->wm.manager= wm; C->wm.manager= wm;

@ -67,7 +67,7 @@ static int change_frame_init(bContext *C, wmOperator *op)
return 0; return 0;
if (curarea->spacetype == SPACE_TIME) { 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 */ /* timeline displays frame number only when dragging indicator */
// XXX make this more in line with other anim editors? // XXX make this more in line with other anim editors?
@ -103,7 +103,7 @@ static void change_frame_exit(bContext *C, wmOperator *op)
return; return;
if (curarea->spacetype == SPACE_TIME) { 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 */ /* timeline displays frame number only when dragging indicator */
// XXX make this more in line with other anim editors? // 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) { switch (curarea->spacetype) {
case SPACE_TIME: /* TimeLine */ case SPACE_TIME: /* TimeLine */
{ {
SpaceTime *stime= (SpaceTime *)CTX_wm_space_data(C); SpaceTime *stime= CTX_wm_space_time(C);
stime->flag ^= TIME_DRAWFRAMES; stime->flag ^= TIME_DRAWFRAMES;
} }
break; break;
case SPACE_ACTION: /* Action Editor */ case SPACE_ACTION: /* Action Editor */
{ {
SpaceAction *saction= (SpaceAction *)CTX_wm_space_data(C); SpaceAction *saction= CTX_wm_space_action(C);
saction->flag ^= SACTION_DRAWTIME; saction->flag ^= SACTION_DRAWTIME;
} }
break; break;
case SPACE_IPO: /* Graph Editor */ case SPACE_IPO: /* Graph Editor */
{ {
SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C); SpaceIpo *sipo= CTX_wm_space_graph(C);
sipo->flag ^= SIPO_DRAWTIME; sipo->flag ^= SIPO_DRAWTIME;
} }
break; break;
case SPACE_NLA: /* NLA Editor */ case SPACE_NLA: /* NLA Editor */
{ {
SpaceNla *snla= (SpaceNla *)CTX_wm_space_data(C); SpaceNla *snla= CTX_wm_space_nla(C);
snla->flag ^= SNLA_DRAWTIME; snla->flag ^= SNLA_DRAWTIME;
} }
break; break;
case SPACE_SEQ: /* Sequencer */ case SPACE_SEQ: /* Sequencer */
{ {
SpaceSeq *sseq= (SpaceSeq *)CTX_wm_space_data(C); SpaceSeq *sseq= CTX_wm_space_seq(C);
sseq->flag ^= SEQ_DRAWFRAMES; sseq->flag ^= SEQ_DRAWFRAMES;
} }
break; break;

@ -965,18 +965,15 @@ static int modify_key_op_poll(bContext *C)
{ {
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
SpaceOops *so= CTX_wm_space_outliner(C);
/* if no area or active scene */ /* if no area or active scene */
if (ELEM(NULL, sa, scene)) if (ELEM(NULL, sa, scene))
return 0; return 0;
/* if Outliner, only allow in DataBlocks view */ /* if Outliner, only allow in DataBlocks view */
if (sa->spacetype == SPACE_OUTLINER) { if (so && (so->outlinevis != SO_DATABLOCKS))
SpaceOops *so= (SpaceOops *)CTX_wm_space_data(C); return 0;
if ((so->outlinevis != SO_DATABLOCKS))
return 0;
}
/* TODO: checks for other space types can be added here */ /* TODO: checks for other space types can be added here */

@ -2033,7 +2033,7 @@ static EnumPropertyItem prop_calc_roll_types[] = {
static int armature_calc_roll_exec(bContext *C, wmOperator *op) static int armature_calc_roll_exec(bContext *C, wmOperator *op)
{ {
Scene *scene= CTX_data_scene(C); 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); Object *ob= CTX_data_edit_object(C);
void (*roll_func)(Scene *, View3D *, EditBone *) = NULL; 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); Object *obedit= CTX_data_edit_object(C);
bArmature *arm= (obedit) ? obedit->data : NULL; bArmature *arm= (obedit) ? obedit->data : NULL;
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
View3D *v3d= (View3D *)CTX_wm_space_data(C); View3D *v3d= CTX_wm_view3d(C);
EditBone *newbone=NULL; EditBone *newbone=NULL;
ListBase points = {NULL, NULL}; ListBase points = {NULL, NULL};
int count; int count;

@ -168,11 +168,11 @@ int ED_operator_buttons_active(bContext *C)
int ED_operator_node_active(bContext *C) int ED_operator_node_active(bContext *C)
{ {
if(ed_spacetype_test(C, SPACE_NODE)) { SpaceNode *snode= CTX_wm_space_node(C);
SpaceNode *snode= (SpaceNode *)CTX_wm_space_data(C);
if(snode->edittree) if(snode && snode->edittree)
return 1; return 1;
}
return 0; return 0;
} }

@ -4387,10 +4387,9 @@ static int image_paint_poll(bContext *C)
return 1; return 1;
} }
else { else {
ScrArea *sa= CTX_wm_area(C); SpaceImage *sima= CTX_wm_space_image(C);
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C);
if(sa && sa->spacetype==SPACE_IMAGE) { if(sima) {
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
if((sima->flag & SI_DRAWTOOL) && ar->regiontype==RGN_TYPE_WINDOW) 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); view3d_set_viewcontext(C, &pop->vc);
} }
else { 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; 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); RegionView3D *rv3d= CTX_wm_region_view3d(C);
if(!rv3d) { if(!rv3d) {
SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); SpaceImage *sima= CTX_wm_space_image(C);
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
ED_space_image_zoom(sima, ar, zoomx, zoomy); ED_space_image_zoom(sima, ar, zoomx, zoomy);

@ -77,7 +77,7 @@ static void act_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
{ {
bScreen *sc= CTX_wm_screen(C); bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
SpaceAction *sact= (SpaceAction*)CTX_wm_space_data(C); SpaceAction *sact= CTX_wm_space_action(C);
PointerRNA spaceptr; PointerRNA spaceptr;
/* retrieve state */ /* 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) 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); Object *obact= CTX_data_active_object(C);
printf("actedit do id: \n"); 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) void action_header_buttons(const bContext *C, ARegion *ar)
{ {
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
SpaceAction *saction= (SpaceAction *)CTX_wm_space_data(C); SpaceAction *saction= CTX_wm_space_action(C);
bAnimContext ac; bAnimContext ac;
uiBlock *block; uiBlock *block;
int xco, yco= 3, xmax; int xco, yco= 3, xmax;

@ -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) static void action_main_area_draw(const bContext *C, ARegion *ar)
{ {
/* draw entirely, view changes should be handled here */ /* 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; bAnimContext ac;
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
View2DGrid *grid; 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) static void action_channel_area_draw(const bContext *C, ARegion *ar)
{ {
/* draw entirely, view changes should be handled here */ /* 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; bAnimContext ac;
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
View2DScrollers *scrollers; View2DScrollers *scrollers;

@ -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) 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; ID *id;
int found; 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) 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; ButsContextPath *path= sbuts?sbuts->path:NULL;
if(!path) 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) 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; ButsContextPath *path= sbuts->path;
PointerRNA *ptr; PointerRNA *ptr;
int a; 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) 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; ButsContextPath *path= sbuts->path;
uiLayout *row; uiLayout *row;
uiBlock *block; uiBlock *block;

@ -65,7 +65,10 @@
static void do_buttons_buttons(bContext *C, void *arg, int event) 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) { switch(event) {
case B_CONTEXT_SWITCH: 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) 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; uiBlock *block;
int xco, yco= 3; int xco, yco= 3;

@ -910,7 +910,7 @@ void SCENE_OT_render_layer_remove(wmOperatorType *ot)
static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event) static int toolbox_invoke(bContext *C, wmOperator *op, wmEvent *event)
{ {
bScreen *sc= CTX_wm_screen(C); bScreen *sc= CTX_wm_screen(C);
SpaceButs *sbuts= (SpaceButs*)CTX_wm_space_data(C); SpaceButs *sbuts= CTX_wm_space_buts(C);
PointerRNA ptr; PointerRNA ptr;
uiPopupMenu *pup; uiPopupMenu *pup;
uiLayout *layout; uiLayout *layout;

@ -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) static void buttons_main_area_draw(const bContext *C, ARegion *ar)
{ {
/* draw entirely, view changes should be handled here */ /* 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); int vertical= (sbuts->align == BUT_VERTICAL);
buttons_context_compute(C, sbuts); 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) 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; uiStyle *style= U.uistyles.first;
uiBlock *block; uiBlock *block;
uiLayout *layout; uiLayout *layout;

@ -242,7 +242,7 @@ static void driver_update_flags_cb (bContext *C, void *fcu_v, void *dummy_v)
/* drivers panel poll */ /* drivers panel poll */
static int graph_panel_drivers_poll(const bContext *C, PanelType *pt) 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) if(sipo->mode != SIPO_MODE_DRIVERS)
return 0; return 0;

@ -69,7 +69,7 @@ static void graph_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
{ {
bScreen *sc= CTX_wm_screen(C); bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
SpaceIpo *sipo= (SpaceIpo*)CTX_wm_space_data(C); SpaceIpo *sipo= CTX_wm_space_graph(C);
PointerRNA spaceptr; PointerRNA spaceptr;
/* retrieve state */ /* 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) void graph_header_buttons(const bContext *C, ARegion *ar)
{ {
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
SpaceIpo *sipo= (SpaceIpo *)CTX_wm_space_data(C); SpaceIpo *sipo= CTX_wm_space_graph(C);
uiBlock *block; uiBlock *block;
int xco, yco= 3; int xco, yco= 3;

@ -68,7 +68,7 @@
static int view_toggle_handles_exec (bContext *C, wmOperator *op) 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); ARegion *ar= CTX_wm_region(C);
if (sipo == NULL) if (sipo == NULL)

@ -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) static void graph_main_area_draw(const bContext *C, ARegion *ar)
{ {
/* draw entirely, view changes should be handled here */ /* 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; bAnimContext ac;
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
View2DGrid *grid; 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) 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; bAnimContext ac;
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
View2DScrollers *scrollers; View2DScrollers *scrollers;

@ -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) 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); ARegion *ar= CTX_wm_region(C);
switch(event) { 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... */ /* is used for both read and write... */
static void image_editvertex_buts(const bContext *C, uiBlock *block) 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); Object *obedit= CTX_data_edit_object(C);
static float ocent[2]; static float ocent[2];
float cent[2]= {0.0, 0.0}; 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... */ /* is used for both read and write... */
static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block) 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]; static float ocent[2];
int imx= 256, imy= 256; int imx= 256, imy= 256;
int step, digits; int step, digits;
@ -386,7 +386,7 @@ static void image_editcursor_buts(const bContext *C, View2D *v2d, uiBlock *block
#if 0 #if 0
static void image_panel_view_properties(const bContext *C, Panel *pa) 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); ARegion *ar= CTX_wm_region(C);
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
uiBlock *block; uiBlock *block;
@ -448,7 +448,7 @@ void brush_buttons(const bContext *C, uiBlock *block, short fromsima,
int evt_del, int evt_keepdata, int evt_del, int evt_keepdata,
int evt_texbrowse, int evt_texdel) 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); ToolSettings *settings= CTX_data_tool_settings(C);
Brush *brush= settings->imapaint.brush; Brush *brush= settings->imapaint.brush;
ID *id; 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) 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)); return (sima->image && (sima->flag & SI_DRAWTOOL));
} }
static void image_panel_paintcolor(const bContext *C, Panel *pa) 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); ToolSettings *settings= CTX_data_tool_settings(C);
Brush *brush= settings->imapaint.brush; Brush *brush= settings->imapaint.brush;
uiBlock *block; 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) 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; uiBlock *block;
if(!sima->image || (sima->flag & SI_DRAWTOOL)==0) 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) 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; CurveMapping *cumap = cumap_v;
int a; 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) 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; ImBuf *ibuf;
uiBlock *block; uiBlock *block;
uiBut *bt; uiBut *bt;
@ -1201,7 +1201,7 @@ void ED_image_uiblock_panel(const bContext *C, uiBlock *block, Image **ima_pp, I
short redraw, short imagechanged) short redraw, short imagechanged)
{ {
Scene *scene= CTX_data_scene(C); 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; Image *ima= *ima_pp;
uiBut *but; uiBut *but;
char str[128], *strp; 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) 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; uiBlock *block;
block= uiLayoutFreeBlock(pa->layout); block= uiLayoutFreeBlock(pa->layout);

@ -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) 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); Object *obedit= CTX_data_edit_object(C);
uiPopupMenu *pup; uiPopupMenu *pup;
uiLayout *layout; uiLayout *layout;

@ -109,7 +109,7 @@ static void sima_zoom_set_factor(SpaceImage *sima, ARegion *ar, float zoomfac)
static int space_image_poll(bContext *C) 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(sima && sima->spacetype==SPACE_IMAGE)
if(ED_space_image_buffer(sima)) if(ED_space_image_buffer(sima))
return 1; return 1;
@ -119,7 +119,7 @@ static int space_image_poll(bContext *C)
static int space_image_file_exists_poll(bContext *C) static int space_image_file_exists_poll(bContext *C)
{ {
if(space_image_poll(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); ImBuf *ibuf= ED_space_image_buffer(sima);
if(ibuf && BLI_exists(ibuf->name) && BLI_is_writable(ibuf->name)) 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) 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); // 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 1; // XXX (ar && ar->type->regionid == RGN_TYPE_WINDOW);
return 0; return 0;
@ -149,7 +149,7 @@ typedef struct ViewPanData {
static void view_pan_init(bContext *C, wmOperator *op, wmEvent *event) 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; ViewPanData *vpd;
op->customdata= vpd= MEM_callocN(sizeof(ViewPanData), "ImageViewPanData"); 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) 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; ViewPanData *vpd= op->customdata;
if(cancel) { 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) 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]; float offset[2];
RNA_float_get_array(op->ptr, "offset", offset); 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) 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; ViewPanData *vpd= op->customdata;
float offset[2]; float offset[2];
@ -269,7 +269,7 @@ typedef struct ViewZoomData {
static void view_zoom_init(bContext *C, wmOperator *op, wmEvent *event) 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; ViewZoomData *vpd;
op->customdata= vpd= MEM_callocN(sizeof(ViewZoomData), "ImageViewZoomData"); 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) 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; ViewZoomData *vpd= op->customdata;
if(cancel) { 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) 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); ARegion *ar= CTX_wm_region(C);
sima_zoom_set_factor(sima, ar, RNA_float_get(op->ptr, "factor")); 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) 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); ARegion *ar= CTX_wm_region(C);
ViewZoomData *vpd= op->customdata; ViewZoomData *vpd= op->customdata;
float factor; float factor;
@ -392,7 +392,7 @@ static int view_all_exec(bContext *C, wmOperator *op)
int width, height; int width, height;
/* retrieve state */ /* retrieve state */
sima= (SpaceImage*)CTX_wm_space_data(C); sima= CTX_wm_space_image(C);
ar= CTX_wm_region(C); ar= CTX_wm_region(C);
scene= (Scene*)CTX_data_scene(C); scene= (Scene*)CTX_data_scene(C);
obedit= CTX_data_edit_object(C); obedit= CTX_data_edit_object(C);
@ -449,7 +449,7 @@ static int view_selected_exec(bContext *C, wmOperator *op)
int width, height; int width, height;
/* retrieve state */ /* retrieve state */
sima= (SpaceImage*)CTX_wm_space_data(C); sima= CTX_wm_space_image(C);
ar= CTX_wm_region(C); ar= CTX_wm_region(C);
scene= (Scene*)CTX_data_scene(C); scene= (Scene*)CTX_data_scene(C);
obedit= CTX_data_edit_object(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) 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); ARegion *ar= CTX_wm_region(C);
sima_zoom_set_factor(sima, ar, 1.25f); 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) 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); ARegion *ar= CTX_wm_region(C);
sima_zoom_set_factor(sima, ar, 0.8f); 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) 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); ARegion *ar= CTX_wm_region(C);
sima_zoom_set(sima, ar, RNA_float_get(op->ptr, "ratio")); 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) 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); Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
Image *ima= NULL; 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) 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; char *path= (sima->image)? sima->image->name: U.textudir;
if(RNA_property_is_set(op->ptr, "filename")) 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) 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; char *path= (sima->image)? sima->image->name: U.textudir;
if(!sima->image) 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) 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); Scene *scene= CTX_data_scene(C);
Image *ima = ED_space_image(sima); Image *ima = ED_space_image(sima);
char str[FILE_MAX]; 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) 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); Image *ima = ED_space_image(sima);
ImBuf *ibuf= ED_space_image_buffer(sima); ImBuf *ibuf= ED_space_image_buffer(sima);
Scene *scene= CTX_data_scene(C); 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) 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; ImBuf *ibuf;
int tot= 0; int tot= 0;
char di[FILE_MAX], fi[FILE_MAX]; char di[FILE_MAX], fi[FILE_MAX];
@ -1020,7 +1020,7 @@ static int reload_exec(bContext *C, wmOperator *op)
SpaceImage *sima; SpaceImage *sima;
/* retrieve state */ /* retrieve state */
sima= (SpaceImage*)CTX_wm_space_data(C); sima= CTX_wm_space_image(C);
if(!sima->image) if(!sima->image)
return OPERATOR_CANCELLED; return OPERATOR_CANCELLED;
@ -1062,7 +1062,7 @@ static int new_exec(bContext *C, wmOperator *op)
int width, height, floatbuf, uvtestgrid; int width, height, floatbuf, uvtestgrid;
/* retrieve state */ /* retrieve state */
sima= (SpaceImage*)CTX_wm_space_data(C); sima= CTX_wm_space_image(C);
scene= (Scene*)CTX_data_scene(C); scene= (Scene*)CTX_data_scene(C);
obedit= CTX_data_edit_object(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) 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); Image *ima= ED_space_image(sima);
ImBuf *ibuf= ED_space_image_buffer(sima); ImBuf *ibuf= ED_space_image_buffer(sima);
int as_png= RNA_boolean_get(op->ptr, "as_png"); 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) 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); ImBuf *ibuf= ED_space_image_buffer(sima);
uiPopupMenu *pup; uiPopupMenu *pup;
uiLayout *layout; uiLayout *layout;
@ -1336,7 +1336,7 @@ typedef struct ImageSampleInfo {
static void sample_draw(const bContext *C, ARegion *ar, void *arg_info) 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); ImBuf *ibuf= ED_space_image_buffer(sima);
ImageSampleInfo *info= arg_info; 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) 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); ARegion *ar= CTX_wm_region(C);
ImBuf *ibuf= ED_space_image_buffer(sima); ImBuf *ibuf= ED_space_image_buffer(sima);
ImageSampleInfo *info= op->customdata; 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) 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); ARegion *ar= CTX_wm_region(C);
ImBuf *ibuf= ED_space_image_buffer(sima); ImBuf *ibuf= ED_space_image_buffer(sima);
ImageSampleInfo *info; ImageSampleInfo *info;
@ -1557,7 +1557,7 @@ typedef struct RecordCompositeData {
int record_composite_apply(bContext *C, wmOperator *op) 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; RecordCompositeData *rcd= op->customdata;
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
ImBuf *ibuf; ImBuf *ibuf;
@ -1585,7 +1585,7 @@ int record_composite_apply(bContext *C, wmOperator *op)
static int record_composite_init(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); Scene *scene= CTX_data_scene(C);
RecordCompositeData *rcd; RecordCompositeData *rcd;
@ -1607,7 +1607,7 @@ static int record_composite_init(bContext *C, wmOperator *op)
static void record_composite_exit(bContext *C, wmOperator *op) static void record_composite_exit(bContext *C, wmOperator *op)
{ {
Scene *scene= CTX_data_scene(C); 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; RecordCompositeData *rcd= op->customdata;
scene->r.cfra= rcd->old_cfra; scene->r.cfra= rcd->old_cfra;

@ -246,7 +246,7 @@ void image_keymap(struct wmWindowManager *wm)
static void image_refresh(const bContext *C, ScrArea *sa) 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); Object *obedit= CTX_data_edit_object(C);
Image *ima; 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) 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)) { if(CTX_data_dir(member)) {
static const char *dir[] = {"edit_image", NULL}; 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) static void image_main_area_draw(const bContext *C, ARegion *ar)
{ {
/* draw entirely, view changes should be handled here */ /* 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); Object *obedit= CTX_data_edit_object(C);
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;

@ -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) 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; uiBlock *block;
block= uiLayoutFreeBlock(pa->layout); 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) 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; uiBlock *block;
block= uiLayoutFreeBlock(pa->layout); 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) void logic_buttons_register(ARegionType *art)
{ {
PanelType *pt;
#if 0 #if 0
PanelType *pt;
pt= MEM_callocN(sizeof(PanelType), "spacetype logic panel properties"); pt= MEM_callocN(sizeof(PanelType), "spacetype logic panel properties");
strcpy(pt->idname, "LOGIC_PT_properties"); strcpy(pt->idname, "LOGIC_PT_properties");
strcpy(pt->label, "Logic Properties"); strcpy(pt->label, "Logic Properties");

@ -63,12 +63,12 @@
static void do_logic_buttons(bContext *C, void *arg, int event) 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) 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; uiBlock *block;
short yco= 0, menuwidth=120; 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) void logic_header_buttons(const bContext *C, ARegion *ar)
{ {
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
// SpaceLogic *slogic= (SpaceLogic*)CTX_wm_space_data(C); // SpaceLogic *slogic= CTX_wm_space_logic(C);
uiBlock *block; uiBlock *block;
short xco, yco= 3; short xco, yco= 3;

@ -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) 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; ID **idar;
Object *ob; Object *ob;
bSensor *sens; 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) 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; ID **idar;
Object *ob; Object *ob;
bController *cont; 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) 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; ID **idar;
Object *ob; Object *ob;
bActuator *act; bActuator *act;
@ -3011,7 +3011,7 @@ static int is_sensor_linked(uiBlock *block, bSensor *sens)
void logic_buttons(bContext *C, ARegion *ar) 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); Object *ob= CTX_data_active_object(C);
ID **idar; ID **idar;
bSensor *sens; bSensor *sens;

@ -188,7 +188,7 @@ void logic_keymap(struct wmWindowManager *wm)
static void logic_refresh(const bContext *C, ScrArea *sa) 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); // 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) 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; 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) static void logic_main_area_draw(const bContext *C, ARegion *ar)
{ {
/* draw entirely, view changes should be handled here */ /* 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; View2D *v2d= &ar->v2d;
View2DScrollers *scrollers; View2DScrollers *scrollers;
float col[3]; float col[3];

@ -83,7 +83,7 @@ static void nla_viewmenu(bContext *C, uiLayout *layout, void *arg_unused)
{ {
bScreen *sc= CTX_wm_screen(C); bScreen *sc= CTX_wm_screen(C);
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
SpaceNla *snla= (SpaceNla*)CTX_wm_space_data(C); SpaceNla *snla= CTX_wm_space_nla(C);
PointerRNA spaceptr; PointerRNA spaceptr;
/* retrieve state */ /* 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) 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); ScrArea *sa= CTX_wm_area(C);
uiBlock *block; uiBlock *block;
int xco, yco= 3; int xco, yco= 3;

@ -223,7 +223,7 @@ static void nla_channel_area_init(wmWindowManager *wm, ARegion *ar)
/* draw entirely, view changes should be handled here */ /* draw entirely, view changes should be handled here */
static void nla_channel_area_draw(const bContext *C, ARegion *ar) 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; bAnimContext ac;
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
View2DScrollers *scrollers; 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) static void nla_main_area_draw(const bContext *C, ARegion *ar)
{ {
/* draw entirely, view changes should be handled here */ /* 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; bAnimContext ac;
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
View2DGrid *grid; View2DGrid *grid;

@ -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 */ /* 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) 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); ScrArea *sa= CTX_wm_area(C);
bNode *node; bNode *node;
bNodeSocket *sock= socket_v; 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) 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(event==B_NODE_EXEC) {
if(snode->treetype==NTREE_SHADER) { if(snode->treetype==NTREE_SHADER) {
@ -1050,7 +1050,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
{ {
float col[3]; float col[3];
View2DScrollers *scrollers; View2DScrollers *scrollers;
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); SpaceNode *snode= CTX_wm_space_node(C);
UI_GetThemeColor3fv(TH_BACK, col); UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0); glClearColor(col[0], col[1], col[2], 0);

@ -1089,7 +1089,7 @@ typedef struct NodeSizeWidget {
static int node_resize_modal(bContext *C, wmOperator *op, wmEvent *event) 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); ARegion *ar= CTX_wm_region(C);
bNode *node= editnode_get_active(snode->edittree); bNode *node= editnode_get_active(snode->edittree);
NodeSizeWidget *nsw= op->customdata; 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) 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); ARegion *ar= CTX_wm_region(C);
bNode *node= editnode_get_active(snode->edittree); bNode *node= editnode_get_active(snode->edittree);
@ -1691,7 +1691,7 @@ void node_mute(SpaceNode *snode)
int node_duplicate_exec(bContext *C, wmOperator *op) 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 */ 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 */ /* in_out = starting socket */
static int node_link_modal(bContext *C, wmOperator *op, wmEvent *event) 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); ARegion *ar= CTX_wm_region(C);
NodeLinkDrag *nldrag= op->customdata; NodeLinkDrag *nldrag= op->customdata;
bNode *tnode, *node; 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) 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); ARegion *ar= CTX_wm_region(C);
NodeLinkDrag *nldrag= MEM_callocN(sizeof(NodeLinkDrag), "drag link op customdata"); 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) 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); ARegion *ar= CTX_wm_region(C);
float mcoords[256][2]; float mcoords[256][2];
int i= 0; 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) 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); ARegion *ar= CTX_wm_region(C);
node_delete(snode); node_delete(snode);

@ -67,7 +67,7 @@
static void do_node_selectmenu(bContext *C, void *arg, int event) static void do_node_selectmenu(bContext *C, void *arg, int event)
{ {
ScrArea *curarea= CTX_wm_area(C); 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 */ /* functions in editnode.c assume there's a tree */
if(snode->nodetree==NULL) 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) 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; bNode *node;
/* store selection in temp test flag */ /* 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) static void node_make_addmenu(bContext *C, int nodeclass, uiBlock *block)
{ {
Main *bmain= CTX_data_main(C); Main *bmain= CTX_data_main(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); SpaceNode *snode= CTX_wm_space_node(C);
bNodeTree *ntree; bNodeTree *ntree;
int tot= 0, a; int tot= 0, a;
short yco= 0, menuwidth=120; 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) static uiBlock *node_addmenu(bContext *C, ARegion *ar, void *arg_unused)
{ {
ScrArea *curarea= CTX_wm_area(C); ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); SpaceNode *snode= CTX_wm_space_node(C);
uiBlock *block; uiBlock *block;
short yco= 0, menuwidth=120; 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) static void do_node_nodemenu(bContext *C, void *arg, int event)
{ {
ScrArea *curarea= CTX_wm_area(C); ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); SpaceNode *snode= CTX_wm_space_node(C);
int fromlib=0; int fromlib=0;
/* functions in editnode.c assume there's a tree */ /* 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) static uiBlock *node_nodemenu(bContext *C, ARegion *ar, void *arg_unused)
{ {
ScrArea *curarea= CTX_wm_area(C); ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); SpaceNode *snode= CTX_wm_space_node(C);
uiBlock *block; uiBlock *block;
short yco= 0, menuwidth=120; 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) 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); // ARegion *ar= CTX_wm_region(C);
ScrArea *sa= CTX_wm_area(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) static uiBlock *node_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{ {
ScrArea *curarea= CTX_wm_area(C); ScrArea *curarea= CTX_wm_area(C);
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); SpaceNode *snode= CTX_wm_space_node(C);
uiBlock *block; uiBlock *block;
short yco= 0, menuwidth=120; 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? // 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) // 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); Scene *scene= CTX_data_scene(C);
Material *ma; Material *ma;
Tex *tx; 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) void node_header_buttons(const bContext *C, ARegion *ar)
{ {
ScrArea *sa= CTX_wm_area(C); 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); Scene *scene= CTX_data_scene(C);
uiBlock *block; uiBlock *block;
short xco, yco= 3; short xco, yco= 3;

@ -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) static int node_select_exec(bContext *C, wmOperator *op)
{ {
// XXX wmWindow *window= CTX_wm_window(C); // 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); ARegion *ar= CTX_wm_region(C);
int select_type; int select_type;
short mval[2]; short mval[2];
@ -232,7 +232,7 @@ static EnumPropertyItem prop_select_types[] = {
static int node_borderselect_exec(bContext *C, wmOperator *op) 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); ARegion *ar= CTX_wm_region(C);
bNode *node; bNode *node;
rcti rect; rcti rect;

@ -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) 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); ARegion *ar= CTX_wm_region(C);
short mval[2]; short mval[2];
@ -187,7 +187,7 @@ static int node_fit_all_exec(bContext *C, wmOperator *op)
{ {
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
ARegion *ar= CTX_wm_region(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); snode_home(sa, ar, snode);
ED_region_tag_redraw(ar); ED_region_tag_redraw(ar);
return OPERATOR_FINISHED; return OPERATOR_FINISHED;

@ -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) 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)) { if(CTX_data_dir(member)) {
static const char *dir[] = {"selected_nodes", NULL}; static const char *dir[] = {"selected_nodes", NULL};

@ -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) 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); Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(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) 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); Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(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) 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); Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(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) 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); ARegion *ar= CTX_wm_region(C);
if (outliner_has_one_flag(soops, &soops->tree, TSE_CLOSED, 1)) 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) 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); ARegion *ar= CTX_wm_region(C);
if (outliner_has_one_flag(soops, &soops->tree, TSE_SELECTED, 1)) 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) 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); ARegion *ar= CTX_wm_region(C);
int add= RNA_boolean_get(op->ptr, "open"); int add= RNA_boolean_get(op->ptr, "open");
int level; int level;
@ -2367,7 +2367,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event)
{ {
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); SpaceOops *soops= CTX_wm_space_outliner(C);
TreeElement *te; TreeElement *te;
float fmval[2]; float fmval[2];
int extend= RNA_boolean_get(op->ptr, "extend"); 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) static int outliner_item_openclose(bContext *C, wmOperator *op, wmEvent *event)
{ {
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); SpaceOops *soops= CTX_wm_space_outliner(C);
TreeElement *te; TreeElement *te;
float fmval[2]; float fmval[2];
int all= RNA_boolean_get(op->ptr, "all"); 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) static int outliner_item_rename(bContext *C, wmOperator *op, wmEvent *event)
{ {
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); SpaceOops *soops= CTX_wm_space_outliner(C);
TreeElement *te; TreeElement *te;
float fmval[2]; 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) 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); Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
@ -2822,7 +2822,7 @@ static void tree_element_show_hierarchy(Scene *scene, SpaceOops *soops, ListBase
/* show entire object level hierarchy */ /* show entire object level hierarchy */
static int outliner_show_hierarchy_exec(bContext *C, wmOperator *op) 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); ARegion *ar= CTX_wm_region(C);
Scene *scene= CTX_data_scene(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) static int outliner_object_operation_exec(bContext *C, wmOperator *op)
{ {
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); SpaceOops *soops= CTX_wm_space_outliner(C);
int event; int event;
char *str; char *str;
@ -3329,7 +3329,7 @@ static EnumPropertyItem prop_group_op_types[] = {
static int outliner_group_operation_exec(bContext *C, wmOperator *op) static int outliner_group_operation_exec(bContext *C, wmOperator *op)
{ {
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); SpaceOops *soops= CTX_wm_space_outliner(C);
int event; int event;
/* check for invalid states */ /* check for invalid states */
@ -3386,7 +3386,7 @@ static EnumPropertyItem prop_id_op_types[] = {
static int outliner_id_operation_exec(bContext *C, wmOperator *op) static int outliner_id_operation_exec(bContext *C, wmOperator *op)
{ {
Scene *scene= CTX_data_scene(C); 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 scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
int event; int event;
@ -3453,7 +3453,7 @@ static EnumPropertyItem prop_data_op_types[] = {
static int outliner_data_operation_exec(bContext *C, wmOperator *op) 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 scenelevel=0, objectlevel=0, idlevel=0, datalevel=0;
int event; int event;
@ -3517,7 +3517,6 @@ void OUTLINER_OT_data_operation(wmOperatorType *ot)
static int outliner_drag_invoke(bContext *C, wmOperator *op, wmEvent *event) static int outliner_drag_invoke(bContext *C, wmOperator *op, wmEvent *event)
{ {
wmWindow *win= CTX_wm_window(C);
Object *ob= CTX_data_active_object(C); Object *ob= CTX_data_active_object(C);
PointerRNA ptr; PointerRNA ptr;
@ -3626,7 +3625,7 @@ static int outliner_operation(bContext *C, wmOperator *op, wmEvent *event)
{ {
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); SpaceOops *soops= CTX_wm_space_outliner(C);
TreeElement *te; TreeElement *te;
float fmval[2]; float fmval[2];
@ -3660,7 +3659,7 @@ static int ed_operator_outliner_datablocks_active(bContext *C)
{ {
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
if ((sa) && (sa->spacetype==SPACE_OUTLINER)) { 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 (so->outlinevis == SO_DATABLOCKS);
} }
return 0; 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) 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 */ /* check for invalid states */
if (soutliner == NULL) if (soutliner == NULL)
@ -3908,7 +3907,7 @@ void OUTLINER_OT_drivers_add(wmOperatorType *ot)
static int outliner_drivers_deletesel_exec(bContext *C, wmOperator *op) 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 */ /* check for invalid states */
if (soutliner == NULL) 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) 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); Scene *scene= CTX_data_scene(C);
KeyingSet *ks= verify_active_keyingset(scene, 1); 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) 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); Scene *scene= CTX_data_scene(C);
KeyingSet *ks= verify_active_keyingset(scene, 1); 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) 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); Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
TreeStore *ts= soops->treestore; TreeStore *ts= soops->treestore;
@ -5294,7 +5293,7 @@ void draw_outliner(const bContext *C)
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
View2D *v2d= &ar->v2d; View2D *v2d= &ar->v2d;
SpaceOops *soops= (SpaceOops*)CTX_wm_space_data(C); SpaceOops *soops= CTX_wm_space_outliner(C);
uiBlock *block; uiBlock *block;
int sizey= 0, sizex= 0, sizex_rna= 0; int sizey= 0, sizex= 0, sizex_rna= 0;

@ -209,7 +209,7 @@ void outliner_header_buttons(const bContext *C, ARegion *ar)
{ {
ScrArea *sa= CTX_wm_area(C); ScrArea *sa= CTX_wm_area(C);
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
SpaceOops *soutliner= (SpaceOops*)CTX_wm_space_data(C); SpaceOops *soutliner= CTX_wm_space_outliner(C);
uiBlock *block; uiBlock *block;
int xco, yco= 3, xmax; int xco, yco= 3, xmax;

@ -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) static void time_main_area_draw(const bContext *C, ARegion *ar)
{ {
/* draw entirely, view changes should be handled here */ /* 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; View2D *v2d= &ar->v2d;
View2DGrid *grid; View2DGrid *grid;
View2DScrollers *scrollers; View2DScrollers *scrollers;

@ -96,7 +96,7 @@ static void do_time_redrawmenu(bContext *C, void *arg, int event)
if(event < 1001) { if(event < 1001) {
bScreen *screen= CTX_wm_screen(C); bScreen *screen= CTX_wm_screen(C);
SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); SpaceTime *stime= CTX_wm_space_time(C);
stime->redraws ^= event; 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) static uiBlock *time_redrawmenu(bContext *C, ARegion *ar, void *arg_unused)
{ {
ScrArea *curarea= CTX_wm_area(C); ScrArea *curarea= CTX_wm_area(C);
SpaceTime *stime= (SpaceTime*)CTX_wm_space_data(C); SpaceTime *stime= CTX_wm_space_time(C);
uiBlock *block; uiBlock *block;
short yco= 0, menuwidth=120, icon; 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) static void do_time_viewmenu(bContext *C, void *arg, int event)
{ {
ScrArea *curarea= CTX_wm_area(C); 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); View2D *v2d= UI_view2d_fromcontext_rwin(C);
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
int first; 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) static uiBlock *time_viewmenu(bContext *C, ARegion *ar, void *arg_unused)
{ {
ScrArea *curarea= CTX_wm_area(C); 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); View2D *v2d= UI_view2d_fromcontext_rwin(C);
uiBlock *block; uiBlock *block;
short yco= 0, menuwidth=120; 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) void do_time_buttons(bContext *C, void *arg, int event)
{ {
bScreen *screen= CTX_wm_screen(C); 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); Scene *scene= CTX_data_scene(C);
switch(event) { 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) void time_header_buttons(const bContext *C, ARegion *ar)
{ {
ScrArea *sa= CTX_wm_area(C); 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); Scene *scene= CTX_data_scene(C);
uiBlock *block; uiBlock *block;
uiBut *but; uiBut *but;

@ -205,7 +205,7 @@ static void handle_view3d_lock(bContext *C)
{ {
Scene *scene= CTX_data_scene(C); Scene *scene= CTX_data_scene(C);
ScrArea *sa= CTX_wm_area(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 != NULL && sa != NULL) {
if(v3d->localview==0 && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) { if(v3d->localview==0 && v3d->scenelock && sa->spacetype==SPACE_VIEW3D) {

@ -2416,7 +2416,7 @@ static void UVsToTransData(SpaceImage *sima, TransData *td, TransData2D *td2d, f
static void createTransUVs(bContext *C, TransInfo *t) 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); Image *ima = CTX_data_edit_image(C);
Scene *scene = CTX_data_scene(C); Scene *scene = CTX_data_scene(C);
TransData *td = NULL; TransData *td = NULL;

@ -1132,7 +1132,7 @@ static int stitch_exec(bContext *C, wmOperator *op)
Image *ima; Image *ima;
MTFace *tf; MTFace *tf;
sima= (SpaceImage*)CTX_wm_space_data(C); sima= CTX_wm_space_image(C);
scene= CTX_data_scene(C); scene= CTX_data_scene(C);
obedit= CTX_data_edit_object(C); obedit= CTX_data_edit_object(C);
em= BKE_mesh_get_editmesh((Mesh*)obedit->data); 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) 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); Scene *scene= CTX_data_scene(C);
ToolSettings *ts= CTX_data_tool_settings(C); ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(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) 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); Scene *scene= CTX_data_scene(C);
ToolSettings *ts= CTX_data_tool_settings(C); ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(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) 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); Scene *scene= CTX_data_scene(C);
ToolSettings *ts= CTX_data_tool_settings(C); ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(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) 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); Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); 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) 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); Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
Image *ima= CTX_data_edit_image(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) 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); Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
Image *ima= CTX_data_edit_image(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) 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); ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); 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) 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); ToolSettings *ts= CTX_data_tool_settings(C);
Object *obedit= CTX_data_edit_object(C); Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh*)obedit->data); 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) 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); Image *ima= CTX_data_edit_image(C);
ARegion *ar= CTX_wm_region(C); ARegion *ar= CTX_wm_region(C);
float fx, fy; float fx, fy;