2.5 / Nodes

* fix icon scaling -> SpaceNode aspect.
* bring back a bit more code
This commit is contained in:
Nathan Letwory
2008-12-26 18:00:38 +00:00
parent f10e828b1e
commit ce733db5cb
4 changed files with 23 additions and 22 deletions

View File

@@ -9,7 +9,8 @@ incs += ' ../../windowmanager #intern/guardedalloc #extern/glew/include'
defs = []
cf = []
if env['OURPLATFORM'] == 'win32-vc':
#cf.append('/Wall')
cf.append('/WX')
if env['CC'] == 'gcc':
cf.append('-Werror')
env.BlenderLib ( 'bf_editors_space_node', sources, Split(incs), defs, libtype=['core'], priority=[55], compileflags=cf )

View File

@@ -98,8 +98,8 @@
#include "UI_resources.h"
/*
#include "RE_pipeline.h"
#include "IMB_imbuf_types.h"*/
#include "RE_pipeline.h"*/
#include "IMB_imbuf_types.h"
/*#include "blendef.h"
#include "butspace.h"*/
@@ -2503,12 +2503,11 @@ static void draw_nodespace_grid(SpaceNode *snode)
glEnd();
}
#endif
static void draw_nodespace_back_pix(ScrArea *sa, SpaceNode *snode)
void draw_nodespace_back_pix(ScrArea *sa, SpaceNode *snode)
{
draw_nodespace_grid(snode);
if((snode->flag & SNODE_BACKDRAW) && snode->treetype==NTREE_COMPOSIT) {
Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
@@ -2516,9 +2515,9 @@ static void draw_nodespace_back_pix(ScrArea *sa, SpaceNode *snode)
int x, y;
/* somehow the offset has to be calculated inverse */
glaDefine2DArea(&sa->winrct);
//glaDefine2DArea(&sa->winrct);
/* ortho at pixel level curarea */
myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
//myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
x = (sa->winx-ibuf->x)/2 + snode->xof;
y = (sa->winy-ibuf->y)/2 + snode->yof;
@@ -2529,13 +2528,14 @@ static void draw_nodespace_back_pix(ScrArea *sa, SpaceNode *snode)
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float);
/* sort this out, this should not be needed */
myortho2(snode->v2d.cur.xmin, snode->v2d.cur.xmax, snode->v2d.cur.ymin, snode->v2d.cur.ymax);
bwin_clear_viewmat(sa->win); /* clear buttons view */
//myortho2(snode->v2d.cur.xmin, snode->v2d.cur.xmax, snode->v2d.cur.ymin, snode->v2d.cur.ymax);
//bwin_clear_viewmat(sa->win); /* clear buttons view */
glLoadIdentity();
}
}
}
#if 0
#if 0
/* note: needs to be userpref or opengl profile option */
static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)

View File

@@ -503,7 +503,6 @@ static void node_sync_cb(bContext *C, void *snode_v, void *node_v)
/* ************** Socket callbacks *********** */
#if 0
static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
{
if(node_v && ntree_v) {
@@ -511,13 +510,12 @@ static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
// addqueue(curarea->win, UI_BUT_EVENT, B_NODE_EXEC+((bNode *)node_v)->nr); XXX
}
}
#endif
/* NOTE: this is a block-menu, needs 0 events, otherwise the menu closes */
static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void *socket_v)
{
#if 0 //XXX
SpaceNode *snode= curarea->spacedata.first;
SpaceNode *snode= (SpaceNode *)CTX_wm_space_data(C);
ScrArea *curarea= CTX_wm_area(C);
bNode *node;
bNodeSocket *sock= socket_v;
bNodeStack *ns= &sock->ns;
@@ -534,7 +532,7 @@ static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void
break;
}
block= uiNewBlock(&curarea->uiblocks, "socket menu", UI_EMBOSS, UI_HELV, curarea->win);
block= uiBeginBlock(C, handle->region, "socket menu", UI_EMBOSS, UI_HELV);
/* use this for a fake extra empy space around the buttons */
uiDefBut(block, LABEL, 0, "", -4, -4, 188, 68, NULL, 0, 0, 0, 0, "");
@@ -548,12 +546,11 @@ static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void
uiButSetFunc(bt, socket_vector_menu_cb, node, snode->nodetree);
uiBlockSetDirection(block, UI_TOP);
uiEndBlock(C, block);
// allqueue(REDRAWNODE, 0);
ED_area_tag_redraw(curarea);
return block;
#endif
return NULL;
}
/* not a callback */
@@ -1070,6 +1067,10 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
float col[3];
View2DScrollers *scrollers;
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
ScrArea *sa= CTX_wm_area(C);
int argus;
argus= 1.1f+ 2.3f;
UI_GetThemeColor3fv(TH_BACK, col);
glClearColor(col[0], col[1], col[2], 0.0);
@@ -1088,12 +1089,12 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
glEnable(GL_MAP1_VERTEX_3);
/* aspect+font, set each time */
//snode->aspect= (snode->v2d.cur.xmax - snode->v2d.cur.xmin)/((float)sa->winx);
snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)sa->winx);
//snode->curfont= uiSetCurFont_ext(snode->aspect);
UI_view2d_constant_grid_draw(C, v2d);
/* backdrop */
// draw_nodespace_back_pix(sa, snode);
draw_nodespace_back_pix(CTX_wm_area(C), snode);
/* nodes */
snode_set_context(snode, CTX_data_scene(C));
@@ -1148,8 +1149,6 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
snode->flag &= ~SNODE_DO_PREVIEW;
}*/
/* reset view matrix */
UI_view2d_view_restore(C);

View File

@@ -44,6 +44,7 @@ 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);
void draw_nodespace_back_pix(ScrArea *sa, SpaceNode *snode);
/* node_edit.c */
void snode_set_context(SpaceNode *snode, Scene *scene);