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 *);
else {
/* new space */
if(st) {
- sl= st->new();
+ sl= st->new(C);
BLI_addhead(&sa->spacedata, sl);
/* swap regions */
/* ******************** default callbacks for action space ***************** */
-static SpaceLink *action_new(void)
+static SpaceLink *action_new(const bContext *C)
{
ARegion *ar;
SpaceAction *saction;
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;
/* ****************************** space template *********************** */
/* allocate and init some vars */
-static SpaceLink *xxx_new(void)
+static SpaceLink *xxx_new(const bContext *C)
{
return NULL;
}
/* ******************** default callbacks for buttons space ***************** */
-static SpaceLink *buttons_new(void)
+static SpaceLink *buttons_new(const bContext *C)
{
ARegion *ar;
SpaceButs *sbuts;
/* ******************** default callbacks for file space ***************** */
-static SpaceLink *file_new(void)
+static SpaceLink *file_new(const bContext *C)
{
ARegion *ar;
SpaceFile *sfile;
/* ******************** default callbacks for image space ***************** */
-static SpaceLink *image_new(void)
+static SpaceLink *image_new(const bContext *C)
{
ARegion *ar;
SpaceImage *simage;
/* ******************** default callbacks for info space ***************** */
-static SpaceLink *info_new(void)
+static SpaceLink *info_new(const bContext *C)
{
ARegion *ar;
SpaceInfo *sinfo;
/* ******************** 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;
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;
/* ******************** default callbacks for nla space ***************** */
-static SpaceLink *nla_new(void)
+static SpaceLink *nla_new(const bContext *C)
{
ARegion *ar;
SpaceNla *snla;
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 */
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);
/* ******************** default callbacks for node space ***************** */
-static SpaceLink *node_new(void)
+static SpaceLink *node_new(const bContext *C)
{
ARegion *ar;
SpaceNode *snode;
/* ******************** default callbacks for outliner space ***************** */
-static SpaceLink *outliner_new(void)
+static SpaceLink *outliner_new(const bContext *C)
{
ARegion *ar;
SpaceOops *soutliner;
/* ******************** default callbacks for script space ***************** */
-static SpaceLink *script_new(void)
+static SpaceLink *script_new(const bContext *C)
{
ARegion *ar;
SpaceScript *sscript;
/* ******************** 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;
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;
/* ******************** default callbacks for sound space ***************** */
-static SpaceLink *sound_new(void)
+static SpaceLink *sound_new(const bContext *C)
{
ARegion *ar;
SpaceSound *ssound;
/* ******************** default callbacks for text space ***************** */
-static SpaceLink *text_new(void)
+static SpaceLink *text_new(const bContext *C)
{
ARegion *ar;
SpaceText *stext;
/* ******************** 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;
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;
/* ******************** 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;
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;