2.5 - node editor

Commit of WIP code (what code isn't wip, these days ;)
- only drawing code as basis to work further from (and have less conflicts between different systems I work on)
This commit is contained in:
Nathan Letwory 2008-12-24 10:33:10 +00:00
parent 1d0ae96049
commit 486de068b2
9 changed files with 6670 additions and 28 deletions

@ -167,7 +167,7 @@ BF_OPENGL_LIB_STATIC = [ '${BF_OPENGL}/lib/libGL.a', '${BF_OPENGL}/lib/libGLU.a'
CC = 'cl.exe'
CXX = 'cl.exe'
CCFLAGS = ['/nologo', '/Ob1', '/J', '/W3', '/Gd', '/MT']
CCFLAGS = ['/nologo', '/Ob1', '/J', '/W4', '/Gd', '/MT']
CXXFLAGS = ['/EHsc']
BF_DEBUG_CCFLAGS = ['/Zi', '/FR${TARGET}.sbr']

@ -31,6 +31,7 @@
struct rcti;
struct rctf;
void fdrawbezier(float vec[4][3]);
void fdrawline(float x1, float y1, float x2, float y2);
void fdrawbox(float x1, float y1, float x2, float y2);
void sdrawline(short x1, short y1, short x2, short y2);

@ -49,6 +49,34 @@
/* ******************************************** */
void fdrawbezier(float vec[4][3])
{
float dist;
float curve_res = 24, spline_step = 0.0f;
dist= 0.5f*ABS(vec[0][0] - vec[3][0]);
/* check direction later, for top sockets */
vec[1][0]= vec[0][0]+dist;
vec[1][1]= vec[0][1];
vec[2][0]= vec[3][0]-dist;
vec[2][1]= vec[3][1];
/* we can reuse the dist variable here to increment the GL curve eval amount*/
dist = 1.0f/curve_res;
cpack(0x0);
glMap1f(GL_MAP1_VERTEX_3, 0.0, 1.0, 3, 4, vec[0]);
glBegin(GL_LINE_STRIP);
while (spline_step < 1.000001f) {
/*if(do_shaded)
UI_ThemeColorBlend(th_col1, th_col2, spline_step);*/
glEvalCoord1f(spline_step);
spline_step += dist;
}
glEnd();
}
void fdrawline(float x1, float y1, float x2, float y2)
{
float v[2];

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

@ -30,6 +30,7 @@
#include <stdio.h>
#include "DNA_space_types.h"
#include "DNA_node_types.h"
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_windowmanager_types.h"
@ -62,7 +63,7 @@
static void do_viewmenu(bContext *C, void *arg, int event)
{
}
static uiBlock *dummy_viewmenu(bContext *C, uiMenuBlockHandle *handle, void *arg_unused)
@ -123,7 +124,7 @@ void node_header_buttons(const bContext *C, ARegion *ar)
uiBlockSetEmboss(block, UI_EMBOSS);
/* always as last */
UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, ar->v2d.tot.ymax-ar->v2d.tot.ymin);
UI_view2d_totRect_set(&ar->v2d, xco+XIC+80, (int)(ar->v2d.tot.ymax-ar->v2d.tot.ymin));
uiEndBlock(C, block);
uiDrawBlock(block);

@ -30,10 +30,23 @@
/* internal exports only */
struct ARegion;
struct View2D;
struct bContext;
/* node_header.c */
void node_header_buttons(const bContext *C, ARegion *ar);
/* node_draw.c */
void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
/* drawnode.c */
void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link);
void node_draw_link_bezier(View2D *v2d, float vec[][3], int th_col1, int th_col2, int do_shaded);
/* node_edit.c */
void snode_set_context(SpaceNode *snode, Scene *scene);
#endif /* ED_NODE_INTERN_H */

@ -101,11 +101,10 @@ static SpaceLink *node_new(const bContext *C)
ar->v2d.minzoom= 0.5f;
ar->v2d.maxzoom= 1.21f;
ar->v2d.scroll= 0;
ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
ar->v2d.keepzoom= V2D_KEEPZOOM|V2D_KEEPASPECT;
ar->v2d.keeptot= 0;
return (SpaceLink *)snode;
}
@ -152,32 +151,11 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
static void node_main_area_draw(const bContext *C, ARegion *ar)
{
/* draw entirely, view changes should be handled here */
// SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
//SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
View2D *v2d= &ar->v2d;
//View2DGrid *grid;
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);
drawnodespace(C, ar, v2d);
UI_view2d_view_ortho(C, v2d);
#if 0
/* grid */
grid= UI_view2d_grid_calc(C, v2d, V2D_UNIT_VALUES, V2D_GRID_CLAMP, V2D_UNIT_VALUES, V2D_GRID_CLAMP, ar->winx, ar->winy);
UI_view2d_grid_draw(C, v2d, grid, V2D_GRIDLINES_ALL);
UI_view2d_grid_free(grid);
#endif
/* data... */
/* reset view matrix */
UI_view2d_view_restore(C);
/* scrollers? */
}
void node_operatortypes(void)