diff options
author | Diego Borghetti <bdiego@gmail.com> | 2010-07-09 00:58:34 +0400 |
---|---|---|
committer | Diego Borghetti <bdiego@gmail.com> | 2010-07-09 00:58:34 +0400 |
commit | 24f63b20810692ff3d25fbe205098467ba32d277 (patch) | |
tree | b65300a3ad0458920f84e6ee661c3519edd06bb7 | |
parent | a9050083fe649f2a5839aeba4cb0bd5ddbbc5c5e (diff) |
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.
-rw-r--r-- | source/blender/blenkernel/BKE_node.h | 1 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 1 | ||||
-rw-r--r-- | source/blender/nodes/intern/CMP_nodes/CMP_scale.c | 4 |
3 files changed, 6 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index 0e5ad8e3ee9..4c7dcff0cd2 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -383,6 +383,7 @@ void ntreeGPUMaterialNodes(struct bNodeTree *ntree, struct GPUMaterial *mat); #define CMP_SCALE_RELATIVE 0 #define CMP_SCALE_ABSOLUTE 1 #define CMP_SCALE_SCENEPERCENT 2 +#define CMP_SCALE_RENDERPERCENT 3 /* the type definitions array */ diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index e5bfc1c6aad..5ebf43fc2b7 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -1176,6 +1176,7 @@ static void def_cmp_scale(StructRNA *srna) {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); diff --git a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c index d7a9497f41d..9779875b01a 100644 --- a/source/blender/nodes/intern/CMP_nodes/CMP_scale.c +++ b/source/blender/nodes/intern/CMP_nodes/CMP_scale.c @@ -64,6 +64,10 @@ static void node_composit_exec_scale(void *data, bNode *node, bNodeStack **in, b 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); |