diff options
Diffstat (limited to 'source/blender/depsgraph')
-rw-r--r-- | source/blender/depsgraph/DEG_depsgraph_query.h | 3 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.cc | 4 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph.h | 3 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_query.cc | 6 |
4 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/depsgraph/DEG_depsgraph_query.h b/source/blender/depsgraph/DEG_depsgraph_query.h index b9cbd75ce1e..48a62a69f30 100644 --- a/source/blender/depsgraph/DEG_depsgraph_query.h +++ b/source/blender/depsgraph/DEG_depsgraph_query.h @@ -67,6 +67,9 @@ float DEG_get_ctime(const Depsgraph *graph); bool DEG_id_type_updated(const struct Depsgraph *depsgraph, short id_type); bool DEG_id_type_any_updated(const struct Depsgraph *depsgraph); +/* Check if given ID type is present in the depsgraph */ +bool DEG_id_type_any_exists(const struct Depsgraph *depsgraph, short id_type); + /* Get additional evaluation flags for the given ID. */ uint32_t DEG_get_eval_flags_for_id(const struct Depsgraph *graph, struct ID *id); diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 5d96bfad95e..d8a9b41206b 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -38,6 +38,7 @@ extern "C" { #include "BKE_scene.h" #include "BKE_global.h" +#include "BKE_idcode.h" } #include "DEG_depsgraph.h" @@ -81,6 +82,7 @@ Depsgraph::Depsgraph(Scene *scene, ViewLayer *view_layer, eEvaluationMode mode) entry_tags = BLI_gset_ptr_new("Depsgraph entry_tags"); debug_flags = G.debug; memset(id_type_updated, 0, sizeof(id_type_updated)); + memset(id_type_exist, 0, sizeof(id_type_exist)); memset(physics_relations, 0, sizeof(physics_relations)); } @@ -130,6 +132,8 @@ IDNode *Depsgraph::add_id_node(ID *id, ID *id_cow_hint) * referencing to. */ BLI_ghash_insert(id_hash, id, id_node); id_nodes.push_back(id_node); + + id_type_exist[BKE_idcode_to_index(GS(id->name))] = 1; } return id_node; } diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h index 073ec99b3aa..f194a44346b 100644 --- a/source/blender/depsgraph/intern/depsgraph.h +++ b/source/blender/depsgraph/intern/depsgraph.h @@ -152,6 +152,9 @@ struct Depsgraph { /* Indicates which ID types were updated. */ char id_type_updated[MAX_LIBARRAY]; + /* Indicates type of IDs present in the depsgraph. */ + char id_type_exist[MAX_LIBARRAY]; + /* Quick-Access Temp Data ............. */ /* Nodes which have been tagged as "directly modified". */ diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index 326d852b1e1..0345f294860 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -95,6 +95,12 @@ bool DEG_id_type_any_updated(const Depsgraph *graph) return false; } +bool DEG_id_type_any_exists(const Depsgraph *depsgraph, short id_type) +{ + const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(depsgraph); + return deg_graph->id_type_exist[BKE_idcode_to_index(id_type)] != 0; +} + uint32_t DEG_get_eval_flags_for_id(const Depsgraph *graph, ID *id) { if (graph == NULL) { |