Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/composite/nodes/node_composite_scale.cc
- This file was moved from source/blender/nodes/composite/nodes/node_composite_scale.c.
| Show All 15 Lines | |||||
| * The Original Code is Copyright (C) 2006 Blender Foundation. | * The Original Code is Copyright (C) 2006 Blender Foundation. | ||||
| * All rights reserved. | * All rights reserved. | ||||
| */ | */ | ||||
| /** \file | /** \file | ||||
| * \ingroup cmpnodes | * \ingroup cmpnodes | ||||
| */ | */ | ||||
| #include "node_composite_util.h" | #include "node_composite_util.hh" | ||||
| /* **************** Scale ******************** */ | /* **************** Scale ******************** */ | ||||
| static bNodeSocketTemplate cmp_node_scale_in[] = { | static bNodeSocketTemplate cmp_node_scale_in[] = { | ||||
| {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, | {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, | ||||
| {SOCK_FLOAT, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, | {SOCK_FLOAT, N_("X"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, | ||||
| {SOCK_FLOAT, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, | {SOCK_FLOAT, N_("Y"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0001f, CMP_SCALE_MAX, PROP_NONE}, | ||||
| {-1, ""}}; | {-1, ""}}; | ||||
| static bNodeSocketTemplate cmp_node_scale_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; | static bNodeSocketTemplate cmp_node_scale_out[] = {{SOCK_RGBA, N_("Image")}, {-1, ""}}; | ||||
| static void node_composite_update_scale(bNodeTree *UNUSED(ntree), bNode *node) | static void node_composite_update_scale(bNodeTree *UNUSED(ntree), bNode *node) | ||||
| { | { | ||||
| bNodeSocket *sock; | bNodeSocket *sock; | ||||
| bool use_xy_scale = ELEM(node->custom1, CMP_SCALE_RELATIVE, CMP_SCALE_ABSOLUTE); | bool use_xy_scale = ELEM(node->custom1, CMP_SCALE_RELATIVE, CMP_SCALE_ABSOLUTE); | ||||
| /* Only show X/Y scale factor inputs for modes using them! */ | /* Only show X/Y scale factor inputs for modes using them! */ | ||||
| for (sock = node->inputs.first; sock; sock = sock->next) { | for (sock = (bNodeSocket *)node->inputs.first; sock; sock = sock->next) { | ||||
| if (STR_ELEM(sock->name, "X", "Y")) { | if (STR_ELEM(sock->name, "X", "Y")) { | ||||
| if (use_xy_scale) { | if (use_xy_scale) { | ||||
| sock->flag &= ~SOCK_UNAVAIL; | sock->flag &= ~SOCK_UNAVAIL; | ||||
| } | } | ||||
| else { | else { | ||||
| sock->flag |= SOCK_UNAVAIL; | sock->flag |= SOCK_UNAVAIL; | ||||
| } | } | ||||
| } | } | ||||
| Show All 13 Lines | |||||