[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34134] trunk/blender/source/blender/nodes /intern/CMP_nodes/CMP_texture.c: Todo item:

Ton Roosendaal ton at blender.org
Thu Jan 6 15:58:58 CET 2011


Revision: 34134
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34134
Author:   ton
Date:     2011-01-06 15:58:58 +0100 (Thu, 06 Jan 2011)

Log Message:
-----------
Todo item:

Compositor: Texture Node now behaves like an image.
- Image always in render output size
- Buffer outputs RGBA and Value both supported
- Works for filter and blur and scaling too.
- Mixing 2 textures works

Implementation note:
The texture node was meant to be 'procedural', not a buffer
but a color-sample method. Unfortunately the node editor 
didn't support this well, blur/filter/scale ignored it too.

For now, its better to drop this procedural concept, then
things work at least as expected. :)

Modified Paths:
--------------
    trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c

Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c	2011-01-06 14:19:46 UTC (rev 34133)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c	2011-01-06 14:58:58 UTC (rev 34134)
@@ -90,16 +90,12 @@
 	/* outputs: value, color, normal */
 	
 	if(node->id) {
-		/* RenderData *rd= data; */
-		/* short sizex, sizey; */
+		RenderData *rd= data;
+		short sizex, sizey;
 		
 		/* first make the preview image */
 		CompBuf *prevbuf= alloc_compbuf(140, 140, CB_RGBA, 1); /* alloc */
 
-		/* Also take care about the render size! */
-		/* sizex = (rd->size*rd->xsch)/100; */
-		/* sizey = (rd->size*rd->ysch)/100; */
-
 		prevbuf->rect_procedural= texture_procedural;
 		prevbuf->node= node;
 		VECCOPY(prevbuf->procedural_offset, in[0]->vec);
@@ -107,32 +103,39 @@
 		prevbuf->procedural_type= CB_RGBA;
 		composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
 		
-		/* texture is procedural node, like RGBA node, we give it fake buffer for nodes that don't check it */
+		generate_preview(data, node, prevbuf);
+		free_compbuf(prevbuf);
+		
+		/* texture procedural buffer type doesnt work well, we now render a buffer in scene size */
+		sizex = (rd->size*rd->xsch)/100;
+		sizey = (rd->size*rd->ysch)/100;
+		
 		if(out[0]->hasoutput) {
-			CompBuf *stackbuf= dupalloc_compbuf(prevbuf); /* buffer alloc */
+			CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */
 			
 			stackbuf->rect_procedural= texture_procedural;
 			stackbuf->node= node;
 			VECCOPY(stackbuf->procedural_offset, in[0]->vec);
 			VECCOPY(stackbuf->procedural_size, in[1]->vec);
 			stackbuf->procedural_type= CB_VAL;
+			composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_value, CB_VAL);
+			stackbuf->rect_procedural= NULL;
 			
 			out[0]->data= stackbuf; 
 		}
 		if(out[1]->hasoutput) {
-			CompBuf *stackbuf= dupalloc_compbuf(prevbuf); /* buffer alloc */
+			CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_RGBA, 1); /* alloc */
 			
 			stackbuf->rect_procedural= texture_procedural;
 			stackbuf->node= node;
 			VECCOPY(stackbuf->procedural_offset, in[0]->vec);
 			VECCOPY(stackbuf->procedural_size, in[1]->vec);
 			stackbuf->procedural_type= CB_RGBA;
+			composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
+			stackbuf->rect_procedural= NULL;
 			
 			out[1]->data= stackbuf;
 		}
-		
-		generate_preview(data, node, prevbuf);
-		free_compbuf(prevbuf);
 	}
 }
 





More information about the Bf-blender-cvs mailing list