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>2007-03-28 17:48:01 +0400
committerTon Roosendaal <ton@blender.org>2007-03-28 17:48:01 +0400
commitf5b919e12eff5df022bf340a81108c6e22463e2d (patch)
tree05f1b6af0c9449adad6c13980f08484b49efc703 /source/blender/nodes
parent39ef0f4eba5c0890e6792c95ed8ae6c8804de28c (diff)
Long wanted feature; decent ESC processing in composite nodes.
Works simple; just check for if(node->exec & NODE_BREAK) break; The main process (node processor) sets such a flag, checking for esc 20 times per second. That means you can check for ESC while doing image processing without much cpu overhead. Currently only added in blur nodes and defocus. Needs to be added all over, nice for others... needs careful tests too. What we now could do is even calling ESC on editing commands or mouseclicks in composite editor? Could give user feeling of interactive app :) Further, finished nodes are kept in memory anyway.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_blur.c25
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_defocus.c20
2 files changed, 32 insertions, 13 deletions
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
index 7c081ec5210..4b0a0774f6d 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_blur.c
@@ -83,8 +83,9 @@ static float *make_bloomtab(int rad)
}
/* both input images of same type, either 4 or 1 channel */
-static void blur_single_image(CompBuf *new, CompBuf *img, float scale, NodeBlurData *nbd)
+static void blur_single_image(bNode *node, CompBuf *new, CompBuf *img, float scale)
{
+ NodeBlurData *nbd= node->storage;
CompBuf *work;
register float sum, val;
float rval, gval, bval, aval;
@@ -137,6 +138,8 @@ static void blur_single_image(CompBuf *new, CompBuf *img, float scale, NodeBlurD
*dest++ = aval*sum;
}
}
+ if(node->exec & NODE_BREAK)
+ break;
}
/* vertical */
@@ -184,6 +187,8 @@ static void blur_single_image(CompBuf *new, CompBuf *img, float scale, NodeBlurD
}
dest+= bigstep;
}
+ if(node->exec & NODE_BREAK)
+ break;
}
free_compbuf(work);
@@ -327,8 +332,9 @@ static float hexagon_filter(float fi, float fj)
/* uses full filter, no horizontal/vertical optimize possible */
/* both images same type, either 1 or 4 channels */
-static void bokeh_single_image(CompBuf *new, CompBuf *img, float fac, NodeBlurData *nbd)
+static void bokeh_single_image(bNode *node, CompBuf *new, CompBuf *img, float fac)
{
+ NodeBlurData *nbd= node->storage;
register float val;
float radxf, radyf;
float *gausstab, *dgauss;
@@ -415,6 +421,8 @@ static void bokeh_single_image(CompBuf *new, CompBuf *img, float fac, NodeBlurDa
}
}
}
+ if(node->exec & NODE_BREAK)
+ break;
}
MEM_freeN(gausstab);
@@ -422,8 +430,9 @@ static void bokeh_single_image(CompBuf *new, CompBuf *img, float fac, NodeBlurDa
/* reference has to be mapped 0-1, and equal in size */
-static void blur_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, NodeBlurData *nbd)
+static void blur_with_reference(bNode *node, CompBuf *new, CompBuf *img, CompBuf *ref)
{
+ NodeBlurData *nbd= node->storage;
CompBuf *blurbuf, *ref_use;
register float sum, val;
float rval, gval, bval, aval, radxf, radyf;
@@ -450,7 +459,7 @@ static void blur_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, NodeBl
else blurd[0]= refd[0];
}
- blur_single_image(blurbuf, blurbuf, 1.0f, nbd);
+ blur_single_image(node, blurbuf, blurbuf, 1.0f);
/* horizontal */
radx = (float)nbd->sizex;
@@ -531,6 +540,8 @@ static void blur_with_reference(CompBuf *new, CompBuf *img, CompBuf *ref, NodeBl
}
}
}
+ if(node->exec & NODE_BREAK)
+ break;
}
free_compbuf(blurbuf);
@@ -567,7 +578,7 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
new->xof = img->xof;
new->yof = img->yof;
- blur_with_reference(new, img, in[1]->data, node->storage);
+ blur_with_reference(node, new, img, in[1]->data);
out[0]->data= new;
}
@@ -594,9 +605,9 @@ static void node_composit_exec_blur(void *data, bNode *node, bNodeStack **in, bN
else gammabuf= img;
if(nbd->bokeh)
- bokeh_single_image(new, gammabuf, in[1]->vec[0], nbd);
+ bokeh_single_image(node, new, gammabuf, in[1]->vec[0]);
else if(1)
- blur_single_image(new, gammabuf, in[1]->vec[0], nbd);
+ blur_single_image(node, new, gammabuf, in[1]->vec[0]);
else /* bloom experimental... */
bloom_with_reference(new, gammabuf, NULL, in[1]->vec[0], nbd);
diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
index 454f42324fc..edefd0fbadf 100644
--- a/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
+++ b/source/blender/nodes/intern/CMP_nodes/CMP_defocus.c
@@ -234,10 +234,11 @@ static void IIR_gauss(CompBuf* buf, float sigma)
#undef YVV
}
-static void defocus_blur(CompBuf* new, CompBuf* img, CompBuf* zbuf, float inpval, NodeDefocus* nqd)
+static void defocus_blur(bNode *node, CompBuf *new, CompBuf *img, CompBuf *zbuf, float inpval)
{
- CompBuf *wts; // weights buffer
- CompBuf *crad; // CoC radius buffer
+ NodeDefocus *nqd = node->storage;
+ CompBuf *wts; // weights buffer
+ CompBuf *crad; // CoC radius buffer
BokehCoeffs BKH[8]; // bokeh shape data, here never > 8 pts.
float bkh_b[4] = {0}; // shape 2D bound
unsigned int p, px, p4, zp, cp, cp4;
@@ -249,6 +250,7 @@ static void defocus_blur(CompBuf* new, CompBuf* img, CompBuf* zbuf, float inpval
int minsz;
// get some required params from the current scene camera
+ // (ton) this is wrong, needs fixed
Object* camob = G.scene->camera;
if (camob && camob->type==OB_CAMERA) {
Camera* cam = (Camera*)camob->data;
@@ -343,8 +345,10 @@ static void defocus_blur(CompBuf* new, CompBuf* img, CompBuf* zbuf, float inpval
// clear weights for next part
wts->rect[px] = 0.f;
}
+ // esc set by main calling process
+ if(node->exec & NODE_BREAK)
+ break;
}
-
}
//------------------------------------------------------------------
@@ -356,6 +360,10 @@ static void defocus_blur(CompBuf* new, CompBuf* img, CompBuf* zbuf, float inpval
printf("\rdefocus: Processing Line %d of %d ... ", y+1, img->y);
fflush(stdout);
}
+ // esc set by main calling process
+ if(node->exec & NODE_BREAK)
+ break;
+
zp = y * img->x;
for (x=0; x<img->x; x++) {
cp = zp + x;
@@ -744,7 +752,7 @@ static void defocus_blur(CompBuf* new, CompBuf* img, CompBuf* zbuf, float inpval
static void node_composit_exec_defocus(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
{
CompBuf *new, *old, *zbuf_use = NULL, *img = in[0]->data, *zbuf = in[1]->data;
- NodeDefocus* nqd = node->storage;
+ NodeDefocus *nqd = node->storage;
if ((img==NULL) || (out[0]->hasoutput==0)) return;
@@ -777,7 +785,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(new, old, zbuf_use, in[1]->vec[0]*nqd->scale, node->storage);
+ defocus_blur(node, new, old, zbuf_use, in[1]->vec[0]*nqd->scale);
if (nqd->gamco) {
gamma_correct_compbuf(new, 1);