Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2008-01-14 22:03:27 +0300
committerTon Roosendaal <ton@blender.org>2008-01-14 22:03:27 +0300
commit28667a314e94da91de6121894dfd237217da0b80 (patch)
tree74bad101e5c1f1599decb7528c389b51fe1854fa /source/blender/src/drawnode.c
parentcdcba166f63dcb3c87bf1c99c4b7aae4f3481701 (diff)
Feature + Fix:
- while sampling color in image window, you now get the sampled color as a line drawn in the node editor Curve nodes, allowing quicker view of what values you actually change. - reverted temporary the patch [#6779] by Matthew Plough He replaced image drawing of backdrop-node-editor with our Texture drawing function. That call is extremely slow, and should be by definition slower than glDrawPixels (unless you don't upload the image each time to gfx mem). Drawing large frames (2k, 4k) in node editor became unacceptable slow, even with the neatest hardware around. (tested nvidia, ati) Probably (Campbell thinks) this is a bypass for Linux ATI cards? Anyhoo, this should be investigated further before applying. It better then becomes a user pref, or even much better: part of the OpenGL profiler we need.
Diffstat (limited to 'source/blender/src/drawnode.c')
-rw-r--r--source/blender/src/drawnode.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/source/blender/src/drawnode.c b/source/blender/src/drawnode.c
index 961cad5f840..cca13671017 100644
--- a/source/blender/src/drawnode.c
+++ b/source/blender/src/drawnode.c
@@ -348,7 +348,7 @@ static int node_buts_time(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *b
if(cumap) cumap->flag |= CUMA_DRAW_CFRA;
if(node->custom1<node->custom2)
- cumap->black[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
+ cumap->sample[0]= (float)(CFRA - node->custom1)/(float)(node->custom2-node->custom1);
uiBlockBeginAlign(block);
uiDefButS(block, NUM, B_NODE_EXEC+node->nr, "Sta:",
@@ -380,9 +380,23 @@ static int node_buts_curvevec(uiBlock *block, bNodeTree *ntree, bNode *node, rct
return (int)(node->width-NODE_DY);
}
+static float *_sample_col= NULL; // bad bad, 2.5 will do better?
+void node_curvemap_sample(float *col)
+{
+ _sample_col= col;
+}
+
static int node_buts_curvecol(uiBlock *block, bNodeTree *ntree, bNode *node, rctf *butr)
{
if(block) {
+ CurveMapping *cumap= node->storage;
+ if(_sample_col) {
+ cumap->flag |= CUMA_DRAW_SAMPLE;
+ VECCOPY(cumap->sample, _sample_col);
+ }
+ else
+ cumap->flag &= ~CUMA_DRAW_SAMPLE;
+
curvemap_buttons(block, node->storage, 'c', B_NODE_EXEC+node->nr, B_REDR, butr);
}
return (int)(node->width-NODE_DY);
@@ -2112,7 +2126,40 @@ static void draw_nodespace_grid(SpaceNode *snode)
glEnd();
}
-static void draw_nodespace_back(ScrArea *sa, SpaceNode *snode)
+static void draw_nodespace_back_pix(ScrArea *sa, SpaceNode *snode)
+{
+
+ draw_nodespace_grid(snode);
+
+ if(snode->flag & SNODE_BACKDRAW) {
+ Image *ima= BKE_image_verify_viewer(IMA_TYPE_COMPOSITE, "Viewer Node");
+ ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
+ if(ibuf) {
+ int x, y;
+ /* somehow the offset has to be calculated inverse */
+
+ glaDefine2DArea(&sa->winrct);
+ /* ortho at pixel level curarea */
+ myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
+
+ x = (sa->winx-ibuf->x)/2 + snode->xof;
+ y = (sa->winx-ibuf->y)/2 + snode->yof;
+
+ if(ibuf->rect)
+ glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
+ else if(ibuf->channels==4)
+ 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 */
+ glLoadIdentity();
+ }
+ }
+}
+
+/* note: needs to be userpref or opengl profile option */
+static void draw_nodespace_back_tex(ScrArea *sa, SpaceNode *snode)
{
draw_nodespace_grid(snode);
@@ -3062,7 +3109,7 @@ void drawnodespace(ScrArea *sa, void *spacedata)
snode->curfont= uiSetCurFont_ext(snode->aspect);
/* backdrop */
- draw_nodespace_back(sa, snode);
+ draw_nodespace_back_pix(sa, snode);
/* nodes */
snode_set_context(snode);