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 blender/depsgraph/intern/depsgraph_intern.h
30 * API's for internal use in the Depsgraph
31 * - Also, defines for "Node Type Info"
38 #include "MEM_guardedalloc.h"
41 #include "BKE_global.h"
44 #include "intern/nodes/deg_node.h"
45 #include "intern/nodes/deg_node_component.h"
46 #include "intern/nodes/deg_node_operation.h"
47 #include "intern/depsgraph.h"
49 struct DEGEditorUpdateContext;
56 /* Node Types Handling ================================================= */
58 /* "Typeinfo" for Node Types ------------------------------------------- */
60 /* Typeinfo Struct (nti) */
61 struct DepsNodeFactory {
62 virtual eDepsNode_Type type() const = 0;
63 virtual const char *tname() const = 0;
64 virtual int id_recalc_tag() const = 0;
66 virtual DepsNode *create_node(const ID *id,
68 const char *name) const = 0;
71 template <class NodeType>
72 struct DepsNodeFactoryImpl : public DepsNodeFactory {
73 eDepsNode_Type type() const { return NodeType::typeinfo.type; }
74 const char *tname() const { return NodeType::typeinfo.tname; }
75 int id_recalc_tag() const { return NodeType::typeinfo.id_recalc_tag; }
77 DepsNode *create_node(const ID *id, const char *subdata, const char *name) const
79 DepsNode *node = OBJECT_GUARDED_NEW(NodeType);
81 /* populate base node settings */
84 if (name[0] != '\0') {
85 /* set name if provided ... */
89 /* ... otherwise use default type name */
93 node->init(id, subdata);
99 /* Typeinfo Management -------------------------------------------------- */
101 /* Register typeinfo */
102 void deg_register_node_typeinfo(DepsNodeFactory *factory);
104 /* Get typeinfo for specified type */
105 DepsNodeFactory *deg_type_get_factory(const eDepsNode_Type type);
107 /* Editors Integration -------------------------------------------------- */
109 void deg_editors_id_update(const DEGEditorUpdateContext *update_ctx,
112 void deg_editors_scene_update(const DEGEditorUpdateContext *update_ctx,
115 #define DEG_DEBUG_PRINTF(...) \
117 if (G.debug & G_DEBUG_DEPSGRAPH) { \
118 fprintf(stderr, __VA_ARGS__); \
123 #define DEG_ERROR_PRINTF(...) \
125 fprintf(stderr, __VA_ARGS__); \