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/intern/CMP_nodes/CMP_defocus.c
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/intern/CMP_nodes/CMP_defocus.c')
-rw-r--r--source/blender/nodes/intern/CMP_nodes/CMP_defocus.c20
1 files changed, 14 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 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);