[Bf-blender-cvs] [5af1c892695] blender2.8: Depsgraph: Make graph to be per-scene-layer for RNA

Sergey Sharybin noreply at git.blender.org
Mon Nov 6 12:40:10 CET 2017


Commit: 5af1c892695df48104337b9466cf7ded4b66e09a
Author: Sergey Sharybin
Date:   Fri Nov 3 17:27:13 2017 +0100
Branches: blender2.8
https://developer.blender.org/rB5af1c892695df48104337b9466cf7ded4b66e09a

Depsgraph: Make graph to be per-scene-layer for RNA

New access is C.scene.render_layers.active.depsgraph. This will give depsgraph
for a given layer. In the future there will need to be some extra context to be
passed.

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

M	source/blender/makesrna/intern/rna_layer.c
M	source/blender/makesrna/intern/rna_scene.c

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

diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index d71f42fe851..1c7ce4fecf1 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -846,6 +846,14 @@ static int rna_SceneLayer_objects_selected_skip(CollectionPropertyIterator *iter
 	return 1;
 };
 
+static PointerRNA rna_SceneLayer_depsgraph_get(PointerRNA *ptr)
+{
+	Scene *scene = (Scene *)ptr->id.data;
+	SceneLayer *scene_layer = (SceneLayer *)ptr->data;
+	Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, scene_layer);
+	return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, depsgraph);
+}
+
 static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
 {
 	SceneLayer *sl = (SceneLayer *)ptr->data;
@@ -954,6 +962,7 @@ static int rna_ViewRenderSettings_use_game_engine_get(PointerRNA *ptr)
 
 	return 0;
 }
+
 #else
 
 static void rna_def_scene_collections(BlenderRNA *brna, PropertyRNA *cprop)
@@ -2162,6 +2171,12 @@ void RNA_def_scene_layer(BlenderRNA *brna)
 	RNA_def_function_ui_description(func,
 	                                "Update data tagged to be updated from previous access to data or operators");
 
+	/* Dependency Graph */
+	prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE);
+	RNA_def_property_struct_type(prop, "Depsgraph");
+	RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data");
+	RNA_def_property_pointer_funcs(prop, "rna_SceneLayer_depsgraph_get", NULL, NULL, NULL);
+
 	/* Nested Data  */
 	/* *** Non-Animated *** */
 	RNA_define_animate_sdna(false);
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 21159bbc240..a5645f362b9 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2175,6 +2175,7 @@ static void rna_SceneLayer_remove(
 		RNA_POINTER_INVALIDATE(sl_ptr);
 	}
 }
+
 #else
 
 /* Grease Pencil Interpolation tool settings */
@@ -7324,12 +7325,6 @@ void RNA_def_scene(BlenderRNA *brna)
 	RNA_def_property_struct_type(prop, "ColorManagedSequencerColorspaceSettings");
 	RNA_def_property_ui_text(prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in");
 
-	/* Dependency Graph */
-	prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE);
-	RNA_def_property_pointer_sdna(prop, NULL, "depsgraph_legacy");
-	RNA_def_property_struct_type(prop, "Depsgraph");
-	RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data");
-
 	/* Layer and Collections */
 	prop = RNA_def_property(srna, "render_layers", PROP_COLLECTION, PROP_NONE);
 	RNA_def_property_collection_sdna(prop, NULL, "render_layers", NULL);



More information about the Bf-blender-cvs mailing list