diff options
Diffstat (limited to 'source/blender/nodes/composite/nodes/node_composite_lensdist.cc')
-rw-r--r-- | source/blender/nodes/composite/nodes/node_composite_lensdist.cc | 44 |
1 files changed, 32 insertions, 12 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc index 2a8dc035792..11ee0cf0aa3 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lensdist.cc +++ b/source/blender/nodes/composite/nodes/node_composite_lensdist.cc @@ -21,18 +21,24 @@ * \ingroup cmpnodes */ +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + #include "node_composite_util.hh" -static bNodeSocketTemplate cmp_node_lensdist_in[] = { - {SOCK_RGBA, N_("Image"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Distort"), 0.0f, 0.0f, 0.0f, 0.0f, -0.999f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Dispersion"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {-1, ""}, -}; -static bNodeSocketTemplate cmp_node_lensdist_out[] = { - {SOCK_RGBA, N_("Image")}, - {-1, ""}, -}; +namespace blender::nodes { + +static void cmp_node_lensdist_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Distort")).default_value(0.0f).min(-0.999f).max(1.0f); + b.add_input<decl::Float>(N_("Dispersion")).default_value(0.0f).min(0.0f).max(1.0f); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node) { @@ -41,12 +47,26 @@ static void node_composit_init_lensdist(bNodeTree *UNUSED(ntree), bNode *node) node->storage = nld; } -void register_node_type_cmp_lensdist(void) +static void node_composit_buts_lensdist(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, false); + uiItemR(col, ptr, "use_projector", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(col, false); + uiLayoutSetActive(col, RNA_boolean_get(ptr, "use_projector") == false); + uiItemR(col, ptr, "use_jitter", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "use_fit", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + +void register_node_type_cmp_lensdist() { static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_LENSDIST, "Lens Distortion", NODE_CLASS_DISTORT, 0); - node_type_socket_templates(&ntype, cmp_node_lensdist_in, cmp_node_lensdist_out); + ntype.declare = blender::nodes::cmp_node_lensdist_declare; + ntype.draw_buttons = node_composit_buts_lensdist; node_type_init(&ntype, node_composit_init_lensdist); node_type_storage( &ntype, "NodeLensDist", node_free_standard_storage, node_copy_standard_storage); |