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:
authorBastien Montagne <montagne29@wanadoo.fr>2013-10-04 16:11:10 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2013-10-04 16:11:10 +0400
commit1dc6d8ece112ba2d9e0de8594f08ba8f29f74740 (patch)
tree9d7a34d625a75e872734000fda5ce47e934ccb06 /source/blender/nodes
parentec4a7fcad12ba8106531ab02c5bc1cce213cfb86 (diff)
Fix related to [#36926] 'scale' Node doesn't work properly.
Scene/Render "spaces" are actually absolute values, they do not use the input X/Y scale factors, hide them in this case. Thanks to Lukas for review and improvement!
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_scale.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_scale.c b/source/blender/nodes/composite/nodes/node_composite_scale.c
index 134402c00e1..8041a2e56e9 100644
--- a/source/blender/nodes/composite/nodes/node_composite_scale.c
+++ b/source/blender/nodes/composite/nodes/node_composite_scale.c
@@ -45,12 +45,31 @@ static bNodeSocketTemplate cmp_node_scale_out[] = {
{ -1, 0, "" }
};
+static void node_composite_update_scale(bNodeTree *UNUSED(ntree), bNode *node)
+{
+ bNodeSocket *sock;
+ bool use_xy_scale = ELEM(node->custom1, CMP_SCALE_RELATIVE, CMP_SCALE_ABSOLUTE);
+
+ /* Only show X/Y scale factor inputs for modes using them! */
+ for (sock = node->inputs.first; sock; sock = sock->next) {
+ if (STREQ(sock->name, "X") || STREQ(sock->name, "Y")) {
+ if (use_xy_scale) {
+ sock->flag &= ~SOCK_UNAVAIL;
+ }
+ else {
+ sock->flag |= SOCK_UNAVAIL;
+ }
+ }
+ }
+}
+
void register_node_type_cmp_scale(void)
{
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_SCALE, "Scale", NODE_CLASS_DISTORT, 0);
node_type_socket_templates(&ntype, cmp_node_scale_in, cmp_node_scale_out);
+ node_type_update(&ntype, node_composite_update_scale, NULL);
nodeRegisterType(&ntype);
}