[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12127] trunk/blender/source/blender/nodes /intern/CMP_nodes/CMP_texture.c: * Change/fix to texture comp node

Matt Ebb matt at mke3.net
Mon Sep 24 04:18:13 CEST 2007


Revision: 12127
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12127
Author:   broken
Date:     2007-09-24 04:18:00 +0200 (Mon, 24 Sep 2007)

Log Message:
-----------
* Change/fix to texture comp node

Previously if the texture node was not connected directly as the 
second input to a node like Mix, the size of the generated image 
was initialised to 140x140, which is not that useful. It now is 
initialised to the size of the render result if it exists, and if 
not, the size of the scene render sizeX/sizeY.

This alleviates bug #7068, which is caused by the displace node 
trying to get pixels from a texture node, where the texture node 
doesn't contain pixels to cover the entire image (only 140x140) 
but it's not really a bulletproof solution...

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	2007-09-23 22:02:18 UTC (rev 12126)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_texture.c	2007-09-24 02:18:00 UTC (rev 12127)
@@ -89,9 +89,20 @@
 	/* outputs: value, color, normal */
 	
 	if(node->id) {
+		RenderResult *rr= RE_GetResult(RE_GetRender(G.scene->id.name)); /* G.scene is WEAK! */
+		short sizex, sizey;
+		
 		/* first make the preview image */
 		CompBuf *prevbuf= alloc_compbuf(140, 140, CB_RGBA, 1); /* alloc */
 		
+		if (rr) {
+			sizex = rr->rectx;
+			sizey = rr->recty;
+		} else {
+			sizex = G.scene->r.xsch;
+			sizey = G.scene->r.ysch;
+		}
+		
 		prevbuf->rect_procedural= texture_procedural;
 		prevbuf->node= node;
 		composit1_pixel_processor(node, prevbuf, prevbuf, out[0]->vec, do_copy_rgba, CB_RGBA);
@@ -99,15 +110,15 @@
 		free_compbuf(prevbuf);
 		
 		if(out[0]->hasoutput) {
-			CompBuf *stackbuf= alloc_compbuf(140, 140, CB_VAL, 1); /* alloc */
+			CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_VAL, 1); /* alloc */
 			
 			stackbuf->rect_procedural= texture_procedural;
 			stackbuf->node= node;
 			
-			out[0]->data= stackbuf;
+			out[0]->data= stackbuf; 
 		}
 		if(out[1]->hasoutput) {
-			CompBuf *stackbuf= alloc_compbuf(140, 140, CB_RGBA, 1); /* alloc */
+			CompBuf *stackbuf= alloc_compbuf(sizex, sizey, CB_RGBA, 1); /* alloc */
 			
 			stackbuf->rect_procedural= texture_procedural;
 			stackbuf->node= node;





More information about the Bf-blender-cvs mailing list