2.5 / Nodes
* fix icon scaling -> SpaceNode aspect. * bring back a bit more code
This commit is contained in:
@@ -9,7 +9,8 @@ incs += ' ../../windowmanager #intern/guardedalloc #extern/glew/include'
|
|||||||
defs = []
|
defs = []
|
||||||
cf = []
|
cf = []
|
||||||
if env['OURPLATFORM'] == 'win32-vc':
|
if env['OURPLATFORM'] == 'win32-vc':
|
||||||
#cf.append('/Wall')
|
|
||||||
cf.append('/WX')
|
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 )
|
env.BlenderLib ( 'bf_editors_space_node', sources, Split(incs), defs, libtype=['core'], priority=[55], compileflags=cf )
|
||||||
|
|||||||
@@ -98,8 +98,8 @@
|
|||||||
#include "UI_resources.h"
|
#include "UI_resources.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
#include "RE_pipeline.h"
|
#include "RE_pipeline.h"*/
|
||||||
#include "IMB_imbuf_types.h"*/
|
#include "IMB_imbuf_types.h"
|
||||||
|
|
||||||
/*#include "blendef.h"
|
/*#include "blendef.h"
|
||||||
#include "butspace.h"*/
|
#include "butspace.h"*/
|
||||||
@@ -2503,12 +2503,11 @@ static void draw_nodespace_grid(SpaceNode *snode)
|
|||||||
|
|
||||||
glEnd();
|
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) {
|
if((snode->flag & SNODE_BACKDRAW) && snode->treetype==NTREE_COMPOSIT) {
|
||||||
Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
|
Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
|
||||||
ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
|
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;
|
int x, y;
|
||||||
/* somehow the offset has to be calculated inverse */
|
/* somehow the offset has to be calculated inverse */
|
||||||
|
|
||||||
glaDefine2DArea(&sa->winrct);
|
//glaDefine2DArea(&sa->winrct);
|
||||||
/* ortho at pixel level curarea */
|
/* 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;
|
x = (sa->winx-ibuf->x)/2 + snode->xof;
|
||||||
y = (sa->winy-ibuf->y)/2 + snode->yof;
|
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);
|
glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float);
|
||||||
|
|
||||||
/* sort this out, this should not be needed */
|
/* 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);
|
//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 */
|
//bwin_clear_viewmat(sa->win); /* clear buttons view */
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
#if 0
|
#if 0
|
||||||
/* note: needs to be userpref or opengl profile option */
|
/* note: needs to be userpref or opengl profile option */
|
||||||
static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
|
static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
|
||||||
|
|||||||
@@ -503,7 +503,6 @@ static void node_sync_cb(bContext *C, void *snode_v, void *node_v)
|
|||||||
|
|
||||||
/* ************** Socket callbacks *********** */
|
/* ************** Socket callbacks *********** */
|
||||||
|
|
||||||
#if 0
|
|
||||||
static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
|
static void socket_vector_menu_cb(bContext *C, void *node_v, void *ntree_v)
|
||||||
{
|
{
|
||||||
if(node_v && 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
|
// 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 */
|
/* 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)
|
static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void *socket_v)
|
||||||
{
|
{
|
||||||
#if 0 //XXX
|
SpaceNode *snode= (SpaceNode *)CTX_wm_space_data(C);
|
||||||
SpaceNode *snode= curarea->spacedata.first;
|
ScrArea *curarea= CTX_wm_area(C);
|
||||||
bNode *node;
|
bNode *node;
|
||||||
bNodeSocket *sock= socket_v;
|
bNodeSocket *sock= socket_v;
|
||||||
bNodeStack *ns= &sock->ns;
|
bNodeStack *ns= &sock->ns;
|
||||||
@@ -534,7 +532,7 @@ static uiBlock *socket_vector_menu(bContext *C, uiMenuBlockHandle *handle, void
|
|||||||
break;
|
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 */
|
/* use this for a fake extra empy space around the buttons */
|
||||||
uiDefBut(block, LABEL, 0, "", -4, -4, 188, 68, NULL, 0, 0, 0, 0, "");
|
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);
|
uiButSetFunc(bt, socket_vector_menu_cb, node, snode->nodetree);
|
||||||
|
|
||||||
uiBlockSetDirection(block, UI_TOP);
|
uiBlockSetDirection(block, UI_TOP);
|
||||||
|
uiEndBlock(C, block);
|
||||||
|
|
||||||
// allqueue(REDRAWNODE, 0);
|
ED_area_tag_redraw(curarea);
|
||||||
|
|
||||||
return block;
|
return block;
|
||||||
#endif
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not a callback */
|
/* not a callback */
|
||||||
@@ -1070,6 +1067,10 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
|
|||||||
float col[3];
|
float col[3];
|
||||||
View2DScrollers *scrollers;
|
View2DScrollers *scrollers;
|
||||||
SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C);
|
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);
|
UI_GetThemeColor3fv(TH_BACK, col);
|
||||||
glClearColor(col[0], col[1], col[2], 0.0);
|
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);
|
glEnable(GL_MAP1_VERTEX_3);
|
||||||
|
|
||||||
/* aspect+font, set each time */
|
/* 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);
|
//snode->curfont= uiSetCurFont_ext(snode->aspect);
|
||||||
|
|
||||||
UI_view2d_constant_grid_draw(C, v2d);
|
UI_view2d_constant_grid_draw(C, v2d);
|
||||||
/* backdrop */
|
/* backdrop */
|
||||||
// draw_nodespace_back_pix(sa, snode);
|
draw_nodespace_back_pix(CTX_wm_area(C), snode);
|
||||||
|
|
||||||
/* nodes */
|
/* nodes */
|
||||||
snode_set_context(snode, CTX_data_scene(C));
|
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;
|
snode->flag &= ~SNODE_DO_PREVIEW;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* reset view matrix */
|
/* reset view matrix */
|
||||||
UI_view2d_view_restore(C);
|
UI_view2d_view_restore(C);
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d);
|
|||||||
/* drawnode.c */
|
/* drawnode.c */
|
||||||
void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link);
|
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 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 */
|
/* node_edit.c */
|
||||||
void snode_set_context(SpaceNode *snode, Scene *scene);
|
void snode_set_context(SpaceNode *snode, Scene *scene);
|
||||||
|
|||||||
Reference in New Issue
Block a user