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:
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_context.h11
-rw-r--r--source/blender/blenkernel/intern/context.c15
2 files changed, 21 insertions, 5 deletions
diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h
index 0d2998cc51e..53976b4c1ad 100644
--- a/source/blender/blenkernel/BKE_context.h
+++ b/source/blender/blenkernel/BKE_context.h
@@ -318,7 +318,14 @@ int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list);
* evaluated data points of view.
*
* NOTE: Can not be used if access to a fully evaluated datablock is needed. */
-struct Depsgraph *CTX_data_depsgraph(const bContext *C);
+struct Depsgraph *CTX_data_depsgraph_pointer(const bContext *C);
+
+/* Get dependency graph which is expected to be fully evaluated.
+ *
+ * In the release builds it is the same as CTX_data_depsgraph_pointer(). In the debug builds extra
+ * sanity checks are done. Additionally, this provides more semantic meaning to what is exactly
+ * expected to happen. */
+struct Depsgraph *CTX_data_expect_evaluated_depsgraph(const bContext *C);
/* Gets fully updated and evaluated dependency graph.
*
@@ -326,7 +333,7 @@ struct Depsgraph *CTX_data_depsgraph(const bContext *C);
*
* NOTE: Will be expensive if there are relations or objects tagged for update.
* NOTE: If there are pending updates depsgraph hooks will be invoked. */
-struct Depsgraph *CTX_data_evaluated_depsgraph(const bContext *C);
+struct Depsgraph *CTX_data_ensure_evaluated_depsgraph(const bContext *C);
/* Will Return NULL if depsgraph is not allocated yet.
* Only used by handful of operators which are run on file load.
diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c
index 4ae87713aa5..2cb98d8d90b 100644
--- a/source/blender/blenkernel/intern/context.c
+++ b/source/blender/blenkernel/intern/context.c
@@ -1348,7 +1348,7 @@ int CTX_data_editable_gpencil_strokes(const bContext *C, ListBase *list)
return ctx_data_collection_get(C, "editable_gpencil_strokes", list);
}
-Depsgraph *CTX_data_depsgraph(const bContext *C)
+Depsgraph *CTX_data_depsgraph_pointer(const bContext *C)
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -1361,9 +1361,18 @@ Depsgraph *CTX_data_depsgraph(const bContext *C)
return depsgraph;
}
-Depsgraph *CTX_data_evaluated_depsgraph(const bContext *C)
+Depsgraph *CTX_data_expect_evaluated_depsgraph(const bContext *C)
{
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
+ Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
+ /* TODO(sergey): Assert that the dependency graph is fully evaluated.
+ * Note that first the depsgraph and scene post-eval hooks needs to run extra round of updates
+ * first to make check here really reliable. */
+ return depsgraph;
+}
+
+Depsgraph *CTX_data_ensure_evaluated_depsgraph(const bContext *C)
+{
+ Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
Main *bmain = CTX_data_main(C);
BKE_scene_graph_evaluated_ensure(depsgraph, bmain);
return depsgraph;