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.
This commit is contained in:
Sergey Sharybin
2017-04-20 17:09:18 +02:00
committed by Dalai Felinto
parent 66377b89da
commit 74023d46ce
2 changed files with 20 additions and 0 deletions

View File

@@ -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

View File

@@ -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;
}