2.5 / Nodes
authorNathan Letwory <nathan@letworyinteractive.com>
Tue, 13 Jan 2009 19:28:18 +0000 (19:28 +0000)
committerNathan Letwory <nathan@letworyinteractive.com>
Tue, 13 Jan 2009 19:28:18 +0000 (19:28 +0000)
* add a list area for material/texture/scene selection.

source/blender/blenloader/intern/readfile.c
source/blender/editors/space_node/node_draw.c
source/blender/editors/space_node/space_node.c
source/blender/makesdna/DNA_node_types.h

index 82fe3199eafcfe2c876e2469b4c013a41321fac6..766386e54b02aadfd47e01130410627da0ba51f9 100644 (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");
index 77e37895160b65f0fe2ebfb519dff38657825079..4008e43e83a1fc7a96b05554a4ddd00502b9a679 100644 (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);
index c54f4ede898d164f9d03a42125c3373a9972f6e8..e9405c2954660c4108cc0ca7271b4f1526976dce 100644 (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);
        
index d5eb4024dcc8ee26b782f2c22c47307a8ec71d1a..497119638706bb26aeffc5a66f9c0c2be826292d 100644 (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 */