Cleanup: Compositor: Migrate most input nodes to new socket builder
This migrates most nodes except for the image/render layer nodes. These nodes require dynamic sockets so their implementation will be more involved.
This commit is contained in:
parent
960b21e1d7
commit
4a48482247
|
@ -47,6 +47,7 @@
|
|||
|
||||
/* only for forward declarations */
|
||||
#include "NOD_composite.h"
|
||||
#include "NOD_socket_declarations.hh"
|
||||
|
||||
#define CMP_SCALE_MAX 12000
|
||||
|
||||
|
|
|
@ -25,10 +25,14 @@
|
|||
|
||||
/* **************** Bokeh image Tools ******************** */
|
||||
|
||||
static bNodeSocketTemplate cmp_node_bokehimage_out[] = {
|
||||
{SOCK_RGBA, N_("Image"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f},
|
||||
{-1, ""},
|
||||
};
|
||||
namespace blender::nodes {
|
||||
|
||||
static void cmp_node_bokehimage_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_output<decl::Color>("Image");
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
static void node_composit_init_bokehimage(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
|
@ -46,7 +50,7 @@ void register_node_type_cmp_bokehimage(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_BOKEHIMAGE, "Bokeh Image", NODE_CLASS_INPUT, NODE_PREVIEW);
|
||||
node_type_socket_templates(&ntype, nullptr, cmp_node_bokehimage_out);
|
||||
ntype.declare = blender::nodes::cmp_node_bokehimage_declare;
|
||||
node_type_init(&ntype, node_composit_init_bokehimage);
|
||||
node_type_storage(
|
||||
&ntype, "NodeBokehImage", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
|
|
@ -25,12 +25,16 @@
|
|||
|
||||
/* **************** CURVE Time ******************** */
|
||||
|
||||
/* custom1 = start_frame, custom2 = end_frame */
|
||||
static bNodeSocketTemplate cmp_node_time_out[] = {
|
||||
{SOCK_FLOAT, N_("Fac")},
|
||||
{-1, ""},
|
||||
};
|
||||
namespace blender::nodes {
|
||||
|
||||
static void cmp_node_time_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_output<decl::Float>("Fac");
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
/* custom1 = start_frame, custom2 = end_frame */
|
||||
static void node_composit_init_curves_time(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
node->custom1 = 1;
|
||||
|
@ -43,7 +47,7 @@ void register_node_type_cmp_curve_time(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_TIME, "Time", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, nullptr, cmp_node_time_out);
|
||||
ntype.declare = blender::nodes::cmp_node_time_declare;
|
||||
node_type_size(&ntype, 140, 100, 320);
|
||||
node_type_init(&ntype, node_composit_init_curves_time);
|
||||
node_type_storage(&ntype, "CurveMapping", node_free_curves, node_copy_curves);
|
||||
|
|
|
@ -25,9 +25,16 @@
|
|||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** Translate ******************** */
|
||||
/* **************** Mask ******************** */
|
||||
|
||||
static bNodeSocketTemplate cmp_node_mask_out[] = {{SOCK_FLOAT, "Mask"}, {-1, ""}};
|
||||
namespace blender::nodes {
|
||||
|
||||
static void cmp_node_mask_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_output<decl::Float>("Mask");
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
static void node_composit_init_mask(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
|
@ -54,7 +61,7 @@ void register_node_type_cmp_mask(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_MASK, "Mask", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, nullptr, cmp_node_mask_out);
|
||||
ntype.declare = blender::nodes::cmp_node_mask_declare;
|
||||
node_type_init(&ntype, node_composit_init_mask);
|
||||
node_type_label(&ntype, node_mask_label);
|
||||
|
||||
|
|
|
@ -26,15 +26,22 @@
|
|||
#include "BKE_context.h"
|
||||
#include "BKE_lib_id.h"
|
||||
|
||||
static bNodeSocketTemplate cmp_node_movieclip_out[] = {
|
||||
{SOCK_RGBA, N_("Image")},
|
||||
{SOCK_FLOAT, N_("Alpha")},
|
||||
{SOCK_FLOAT, N_("Offset X")},
|
||||
{SOCK_FLOAT, N_("Offset Y")},
|
||||
{SOCK_FLOAT, N_("Scale")},
|
||||
{SOCK_FLOAT, N_("Angle")},
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
static void cmp_node_movieclip_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_output<decl::Color>("Image");
|
||||
b.add_output<decl::Float>("Alpha");
|
||||
b.add_output<decl::Float>("Offset X");
|
||||
b.add_output<decl::Float>("Offset Y");
|
||||
b.add_output<decl::Float>("Scale");
|
||||
b.add_output<decl::Float>("Angle");
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
static void init(const bContext *C, PointerRNA *ptr)
|
||||
{
|
||||
|
@ -54,7 +61,7 @@ void register_node_type_cmp_movieclip(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_MOVIECLIP, "Movie Clip", NODE_CLASS_INPUT, NODE_PREVIEW);
|
||||
node_type_socket_templates(&ntype, nullptr, cmp_node_movieclip_out);
|
||||
ntype.declare = blender::nodes::cmp_node_movieclip_declare;
|
||||
ntype.initfunc_api = init;
|
||||
node_type_storage(
|
||||
&ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
|
|
@ -24,17 +24,22 @@
|
|||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** RGB ******************** */
|
||||
static bNodeSocketTemplate cmp_node_rgb_out[] = {
|
||||
{SOCK_RGBA, N_("RGBA"), 0.5f, 0.5f, 0.5f, 1.0f},
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
static void cmp_node_rgb_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_output<decl::Color>("RGBA").default_value({0.5f, 0.5f, 0.5f, 1.0f});
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
void register_node_type_cmp_rgb(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_RGB, "RGB", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, nullptr, cmp_node_rgb_out);
|
||||
ntype.declare = blender::nodes::cmp_node_rgb_declare;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_SMALL);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
|
|
|
@ -24,23 +24,27 @@
|
|||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** TEXTURE ******************** */
|
||||
static bNodeSocketTemplate cmp_node_texture_in[] = {
|
||||
{SOCK_VECTOR, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -2.0f, 2.0f, PROP_TRANSLATION},
|
||||
{SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 1.0f, -10.0f, 10.0f, PROP_XYZ},
|
||||
{-1, ""},
|
||||
};
|
||||
static bNodeSocketTemplate cmp_node_texture_out[] = {
|
||||
{SOCK_FLOAT, N_("Value")},
|
||||
{SOCK_RGBA, N_("Color")},
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
static void cmp_node_texture_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_input<decl::Vector>("Offset").min(-2.0f).max(2.0f).subtype(PROP_TRANSLATION);
|
||||
b.add_input<decl::Vector>("Scale").default_value({1.0f, 1.0f, 1.0f}).min(-10.0f).max(10.0f).subtype(PROP_XYZ);
|
||||
b.add_output<decl::Float>("Value");
|
||||
b.add_output<decl::Color>("Color");
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
void register_node_type_cmp_texture(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_TEXTURE, "Texture", NODE_CLASS_INPUT, NODE_PREVIEW);
|
||||
node_type_socket_templates(&ntype, cmp_node_texture_in, cmp_node_texture_out);
|
||||
ntype.declare = blender::nodes::cmp_node_texture_declare;
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
}
|
||||
|
|
|
@ -23,12 +23,17 @@
|
|||
|
||||
#include "node_composite_util.hh"
|
||||
|
||||
static bNodeSocketTemplate cmp_node_trackpos_out[] = {
|
||||
{SOCK_FLOAT, N_("X")},
|
||||
{SOCK_FLOAT, N_("Y")},
|
||||
{SOCK_VECTOR, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY},
|
||||
{-1, ""},
|
||||
};
|
||||
namespace blender::nodes {
|
||||
|
||||
static void cmp_node_trackpos_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_output<decl::Float>("X");
|
||||
b.add_output<decl::Float>("Y");
|
||||
b.add_output<decl::Vector>("Speed").subtype(PROP_VELOCITY);
|
||||
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
static void init(bNodeTree *UNUSED(ntree), bNode *node)
|
||||
{
|
||||
|
@ -43,7 +48,7 @@ void register_node_type_cmp_trackpos(void)
|
|||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, nullptr, cmp_node_trackpos_out);
|
||||
ntype.declare = blender::nodes::cmp_node_trackpos_declare;
|
||||
node_type_init(&ntype, init);
|
||||
node_type_storage(
|
||||
&ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage);
|
||||
|
|
|
@ -24,17 +24,22 @@
|
|||
#include "node_composite_util.hh"
|
||||
|
||||
/* **************** VALUE ******************** */
|
||||
static bNodeSocketTemplate cmp_node_value_out[] = {
|
||||
{SOCK_FLOAT, N_("Value"), 0.5f, 0, 0, 0, -FLT_MAX, FLT_MAX, PROP_NONE},
|
||||
{-1, ""},
|
||||
};
|
||||
|
||||
namespace blender::nodes {
|
||||
|
||||
static void cmp_node_value_declare(NodeDeclarationBuilder &b)
|
||||
{
|
||||
b.add_output<decl::Float>("Value").default_value(0.5f);
|
||||
}
|
||||
|
||||
} // namespace blender::nodes
|
||||
|
||||
void register_node_type_cmp_value(void)
|
||||
{
|
||||
static bNodeType ntype;
|
||||
|
||||
cmp_node_type_base(&ntype, CMP_NODE_VALUE, "Value", NODE_CLASS_INPUT, 0);
|
||||
node_type_socket_templates(&ntype, nullptr, cmp_node_value_out);
|
||||
ntype.declare = blender::nodes::cmp_node_value_declare;
|
||||
node_type_size_preset(&ntype, NODE_SIZE_SMALL);
|
||||
|
||||
nodeRegisterType(&ntype);
|
||||
|
|
Loading…
Reference in New Issue