From 7ce7d0e7d375963e1caef8478ad7514fdbd0d18f Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 9 Nov 2006 12:06:06 +0000 Subject: [PATCH] Bugreport in irc: The Preview panel in UV window, for compositing, sets a 'crop' flag in the scene when used. Somehow this flag can hang when you switch screens or close windows. Or even worse, it crashed on renders. This commit ensures that the compositor survives and gives error prints. The real issue, hanging flags on closing windows, has to be solved still. --- .../blenkernel/intern/node_composite.c | 64 ++++++++++--------- source/blender/src/drawimage.c | 1 + 2 files changed, 35 insertions(+), 30 deletions(-) diff --git a/source/blender/blenkernel/intern/node_composite.c b/source/blender/blenkernel/intern/node_composite.c index 7f957d4d943..49166a1a131 100644 --- a/source/blender/blenkernel/intern/node_composite.c +++ b/source/blender/blenkernel/intern/node_composite.c @@ -1000,36 +1000,40 @@ static void node_composit_exec_rlayers(void *data, bNode *node, bNodeStack **in, stackbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 0); stackbuf->rect= rl->rectf; } - - stackbuf->xof= rr->xof; - stackbuf->yof= rr->yof; - - /* put on stack */ - out[RRES_OUT_IMAGE]->data= stackbuf; - - if(out[RRES_OUT_ALPHA]->hasoutput) - out[RRES_OUT_ALPHA]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A); - if(out[RRES_OUT_Z]->hasoutput) - out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_Z); - if(out[RRES_OUT_VEC]->hasoutput) - out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_VECTOR); - if(out[RRES_OUT_NOR]->hasoutput) - out[RRES_OUT_NOR]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_NORMAL); - /* - if(out[RRES_OUT_COL]->hasoutput) - out[RRES_OUT_COL]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_RGBA); - if(out[RRES_OUT_DIFF]->hasoutput) - out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_DIFFUSE); - if(out[RRES_OUT_SPEC]->hasoutput) - out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_SPEC); - if(out[RRES_OUT_SHAD]->hasoutput) - out[RRES_OUT_SHAD]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_SHADOW); - if(out[RRES_OUT_AO]->hasoutput) - out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_AO); - if(out[RRES_OUT_RAY]->hasoutput) - out[RRES_OUT_RAY]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_RAY); - */ - generate_preview(node, stackbuf); + if(stackbuf==NULL) { + printf("Error; Preview Panel in UV Window returns zero sized image\n"); + } + else { + stackbuf->xof= rr->xof; + stackbuf->yof= rr->yof; + + /* put on stack */ + out[RRES_OUT_IMAGE]->data= stackbuf; + + if(out[RRES_OUT_ALPHA]->hasoutput) + out[RRES_OUT_ALPHA]->data= valbuf_from_rgbabuf(stackbuf, CHAN_A); + if(out[RRES_OUT_Z]->hasoutput) + out[RRES_OUT_Z]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_Z); + if(out[RRES_OUT_VEC]->hasoutput) + out[RRES_OUT_VEC]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_VECTOR); + if(out[RRES_OUT_NOR]->hasoutput) + out[RRES_OUT_NOR]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_NORMAL); + /* + if(out[RRES_OUT_COL]->hasoutput) + out[RRES_OUT_COL]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_RGBA); + if(out[RRES_OUT_DIFF]->hasoutput) + out[RRES_OUT_DIFF]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_DIFFUSE); + if(out[RRES_OUT_SPEC]->hasoutput) + out[RRES_OUT_SPEC]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_SPEC); + if(out[RRES_OUT_SHAD]->hasoutput) + out[RRES_OUT_SHAD]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_SHADOW); + if(out[RRES_OUT_AO]->hasoutput) + out[RRES_OUT_AO]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_AO); + if(out[RRES_OUT_RAY]->hasoutput) + out[RRES_OUT_RAY]->data= compbuf_from_pass(rd, rl, rr->rectx, rr->recty, SCE_PASS_RAY); + */ + generate_preview(node, stackbuf); + } } } } diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c index 516a1e2b8f3..2a046a30be2 100644 --- a/source/blender/src/drawimage.c +++ b/source/blender/src/drawimage.c @@ -1308,6 +1308,7 @@ static void image_panel_preview(ScrArea *sa, short cntrl) // IMAGE_HANDLER_PREVI if(is_preview_allowed(sa)==0) { rem_blockhandler(sa, IMAGE_HANDLER_PREVIEW); + G.scene->r.scemode &= ~R_COMP_CROP; /* quite weak */ return; }