Blender  V2.93
node_composite_moviedistortion.c
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2011 Blender Foundation.
17  * All rights reserved.
18  */
19 
24 #include "node_composite_util.h"
25 
26 #include "BKE_context.h"
27 #include "BKE_lib_id.h"
28 
29 /* **************** Translate ******************** */
30 
32  {SOCK_RGBA, N_("Image"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f},
33  {-1, ""},
34 };
35 
37  {SOCK_RGBA, N_("Image")},
38  {-1, ""},
39 };
40 
41 static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
42 {
43  if (node->custom1 == 0) {
44  BLI_strncpy(label, IFACE_("Undistortion"), maxlen);
45  }
46  else {
47  BLI_strncpy(label, IFACE_("Distortion"), maxlen);
48  }
49 }
50 
51 static void init(const bContext *C, PointerRNA *ptr)
52 {
53  bNode *node = ptr->data;
55 
56  node->id = (ID *)scene->clip;
57  id_us_plus(node->id);
58 }
59 
60 static void storage_free(bNode *node)
61 {
62  if (node->storage) {
64  }
65 
66  node->storage = NULL;
67 }
68 
69 static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
70 {
71  if (src_node->storage) {
72  dest_node->storage = BKE_tracking_distortion_copy(src_node->storage);
73  }
74 }
75 
77 {
78  static bNodeType ntype;
79 
80  cmp_node_type_base(&ntype, CMP_NODE_MOVIEDISTORTION, "Movie Distortion", NODE_CLASS_DISTORT, 0);
82  node_type_label(&ntype, label);
83 
84  ntype.initfunc_api = init;
86 
87  nodeRegisterType(&ntype);
88 }
struct Scene * CTX_data_scene(const bContext *C)
Definition: context.c:1034
void id_us_plus(struct ID *id)
Definition: lib_id.c:288
void node_type_socket_templates(struct bNodeType *ntype, struct bNodeSocketTemplate *inputs, struct bNodeSocketTemplate *outputs)
Definition: node.cc:4527
#define NODE_CLASS_DISTORT
Definition: BKE_node.h:343
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:4599
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1298
void node_type_label(struct bNodeType *ntype, void(*labelfunc)(struct bNodeTree *ntree, struct bNode *, char *label, int maxlen))
struct MovieDistortion * BKE_tracking_distortion_copy(struct MovieDistortion *distortion)
Definition: tracking.c:2450
void BKE_tracking_distortion_free(struct MovieDistortion *distortion)
Definition: tracking.c:2553
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
Definition: string.c:108
#define UNUSED(x)
#define IFACE_(msgid)
#define N_(msgid)
@ SOCK_RGBA
Group RGB to Bright Vector Camera Vector Combine Material Light Line Style Layer Add Ambient Diffuse Glossy Refraction Transparent Toon Principled Hair Volume Principled Light Particle Volume Image Sky Noise Wave Voronoi Brick Texture Vector Combine Vertex Separate Vector White RGB Map Separate Set Z Dilate Combine Combine Color Channel Split ID Combine Luminance Directional Alpha Distance Hue CMP_NODE_MOVIEDISTORTION
#define C
Definition: RandGen.cpp:39
OperationNode * node
Scene scene
bNodeTree * ntree
static void init(const bContext *C, PointerRNA *ptr)
static void storage_free(bNode *node)
static void label(bNodeTree *UNUSED(ntree), bNode *node, char *label, int maxlen)
static bNodeSocketTemplate cmp_node_moviedistortion_out[]
void register_node_type_cmp_moviedistortion(void)
static bNodeSocketTemplate cmp_node_moviedistortion_in[]
static void storage_copy(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
Definition: DNA_ID.h:273
void * data
Definition: RNA_types.h:52
struct MovieClip * clip
Compact definition of a node socket.
Definition: BKE_node.h:95
Defines a node type.
Definition: BKE_node.h:221
void(* initfunc_api)(const struct bContext *C, struct PointerRNA *ptr)
Definition: BKE_node.h:288
void * storage
PointerRNA * ptr
Definition: wm_files.c:3157