diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_context.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_context.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c index 75f8b97b99d..a2ac7cb40ba 100644 --- a/source/blender/makesrna/intern/rna_context.c +++ b/source/blender/makesrna/intern/rna_context.c @@ -135,12 +135,6 @@ static PointerRNA rna_Context_main_get(PointerRNA *ptr) return rna_pointer_inherit_refine(ptr, &RNA_BlendData, CTX_data_main(C)); } -static PointerRNA rna_Context_depsgraph_get(PointerRNA *ptr) -{ - bContext *C = (bContext *)ptr->data; - return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, CTX_data_depsgraph(C)); -} - static PointerRNA rna_Context_scene_get(PointerRNA *ptr) { bContext *C = (bContext *)ptr->data; @@ -204,6 +198,11 @@ static int rna_Context_mode_get(PointerRNA *ptr) return CTX_data_mode_enum(C); } +static struct Depsgraph *rna_Context_evaluated_depsgraph_get(bContext *C) +{ + return CTX_data_evaluated_depsgraph(C); +} + #else void RNA_def_context(BlenderRNA *brna) @@ -211,6 +210,9 @@ void RNA_def_context(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; + FunctionRNA *func; + PropertyRNA *parm; + srna = RNA_def_struct(brna, "Context", NULL); RNA_def_struct_ui_text(srna, "Context", "Current windowmanager and data context"); RNA_def_struct_sdna(srna, "bContext"); @@ -267,11 +269,6 @@ void RNA_def_context(BlenderRNA *brna) RNA_def_property_struct_type(prop, "BlendData"); RNA_def_property_pointer_funcs(prop, "rna_Context_main_get", NULL, NULL, NULL); - prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); - RNA_def_property_struct_type(prop, "Depsgraph"); - RNA_def_property_pointer_funcs(prop, "rna_Context_depsgraph_get", NULL, NULL, NULL); - prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Scene"); @@ -310,6 +307,16 @@ void RNA_def_context(BlenderRNA *brna) RNA_def_property_enum_items(prop, rna_enum_context_mode_items); RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_enum_funcs(prop, "rna_Context_mode_get", NULL, NULL); + + func = RNA_def_function(srna, "evaluated_depsgraph_get", "rna_Context_evaluated_depsgraph_get"); + RNA_def_function_ui_description( + func, + "Get the dependency graph for the current scene and view layer, to access to data-blocks " + "with animation and modifiers applied. If any data-blocks have been edited, the dependency " + "graph will be updated. This invalidates all references to evaluated data-blocks from the " + "dependency graph."); + parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "Evaluated dependency graph"); + RNA_def_function_return(func, parm); } #endif |