2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2013 Blender Foundation.
19 * All rights reserved.
21 * Original Author: Joshua Leung
22 * Contributor(s): None Yet
24 * ***** END GPL LICENSE BLOCK *****
27 /** \file depsgraph/intern/nodes/deg_node.h
33 #include "intern/depsgraph_types.h"
35 #include "BLI_utildefines.h"
45 struct OperationDepsNode;
47 /* *********************************** */
48 /* Base-Defines for Nodes in Depsgraph */
50 /* All nodes in Depsgraph are descended from this. */
52 /* Helper class for static typeinfo in subclasses. */
54 TypeInfo(eDepsNode_Type type, const char *tname, int id_recalc_tag = 0);
61 /* Reset all the counters. Including all stats needed for average
62 * evaluation time calculation.
65 /* Reset counters needed for the current graph evaluation, does not
66 * touch averaging accumulators.
69 /* Time spend on this node during current graph evaluation. */
72 /* Relationships between nodes
73 * The reason why all depsgraph nodes are descended from this type (apart
74 * from basic serialization benefits - from the typeinfo) is that we can have
75 * relationships between these nodes!
77 typedef vector<DepsRelation *> Relations;
79 const char *name; /* Identifier - mainly for debugging purposes. */
80 eDepsNode_Type type; /* Structural type of node. */
81 Relations inlinks; /* Nodes which this one depends on. */
82 Relations outlinks; /* Nodes which depend on this one. */
83 int done; /* Generic tags for traversal algorithms. */
84 Stats stats; /* Evaluation statistics. */
90 virtual string identifier() const;
92 virtual void init(const ID * /*id*/,
93 const char * /*subdata*/) {}
95 virtual void tag_update(Depsgraph * /*graph*/) {}
97 virtual OperationDepsNode *get_entry_operation() { return NULL; }
98 virtual OperationDepsNode *get_exit_operation() { return NULL; }
100 virtual eDepsNode_Class get_class() const;
103 /* Macros for common static typeinfo. */
104 #define DEG_DEPSNODE_DECLARE \
105 static const DepsNode::TypeInfo typeinfo
106 #define DEG_DEPSNODE_DEFINE(NodeType, type_, tname_) \
107 const DepsNode::TypeInfo NodeType::typeinfo = DepsNode::TypeInfo(type_, tname_)
109 void deg_register_base_depsnodes();