[Bf-blender-cvs] [205d750a634] blender2.8: Depsgraph: Use explicit bmain pointer passed to layer utilities

Sergey Sharybin noreply at git.blender.org
Mon Jul 10 16:49:44 CEST 2017


Commit: 205d750a634c2ed8d02ebc8ffbf8d653769d9a79
Author: Sergey Sharybin
Date:   Mon Jul 10 16:47:12 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB205d750a634c2ed8d02ebc8ffbf8d653769d9a79

Depsgraph: Use explicit bmain pointer passed to layer utilities

it is not necessarily that depsgraph is built from G.bmain.

This will solve issue reported in T51782.

===================================================================

M	source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
M	source/blender/depsgraph/intern/depsgraph.h
M	source/blender/depsgraph/intern/depsgraph_query.cc

===================================================================

diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
index 43204d5fe98..4b8d5119cf6 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc
@@ -75,6 +75,7 @@ void DepsgraphRelationBuilder::build_scene(Main *bmain, Scene *scene)
 	}
 
 	/* XXX store scene to access from DAG_get_scene */
+	m_graph->bmain = bmain;
 	m_graph->scene = scene;
 
 	/* scene objects */
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index 9785d2f90d0..50c55bc0cf9 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -42,6 +42,7 @@
 
 struct ID;
 struct GHash;
+struct Main;
 struct GSet;
 struct PointerRNA;
 struct PropertyRNA;
@@ -164,8 +165,8 @@ struct Depsgraph {
 	SpinLock lock;
 
 	// XXX: additional stuff like eval contexts, mempools for allocating nodes from, etc.
-
-	Scene *scene; /* XXX: We really shouldn't do that, but it's required for shader preview */
+	Main *bmain;  /* XXX: For until depsgraph has proper ownership. */
+	Scene *scene; /* XXX: We really shouldn't do that, but it's required for shader preview. */
 };
 
 }  // namespace DEG
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index 0c876324210..b0ec4575fc5 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -91,8 +91,9 @@ Scene *DEG_get_scene(Depsgraph *graph)
 SceneLayer *DEG_get_scene_layer(Depsgraph *graph)
 {
 	Scene *scene = DEG_get_scene(graph);
-	if (scene) {
-		return BKE_scene_layer_context_active(scene);
+	if (scene != NULL) {
+		DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(graph);
+		return BKE_scene_layer_context_active_ex(deg_graph->bmain, scene);
 	}
 	return NULL;
 }




More information about the Bf-blender-cvs mailing list