2.5 / Nodes

* add a list area for material/texture/scene selection.
This commit is contained in:
Nathan Letwory
2009-01-13 19:28:18 +00:00
parent 469b19d231
commit fecac53522
4 changed files with 51 additions and 4 deletions

View File

@@ -5214,6 +5214,13 @@ static void area_add_window_regions(ScrArea *sa, SpaceLink *sl, ListBase *lb)
ar->v2d.scroll= V2D_SCROLL_BOTTOM;
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
break;
case SPACE_NODE:
ar= MEM_callocN(sizeof(ARegion), "nodetree area for node");
BLI_addtail(lb, ar);
ar->regiontype= RGN_TYPE_CHANNELS;
ar->alignment= RGN_ALIGN_LEFT;
ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
ar->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
case SPACE_FILE:
/* channel (bookmarks/directories) region */
ar= MEM_callocN(sizeof(ARegion), "area region from do_versions");

View File

@@ -1072,7 +1072,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
glEnable(GL_MAP1_VERTEX_3);
/* aspect+font, set each time */
snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)sa->winx);
snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)ar->winx);
//snode->curfont= uiSetCurFont_ext(snode->aspect);
UI_view2d_constant_grid_draw(C, v2d);

View File

@@ -78,6 +78,15 @@ static SpaceLink *node_new(const bContext *C)
ar->regiontype= RGN_TYPE_HEADER;
ar->alignment= RGN_ALIGN_BOTTOM;
/* channels */
ar= MEM_callocN(sizeof(ARegion), "nodetree area for node");
BLI_addtail(&snode->regionbase, ar);
ar->regiontype= RGN_TYPE_CHANNELS;
ar->alignment= RGN_ALIGN_LEFT;
ar->v2d.scroll = (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
/* main area */
ar= MEM_callocN(sizeof(ARegion), "main area for node");
@@ -136,6 +145,35 @@ static SpaceLink *node_duplicate(SpaceLink *sl)
return (SpaceLink *)snoden;
}
static void node_channel_area_init(wmWindowManager *wm, ARegion *ar)
{
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_LIST, ar->winx, ar->winy);
}
static void node_channel_area_draw(const bContext *C, ARegion *ar)
{
View2D *v2d= &ar->v2d;
View2DScrollers *scrollers;
float col[3];
/* clear and setup matrix */
UI_GetThemeColor3fv(TH_SHADE2, 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 */
scrollers= UI_view2d_scrollers_calc(C, v2d, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY, V2D_ARG_DUMMY);
UI_view2d_scrollers_draw(C, v2d, scrollers);
UI_view2d_scrollers_free(scrollers);
}
/* Initialise main area, setting handlers. */
static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
{
@@ -257,11 +295,11 @@ void ED_spacetype_node(void)
/* regions: channels */
art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_CHANNELS;
art->minsizex= 80;
art->minsizex= 200;
art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D;
// art->init= node_channel_area_init;
// art->draw= node_channel_area_draw;
art->init= node_channel_area_init;
art->draw= node_channel_area_draw;
BLI_addhead(&st->regiontypes, art);

View File

@@ -154,6 +154,8 @@ typedef struct bNodeLink {
bNode *fromnode, *tonode;
bNodeSocket *fromsock, *tosock;
int flag, pad;
} bNodeLink;
/* the basis for a Node tree, all links and nodes reside internal here */