Blender  V2.93
node_composite_movieclip.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 
30  {SOCK_RGBA, N_("Image")},
31  {SOCK_FLOAT, N_("Alpha")},
32  {SOCK_FLOAT, N_("Offset X")},
33  {SOCK_FLOAT, N_("Offset Y")},
34  {SOCK_FLOAT, N_("Scale")},
35  {SOCK_FLOAT, N_("Angle")},
36  {-1, ""},
37 };
38 
39 static void init(const bContext *C, PointerRNA *ptr)
40 {
41  bNode *node = ptr->data;
43  MovieClipUser *user = MEM_callocN(sizeof(MovieClipUser), "node movie clip user");
44 
45  node->id = (ID *)scene->clip;
46  id_us_plus(node->id);
47  node->storage = user;
48  user->framenr = 1;
49 }
50 
52 {
53  static bNodeType ntype;
54 
57  ntype.initfunc_api = init;
59  &ntype, "MovieClipUser", node_free_standard_storage, node_copy_standard_storage);
60 
61  nodeRegisterType(&ntype);
62 }
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 CMP_NODE_MOVIECLIP
Definition: BKE_node.h:1193
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
#define NODE_CLASS_INPUT
Definition: BKE_node.h:334
void nodeRegisterType(struct bNodeType *ntype)
Definition: node.cc:1298
#define N_(msgid)
#define NODE_PREVIEW
@ SOCK_FLOAT
@ SOCK_RGBA
#define C
Definition: RandGen.cpp:39
OperationNode * node
Scene scene
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:45
static void init(const bContext *C, PointerRNA *ptr)
void register_node_type_cmp_movieclip(void)
static bNodeSocketTemplate cmp_node_movieclip_out[]
void cmp_node_type_base(bNodeType *ntype, int type, const char *name, short nclass, short flag)
void node_copy_standard_storage(bNodeTree *UNUSED(dest_ntree), bNode *dest_node, const bNode *src_node)
Definition: node_util.c:67
void node_free_standard_storage(bNode *node)
Definition: node_util.c:55
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
PointerRNA * ptr
Definition: wm_files.c:3157