diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-04-01 15:08:48 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-04-01 15:08:48 +0400 |
commit | 22149c95ba5e3f885b9609b0cf60f54a13c481d5 (patch) | |
tree | 69a3393831445722af910357cabaa45a6c21f9aa | |
parent | 4f6493d1a7233d61ecce73caee5073d721d41e61 (diff) |
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.
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_defocus.c | 13 |
1 files 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 f8be69d8092..6f175671296 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 @@ -283,7 +283,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); @@ -700,7 +700,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. @@ -774,11 +774,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; } @@ -793,7 +794,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; @@ -808,7 +809,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); |