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 
20 /** \file
21  * \ingroup cmpnodes
22  */
23 
24 #include "node_composite_util.h"
25 
26 static bNodeSocketTemplate cmp_node_trackpos_out[] = {
27     {SOCK_FLOAT, N_("X")},
28     {SOCK_FLOAT, N_("Y")},
29     {SOCK_VECTOR, N_("Speed"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_VELOCITY},
30     {-1, ""},
31 };
32 
init(bNodeTree * UNUSED (ntree),bNode * node)33 static void init(bNodeTree *UNUSED(ntree), bNode *node)
34 {
35   NodeTrackPosData *data = MEM_callocN(sizeof(NodeTrackPosData), "node track position data");
36 
37   node->storage = data;
38 }
39 
register_node_type_cmp_trackpos(void)40 void register_node_type_cmp_trackpos(void)
41 {
42   static bNodeType ntype;
43 
44   cmp_node_type_base(&ntype, CMP_NODE_TRACKPOS, "Track Position", NODE_CLASS_INPUT, 0);
45   node_type_socket_templates(&ntype, NULL, cmp_node_trackpos_out);
46   node_type_init(&ntype, init);
47   node_type_storage(
48       &ntype, "NodeTrackPosData", node_free_standard_storage, node_copy_standard_storage);
49 
50   nodeRegisterType(&ntype);
51 }
52