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:
authorSergey Sharybin <sergey.vfx@gmail.com>2018-05-31 13:57:21 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2018-05-31 19:07:55 +0300
commit7a4b0ff358121397519873123fa77a7cc00974bd (patch)
tree03feb3df33269c6aefa5f37798360f7566ff5ce6
parentd4daf9c00d36a2dc7073a0a0716fec1936b212da (diff)
Depsgraph: Begin concept of active dependency graph
When active dependency graph is evaluated, it will apply animation, drivers and scalar evaluation data (such as object matrix) to an original datablock. This way operators and tools can easily read data from original datablock. This will simplify porting them to copy-on-write, and solve issues when some operator will allocate new datablock based on original one, and will want to read data from it.
-rw-r--r--source/blender/depsgraph/DEG_depsgraph.h6
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc31
-rw-r--r--source/blender/depsgraph/intern/depsgraph.h10
3 files changed, 46 insertions, 1 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index fbd267924a9..2071342dfa0 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -229,6 +229,12 @@ typedef void (*DEG_EditorUpdateSceneCb)(
void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
DEG_EditorUpdateSceneCb scene_func);
+/* Evaluation ----------------------------------- */
+
+bool DEG_is_active(const struct Depsgraph *depsgraph);
+void DEG_make_active(struct Depsgraph *depsgraph);
+void DEG_make_inactive(struct Depsgraph *depsgraph);
+
/* Evaluation Debug ------------------------------ */
void DEG_debug_print_begin(struct Depsgraph *depsgraph);
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index a247b458cc7..96e89449d42 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -92,7 +92,8 @@ Depsgraph::Depsgraph(Scene *scene,
view_layer(view_layer),
mode(mode),
ctime(BKE_scene_frame_get(scene)),
- scene_cow(NULL)
+ scene_cow(NULL),
+ is_active(false)
{
BLI_spin_init(&lock);
id_hash = BLI_ghash_ptr_new("Depsgraph id hash");
@@ -588,6 +589,34 @@ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func,
DEG::deg_editor_update_scene_cb = scene_func;
}
+bool DEG_is_active(const struct Depsgraph *depsgraph)
+{
+ if (depsgraph == NULL) {
+ /* Happens for such cases as work object in what_does_obaction(),
+ * and sine render pipeline parts. Shouldn't really be accepting
+ * NULL depsgraph, but is quite hard to get proper one in those
+ * cases.
+ */
+ return false;
+ }
+ const DEG::Depsgraph *deg_graph =
+ reinterpret_cast<const DEG::Depsgraph *>(depsgraph);
+ return deg_graph->is_active;
+}
+
+void DEG_make_active(struct Depsgraph *depsgraph)
+{
+ DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+ deg_graph->is_active = true;
+ /* TODO(sergey): Copy data from evaluated state to original. */
+}
+
+void DEG_make_inactive(struct Depsgraph *depsgraph)
+{
+ DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+ deg_graph->is_active = false;
+}
+
/* Evaluation and debug */
static DEG::string depsgraph_name_for_logging(struct Depsgraph *depsgraph)
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index a368158a6c4..3c1233cd5bb 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -210,6 +210,16 @@ struct Depsgraph {
*/
Scene *scene_cow;
+ /* Active dependency graph is a dependency graph which is used by the
+ * currently active window. When dependency graph is active, it is allowed
+ * for evaluation functions to write animation f-curve result, drivers
+ * result and other selective things (object matrix?) to original object.
+ *
+ * This way we simplify operators, which don't need to worry about where
+ * to read stuff from.
+ */
+ bool is_active;
+
/* NITE: Corresponds to G_DEBUG_DEPSGRAPH_* flags. */
int debug_flags;
string debug_name;