diff options
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations.cc')
-rw-r--r-- | source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 42 |
1 files changed, 28 insertions, 14 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 4caea4b8aee..f551cd8b10c 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -28,7 +28,6 @@ #include <cstring> /* required for STREQ later on. */ #include <stdio.h> #include <stdlib.h> -#include <unordered_set> #include "MEM_guardedalloc.h" @@ -62,6 +61,7 @@ extern "C" { #include "DNA_rigidbody_types.h" #include "DNA_scene_types.h" #include "DNA_sequence_types.h" +#include "DNA_simulation_types.h" #include "DNA_sound_types.h" #include "DNA_speaker_types.h" #include "DNA_texture_types.h" @@ -76,7 +76,7 @@ extern "C" { #include "BKE_constraint.h" #include "BKE_curve.h" #include "BKE_effect.h" -#include "BKE_fcurve.h" +#include "BKE_fcurve_driver.h" #include "BKE_gpencil_modifier.h" #include "BKE_idprop.h" #include "BKE_image.h" @@ -122,8 +122,6 @@ extern "C" { namespace DEG { -using std::unordered_set; - /* ***************** */ /* Relations Builder */ @@ -559,6 +557,9 @@ void DepsgraphRelationBuilder::build_id(ID *id) case ID_SCE: build_scene_parameters((Scene *)id); break; + case ID_SIM: + build_simulation((Simulation *)id); + break; default: fprintf(stderr, "Unhandled ID %s\n", id->name); BLI_assert(!"Should never happen"); @@ -2393,22 +2394,28 @@ void DepsgraphRelationBuilder::build_texture(Tex *texture) return; } /* texture itself */ + ComponentKey texture_key(&texture->id, NodeType::GENERIC_DATABLOCK); build_idproperties(texture->id.properties); build_animdata(&texture->id); build_parameters(&texture->id); + /* texture's nodetree */ build_nodetree(texture->nodetree); + build_nested_nodetree(&texture->id, texture->nodetree); + /* Special cases for different IDs which texture uses. */ if (texture->type == TEX_IMAGE) { if (texture->ima != nullptr) { build_image(texture->ima); + + ComponentKey image_key(&texture->ima->id, NodeType::GENERIC_DATABLOCK); + add_relation(image_key, texture_key, "Texture Image"); } } - build_nested_nodetree(&texture->id, texture->nodetree); + if (check_id_has_anim_component(&texture->id)) { ComponentKey animation_key(&texture->id, NodeType::ANIMATION); - ComponentKey datablock_key(&texture->id, NodeType::GENERIC_DATABLOCK); - add_relation(animation_key, datablock_key, "Datablock Animation"); + add_relation(animation_key, texture_key, "Datablock Animation"); } } @@ -2559,6 +2566,15 @@ void DepsgraphRelationBuilder::build_sound(bSound *sound) build_parameters(&sound->id); } +void DepsgraphRelationBuilder::build_simulation(Simulation *simulation) +{ + if (built_map_.checkIsBuiltAndTag(simulation)) { + return; + } + build_animdata(&simulation->id); + build_parameters(&simulation->id); +} + void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene) { if (scene->ed == nullptr) { @@ -2674,7 +2690,7 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) Node *node_cow = find_node(copy_on_write_key); OperationNode *op_cow = node_cow->get_exit_operation(); /* Plug any other components to this one. */ - GHASH_FOREACH_BEGIN (ComponentNode *, comp_node, id_node->components) { + for (ComponentNode *comp_node : id_node->components.values()) { if (comp_node->type == NodeType::COPY_ON_WRITE) { /* Copy-on-write component never depends on itself. */ continue; @@ -2717,11 +2733,11 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) rel->flag |= rel_flag; } /* All dangling operations should also be executed after copy-on-write. */ - GHASH_FOREACH_BEGIN (OperationNode *, op_node, comp_node->operations_map) { + for (OperationNode *op_node : comp_node->operations_map->values()) { if (op_node == op_entry) { continue; } - if (op_node->inlinks.size() == 0) { + if (op_node->inlinks.is_empty()) { Relation *rel = graph_->add_new_relation(op_cow, op_node, "CoW Dependency"); rel->flag |= rel_flag; } @@ -2743,7 +2759,6 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) } } } - GHASH_FOREACH_END(); /* NOTE: We currently ignore implicit relations to an external * data-blocks for copy-on-write operations. This means, for example, * copy-on-write component of Object will not wait for copy-on-write @@ -2752,7 +2767,6 @@ void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) * evaluation step needs geometry, it will have transitive dependency * to Mesh copy-on-write already. */ } - GHASH_FOREACH_END(); /* TODO(sergey): This solves crash for now, but causes too many * updates potentially. */ if (GS(id_orig->name) == ID_OB) { @@ -2801,7 +2815,7 @@ static bool is_reachable(const Node *const from, const Node *const to) // Perform a graph walk from 'to' towards its incoming connections. // Walking from 'from' towards its outgoing connections is 10x slower on the Spring rig. deque<const Node *> queue; - unordered_set<const Node *> seen; + Set<const Node *> seen; queue.push_back(to); while (!queue.empty()) { // Visit the next node to inspect. @@ -2815,7 +2829,7 @@ static bool is_reachable(const Node *const from, const Node *const to) // Queue all incoming relations that we haven't seen before. for (Relation *relation : visit->inlinks) { const Node *prev_node = relation->from; - if (seen.insert(prev_node).second) { + if (seen.add(prev_node)) { queue.push_back(prev_node); } } |