[Bf-blender-cvs] [74023d46ced] blender2.8: Implement DAG_get_scene_layer

Sergey Sharybin noreply at git.blender.org
Thu Apr 20 17:21:44 CEST 2017


Commit: 74023d46ced40f152f97727137f891f60a5b0846
Author: Sergey Sharybin
Date:   Thu Apr 20 17:09:18 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB74023d46ced40f152f97727137f891f60a5b0846

Implement DAG_get_scene_layer

Even though this will have to change once we get workspaces, we will
still have a depsgraph for the Scene.

This is required for the upcoming depsgraph.objects RNA iterator.

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

M	source/blender/depsgraph/DEG_depsgraph_query.h
M	source/blender/depsgraph/intern/depsgraph_query.cc

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

diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index ccd204a2083..01cbaf503b5 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -36,6 +36,7 @@
 struct ID;
 
 struct Depsgraph;
+struct SceneLayer;
 
 #ifdef __cplusplus
 extern "C" {
@@ -47,6 +48,9 @@ bool DEG_id_type_tagged(struct Main *bmain, short idtype);
 /* Get additional evaluation flags for the given ID. */
 short DEG_get_eval_flags_for_id(struct Depsgraph *graph, struct ID *id);
 
+/* Get scene layer the despgraph is created for. */
+struct SceneLayer *DAG_get_scene_layer(struct Depsgraph *graph);
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index 7f2f6a65f5e..7d09cdf4ac2 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -34,12 +34,16 @@
 
 extern "C" {
 #include "BKE_idcode.h"
+#include "BKE_layer.h"
 #include "BKE_main.h"
 
+#include "DNA_scene_types.h"
+
 #include "DEG_depsgraph_query.h"
 } /* extern "C" */
 
 #include "intern/depsgraph_intern.h"
+#include "util/deg_util_foreach.h"
 
 bool DEG_id_type_tagged(Main *bmain, short idtype)
 {
@@ -68,3 +72,15 @@ short DEG_get_eval_flags_for_id(Depsgraph *graph, ID *id)
 
 	return id_node->eval_flags;
 }
+
+SceneLayer *DAG_get_scene_layer(Depsgraph *graph)
+{
+	Main *bmain = G.main;
+	LINKLIST_FOREACH (Scene*, scene, &bmain->scene) {
+		if (scene->depsgraph == graph) {
+			/* Got the scene! */
+			return BKE_scene_layer_context_active(scene);
+		}
+	}
+	return NULL;
+}




More information about the Bf-blender-cvs mailing list