[Bf-blender-cvs] [5aaef90] depsgraph_refactor: World node building.
Lukas Tönne
noreply at git.blender.org
Wed Apr 9 16:49:25 CEST 2014
Commit: 5aaef90383070383f6a226abb430ae483b78b1fd
Author: Lukas Tönne
Date: Wed Apr 9 15:14:19 2014 +0200
https://developer.blender.org/rB5aaef90383070383f6a226abb430ae483b78b1fd
World node building.
===================================================================
M source/blender/depsgraph/intern/depsgraph_build.h
M source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
M source/blender/depsgraph/intern/depsgraph_build_relations.cpp
M source/blender/depsgraph/util/depsgraph_util_id.h
===================================================================
diff --git a/source/blender/depsgraph/intern/depsgraph_build.h b/source/blender/depsgraph/intern/depsgraph_build.h
index b81f524..6ceb52b 100644
--- a/source/blender/depsgraph/intern/depsgraph_build.h
+++ b/source/blender/depsgraph/intern/depsgraph_build.h
@@ -70,7 +70,7 @@ struct DepsgraphNodeBuilder {
void build_rigidbody(Scene *scene);
void build_animdata(IDDepsNode *id_node);
OperationDepsNode *build_driver(ComponentDepsNode *adt_node, FCurve *fcurve);
- void build_world(Scene *scene, World *world);
+ void build_world(World *world);
void build_compositor(Scene *scene);
private:
diff --git a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
index 3b4e3eb..2c71480 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_nodes.cpp
@@ -104,21 +104,6 @@ extern "C" {
/* ************************************************* */
/* Node Builder */
-static bool is_id_tagged(ConstIDPtr id)
-{
- return id->flag & LIB_DOIT;
-}
-
-static void id_tag_set(IDPtr id)
-{
- id->flag |= LIB_DOIT;
-}
-
-static void id_tag_clear(IDPtr id)
-{
- id->flag &= ~LIB_DOIT;
-}
-
IDDepsNode *DepsgraphNodeBuilder::build_scene(Scene *scene)
{
IDDepsNode *scene_node = add_id_node(scene);
@@ -157,7 +142,7 @@ IDDepsNode *DepsgraphNodeBuilder::build_scene(Scene *scene)
/* tagged groups */
for (Group *group = (Group *)m_bmain->group.first; group; group = (Group *)group->id.next) {
- if (is_id_tagged(group)) {
+ if (id_is_tagged(group)) {
// TODO: we need to make this group reliant on the object that spawned it...
build_subgraph(group);
@@ -177,7 +162,7 @@ IDDepsNode *DepsgraphNodeBuilder::build_scene(Scene *scene)
/* world */
if (scene->world) {
- build_world(scene, scene->world);
+ build_world(scene->world);
}
/* compo nodes */
@@ -367,9 +352,33 @@ OperationDepsNode *DepsgraphNodeBuilder::build_driver(ComponentDepsNode *adt_nod
return driver_op;
}
-void DepsgraphNodeBuilder::build_world(Scene *scene, World *world)
+/* Recursively build graph for world */
+void DepsgraphNodeBuilder::build_world(World *world)
{
+ /* Prevent infinite recursion by checking (and tagging the world) as having been visited
+ * already. This assumes wo->id.flag & LIB_DOIT isn't set by anything else
+ * in the meantime... [#32017]
+ */
+ if (id_is_tagged(world))
+ return;
+ id_tag_set(world);
+
+ /* world itself */
+ IDDepsNode *world_node = add_id_node(world); /* world shading/params? */
+
+ build_animdata(world_node);
+ /* TODO: other settings? */
+
+ /* textures */
+// deg_build_texture_stack_graph(graph, scene, owner_component, wo->mtex);
+
+ /* world's nodetree */
+ if (world->nodetree) {
+// deg_build_nodetree_graph(graph, scene, owner_component, wo->nodetree);
+ }
+
+ id_tag_clear(world);
}
void DepsgraphNodeBuilder::build_compositor(Scene *scene)
diff --git a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
index 6da8f7c..6b731f8 100644
--- a/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
+++ b/source/blender/depsgraph/intern/depsgraph_build_relations.cpp
@@ -449,7 +449,27 @@ void DepsgraphRelationBuilder::build_driver(IDPtr id, FCurve *fcurve)
void DepsgraphRelationBuilder::build_world(Scene *scene, World *world)
{
+ /* Prevent infinite recursion by checking (and tagging the world) as having been visited
+ * already. This assumes wo->id.flag & LIB_DOIT isn't set by anything else
+ * in the meantime... [#32017]
+ */
+ if (id_is_tagged(world))
+ return;
+ id_tag_set(world);
+
+ build_animdata(world);
+
+ /* TODO: other settings? */
+ /* textures */
+// deg_build_texture_stack_graph(graph, scene, owner_component, wo->mtex);
+
+ /* world's nodetree */
+ if (world->nodetree) {
+// deg_build_nodetree_graph(graph, scene, owner_component, wo->nodetree);
+ }
+
+ id_tag_clear(world);
}
void DepsgraphRelationBuilder::build_compositor(Scene *scene)
diff --git a/source/blender/depsgraph/util/depsgraph_util_id.h b/source/blender/depsgraph/util/depsgraph_util_id.h
index 63c67fb..c092730 100644
--- a/source/blender/depsgraph/util/depsgraph_util_id.h
+++ b/source/blender/depsgraph/util/depsgraph_util_id.h
@@ -25,6 +25,10 @@
#ifndef __DEPSGRAPH_UTIL_ID_H__
#define __DEPSGRAPH_UTIL_ID_H__
+extern "C" {
+#include "BLI_utildefines.h"
+}
+
/* Helper types for handling ID subtypes in C
*
* These can be casted implicitly from/to ID*
@@ -65,4 +69,20 @@ private:
const ID *m_ptr;
};
+
+BLI_INLINE bool id_is_tagged(ConstIDPtr id)
+{
+ return id->flag & LIB_DOIT;
+}
+
+BLI_INLINE void id_tag_set(IDPtr id)
+{
+ id->flag |= LIB_DOIT;
+}
+
+BLI_INLINE void id_tag_clear(IDPtr id)
+{
+ id->flag &= ~LIB_DOIT;
+}
+
#endif /* __DEPSGRAPH_UTIL_ID_H__ */
More information about the Bf-blender-cvs
mailing list