[Bf-blender-cvs] [0cf0cc9873c] master: Depsgraph: Add query for whether graph is up to date

Sergey Sharybin noreply at git.blender.org
Tue May 28 17:11:03 CEST 2019


Commit: 0cf0cc9873c114f3ccc19901931616a0e91f27cb
Author: Sergey Sharybin
Date:   Tue May 28 15:42:08 2019 +0200
Branches: master
https://developer.blender.org/rB0cf0cc9873c114f3ccc19901931616a0e91f27cb

Depsgraph: Add query for whether graph is up to date

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

M	source/blender/depsgraph/DEG_depsgraph_query.h
M	source/blender/depsgraph/intern/depsgraph_query.cc

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

diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h
index 9b7e5b95fdc..b9cbd75ce1e 100644
--- a/source/blender/depsgraph/DEG_depsgraph_query.h
+++ b/source/blender/depsgraph/DEG_depsgraph_query.h
@@ -116,6 +116,11 @@ bool DEG_is_original_object(struct Object *object);
 bool DEG_is_evaluated_id(struct ID *id);
 bool DEG_is_evaluated_object(struct Object *object);
 
+/* Check whether depsgraph os fully evaluated. This includes the following checks:
+ * - Relations are up-to-date.
+ * - Nothing is tagged for update. */
+bool DEG_is_fully_evaluated(const struct Depsgraph *depsgraph);
+
 /* ************************ DEG object iterators ********************* */
 
 enum {
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc
index 02f2519b3fb..326d852b1e1 100644
--- a/source/blender/depsgraph/intern/depsgraph_query.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query.cc
@@ -29,12 +29,14 @@ extern "C" {
 #include <string.h>  // XXX: memcpy
 
 #include "BLI_utildefines.h"
+#include "BLI_listbase.h"
+#include "BLI_ghash.h"
+
+#include "BKE_action.h"  // XXX: BKE_pose_channel_find_name
 #include "BKE_customdata.h"
 #include "BKE_idcode.h"
 #include "BKE_main.h"
-#include "BLI_listbase.h"
 
-#include "BKE_action.h"  // XXX: BKE_pose_channel_from_name
 } /* extern "C" */
 
 #include "DNA_object_types.h"
@@ -303,3 +305,17 @@ bool DEG_is_evaluated_object(Object *object)
 {
   return !DEG_is_original_object(object);
 }
+
+bool DEG_is_fully_evaluated(const struct Depsgraph *depsgraph)
+{
+  const DEG::Depsgraph *deg_graph = (const DEG::Depsgraph *)depsgraph;
+  /* Check whether relations are up to date. */
+  if (deg_graph->need_update) {
+    return false;
+  }
+  /* Check whether IDs are up to date. */
+  if (BLI_gset_len(deg_graph->entry_tags) > 0) {
+    return false;
+  }
+  return true;
+}



More information about the Bf-blender-cvs mailing list