Nodes: Revert some socket declarations to previos API

See T91826, there is a bug in the code where both `.` and `_` are used as a seperator for `BLI_uniquename_cb`.

This resulted in some nodes becoming disconnected on file load.
Until this is resolved, the chnages are reverted to prevent data loss.
This commit is contained in:
Aaron Carlisle 2021-10-04 10:34:45 -04:00
parent 4a3464050c
commit 0bc4056455
Notes: blender-bot 2023-02-14 06:37:09 +01:00
Referenced by issue #91826, Inconsistent name separator used for duplicate node sockets names.
5 changed files with 50 additions and 64 deletions

View File

@ -20,22 +20,21 @@
/** \file
* \ingroup cmpnodes
*/
#include "node_composite_util.hh"
/* **************** ALPHAOVER ******************** */
namespace blender::nodes {
static void cmp_node_alphaover_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>("Fac").default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
b.add_input<decl::Color>("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f});
b.add_input<decl::Color>("Image", "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f});
b.add_output<decl::Color>("Image");
}
} // namespace blender::nodes
static bNodeSocketTemplate cmp_node_alphaover_in[] = {
{SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, PROP_FACTOR},
{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{-1, ""},
};
static bNodeSocketTemplate cmp_node_alphaover_out[] = {
{SOCK_RGBA, N_("Image")},
{-1, ""},
};
static void node_alphaover_init(bNodeTree *UNUSED(ntree), bNode *node)
{
@ -47,7 +46,7 @@ void register_node_type_cmp_alphaover(void)
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_ALPHAOVER, "Alpha Over", NODE_CLASS_OP_COLOR, 0);
ntype.declare = blender::nodes::cmp_node_alphaover_declare;
node_type_socket_templates(&ntype, cmp_node_alphaover_in, cmp_node_alphaover_out);
node_type_init(&ntype, node_alphaover_init);
node_type_storage(
&ntype, "NodeTwoFloats", node_free_standard_storage, node_copy_standard_storage);

View File

@ -24,25 +24,20 @@
#include "node_composite_util.hh"
/* **************** SCALAR MATH ******************** */
static bNodeSocketTemplate cmp_node_math_in[] = {
{SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
{SOCK_FLOAT, N_("Value"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
{SOCK_FLOAT, N_("Value"), 0.0f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE},
{-1, ""}};
namespace blender::nodes {
static void cmp_node_math_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>("Value").default_value(0.5f).min(-10000.0f).max(10000.0f);
b.add_input<decl::Float>("Value", "Value_001").default_value(0.5f).min(-10000.0f).max(10000.0f);
b.add_input<decl::Float>("Value", "Value_002").default_value(0.5f).min(-10000.0f).max(10000.0f);
b.add_output<decl::Float>("Value");
}
} // namespace blender::nodes
static bNodeSocketTemplate cmp_node_math_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}};
void register_node_type_cmp_math(void)
{
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_MATH, "Math", NODE_CLASS_CONVERTER, 0);
ntype.declare = blender::nodes::cmp_node_math_declare;
node_type_socket_templates(&ntype, cmp_node_math_in, cmp_node_math_out);
node_type_label(&ntype, node_math_label);
node_type_update(&ntype, node_math_update);

View File

@ -25,17 +25,16 @@
/* **************** MIX RGB ******************** */
namespace blender::nodes {
static void cmp_node_mixrgb_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Float>("Fac").default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR);
b.add_input<decl::Color>("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f});
b.add_input<decl::Color>("Image", "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f});
b.add_output<decl::Color>("Image");
}
} // namespace blender::nodes
static bNodeSocketTemplate cmp_node_mix_rgb_in[] = {
{SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR},
{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{-1, ""},
};
static bNodeSocketTemplate cmp_node_mix_rgb_out[] = {
{SOCK_RGBA, N_("Image")},
{-1, ""},
};
/* custom1 = mix type */
void register_node_type_cmp_mix_rgb(void)
@ -43,7 +42,7 @@ void register_node_type_cmp_mix_rgb(void)
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, NODE_PREVIEW);
ntype.declare = blender::nodes::cmp_node_mixrgb_declare;
node_type_socket_templates(&ntype, cmp_node_mix_rgb_in, cmp_node_mix_rgb_out);
node_type_label(&ntype, node_blend_label);
nodeRegisterType(&ntype);

View File

@ -27,16 +27,11 @@
#include "BKE_image.h"
/* **************** SPLIT VIEWER ******************** */
namespace blender::nodes {
static void cmp_node_splitviewer_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>("Image");
b.add_input<decl::Color>("Image", "Image_001");
}
} // namespace blender::nodes
static bNodeSocketTemplate cmp_node_splitviewer_in[] = {
{SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
{SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f},
{-1, ""},
};
static void node_composit_init_splitviewer(bNodeTree *UNUSED(ntree), bNode *node)
{
@ -55,7 +50,7 @@ void register_node_type_cmp_splitviewer(void)
cmp_node_type_base(
&ntype, CMP_NODE_SPLITVIEWER, "Split Viewer", NODE_CLASS_OUTPUT, NODE_PREVIEW);
ntype.declare = blender::nodes::cmp_node_splitviewer_declare;
node_type_socket_templates(&ntype, cmp_node_splitviewer_in, nullptr);
node_type_init(&ntype, node_composit_init_splitviewer);
node_type_storage(&ntype, "ImageUser", node_free_standard_storage, node_copy_standard_storage);

View File

@ -24,28 +24,26 @@
#include "node_composite_util.hh"
/* **************** Z COMBINE ******************** */
namespace blender::nodes {
static void cmp_node_zcombine_declare(NodeDeclarationBuilder &b)
{
b.add_input<decl::Color>("Image").default_value({1.0f, 1.0f, 1.0f, 1.0f});
b.add_input<decl::Float>("Z").default_value(1.0f).min(0.0f).max(10000.0f);
b.add_input<decl::Color>("Image", "Image_001").default_value({1.0f, 1.0f, 1.0f, 1.0f});
b.add_input<decl::Float>("Z", "Z_001").default_value(1.0f).min(0.0f).max(10000.0f);
b.add_output<decl::Color>("Image");
b.add_output<decl::Float>("Z");
}
} // namespace blender::nodes
/* lazy coder NOTE: node->custom2 is abused to send signal. */
static bNodeSocketTemplate cmp_node_zcombine_in[] = {
{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE},
{SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f},
{SOCK_FLOAT, N_("Z"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 10000.0f, PROP_NONE},
{-1, ""},
};
static bNodeSocketTemplate cmp_node_zcombine_out[] = {
{SOCK_RGBA, N_("Image")},
{SOCK_FLOAT, N_("Z")},
{-1, ""},
};
void register_node_type_cmp_zcombine(void)
{
static bNodeType ntype;
cmp_node_type_base(&ntype, CMP_NODE_ZCOMBINE, "Z Combine", NODE_CLASS_OP_COLOR, 0);
ntype.declare = blender::nodes::cmp_node_zcombine_declare;
node_type_socket_templates(&ntype, cmp_node_zcombine_in, cmp_node_zcombine_out);
nodeRegisterType(&ntype);
}