From 8a85aa1672796279b5d24d2ccdb4da8e72dfe0c0 Mon Sep 17 00:00:00 2001 From: Diego Hernan Borghetti Date: Thu, 3 Apr 2008 15:32:38 -0300 Subject: [PATCH] Bugfix: the defocus node "no zbuffer" settings was automatically set if there was no zbuffer input. However this means a user settings can be permanently changed without a user knowing. Now it just runs as if this option is set if there is no zbuffer, but doesn't change the setting. Author: Brecht Van Lommel SVN revision: r14305 Date: 2008-04-01 08:08:48 -0300 (Tue, 01 Apr 2008) --- source/blender/nodes/intern/CMP_nodes/CMP_defocus.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c index 0dc8ff4..069c0be 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c @@ -235,7 +235,7 @@ static void IIR_gauss_single(CompBuf* buf, float sigma) #undef YVV } -static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, float inpval) +static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, float inpval, int no_zbuf) { NodeDefocus *nqd = node->storage; CompBuf *wts; // weights buffer @@ -282,7 +282,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // if 'no_zbuf' flag set (which is always set if input is not an image), // values are instead interpreted directly as blur radius values - if (nqd->no_zbuf) { + if (no_zbuf) { // to prevent *reaaallly* big radius values and impossible calculation times, // limit the maximum to half the image width or height, whichever is smaller float maxr = 0.5f*(float)MIN2(img->x, img->y); @@ -697,7 +697,7 @@ static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, // sampled, simple rejection sampling here, good enough unsigned int maxsam, s, ui = BLI_rand()*BLI_rand(); float wcor, cpr = BLI_frand(); - if (nqd->no_zbuf) + if (no_zbuf) maxsam = nqd->samples; // no zbuffer input, use sample value directly else { // depth adaptive sampling hack, the more out of focus, the more samples taken, 16 minimum. @@ -771,11 +771,12 @@ static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, { CompBuf *new, *old, *zbuf_use = NULL, *img = in[0]->data, *zbuf = in[1]->data; NodeDefocus *nqd = node->storage; + int no_zbuf = nqd->no_zbuf; if ((img==NULL) || (out[0]->hasoutput==0)) return; // if image not valid type or fstop==infinite (128), nothing to do, pass in to out - if (((img->type!=CB_RGBA) && (img->type!=CB_VAL)) || ((nqd->no_zbuf==0) && (nqd->fstop==128.f))) { + if (((img->type!=CB_RGBA) && (img->type!=CB_VAL)) || ((no_zbuf==0) && (nqd->fstop==128.f))) { out[0]->data = pass_on_compbuf(img); return; } @@ -790,7 +791,7 @@ static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, } zbuf_use = typecheck_compbuf(zbuf, CB_VAL); } - else nqd->no_zbuf = 1; // no zbuffer input + else no_zbuf = 1; // no zbuffer input // ok, process old = img; @@ -805,7 +806,7 @@ static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, } new = alloc_compbuf(old->x, old->y, old->type, 1); - defocus_blur(node, new, old, zbuf_use, in[1]->vec[0]*nqd->scale); + defocus_blur(node, new, old, zbuf_use, in[1]->vec[0]*nqd->scale, no_zbuf); if (nqd->gamco) { premul_compbuf(new, 1); -- 2.11.4.GIT