Depsgraph: Move ID node to own file
authorSergey Sharybin <sergey.vfx@gmail.com>
Wed, 20 Dec 2017 15:35:48 +0000 (16:35 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Wed, 20 Dec 2017 15:35:48 +0000 (16:35 +0100)
22 files changed:
source/blender/depsgraph/CMakeLists.txt
source/blender/depsgraph/intern/builder/deg_builder.cc
source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
source/blender/depsgraph/intern/builder/deg_builder_relations.cc
source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
source/blender/depsgraph/intern/debug/deg_debug_graphviz.cc
source/blender/depsgraph/intern/depsgraph.cc
source/blender/depsgraph/intern/depsgraph_build.cc
source/blender/depsgraph/intern/depsgraph_debug.cc
source/blender/depsgraph/intern/depsgraph_query.cc
source/blender/depsgraph/intern/depsgraph_query_foreach.cc
source/blender/depsgraph/intern/depsgraph_tag.cc
source/blender/depsgraph/intern/eval/deg_eval.cc
source/blender/depsgraph/intern/eval/deg_eval_flush.cc
source/blender/depsgraph/intern/nodes/deg_node.cc
source/blender/depsgraph/intern/nodes/deg_node.h
source/blender/depsgraph/intern/nodes/deg_node_component.cc
source/blender/depsgraph/intern/nodes/deg_node_component.h
source/blender/depsgraph/intern/nodes/deg_node_id.cc [new file with mode: 0644]
source/blender/depsgraph/intern/nodes/deg_node_id.h [new file with mode: 0644]
source/blender/depsgraph/intern/nodes/deg_node_operation.cc
source/blender/depsgraph/intern/nodes/deg_node_operation.h

index 868a26ae82130b4826497a8bfb612c86cb81a45d..232fc93aeb45fbcbf73bb69ee3108c7413eb1622 100644 (file)
@@ -56,6 +56,7 @@ set(SRC
        intern/eval/deg_eval_flush.cc
        intern/nodes/deg_node.cc
        intern/nodes/deg_node_component.cc
+       intern/nodes/deg_node_id.cc
        intern/nodes/deg_node_operation.cc
        intern/nodes/deg_node_time.cc
        intern/depsgraph.cc
@@ -83,6 +84,7 @@ set(SRC
        intern/eval/deg_eval_flush.h
        intern/nodes/deg_node.h
        intern/nodes/deg_node_component.h
+       intern/nodes/deg_node_id.h
        intern/nodes/deg_node_operation.h
        intern/nodes/deg_node_time.h
        intern/depsgraph.h
index c79716e5ea5b979e623224bfb37d08bad310ea6f..5713297d65864054692d05e3824f93664468b76f 100644 (file)
@@ -42,6 +42,7 @@
 #include "intern/depsgraph_types.h"
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 
 #include "util/deg_util_foreach.h"
index 6de6feb32f26fbbf5dcb4663a8eb22b1a6c01031..85e80f80d262d482f87d6563568048158164acae 100644 (file)
@@ -105,9 +105,11 @@ extern "C" {
 #include "intern/builder/deg_builder.h"
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 #include "intern/depsgraph_types.h"
 #include "intern/depsgraph_intern.h"
+
 #include "util/deg_util_foreach.h"
 
 namespace DEG {
index 2266469c69171af60588288eeeccee6f4036befd..0546d43af72fe6956643aec9869c7e949331c0f2 100644 (file)
@@ -103,6 +103,7 @@ extern "C" {
 
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 #include "intern/nodes/deg_node_time.h"
 
index feb32442cb7163d997679890f845e5b916e04244..29c739bf784ff504797e4dede8357c05a1d5042c 100644 (file)
@@ -58,6 +58,7 @@ extern "C" {
 
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 
 #include "intern/depsgraph_intern.h"
index 4f6b301bf9e9eddf9676f5c50982b5d36396ee65..159e9bcf9a7a3b0035933d3fa4463cffd076cc08 100644 (file)
@@ -41,6 +41,7 @@ extern "C" {
 #include "DEG_depsgraph_debug.h"
 
 #include "intern/depsgraph_intern.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_time.h"
 
 #include "util/deg_util_foreach.h"
index b71e1e1cd4e643e54547727b2677ec6cbb46f1af..c4841d6789eacf90dd3a7ca9aea9a880d9ddb0d2 100644 (file)
@@ -58,6 +58,7 @@ extern "C" {
 
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 #include "intern/nodes/deg_node_time.h"
 
index 4b3d4190dcd53257056b4a46f050c4e076f4cb1b..3884cfe49e7c50f3154de62c9dea1247a61a2d7f 100644 (file)
@@ -66,6 +66,7 @@ extern "C" {
 
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 
 #include "intern/depsgraph_types.h"
index 4290ea121124ae193085fe0f7d4f9774901fa400..b7bf63e0cb08be789dde0e9b6d7a9474d3c16ff3 100644 (file)
@@ -42,6 +42,7 @@ extern "C" {
 #include "DEG_depsgraph_build.h"
 
 #include "intern/depsgraph_intern.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_time.h"
 
 #include "util/deg_util_foreach.h"
index e58a7a324072a11d6f4ff4c651fe3f49e32040f8..9b1961baa48e5f2d540569e6b48fb6b197675035 100644 (file)
@@ -40,6 +40,7 @@ extern "C" {
 #include "DEG_depsgraph_query.h"
 
 #include "intern/depsgraph_intern.h"
+#include "intern/nodes/deg_node_id.h"
 
 bool DEG_id_type_tagged(Main *bmain, short idtype)
 {
index f2a121f3d07c512552ccfcf104c4605ec0e8310d..65d8f58b851a28904c6f49b4077ac2266dd48252 100644 (file)
@@ -50,6 +50,7 @@ extern "C" {
 
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 
 #include "util/deg_util_foreach.h"
index 2979cf7270d0e2d2252f054e444887be5c6d905c..7f08f3f805226c8d7edb83f4baa1be26c82e8c75 100644 (file)
@@ -61,6 +61,7 @@ extern "C" {
 #include "intern/eval/deg_eval_flush.h"
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 
 #include "intern/depsgraph_intern.h"
index dfd2b723c018896c03e7a033d8a6472986c83bd6..16e5fc9b4a52875d3861fd13a035b58508d117fb 100644 (file)
@@ -50,6 +50,7 @@ extern "C" {
 #include "intern/eval/deg_eval_flush.h"
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 #include "intern/nodes/deg_node_time.h"
 #include "intern/depsgraph.h"
index 219ed981870059d1ecce8b213768c10fdcc630bc..63d010849c3661f0dcaee36d70b23b3941f6e4af 100644 (file)
@@ -47,6 +47,7 @@ extern "C" {
 
 #include "intern/nodes/deg_node.h"
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 
 #include "intern/depsgraph_intern.h"
index 82c676524354ea01f2f5d206ca883f32f3e3fa8a..c558777aa67ac12975fe95660d595b45cc1654ca 100644 (file)
@@ -46,6 +46,7 @@ extern "C" {
 #include "DEG_depsgraph.h"
 
 #include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 #include "intern/nodes/deg_node_time.h"
 #include "intern/depsgraph_intern.h"
@@ -101,142 +102,11 @@ string DepsNode::identifier() const
        return string(typebuf) + " : " + name;
 }
 
-/* ************* */
 /* Generic Nodes */
 
-/* Time Source Node ======================================= */
-
 DEG_DEPSNODE_DEFINE(TimeSourceDepsNode, DEG_NODE_TYPE_TIMESOURCE, "Time Source");
 static DepsNodeFactoryImpl<TimeSourceDepsNode> DNTI_TIMESOURCE;
 
-/* ID Node ================================================ */
-
-IDDepsNode::ComponentIDKey::ComponentIDKey(eDepsNode_Type type,
-                                           const char *name)
-        : type(type), name(name)
-{
-}
-
-bool IDDepsNode::ComponentIDKey::operator== (const ComponentIDKey &other) const
-{
-    return type == other.type &&
-           STREQ(name, other.name);
-}
-
-static unsigned int id_deps_node_hash_key(const void *key_v)
-{
-       const IDDepsNode::ComponentIDKey *key =
-               reinterpret_cast<const IDDepsNode::ComponentIDKey *>(key_v);
-       return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(key->type),
-                                         BLI_ghashutil_strhash_p(key->name));
-}
-
-static bool id_deps_node_hash_key_cmp(const void *a, const void *b)
-{
-       const IDDepsNode::ComponentIDKey *key_a =
-               reinterpret_cast<const IDDepsNode::ComponentIDKey *>(a);
-       const IDDepsNode::ComponentIDKey *key_b =
-               reinterpret_cast<const IDDepsNode::ComponentIDKey *>(b);
-       return !(*key_a == *key_b);
-}
-
-static void id_deps_node_hash_key_free(void *key_v)
-{
-       typedef IDDepsNode::ComponentIDKey ComponentIDKey;
-       ComponentIDKey *key = reinterpret_cast<ComponentIDKey *>(key_v);
-       OBJECT_GUARDED_DELETE(key, ComponentIDKey);
-}
-
-static void id_deps_node_hash_value_free(void *value_v)
-{
-       ComponentDepsNode *comp_node = reinterpret_cast<ComponentDepsNode *>(value_v);
-       OBJECT_GUARDED_DELETE(comp_node, ComponentDepsNode);
-}
-
-/* Initialize 'id' node - from pointer data given. */
-void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
-{
-       /* Store ID-pointer. */
-       BLI_assert(id != NULL);
-       this->id = (ID *)id;
-       this->layers = (1 << 20) - 1;
-       this->eval_flags = 0;
-
-       /* For object we initialize layers to layer from base. */
-       if (GS(id->name) == ID_OB) {
-               this->layers = 0;
-       }
-
-       components = BLI_ghash_new(id_deps_node_hash_key,
-                                  id_deps_node_hash_key_cmp,
-                                  "Depsgraph id components hash");
-
-       /* NOTE: components themselves are created if/when needed.
-        * This prevents problems with components getting added
-        * twice if an ID-Ref needs to be created to house it...
-        */
-}
-
-/* Free 'id' node. */
-IDDepsNode::~IDDepsNode()
-{
-       BLI_ghash_free(components,
-                      id_deps_node_hash_key_free,
-                      id_deps_node_hash_value_free);
-}
-
-ComponentDepsNode *IDDepsNode::find_component(eDepsNode_Type type,
-                                              const char *name) const
-{
-       ComponentIDKey key(type, name);
-       return reinterpret_cast<ComponentDepsNode *>(BLI_ghash_lookup(components, &key));
-}
-
-ComponentDepsNode *IDDepsNode::add_component(eDepsNode_Type type,
-                                             const char *name)
-{
-       ComponentDepsNode *comp_node = find_component(type, name);
-       if (!comp_node) {
-               DepsNodeFactory *factory = deg_type_get_factory(type);
-               comp_node = (ComponentDepsNode *)factory->create_node(this->id, "", name);
-
-               /* Register. */
-               ComponentIDKey *key = OBJECT_GUARDED_NEW(ComponentIDKey, type, name);
-               BLI_ghash_insert(components, key, comp_node);
-               comp_node->owner = this;
-       }
-       return comp_node;
-}
-
-void IDDepsNode::tag_update(Depsgraph *graph)
-{
-       GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
-       {
-               /* TODO(sergey): What about drievrs? */
-               bool do_component_tag = comp_node->type != DEG_NODE_TYPE_ANIMATION;
-               if (comp_node->type == DEG_NODE_TYPE_ANIMATION) {
-                       AnimData *adt = BKE_animdata_from_id(id);
-                       /* Animation data might be null if relations are tagged for update. */
-                       if (adt != NULL && (adt->recalc & ADT_RECALC_ANIM)) {
-                               do_component_tag = true;
-                       }
-               }
-               if (do_component_tag) {
-                       comp_node->tag_update(graph);
-               }
-       }
-       GHASH_FOREACH_END();
-}
-
-void IDDepsNode::finalize_build()
-{
-       GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
-       {
-               comp_node->finalize_build();
-       }
-       GHASH_FOREACH_END();
-}
-
 DEG_DEPSNODE_DEFINE(IDDepsNode, DEG_NODE_TYPE_ID_REF, "ID Node");
 static DepsNodeFactoryImpl<IDDepsNode> DNTI_ID_REF;
 
index 8f2cc3f374b961cfc6abce192ca72bb1d40edd2d..54042ae4a1b7d121fba4ca75bb3e84ba17cd2114 100644 (file)
@@ -109,51 +109,6 @@ struct DepsNode {
 #define DEG_DEPSNODE_DEFINE(NodeType, type_, tname_) \
        const DepsNode::TypeInfo NodeType::typeinfo = DepsNode::TypeInfo(type_, tname_)
 
-/* Generic Nodes ======================= */
-
-struct ComponentDepsNode;
-struct IDDepsNode;
-
-/* ID-Block Reference */
-struct IDDepsNode : public DepsNode {
-       struct ComponentIDKey {
-               ComponentIDKey(eDepsNode_Type type, const char *name = "");
-               bool operator==(const ComponentIDKey &other) const;
-
-               eDepsNode_Type type;
-               const char *name;
-       };
-
-       void init(const ID *id, const char *subdata);
-       ~IDDepsNode();
-
-       ComponentDepsNode *find_component(eDepsNode_Type type,
-                                         const char *name = "") const;
-       ComponentDepsNode *add_component(eDepsNode_Type type,
-                                        const char *name = "");
-
-       void tag_update(Depsgraph *graph);
-
-       void finalize_build();
-
-       /* ID Block referenced. */
-       ID *id;
-
-       /* Hash to make it faster to look up components. */
-       GHash *components;
-
-       /* Layers of this node with accumulated layers of it's output relations. */
-       unsigned int layers;
-
-       /* Additional flags needed for scene evaluation.
-        * TODO(sergey): Only needed for until really granular updates
-        * of all the entities.
-        */
-       int eval_flags;
-
-       DEG_DEPSNODE_DECLARE;
-};
-
 void deg_register_base_depsnodes();
 
 }  // namespace DEG
index 8ac73671678230cf1789184dc27b90effe6c1cb2..9450ed7f17d78360f0e49038973a186ba5de9a33 100644 (file)
@@ -42,6 +42,7 @@ extern "C" {
 #include "BKE_action.h"
 } /* extern "C" */
 
+#include "intern/nodes/deg_node_id.h"
 #include "intern/nodes/deg_node_operation.h"
 #include "intern/depsgraph_intern.h"
 #include "util/deg_util_foreach.h"
index 702697eba3a61a8f53f92dec96f447e8107b925d..c6625e5585719e702cf245f15c808e9ed3d1ccdf 100644 (file)
@@ -46,6 +46,7 @@ namespace DEG {
 struct Depsgraph;
 struct OperationDepsNode;
 struct BoneComponentDepsNode;
+struct IDDepsNode;
 
 /* ID Component - Base type for all components */
 struct ComponentDepsNode : public DepsNode {
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_id.cc b/source/blender/depsgraph/intern/nodes/deg_node_id.cc
new file mode 100644 (file)
index 0000000..fc77879
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/depsgraph/intern/nodes/deg_node_id.cc
+ *  \ingroup depsgraph
+ */
+
+#include "intern/nodes/deg_node_id.h"
+
+#include <stdio.h>
+#include <cstring>  /* required for STREQ later on. */
+
+#include "BLI_utildefines.h"
+#include "BLI_ghash.h"
+
+extern "C" {
+#include "DNA_ID.h"
+#include "DNA_anim_types.h"
+
+#include "BKE_animsys.h"
+}
+
+#include "DEG_depsgraph.h"
+
+#include "intern/nodes/deg_node_component.h"
+#include "intern/nodes/deg_node_operation.h"
+#include "intern/nodes/deg_node_time.h"
+#include "intern/depsgraph_intern.h"
+
+#include "util/deg_util_foreach.h"
+
+namespace DEG {
+
+IDDepsNode::ComponentIDKey::ComponentIDKey(eDepsNode_Type type,
+                                           const char *name)
+        : type(type), name(name)
+{
+}
+
+bool IDDepsNode::ComponentIDKey::operator== (const ComponentIDKey &other) const
+{
+    return type == other.type &&
+           STREQ(name, other.name);
+}
+
+static unsigned int id_deps_node_hash_key(const void *key_v)
+{
+       const IDDepsNode::ComponentIDKey *key =
+               reinterpret_cast<const IDDepsNode::ComponentIDKey *>(key_v);
+       return BLI_ghashutil_combine_hash(BLI_ghashutil_uinthash(key->type),
+                                         BLI_ghashutil_strhash_p(key->name));
+}
+
+static bool id_deps_node_hash_key_cmp(const void *a, const void *b)
+{
+       const IDDepsNode::ComponentIDKey *key_a =
+               reinterpret_cast<const IDDepsNode::ComponentIDKey *>(a);
+       const IDDepsNode::ComponentIDKey *key_b =
+               reinterpret_cast<const IDDepsNode::ComponentIDKey *>(b);
+       return !(*key_a == *key_b);
+}
+
+static void id_deps_node_hash_key_free(void *key_v)
+{
+       typedef IDDepsNode::ComponentIDKey ComponentIDKey;
+       ComponentIDKey *key = reinterpret_cast<ComponentIDKey *>(key_v);
+       OBJECT_GUARDED_DELETE(key, ComponentIDKey);
+}
+
+static void id_deps_node_hash_value_free(void *value_v)
+{
+       ComponentDepsNode *comp_node = reinterpret_cast<ComponentDepsNode *>(value_v);
+       OBJECT_GUARDED_DELETE(comp_node, ComponentDepsNode);
+}
+
+/* Initialize 'id' node - from pointer data given. */
+void IDDepsNode::init(const ID *id, const char *UNUSED(subdata))
+{
+       /* Store ID-pointer. */
+       BLI_assert(id != NULL);
+       this->id = (ID *)id;
+       this->layers = (1 << 20) - 1;
+       this->eval_flags = 0;
+
+       /* For object we initialize layers to layer from base. */
+       if (GS(id->name) == ID_OB) {
+               this->layers = 0;
+       }
+
+       components = BLI_ghash_new(id_deps_node_hash_key,
+                                  id_deps_node_hash_key_cmp,
+                                  "Depsgraph id components hash");
+
+       /* NOTE: components themselves are created if/when needed.
+        * This prevents problems with components getting added
+        * twice if an ID-Ref needs to be created to house it...
+        */
+}
+
+/* Free 'id' node. */
+IDDepsNode::~IDDepsNode()
+{
+       BLI_ghash_free(components,
+                      id_deps_node_hash_key_free,
+                      id_deps_node_hash_value_free);
+}
+
+ComponentDepsNode *IDDepsNode::find_component(eDepsNode_Type type,
+                                              const char *name) const
+{
+       ComponentIDKey key(type, name);
+       return reinterpret_cast<ComponentDepsNode *>(BLI_ghash_lookup(components, &key));
+}
+
+ComponentDepsNode *IDDepsNode::add_component(eDepsNode_Type type,
+                                             const char *name)
+{
+       ComponentDepsNode *comp_node = find_component(type, name);
+       if (!comp_node) {
+               DepsNodeFactory *factory = deg_type_get_factory(type);
+               comp_node = (ComponentDepsNode *)factory->create_node(this->id, "", name);
+
+               /* Register. */
+               ComponentIDKey *key = OBJECT_GUARDED_NEW(ComponentIDKey, type, name);
+               BLI_ghash_insert(components, key, comp_node);
+               comp_node->owner = this;
+       }
+       return comp_node;
+}
+
+void IDDepsNode::tag_update(Depsgraph *graph)
+{
+       GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
+       {
+               /* TODO(sergey): What about drievrs? */
+               bool do_component_tag = comp_node->type != DEG_NODE_TYPE_ANIMATION;
+               if (comp_node->type == DEG_NODE_TYPE_ANIMATION) {
+                       AnimData *adt = BKE_animdata_from_id(id);
+                       /* Animation data might be null if relations are tagged for update. */
+                       if (adt != NULL && (adt->recalc & ADT_RECALC_ANIM)) {
+                               do_component_tag = true;
+                       }
+               }
+               if (do_component_tag) {
+                       comp_node->tag_update(graph);
+               }
+       }
+       GHASH_FOREACH_END();
+}
+
+void IDDepsNode::finalize_build()
+{
+       GHASH_FOREACH_BEGIN(ComponentDepsNode *, comp_node, components)
+       {
+               comp_node->finalize_build();
+       }
+       GHASH_FOREACH_END();
+}
+
+}  // namespace DEG
diff --git a/source/blender/depsgraph/intern/nodes/deg_node_id.h b/source/blender/depsgraph/intern/nodes/deg_node_id.h
new file mode 100644 (file)
index 0000000..5502291
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Original Author: Joshua Leung
+ * Contributor(s): None Yet
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file depsgraph/intern/nodes/deg_node_id.h
+ *  \ingroup depsgraph
+ */
+
+#pragma once
+
+#include "intern/nodes/deg_node.h"
+
+namespace DEG {
+
+struct ComponentDepsNode;
+
+/* ID-Block Reference */
+struct IDDepsNode : public DepsNode {
+       struct ComponentIDKey {
+               ComponentIDKey(eDepsNode_Type type, const char *name = "");
+               bool operator==(const ComponentIDKey &other) const;
+
+               eDepsNode_Type type;
+               const char *name;
+       };
+
+       void init(const ID *id, const char *subdata);
+       ~IDDepsNode();
+
+       ComponentDepsNode *find_component(eDepsNode_Type type,
+                                         const char *name = "") const;
+       ComponentDepsNode *add_component(eDepsNode_Type type,
+                                        const char *name = "");
+
+       void tag_update(Depsgraph *graph);
+
+       void finalize_build();
+
+       /* ID Block referenced. */
+       ID *id;
+
+       /* Hash to make it faster to look up components. */
+       GHash *components;
+
+       /* Layers of this node with accumulated layers of it's output relations. */
+       unsigned int layers;
+
+       /* Additional flags needed for scene evaluation.
+        * TODO(sergey): Only needed for until really granular updates
+        * of all the entities.
+        */
+       int eval_flags;
+
+       DEG_DEPSNODE_DECLARE;
+};
+
+}  // namespace DEG
index 7467264f61278078336f7bd56ce20955fcbd6c0c..0fc87a52005e0033b3ee09c8c587ef2d097277a8 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "intern/depsgraph.h"
 #include "intern/depsgraph_intern.h"
+#include "intern/nodes/deg_node_id.h"
 
 namespace DEG {
 
index d8203540fc5ca4b02c715b6efb017884090f675e..ffb95a53b5d5658793d8d70012976f34c7fbd02f 100644 (file)
@@ -38,6 +38,8 @@ struct Depsgraph;
 
 namespace DEG {
 
+struct ComponentDepsNode;
+
 /* Flags for Depsgraph Nodes */
 typedef enum eDepsOperation_Flag {
        /* node needs to be updated */