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:
Diffstat (limited to 'source/blender/depsgraph/intern/builder/deg_builder_relations.cc')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc61
1 files changed, 39 insertions, 22 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index 9bad796c541..8f977e07f17 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -28,14 +28,12 @@
#include <cstring> /* required for STREQ later on. */
#include <stdio.h>
#include <stdlib.h>
-#include <unordered_set>
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
#include "BLI_utildefines.h"
-extern "C" {
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
@@ -62,6 +60,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 +75,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"
@@ -99,7 +98,6 @@ extern "C" {
#include "RNA_access.h"
#include "RNA_types.h"
-} /* extern "C" */
#include "DEG_depsgraph.h"
#include "DEG_depsgraph_build.h"
@@ -122,8 +120,6 @@ extern "C" {
namespace DEG {
-using std::unordered_set;
-
/* ***************** */
/* Relations Builder */
@@ -559,6 +555,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");
@@ -659,19 +658,19 @@ void DepsgraphRelationBuilder::build_object(Base *base, Object *object)
if (object->modifiers.first != nullptr) {
BuilderWalkUserData data;
data.builder = this;
- modifiers_foreachIDLink(object, modifier_walk, &data);
+ BKE_modifiers_foreach_ID_link(object, modifier_walk, &data);
}
/* Grease Pencil Modifiers. */
if (object->greasepencil_modifiers.first != nullptr) {
BuilderWalkUserData data;
data.builder = this;
- BKE_gpencil_modifiers_foreachIDLink(object, modifier_walk, &data);
+ BKE_gpencil_modifiers_foreach_ID_link(object, modifier_walk, &data);
}
/* Shader FX. */
if (object->shader_fx.first != nullptr) {
BuilderWalkUserData data;
data.builder = this;
- BKE_shaderfx_foreachIDLink(object, modifier_walk, &data);
+ BKE_shaderfx_foreach_ID_link(object, modifier_walk, &data);
}
/* Constraints. */
if (object->constraints.first != nullptr) {
@@ -1972,7 +1971,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
ctx.scene = scene_;
ctx.object = object;
LISTBASE_FOREACH (ModifierData *, md, &object->modifiers) {
- const ModifierTypeInfo *mti = modifierType_getInfo((ModifierType)md->type);
+ const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)md->type);
if (mti->updateDepsgraph) {
DepsNodeHandle handle = create_node_handle(obdata_ubereval_key);
ctx.node = reinterpret_cast<::DepsNodeHandle *>(&handle);
@@ -1990,7 +1989,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
ctx.scene = scene_;
ctx.object = object;
LISTBASE_FOREACH (GpencilModifierData *, md, &object->greasepencil_modifiers) {
- const GpencilModifierTypeInfo *mti = BKE_gpencil_modifierType_getInfo(
+ const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(
(GpencilModifierType)md->type);
if (mti->updateDepsgraph) {
DepsNodeHandle handle = create_node_handle(obdata_ubereval_key);
@@ -2009,7 +2008,7 @@ void DepsgraphRelationBuilder::build_object_data_geometry(Object *object)
ctx.scene = scene_;
ctx.object = object;
LISTBASE_FOREACH (ShaderFxData *, fx, &object->shader_fx) {
- const ShaderFxTypeInfo *fxi = BKE_shaderfxType_getInfo((ShaderFxType)fx->type);
+ const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info((ShaderFxType)fx->type);
if (fxi->updateDepsgraph) {
DepsNodeHandle handle = create_node_handle(obdata_ubereval_key);
ctx.node = reinterpret_cast<::DepsNodeHandle *>(&handle);
@@ -2400,22 +2399,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");
}
}
@@ -2566,6 +2571,20 @@ 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);
+
+ OperationKey simulation_update_key(
+ &simulation->id, NodeType::SIMULATION, OperationCode::SIMULATION_EVAL);
+ TimeSourceKey time_src_key;
+ add_relation(time_src_key, simulation_update_key, "TimeSrc -> Simulation");
+}
+
void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)
{
if (scene->ed == nullptr) {
@@ -2681,7 +2700,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;
@@ -2724,11 +2743,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;
}
@@ -2750,7 +2769,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
@@ -2759,7 +2777,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) {
@@ -2808,7 +2825,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.
@@ -2822,7 +2839,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);
}
}