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>2006-01-24 20:09:04 +0300
committerTon Roosendaal <ton@blender.org>2006-01-24 20:09:04 +0300
commit74f76981bfee039468eb99f589166cdb814e75ab (patch)
tree95b3f3a35c0b4368b337f7f8975a0580749e8214
parent9a20e5466cbd337c1eca9223fcedd0ab9f1f9f33 (diff)
Orange: preparation commit for Output nodes type "Render" and "File".
They dont work yet, but i accidentally committed parts of it with a bugfix.
-rw-r--r--source/blender/blenkernel/BKE_node.h5
-rw-r--r--source/blender/blenkernel/intern/node.c28
-rw-r--r--source/blender/blenkernel/intern/node_composit.c87
3 files changed, 104 insertions, 16 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 88012978cd2..3ecfbb8ef29 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -83,6 +83,7 @@ typedef struct bNodeType {
#define NODE_CLASS_GENERATOR 2
#define NODE_CLASS_OPERATOR 3
#define NODE_CLASS_GROUP 4
+#define NODE_CLASS_FILE 5
/* ************** GENERIC API, TREES *************** */
@@ -181,7 +182,9 @@ void set_node_shader_lamp_loop(void (*lamp_loop_func)(struct ShadeInput *, str
/* ************** COMPOSIT NODES *************** */
/* note: types are needed to restore callbacks, don't change values */
-#define CMP_NODE_OUTPUT 201
+#define CMP_NODE_OUTPUT 201
+#define CMP_NODE_OUTPUT_RENDER 202
+#define CMP_NODE_OUTPUT_FILE 203
#define CMP_NODE_RGB 202
#define CMP_NODE_VALUE 203
diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c
index fc23758c4b3..1b755a84efb 100644
--- a/source/blender/blenkernel/intern/node.c
+++ b/source/blender/blenkernel/intern/node.c
@@ -1179,18 +1179,22 @@ void ntreeSolveOrder(bNodeTree *ntree)
MEM_freeN(nodesort);
- /* find the active outputs, tree type dependant, might become handler */
- if(ntree->type==NTREE_SHADER || ntree->type==NTREE_COMPOSIT) {
- /* shader/composit nodes only accepts one output */
- int output= 0;
-
- for(node= ntree->nodes.first; node; node= node->next) {
- if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
- if(output==0)
- node->flag |= NODE_DO_OUTPUT;
- else
- node->flag &= ~NODE_DO_OUTPUT;
- output= 1;
+ /* find the active outputs, might become tree type dependant handler */
+ for(node= ntree->nodes.first; node; node= node->next) {
+ if(node->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ bNode *tnode;
+ int output= 0;
+ /* there is more types having output class, each one is checked */
+ for(tnode= ntree->nodes.first; tnode; tnode= tnode->next) {
+ if(tnode->typeinfo->nclass==NODE_CLASS_OUTPUT) {
+ if(tnode->type==node->type) {
+ if(output==0)
+ tnode->flag |= NODE_DO_OUTPUT;
+ else
+ tnode->flag &= ~NODE_DO_OUTPUT;
+ output= 1;
+ }
+ }
}
}
}
diff --git a/source/blender/blenkernel/intern/node_composit.c b/source/blender/blenkernel/intern/node_composit.c
index b7d70b167ba..4659b587e61 100644
--- a/source/blender/blenkernel/intern/node_composit.c
+++ b/source/blender/blenkernel/intern/node_composit.c
@@ -442,7 +442,7 @@ static void node_composit_exec_output(void *data, bNode *node, bNodeStack **in,
cbuf= alloc_compbuf(rectx, recty, CB_RGBA, 0); // no alloc
cbuf->rect= ima->ibuf->rect_float;
-
+
/* when no alpha, we can simply copy */
if(in[1]->data==NULL)
composit1_pixel_processor(node, cbuf, in[0]->data, in[0]->vec, do_copy_rgba);
@@ -462,7 +462,7 @@ static void node_composit_exec_output(void *data, bNode *node, bNodeStack **in,
ima->ibuf->y= cbuf->y;
cbuf->rect= NULL;
}
-
+
}
else if(in[0]->data)
generate_preview(node, in[0]->data);
@@ -480,6 +480,82 @@ static bNodeType cmp_node_output= {
};
+/* **************** OUTPUT RENDER ******************** */
+static bNodeSocketType cmp_node_output_render_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_VALUE, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+
+static void node_composit_exec_output_render(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+{
+ /* image assigned to output */
+ /* stack order input sockets: col, alpha */
+
+ if(node->flag & NODE_DO_OUTPUT) { /* only one works on out */
+ RenderResult *rr= RE_GetResult(RE_GetRender("Render"));
+ if(rr) {
+ RenderLayer *rl= rr->layers.first;
+ CompBuf *outbuf= alloc_compbuf(rr->rectx, rr->recty, CB_RGBA, 0); /* no alloc */
+
+ outbuf->rect= rl->rectf;
+
+ if(in[1]->data==NULL)
+ composit1_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, do_copy_rgba);
+ else
+ composit2_pixel_processor(node, outbuf, in[0]->data, in[0]->vec, in[1]->data, in[1]->vec, do_copy_a_rgba);
+
+ free_compbuf(outbuf);
+ }
+ }
+ else if(in[0]->data)
+ generate_preview(node, in[0]->data);
+}
+
+static bNodeType cmp_node_output_render= {
+ /* type code */ CMP_NODE_OUTPUT_RENDER,
+ /* name */ "Render Output",
+ /* width+range */ 80, 60, 200,
+ /* class+opts */ NODE_CLASS_OUTPUT, NODE_PREVIEW,
+ /* input sock */ cmp_node_output_render_in,
+ /* output sock */ NULL,
+ /* storage */ "",
+ /* execfunc */ node_composit_exec_output_render
+
+};
+
+/* **************** OUTPUT FILE ******************** */
+static bNodeSocketType cmp_node_output_file_in[]= {
+ { SOCK_RGBA, 1, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
+ { SOCK_VALUE, 1, "Alpha", 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},
+ { -1, 0, "" }
+};
+
+
+static void node_composit_exec_output_file(void *data, bNode *node, bNodeStack **in, bNodeStack **out)
+{
+ /* image assigned to output */
+ /* stack order input sockets: col, alpha */
+
+ if(node->id && (node->flag & NODE_DO_OUTPUT)) { /* only one works on out */
+ }
+ else if(in[0]->data)
+ generate_preview(node, in[0]->data);
+}
+
+static bNodeType cmp_node_output_file= {
+ /* type code */ CMP_NODE_OUTPUT_FILE,
+ /* name */ "File Output",
+ /* width+range */ 80, 60, 200,
+ /* class+opts */ NODE_CLASS_FILE, NODE_PREVIEW,
+ /* input sock */ cmp_node_output_file_in,
+ /* output sock */ NULL,
+ /* storage */ "",
+ /* execfunc */ node_composit_exec_output_file
+
+};
+
/* **************** IMAGE ******************** */
static bNodeSocketType cmp_node_image_out[]= {
{ SOCK_RGBA, 0, "Image", 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
@@ -862,7 +938,10 @@ static void do_filter3(CompBuf *out, CompBuf *in, float *filter, float fac)
row1= in->rect + 4*(y-2)*rowlen;
row2= row1 + 4*rowlen;
row3= row2 + 4*rowlen;
- fp= out->rect + 4*(y-1)*rowlen + 4;
+
+ fp= out->rect + 4*(y-1)*rowlen;
+ QUATCOPY(fp, row2);
+ fp+= 4;
for(x=2; x<rowlen; x++) {
for(c=0; c<4; c++) {
@@ -1339,6 +1418,8 @@ static bNodeType cmp_node_blur= {
bNodeType *node_all_composit[]= {
&node_group_typeinfo,
&cmp_node_output,
+ &cmp_node_output_render,
+ &cmp_node_output_file,
&cmp_node_value,
&cmp_node_rgb,
&cmp_node_mix_rgb,