2.5
Small area/space api fix: space->new() callbacks now require Context pointer. Too many cases you want to initialize stuff... Also: added dummy draw function for NLA channel region, was too ugly.
This commit is contained in:
parent
fa12c089b1
commit
bac4d10174
|
@ -57,7 +57,7 @@ typedef struct SpaceType {
|
|||
int iconid; /* icon lookup for menus */
|
||||
|
||||
/* initial allocation, after this WM will call init() too */
|
||||
struct SpaceLink *(*new)(void);
|
||||
struct SpaceLink *(*new)(const struct bContext *C);
|
||||
/* not free spacelink itself */
|
||||
void (*free)(struct SpaceLink *);
|
||||
|
||||
|
|
|
@ -620,7 +620,7 @@ void area_newspace(bContext *C, ScrArea *sa, int type)
|
|||
else {
|
||||
/* new space */
|
||||
if(st) {
|
||||
sl= st->new();
|
||||
sl= st->new(C);
|
||||
BLI_addhead(&sa->spacedata, sl);
|
||||
|
||||
/* swap regions */
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
|
||||
/* ******************** default callbacks for action space ***************** */
|
||||
|
||||
static SpaceLink *action_new(void)
|
||||
static SpaceLink *action_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceAction *saction;
|
||||
|
@ -105,7 +105,7 @@ static SpaceLink *action_new(void)
|
|||
ar->v2d.tot.ymax= 0.0f;
|
||||
|
||||
ar->v2d.cur.xmin= -2.0f;
|
||||
ar->v2d.cur.ymin= -2000.0f; /* ideally this would be the size of the region, but since we don't know that, set for 1:1 */
|
||||
ar->v2d.cur.ymin= -2000.0f; /* ideally this would be the size of the region */
|
||||
ar->v2d.cur.xmax= 100.0f;
|
||||
ar->v2d.cur.ymax= 0.0f;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ void ED_spacetypes_keymap(wmWindowManager *wm)
|
|||
/* ****************************** space template *********************** */
|
||||
|
||||
/* allocate and init some vars */
|
||||
static SpaceLink *xxx_new(void)
|
||||
static SpaceLink *xxx_new(const bContext *C)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
/* ******************** default callbacks for buttons space ***************** */
|
||||
|
||||
static SpaceLink *buttons_new(void)
|
||||
static SpaceLink *buttons_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceButs *sbuts;
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
|
||||
/* ******************** default callbacks for file space ***************** */
|
||||
|
||||
static SpaceLink *file_new(void)
|
||||
static SpaceLink *file_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceFile *sfile;
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
/* ******************** default callbacks for image space ***************** */
|
||||
|
||||
static SpaceLink *image_new(void)
|
||||
static SpaceLink *image_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceImage *simage;
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
/* ******************** default callbacks for info space ***************** */
|
||||
|
||||
static SpaceLink *info_new(void)
|
||||
static SpaceLink *info_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceInfo *sinfo;
|
||||
|
|
|
@ -62,8 +62,9 @@
|
|||
|
||||
/* ******************** default callbacks for ipo space ***************** */
|
||||
|
||||
static SpaceLink *ipo_new(void)
|
||||
static SpaceLink *ipo_new(const bContext *C)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar;
|
||||
SpaceIpo *sipo;
|
||||
|
||||
|
@ -97,7 +98,7 @@ static SpaceLink *ipo_new(void)
|
|||
|
||||
ar->v2d.tot.xmin= 0.0f;
|
||||
ar->v2d.tot.ymin= -10.0f;
|
||||
ar->v2d.tot.xmax= 250.0;
|
||||
ar->v2d.tot.xmax= scene->r.efra;
|
||||
ar->v2d.tot.ymax= 10.0f;
|
||||
|
||||
ar->v2d.cur= ar->v2d.tot;
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
/* ******************** default callbacks for nla space ***************** */
|
||||
|
||||
static SpaceLink *nla_new(void)
|
||||
static SpaceLink *nla_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceNla *snla;
|
||||
|
@ -142,6 +142,28 @@ static SpaceLink *nla_duplicate(SpaceLink *sl)
|
|||
return (SpaceLink *)snlan;
|
||||
}
|
||||
|
||||
static void nla_channel_area_draw(const bContext *C, ARegion *ar)
|
||||
{
|
||||
/* draw entirely, view changes should be handled here */
|
||||
// SpaceNla *snla= (SpaceNla*)CTX_wm_space_data(C);
|
||||
// View2D *v2d= &ar->v2d;
|
||||
float col[3];
|
||||
|
||||
/* clear and setup matrix */
|
||||
UI_GetThemeColor3fv(TH_BACK, col);
|
||||
glClearColor(col[0], col[1], col[2], 0.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// UI_view2d_view_ortho(C, v2d);
|
||||
|
||||
/* data... */
|
||||
|
||||
|
||||
/* reset view matrix */
|
||||
//UI_view2d_view_restore(C);
|
||||
|
||||
/* scrollers? */
|
||||
}
|
||||
|
||||
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
|
@ -265,7 +287,7 @@ void ED_spacetype_nla(void)
|
|||
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
|
||||
|
||||
//art->init= nla_channel_area_init;
|
||||
//art->draw= nla_channel_area_draw;
|
||||
art->draw= nla_channel_area_draw;
|
||||
|
||||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
|
||||
/* ******************** default callbacks for node space ***************** */
|
||||
|
||||
static SpaceLink *node_new(void)
|
||||
static SpaceLink *node_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceNode *snode;
|
||||
|
|
|
@ -532,7 +532,7 @@ static void outliner_header_area_free(ARegion *ar)
|
|||
|
||||
/* ******************** default callbacks for outliner space ***************** */
|
||||
|
||||
static SpaceLink *outliner_new(void)
|
||||
static SpaceLink *outliner_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceOops *soutliner;
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
/* ******************** default callbacks for script space ***************** */
|
||||
|
||||
static SpaceLink *script_new(void)
|
||||
static SpaceLink *script_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceScript *sscript;
|
||||
|
|
|
@ -62,8 +62,9 @@
|
|||
|
||||
/* ******************** default callbacks for sequencer space ***************** */
|
||||
|
||||
static SpaceLink *sequencer_new(void)
|
||||
static SpaceLink *sequencer_new(const bContext *C)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar;
|
||||
SpaceSeq *sseq;
|
||||
|
||||
|
@ -87,11 +88,11 @@ static SpaceLink *sequencer_new(void)
|
|||
ar->regiontype= RGN_TYPE_WINDOW;
|
||||
|
||||
|
||||
/* seq space goes from (0,8) to (250, 0) */
|
||||
/* seq space goes from (0,8) to (0, efra) */
|
||||
|
||||
ar->v2d.tot.xmin= 0.0f;
|
||||
ar->v2d.tot.ymin= 0.0f;
|
||||
ar->v2d.tot.xmax= 250.0f;
|
||||
ar->v2d.tot.xmax= scene->r.efra;
|
||||
ar->v2d.tot.ymax= 8.0f;
|
||||
|
||||
ar->v2d.cur= ar->v2d.tot;
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
/* ******************** default callbacks for sound space ***************** */
|
||||
|
||||
static SpaceLink *sound_new(void)
|
||||
static SpaceLink *sound_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceSound *ssound;
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
|
||||
/* ******************** default callbacks for text space ***************** */
|
||||
|
||||
static SpaceLink *text_new(void)
|
||||
static SpaceLink *text_new(const bContext *C)
|
||||
{
|
||||
ARegion *ar;
|
||||
SpaceText *stext;
|
||||
|
|
|
@ -205,8 +205,9 @@ static void time_header_area_draw(const bContext *C, ARegion *ar)
|
|||
|
||||
/* ******************** default callbacks for time space ***************** */
|
||||
|
||||
static SpaceLink *time_new(void)
|
||||
static SpaceLink *time_new(const bContext *C)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar;
|
||||
SpaceTime *stime;
|
||||
|
||||
|
@ -229,10 +230,9 @@ static SpaceLink *time_new(void)
|
|||
BLI_addtail(&stime->regionbase, ar);
|
||||
ar->regiontype= RGN_TYPE_WINDOW;
|
||||
|
||||
/* XXX here sfra and efra was used.... */
|
||||
ar->v2d.tot.xmin= (float)(- 4);
|
||||
ar->v2d.tot.xmin= (float)(SFRA - 4);
|
||||
ar->v2d.tot.ymin= 0.0f;
|
||||
ar->v2d.tot.xmax= (float)(250 + 4);
|
||||
ar->v2d.tot.xmax= (float)(EFRA + 4);
|
||||
ar->v2d.tot.ymax= 50.0f;
|
||||
|
||||
ar->v2d.cur= ar->v2d.tot;
|
||||
|
|
|
@ -60,8 +60,9 @@
|
|||
|
||||
/* ******************** default callbacks for view3d space ***************** */
|
||||
|
||||
static SpaceLink *view3d_new(void)
|
||||
static SpaceLink *view3d_new(const bContext *C)
|
||||
{
|
||||
Scene *scene= CTX_data_scene(C);
|
||||
ARegion *ar;
|
||||
View3D *vd;
|
||||
|
||||
|
@ -69,9 +70,9 @@ static SpaceLink *view3d_new(void)
|
|||
vd->spacetype= SPACE_VIEW3D;
|
||||
vd->blockscale= 0.7f;
|
||||
vd->lay= vd->layact= 1;
|
||||
if(G.scene) {
|
||||
vd->lay= vd->layact= G.scene->lay;
|
||||
vd->camera= G.scene->camera;
|
||||
if(scene) {
|
||||
vd->lay= vd->layact= scene->lay;
|
||||
vd->camera= scene->camera;
|
||||
}
|
||||
vd->scenelock= 1;
|
||||
vd->grid= 1.0f;
|
||||
|
|
Loading…
Reference in New Issue