Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-04-20 18:09:18 +0300
committerDalai Felinto <dfelinto@gmail.com>2017-04-20 18:18:31 +0300
commit74023d46ced40f152f97727137f891f60a5b0846 (patch)
tree5681300067a254fb5e1afc060b369a918f311050 /source/blender
parent66377b89da08f46a27d48fd918fcee0daa505429 (diff)
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.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/depsgraph/DEG_depsgraph_query.h4
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query.cc16
2 files changed, 20 insertions, 0 deletions
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;
+}