[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30134] trunk/blender/source/blender: New option for Scale node.

Diego Borghetti bdiego at gmail.com
Thu Jul 8 22:58:34 CEST 2010


Revision: 30134
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30134
Author:   bdiego
Date:     2010-07-08 22:58:34 +0200 (Thu, 08 Jul 2010)

Log Message:
-----------
New option for Scale node.

This is because problem reported by venomgfx on the irc.
If you have a render of 2k with a render size of 25% (and this
problem is for any resolution/size) and you try to use a image
of 1k in the compo, the first thing you do is put a scale node.

Here come the problem, if you set the option "Scene Size" in the
node scale, the buffer output is not the same size that the render.

This is because the "Scene size" work with the image size and
not the render size, so in this case is the 25% of 1k.. not
the 25% 2k.

So this new option "Render Size" scale the output buffer to the
render resolution, taking into account the render size (percentage) too.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/BKE_node.h
    trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
    trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_scale.c

Modified: trunk/blender/source/blender/blenkernel/BKE_node.h
===================================================================
--- trunk/blender/source/blender/blenkernel/BKE_node.h	2010-07-08 19:29:41 UTC (rev 30133)
+++ trunk/blender/source/blender/blenkernel/BKE_node.h	2010-07-08 20:58:34 UTC (rev 30134)
@@ -383,6 +383,7 @@
 #define CMP_SCALE_RELATIVE		0
 #define CMP_SCALE_ABSOLUTE		1
 #define CMP_SCALE_SCENEPERCENT	2
+#define CMP_SCALE_RENDERPERCENT 3
 
 
 /* the type definitions array */

Modified: trunk/blender/source/blender/makesrna/intern/rna_nodetree.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2010-07-08 19:29:41 UTC (rev 30133)
+++ trunk/blender/source/blender/makesrna/intern/rna_nodetree.c	2010-07-08 20:58:34 UTC (rev 30134)
@@ -1176,6 +1176,7 @@
 		{0, "RELATIVE",   0, "Relative",   ""},
 		{1, "ABSOLUTE",   0, "Absolute",   ""},
 		{2, "SCENE_SIZE", 0, "Scene Size", ""},
+		{3, "RENDER_SIZE", 0, "Render Size", ""},
 		{0, NULL, 0, NULL, NULL}};
 	
 	prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);

Modified: trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_scale.c
===================================================================
--- trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_scale.c	2010-07-08 19:29:41 UTC (rev 30133)
+++ trunk/blender/source/blender/nodes/intern/CMP_nodes/CMP_scale.c	2010-07-08 20:58:34 UTC (rev 30134)
@@ -64,6 +64,10 @@
 		else if(node->custom1==CMP_SCALE_SCENEPERCENT) {
 			newx = cbuf->x * (rd->size / 100.0f);
 			newy = cbuf->y * (rd->size / 100.0f);
+		}
+		else if (node->custom1==CMP_SCALE_RENDERPERCENT) {
+			newx= (rd->xsch * rd->size)/100;
+			newy= (rd->ysch * rd->size)/100;
 		} else {	/* CMP_SCALE_ABSOLUTE */
 			newx= MAX2((int)in[1]->vec[0], 1);
 			newy= MAX2((int)in[2]->vec[0], 1);





More information about the Bf-blender-cvs mailing list