diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-02-23 15:22:35 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-02-28 00:25:54 +0300 |
commit | bd119ab0177a380a1736677278c02790d8235be4 (patch) | |
tree | e1a51aa50167ec272d188569cb72004e153771ca /source/blender/makesrna/intern/rna_depsgraph.c | |
parent | 0f6c08c8cfa7bb28dac6e527c684bc0a016bed11 (diff) |
Depsgraph: Expose query to get view layer to RNA
Diffstat (limited to 'source/blender/makesrna/intern/rna_depsgraph.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_depsgraph.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c index e6e1c714008..bb20fcb271f 100644 --- a/source/blender/makesrna/intern/rna_depsgraph.c +++ b/source/blender/makesrna/intern/rna_depsgraph.c @@ -34,10 +34,11 @@ #include "rna_internal.h" -#include "DEG_depsgraph.h" - #include "DNA_object_types.h" +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" + #define STATS_MAX_SIZE 16384 #ifdef RNA_RUNTIME @@ -240,6 +241,13 @@ static ID *rna_Depsgraph_evaluated_id_get(Depsgraph *depsgraph, ID *id_orig) return DEG_get_evaluated_id(depsgraph, id_orig); } +static PointerRNA rna_Depsgraph_view_layer_get(PointerRNA *ptr) +{ + Depsgraph *depsgraph = (Depsgraph *)ptr->data; + ViewLayer *view_layer = DEG_get_evaluated_view_layer(depsgraph); + return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer); +} + #else static void rna_def_depsgraph_iter(BlenderRNA *brna) @@ -358,6 +366,11 @@ static void rna_def_depsgraph(BlenderRNA *brna) "rna_Depsgraph_duplis_end", "rna_Depsgraph_duplis_get", NULL, NULL, NULL, NULL); + + prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE); + RNA_def_property_struct_type(prop, "ViewLayer"); + RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_view_layer_get", NULL, NULL, NULL); + RNA_def_property_ui_text(prop, "Scene layer", ""); } void RNA_def_depsgraph(BlenderRNA *brna) |