Added callback to compositor, so it can print in RenderWindow header the

current to-be composited node and amount of memory in use.
This commit is contained in:
2006-02-14 18:04:25 +00:00
parent 86e9faad70
commit acb5f6e79f
4 changed files with 28 additions and 13 deletions

View File

@@ -1407,7 +1407,7 @@ static void nodeInitPreview(bNode *node, int xsize, int ysize)
if(node->preview==NULL) {
node->preview= MEM_callocN(sizeof(bNodePreview), "node preview");
printf("added preview %s\n", node->name);
// printf("added preview %s\n", node->name);
}
/* node previews can get added with variable size this way */
@@ -1876,10 +1876,8 @@ static bNode *getExecutableNode(bNodeTree *ntree)
if((sock->link->fromnode->exec & NODE_READY)==0)
break;
}
if(sock==NULL) {
printf("exec %s\n", node->name);
if(sock==NULL)
return node;
}
}
}
return NULL;
@@ -1926,7 +1924,13 @@ void ntreeCompositExecTree(bNodeTree *ntree, RenderData *rd, int do_preview)
if(node) {
if(ntree->timecursor)
ntree->timecursor(totnode--);
ntree->timecursor(totnode);
if(ntree->stats_draw) {
char str[64];
sprintf(str, "Compositing %d %s\n", totnode, node->name);
ntree->stats_draw(str);
}
totnode--;
node->new = (bNode *)&thdata;
node->exec= NODE_PROCESSING;

View File

@@ -104,7 +104,8 @@ static CompBuf *alloc_compbuf(int sizex, int sizey, int type, int alloc)
static CompBuf *dupalloc_compbuf(CompBuf *cbuf)
{
CompBuf *dupbuf= alloc_compbuf(cbuf->x, cbuf->y, cbuf->type, 1);
memcpy(dupbuf->rect, cbuf->rect, cbuf->type*sizeof(float)*cbuf->x*cbuf->y);
if(dupbuf)
memcpy(dupbuf->rect, cbuf->rect, cbuf->type*sizeof(float)*cbuf->x*cbuf->y);
return dupbuf;
}

View File

@@ -167,6 +167,7 @@ typedef struct bNodeTree {
/* callbacks */
void (*timecursor)(int nr);
void (*stats_draw)(char *str);
} bNodeTree;

View File

@@ -931,6 +931,14 @@ int composite_needs_render(Scene *sce)
return 0;
}
/* bad call... need to think over proper method still */
static void render_composit_stats(char *str)
{
R.i.infostr= str;
R.stats_draw(&R.i);
R.i.infostr= NULL;
}
static void do_render_final(Render *re)
{
/* we set start time here, for main Blender loops */
@@ -944,10 +952,11 @@ static void do_render_final(Render *re)
do_render_seq(re->result, re->r.cfra);
}
else {
bNodeTree *ntree= re->scene->nodetree;
if(composite_needs_render(re->scene)) {
/* save memory... free all cached images */
ntreeFreeCache(re->scene->nodetree);
ntreeFreeCache(ntree);
/* now use renderdata and camera to set viewplane */
RE_SetCamera(re, re->scene->camera);
@@ -960,17 +969,17 @@ static void do_render_final(Render *re)
render_one_frame(re);
}
if(!re->test_break() && re->scene->nodetree) {
ntreeCompositTagRender(re->scene->nodetree);
ntreeCompositTagAnimated(re->scene->nodetree);
if(!re->test_break() && ntree) {
ntreeCompositTagRender(ntree);
ntreeCompositTagAnimated(ntree);
if(re->r.scemode & R_DOCOMP) {
/* checks if there are render-result nodes that need scene */
ntree_render_scenes(re);
re->i.infostr= "Compositing";
re->stats_draw(&re->i);
ntreeCompositExecTree(re->scene->nodetree, &re->r, G.background==0);
ntree->stats_draw= render_composit_stats;
ntreeCompositExecTree(ntree, &re->r, G.background==0);
ntree->stats_draw= NULL;
}
}
}