diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-31 13:57:21 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2018-05-31 19:07:55 +0300 |
commit | 7a4b0ff358121397519873123fa77a7cc00974bd (patch) | |
tree | 03feb3df33269c6aefa5f37798360f7566ff5ce6 /source/blender/depsgraph/intern/depsgraph.cc | |
parent | d4daf9c00d36a2dc7073a0a0716fec1936b212da (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.
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph.cc')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.cc | 31 |
1 files changed, 30 insertions, 1 deletions
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) |