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>2006-01-25 00:50:23 +0300
committerTon Roosendaal <ton@blender.org>2006-01-25 00:50:23 +0300
commitf0dae325c30b53bbd1c46bd39be91749aa6712ff (patch)
tree6b17a9afd0a41ce0bb169cbefee04479df3e9373 /source/blender/src
parent3909f1d4a31bcb7badf77ade8890293b48b4b6d7 (diff)
Orange: enabled compositing in render pipeline.
- New Node "Composite" is output node that puts composited result back in render pipeline. - This then also displays in the render window while editing - But, only with Scene buttons option "Do Compositor" set - Then, just press F12 or render anims to see the magic! For clarity, the former 'Output" node is renamed to "Viewer".
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/buttons_scene.c4
-rw-r--r--source/blender/src/editnode.c11
-rw-r--r--source/blender/src/renderwin.c62
-rw-r--r--source/blender/src/writeimage.c15
4 files changed, 52 insertions, 40 deletions
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 6c76171dac4..83647424e3d 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -1212,8 +1212,8 @@ static void render_panel_anim(void)
uiBlockSetCol(block, TH_BUT_SETTING1);
uiBlockBeginAlign(block);
- uiDefButBitS(block, TOG, R_DOSEQ, 0, "Do Sequence",692,114,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Enables sequence output rendering (Default: 3D rendering)");
- uiDefButBitS(block, TOG, R_BG_RENDER, 0, "Render Daemon",692,90,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Let external network render current scene");
+ uiDefButBitS(block, TOG, R_DOSEQ, B_NOP, "Do Sequence",692,114,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Enables sequence output rendering (Default: 3D rendering)");
+ uiDefButBitS(block, TOG, R_DOCOMP, B_NOP, "Do Composit",692,90,192,20, &G.scene->r.scemode, 0, 0, 0, 0, "Uses compositing nodes for output rendering");
uiBlockEndAlign(block);
uiBlockSetCol(block, TH_AUTO);
diff --git a/source/blender/src/editnode.c b/source/blender/src/editnode.c
index 114c3983712..fc0aed7728a 100644
--- a/source/blender/src/editnode.c
+++ b/source/blender/src/editnode.c
@@ -60,6 +60,7 @@
#include "BIF_mywindow.h"
#include "BIF_previewrender.h"
#include "BIF_resources.h"
+#include "BIF_renderwin.h"
#include "BIF_space.h"
#include "BIF_screen.h"
#include "BIF_toolbox.h"
@@ -139,9 +140,13 @@ static void snode_handle_recalc(SpaceNode *snode)
BIF_preview_changed(ID_MA); /* signals buttons windows and node editors */
}
else if(snode->treetype==NTREE_COMPOSIT) {
- ntreeCompositExecTree(snode->nodetree);
+ ntreeCompositExecTree(snode->nodetree, &G.scene->r, 1); /* 1 is do_previews */
allqueue(REDRAWNODE, 1);
allqueue(REDRAWIMAGE, 1);
+ if(G.scene->r.scemode & R_DOCOMP) {
+ BIF_redraw_render_rect(); /* seems to screwup display? */
+ mywinset(curarea->win);
+ }
}
}
@@ -253,7 +258,7 @@ void node_composit_default(Scene *sce)
sce->nodetree= ntreeAddTree(NTREE_COMPOSIT);
- out= nodeAddNodeType(sce->nodetree, CMP_NODE_OUTPUT, NULL);
+ out= nodeAddNodeType(sce->nodetree, CMP_NODE_VIEWER, NULL);
out->locx= 300.0f; out->locy= 300.0f;
in= nodeAddNodeType(sce->nodetree, CMP_NODE_R_RESULT, NULL);
@@ -1129,7 +1134,7 @@ static void node_add_menu(SpaceNode *snode)
}
else if(snode->treetype==NTREE_COMPOSIT) {
/* compo menu, still hardcoded defines... solve */
- event= pupmenu("Add Node%t|Output%x201|Render Output%x202|Render Result %x221|Image %x220|RGB Curves%x209|AlphaOver %x210|Blur %x211|Filter %x212|Value %x203|Color %x202|Mix %x204|ColorRamp %x205|Color to BW %x206|Normal %x207");
+ event= pupmenu("Add Node%t|Render Result %x221|Composite %x222|Viewer%x201|Image %x220|RGB Curves%x209|AlphaOver %x210|Blur %x211|Filter %x212|Value %x203|Color %x202|Mix %x204|ColorRamp %x205|Color to BW %x206|Normal %x207");
if(event<1) return;
}
else return;
diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c
index 97f1a6fbca2..493621269e6 100644
--- a/source/blender/src/renderwin.c
+++ b/source/blender/src/renderwin.c
@@ -287,10 +287,11 @@ static void renderwin_draw_render_info(RenderWin *rw)
static void renderwin_draw(RenderWin *rw, int just_clear)
{
- RenderResult *rr= RE_GetResult(RE_GetRender("Render"));
+ RenderResult rres;
+
+ RE_GetResultImage(RE_GetRender("Render"), &rres);
- if(rr) {
- RenderLayer *rl= rr->layers.first;
+ if(rres.rectf) {
float fullrect[2][2];
int set_back_mainwindow;
rcti rect;
@@ -328,10 +329,10 @@ static void renderwin_draw(RenderWin *rw, int just_clear)
// glPixelStorei(GL_UNPACK_SWAP_BYTES, 0);
}
else {
- if(rr->rect32)
- glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rr->rectx, rr->recty, rr->rectx, GL_RGBA, GL_UNSIGNED_BYTE, rr->rect32);
- else if(rl->rectf)
- glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rr->rectx, rr->recty, rr->rectx, GL_RGBA, GL_FLOAT, rl->rectf);
+ if(rres.rect32)
+ glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_UNSIGNED_BYTE, rres.rect32);
+ else if(rres.rectf)
+ glaDrawPixelsSafe(fullrect[0][0], fullrect[0][1], rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_FLOAT, rres.rectf);
}
glPixelZoom(1.0, 1.0);
}
@@ -360,25 +361,26 @@ static void renderwin_draw(RenderWin *rw, int just_clear)
static void renderwin_mouse_moved(RenderWin *rw)
{
- RenderResult *rr= RE_GetResult(RE_GetRender("Render"));
- RenderLayer *rl= (rr?rr->layers.first:NULL);
+ RenderResult rres;
+
+ RE_GetResultImage(RE_GetRender("Render"), &rres);
if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
int imgco[2], ofs=0;
char buf[128];
-// char *pxl;
+ char *pxl;
- if (rl && renderwin_win_to_image_co(rw, rw->lmouse, imgco)) {
-// pxl= (char*) &R.rectot[R.rectx*imgco[1] + imgco[0]];
-
-// ofs= sprintf(buf, "R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
-
- if (rl->rectf) {
- float *pxlf= rl->rectf + 4*(rr->rectx*imgco[1] + imgco[0]);
+ if (renderwin_win_to_image_co(rw, rw->lmouse, imgco)) {
+ if (rres.rect32) {
+ pxl= (char*) &rres.rect32[rres.rectx*imgco[1] + imgco[0]];
+ ofs= sprintf(buf, "R: %d G: %d B: %d A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
+ }
+ if (rres.rectf) {
+ float *pxlf= rres.rectf + 4*(rres.rectx*imgco[1] + imgco[0]);
ofs+= sprintf(buf+ofs, " | R: %.3f G: %.3f B: %.3f A: %.3f ", pxlf[0], pxlf[1], pxlf[2], pxlf[3]);
}
- if (rl->rectz) {
- float *pxlz= &rl->rectz[rr->rectx*imgco[1] + imgco[0]];
+ if (rres.rectz) {
+ float *pxlz= &rres.rectz[rres.rectx*imgco[1] + imgco[0]];
sprintf(buf+ofs, "| Z: %.3f", *pxlz );
}
@@ -395,8 +397,8 @@ static void renderwin_mouse_moved(RenderWin *rw)
rw->zoomofs[0]= rw->pan_ofs_start[0] - delta_x/rw->zoom;
rw->zoomofs[1]= rw->pan_ofs_start[1] - delta_y/rw->zoom;
- rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -rr->rectx/2, rr->rectx/2);
- rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -rr->recty/2, rr->recty/2);
+ rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -rres.rectx/2, rres.rectx/2);
+ rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -rres.recty/2, rres.recty/2);
renderwin_queue_redraw(rw);
}
@@ -408,8 +410,8 @@ static void renderwin_mouse_moved(RenderWin *rw)
h-= RW_HEADERY;
renderwin_win_to_ndc(rw, rw->lmouse, ndc);
- rw->zoomofs[0]= -0.5*ndc[0]*(w-rr->rectx*rw->zoom)/rw->zoom;
- rw->zoomofs[1]= -0.5*ndc[1]*(h-rr->recty*rw->zoom)/rw->zoom;
+ rw->zoomofs[0]= -0.5*ndc[0]*(w-rres.rectx*rw->zoom)/rw->zoom;
+ rw->zoomofs[1]= -0.5*ndc[1]*(h-rres.recty*rw->zoom)/rw->zoom;
renderwin_queue_redraw(rw);
}
@@ -721,7 +723,6 @@ static void renderwin_clear_display_cb(RenderResult *rr)
/* can get as well the full picture, as the parts while rendering */
static void renderwin_progress(RenderWin *rw, RenderResult *rr, rcti *unused)
{
- RenderLayer *rl;
rcti win_rct;
float *rectf, fullrect[2][2];
@@ -731,10 +732,13 @@ static void renderwin_progress(RenderWin *rw, RenderResult *rr, rcti *unused)
win_rct.ymax-= RW_HEADERY;
renderwin_get_fullrect(rw, fullrect);
- /* find current float rect for display */
- rl= rr->layers.first;
- rectf= rl->rectf;
-
+ /* find current float rect for display, first case is after composit... still weak */
+ if(rr->rectf)
+ rectf= rr->rectf;
+ else {
+ RenderLayer *rl= rr->layers.first;
+ rectf= rl->rectf;
+ }
/* when rendering more pixels than needed, we crop away cruft */
if(rr->crop)
rectf+= 4*(rr->crop*rr->rectx + rr->crop);
@@ -1018,6 +1022,8 @@ void BIF_do_render(int anim)
}
else do_render(anim);
+ if(G.scene->use_nodes)
+ allqueue(REDRAWNODE, 1);
if (slink_flag) G.f |= G_DOSCRIPTLINKS;
if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER);
}
diff --git a/source/blender/src/writeimage.c b/source/blender/src/writeimage.c
index 1e89c8e8bba..808c10c4a17 100644
--- a/source/blender/src/writeimage.c
+++ b/source/blender/src/writeimage.c
@@ -88,7 +88,7 @@ static void save_rendered_image_cb(char *name)
{
char str[FILE_MAXDIR+FILE_MAXFILE];
- if(BLI_testextensie(str,".blend")) {
+ if(BLI_testextensie(name,".blend")) {
error("Wrong filename");
return;
}
@@ -102,16 +102,17 @@ static void save_rendered_image_cb(char *name)
BLI_convertstringcode(str, G.sce, G.scene->r.cfra);
if(saveover(str)) {
- RenderResult *rr= RE_GetResult(RE_GetRender("Render"));
- RenderLayer *rl= rr->layers.first;
+ RenderResult rres;
ImBuf *ibuf;
+ RE_GetResultImage(RE_GetRender("Render"), &rres);
+
waitcursor(1); /* from screen.c */
- ibuf= IMB_allocImBuf(rr->rectx, rr->recty, G.scene->r.planes, 0, 0);
- ibuf->rect= rr->rect32;
- ibuf->rect_float= rl->rectf;
- ibuf->zbuf_float= rl->rectz;
+ ibuf= IMB_allocImBuf(rres.rectx, rres.recty, G.scene->r.planes, 0, 0);
+ ibuf->rect= rres.rect32;
+ ibuf->rect_float= rres.rectf;
+ ibuf->zbuf_float= rres.rectz;
BKE_write_ibuf(ibuf, str, G.scene->r.imtype, G.scene->r.subimtype, G.scene->r.quality);
IMB_freeImBuf(ibuf); /* imbuf knows rects are not part of ibuf */