Blender  V3.3
node_composite_moviedistortion.cc
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2011 Blender Foundation. All rights reserved. */
3 
8 #include "BKE_context.h"
9 #include "BKE_lib_id.h"
10 #include "BKE_tracking.h"
11 
12 #include "UI_interface.h"
13 #include "UI_resources.h"
14 
15 #include "node_composite_util.hh"
16 
17 /* **************** Translate ******************** */
18 
20 
22 {
23  b.add_input<decl::Color>(N_("Image")).default_value({0.8f, 0.8f, 0.8f, 1.0f});
24  b.add_output<decl::Color>(N_("Image"));
25 }
26 
27 static void label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
28 {
29  if (node->custom1 == 0) {
30  BLI_strncpy(label, IFACE_("Undistortion"), maxlen);
31  }
32  else {
33  BLI_strncpy(label, IFACE_("Distortion"), maxlen);
34  }
35 }
36 
37 static void init(const bContext *C, PointerRNA *ptr)
38 {
39  bNode *node = (bNode *)ptr->data;
41 
42  node->id = (ID *)scene->clip;
43  id_us_plus(node->id);
44 }
45 
46 static void storage_free(bNode *node)
47 {
48  if (node->storage) {
50  }
51 
52  node->storage = nullptr;
53 }
54 
55 static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
56 {
57  if (src_node->storage) {
59  }
60 }
61 
63 {
64  bNode *node = (bNode *)ptr->data;
65 
66  uiTemplateID(layout,
67  C,
68  ptr,
69  "clip",
70  nullptr,
71  "CLIP_OT_open",
72  nullptr,
74  false,
75  nullptr);
76 
77  if (!node->id) {
78  return;
79  }
80 
81  uiItemR(layout, ptr, "distortion_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE);
82 }
83 
84 } // namespace blender::nodes::node_composite_moviedistortion_cc
85 
87 {
89 
90  static bNodeType ntype;
91 
95  ntype.labelfunc = file_ns::label;
98 
99  nodeRegisterType(&ntype);
100 }
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1090
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
#define CMP_NODE_MOVIEDISTORTION
Definition: BKE_node.h:1260
#define NODE_CLASS_DISTORT
Definition: BKE_node.h:353
void node_type_storage(struct bNodeType *ntype, const char *storagename, void(*freefunc)(struct bNode *node), void(*copyfunc)(struct bNodeTree *dest_ntree, struct bNode *dest_node, const struct bNode *src_node))
Definition: node.cc:4426
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1357
struct MovieDistortion * BKE_tracking_distortion_copy(struct MovieDistortion *distortion)
Definition: tracking.c:2347
void BKE_tracking_distortion_free(struct MovieDistortion *distortion)
Definition: tracking.c:2450
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
Definition: string.c:64
#define UNUSED(x)
#define IFACE_(msgid)
#define C
Definition: RandGen.cpp:25
@ UI_ITEM_R_SPLIT_EMPTY_NAME
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void uiTemplateID(uiLayout *layout, const struct bContext *C, struct PointerRNA *ptr, const char *propname, const char *newop, const char *openop, const char *unlinkop, int filter, bool live_icon, const char *text)
@ UI_TEMPLATE_ID_FILTER_ALL
OperationNode * node
const char * label
Scene scene
bNodeTree * ntree
static void label(const bNodeTree *UNUSED(ntree), const bNode *node, char *label, int maxlen)
static void init(const bContext *C, PointerRNA *ptr)
static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
static void node_composit_buts_moviedistortion(uiLayout *layout, bContext *C, PointerRNA *ptr)
static void cmp_node_moviedistortion_declare(NodeDeclarationBuilder &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
void register_node_type_cmp_moviedistortion()
void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass)
Definition: DNA_ID.h:368
void * data
Definition: RNA_types.h:38
struct MovieClip * clip
Defines a node type.
Definition: BKE_node.h:226
void(* initfunc_api)(const struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:279
void(* labelfunc)(const struct bNodeTree *ntree, const struct bNode *node, char *label, int maxlen)
Definition: BKE_node.h:256
void(* draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:244
NodeDeclareFunction declare
Definition: BKE_node.h:324
void * storage
#define N_(msgid)
PointerRNA * ptr
Definition: wm_files.c:3480