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:
Diffstat (limited to 'source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc')
-rw-r--r--source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc63
1 files changed, 45 insertions, 18 deletions
diff --git a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
index 2bac30cc152..396c6fa7a13 100644
--- a/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
+++ b/source/blender/nodes/composite/nodes/node_composite_moviedistortion.cc
@@ -21,24 +21,25 @@
* \ingroup cmpnodes
*/
-#include "node_composite_util.hh"
-
#include "BKE_context.h"
#include "BKE_lib_id.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "node_composite_util.hh"
+
/* **************** Translate ******************** */
-static bNodeSocketTemplate cmp_node_moviedistortion_in[] = {
- {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
- {-1, ""},
-};
+namespace blender::nodes::node_composite_moviedistortion_cc {
-static bNodeSocketTemplate cmp_node_moviedistortion_out[] = {
- {SOCK_RGBA, N_("Image")},
- {-1, ""},
-};
+static void cmp_node_moviedistortion_declare(NodeDeclarationBuilder &b)
+{
+ b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
+ b.add_output<decl::Color>(N_("Image"));
+}
-static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
+static void label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
{
if (node->custom1 == 0) {
BLI_strncpy(label, IFACE_("Undistortion"), maxlen);
@@ -73,16 +74,42 @@ static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const
}
}
-void register_node_type_cmp_moviedistortion(void)
+static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, PointerRNA *ptr)
{
- static bNodeType ntype;
+ bNode *node = (bNode *)ptr->data;
- cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0);
- node_type_socket_templates(&ntype, cmp_node_moviedistortion_in, cmp_node_moviedistortion_out);
- node_type_label(&ntype, label);
+ uiTemplateID(layout,
+ C,
+ ptr,
+ "clip",
+ nullptr,
+ "CLIP_OT_open",
+ nullptr,
+ UI_TEMPLATE_ID_FILTER_ALL,
+ false,
+ nullptr);
+
+ if (!node->id) {
+ return;
+ }
+
+ uiItemR(layout, ptr, "distortion_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
+}
+
+} // namespace blender::nodes::node_composite_moviedistortion_cc
+
+void register_node_type_cmp_moviedistortion()
+{
+ namespace file_ns = blender::nodes::node_composite_moviedistortion_cc;
+
+ static bNodeType ntype;
- ntype.initfunc_api = init;
- node_type_storage(&ntype, nullptr, storage_free, storage_copy);
+ cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT);
+ ntype.declare = file_ns::cmp_node_moviedistortion_declare;
+ ntype.draw_buttons = file_ns::node_composit_buts_moviedistortion;
+ ntype.labelfunc = file_ns::label;
+ ntype.initfunc_api = file_ns::init;
+ node_type_storage(&ntype, nullptr, file_ns::storage_free, file_ns::storage_copy);
nodeRegisterType(&ntype);
}