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')
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_nodes.cc44
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations.cc74
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc44
-rw-r--r--source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc2
-rw-r--r--source/blender/depsgraph/intern/debug/deg_time_average.h11
-rw-r--r--source/blender/depsgraph/intern/depsgraph_query_iter.cc16
-rw-r--r--source/blender/depsgraph/intern/depsgraph_registry.cc2
-rw-r--r--source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc48
-rw-r--r--source/blender/depsgraph/intern/node/deg_node_component.cc2
9 files changed, 134 insertions, 109 deletions
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
index 22bce10937d..a739a0fe337 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
@@ -112,6 +112,7 @@
#include "DEG_depsgraph_build.h"
#include "SEQ_iterator.h"
+#include "SEQ_sequencer.h"
#include "intern/builder/deg_builder.h"
#include "intern/builder/deg_builder_rna.h"
@@ -2032,6 +2033,27 @@ void DepsgraphNodeBuilder::build_simulation(Simulation *simulation)
});
}
+static bool seq_node_build_cb(Sequence *seq, void *user_data)
+{
+ DepsgraphNodeBuilder *nb = (DepsgraphNodeBuilder *)user_data;
+ nb->build_idproperties(seq->prop);
+ if (seq->sound != nullptr) {
+ nb->build_sound(seq->sound);
+ }
+ if (seq->scene != nullptr) {
+ nb->build_scene_parameters(seq->scene);
+ }
+ if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) {
+ if (seq->flag & SEQ_SCENE_STRIPS) {
+ nb->build_scene_sequencer(seq->scene);
+ }
+ ViewLayer *sequence_view_layer = BKE_view_layer_default_render(seq->scene);
+ nb->build_scene_speakers(seq->scene, sequence_view_layer);
+ }
+ /* TODO(sergey): Movie clip, scene, camera, mask. */
+ return true;
+}
+
void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene)
{
if (scene->ed == nullptr) {
@@ -2046,28 +2068,10 @@ void DepsgraphNodeBuilder::build_scene_sequencer(Scene *scene)
NodeType::SEQUENCER,
OperationCode::SEQUENCES_EVAL,
[scene_cow](::Depsgraph *depsgraph) {
- BKE_scene_eval_sequencer_sequences(depsgraph, scene_cow);
+ SEQ_eval_sequences(depsgraph, scene_cow, &scene_cow->ed->seqbase);
});
/* Make sure data for sequences is in the graph. */
- Sequence *seq;
- SEQ_ALL_BEGIN (scene->ed, seq) {
- build_idproperties(seq->prop);
- if (seq->sound != nullptr) {
- build_sound(seq->sound);
- }
- if (seq->scene != nullptr) {
- build_scene_parameters(seq->scene);
- }
- if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) {
- if (seq->flag & SEQ_SCENE_STRIPS) {
- build_scene_sequencer(seq->scene);
- }
- ViewLayer *sequence_view_layer = BKE_view_layer_default_render(seq->scene);
- build_scene_speakers(seq->scene, sequence_view_layer);
- }
- /* TODO(sergey): Movie clip, scene, camera, mask. */
- }
- SEQ_ALL_END;
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_node_build_cb, this);
}
void DepsgraphNodeBuilder::build_scene_audio(Scene *scene)
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
index d88e9bc9c04..ab3081cb1ae 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc
@@ -2769,6 +2769,45 @@ void DepsgraphRelationBuilder::build_simulation(Simulation *simulation)
add_relation(nodetree_key, simulation_eval_key, "NodeTree -> Simulation", 0);
}
+using Seq_build_prop_cb_data = struct Seq_build_prop_cb_data {
+ DepsgraphRelationBuilder *builder;
+ ComponentKey sequencer_key;
+ bool has_audio_strips;
+};
+
+static bool seq_build_prop_cb(Sequence *seq, void *user_data)
+{
+ Seq_build_prop_cb_data *cd = (Seq_build_prop_cb_data *)user_data;
+
+ cd->builder->build_idproperties(seq->prop);
+ if (seq->sound != nullptr) {
+ cd->builder->build_sound(seq->sound);
+ ComponentKey sound_key(&seq->sound->id, NodeType::AUDIO);
+ cd->builder->add_relation(sound_key, cd->sequencer_key, "Sound -> Sequencer");
+ cd->has_audio_strips = true;
+ }
+ if (seq->scene != nullptr) {
+ cd->builder->build_scene_parameters(seq->scene);
+ /* This is to support 3D audio. */
+ cd->has_audio_strips = true;
+ }
+ if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) {
+ if (seq->flag & SEQ_SCENE_STRIPS) {
+ cd->builder->build_scene_sequencer(seq->scene);
+ ComponentKey sequence_scene_audio_key(&seq->scene->id, NodeType::AUDIO);
+ cd->builder->add_relation(
+ sequence_scene_audio_key, cd->sequencer_key, "Sequence Scene Audio -> Sequencer");
+ ComponentKey sequence_scene_key(&seq->scene->id, NodeType::SEQUENCER);
+ cd->builder->add_relation(
+ sequence_scene_key, cd->sequencer_key, "Sequence Scene -> Sequencer");
+ }
+ ViewLayer *sequence_view_layer = BKE_view_layer_default_render(seq->scene);
+ cd->builder->build_scene_speakers(seq->scene, sequence_view_layer);
+ }
+ /* TODO(sergey): Movie clip, camera, mask. */
+ return true;
+}
+
void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)
{
if (scene->ed == nullptr) {
@@ -2781,36 +2820,11 @@ void DepsgraphRelationBuilder::build_scene_sequencer(Scene *scene)
ComponentKey scene_audio_key(&scene->id, NodeType::AUDIO);
/* Make sure dependencies from sequences data goes to the sequencer evaluation. */
ComponentKey sequencer_key(&scene->id, NodeType::SEQUENCER);
- Sequence *seq;
- bool has_audio_strips = false;
- SEQ_ALL_BEGIN (scene->ed, seq) {
- build_idproperties(seq->prop);
- if (seq->sound != nullptr) {
- build_sound(seq->sound);
- ComponentKey sound_key(&seq->sound->id, NodeType::AUDIO);
- add_relation(sound_key, sequencer_key, "Sound -> Sequencer");
- has_audio_strips = true;
- }
- if (seq->scene != nullptr) {
- build_scene_parameters(seq->scene);
- /* This is to support 3D audio. */
- has_audio_strips = true;
- }
- if (seq->type == SEQ_TYPE_SCENE && seq->scene != nullptr) {
- if (seq->flag & SEQ_SCENE_STRIPS) {
- build_scene_sequencer(seq->scene);
- ComponentKey sequence_scene_audio_key(&seq->scene->id, NodeType::AUDIO);
- add_relation(sequence_scene_audio_key, sequencer_key, "Sequence Scene Audio -> Sequencer");
- ComponentKey sequence_scene_key(&seq->scene->id, NodeType::SEQUENCER);
- add_relation(sequence_scene_key, sequencer_key, "Sequence Scene -> Sequencer");
- }
- ViewLayer *sequence_view_layer = BKE_view_layer_default_render(seq->scene);
- build_scene_speakers(seq->scene, sequence_view_layer);
- }
- /* TODO(sergey): Movie clip, camera, mask. */
- }
- SEQ_ALL_END;
- if (has_audio_strips) {
+
+ Seq_build_prop_cb_data cb_data = {this, sequencer_key, false};
+
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_build_prop_cb, &cb_data);
+ if (cb_data.has_audio_strips) {
add_relation(sequencer_key, scene_audio_key, "Sequencer -> Audio");
}
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc
index b9ce29ce8d2..bf3af571f0b 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_drivers.cc
@@ -125,13 +125,13 @@ static bool is_reachable(const Node *const from, const Node *const to)
return true;
}
- // Perform a graph walk from 'to' towards its incoming connections.
- // Walking from 'from' towards its outgoing connections is 10x slower on the Spring rig.
+ /* 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;
Set<const Node *> seen;
queue.push_back(to);
while (!queue.empty()) {
- // Visit the next node to inspect.
+ /* Visit the next node to inspect. */
const Node *visit = queue.back();
queue.pop_back();
@@ -139,7 +139,7 @@ static bool is_reachable(const Node *const from, const Node *const to)
return true;
}
- // Queue all incoming relations that we haven't seen before.
+ /* Queue all incoming relations that we haven't seen before. */
for (Relation *relation : visit->inlinks) {
const Node *prev_node = relation->from;
if (seen.add(prev_node)) {
@@ -177,7 +177,7 @@ void DepsgraphRelationBuilder::build_driver_relations(IDNode *id_node)
return;
}
- // Mapping from RNA prefix -> set of driver descriptors:
+ /* Mapping from RNA prefix -> set of driver descriptors: */
Map<string, Vector<DriverDescriptor>> driver_groups;
PointerRNA id_ptr;
@@ -197,47 +197,47 @@ void DepsgraphRelationBuilder::build_driver_relations(IDNode *id_node)
}
for (Span<DriverDescriptor> prefix_group : driver_groups.values()) {
- // For each node in the driver group, try to connect it to another node
- // in the same group without creating any cycles.
+ /* For each node in the driver group, try to connect it to another node
+ * in the same group without creating any cycles. */
int num_drivers = prefix_group.size();
if (num_drivers < 2) {
- // A relation requires two drivers.
+ /* A relation requires two drivers. */
continue;
}
for (int from_index = 0; from_index < num_drivers; ++from_index) {
const DriverDescriptor &driver_from = prefix_group[from_index];
Node *op_from = get_node(driver_from.depsgraph_key());
- // Start by trying the next node in the group.
+ /* Start by trying the next node in the group. */
for (int to_offset = 1; to_offset < num_drivers; ++to_offset) {
const int to_index = (from_index + to_offset) % num_drivers;
const DriverDescriptor &driver_to = prefix_group[to_index];
Node *op_to = get_node(driver_to.depsgraph_key());
- // Duplicate drivers can exist (see T78615), but cannot be distinguished by OperationKey
- // and thus have the same depsgraph node. Relations between those drivers should not be
- // created. This not something that is expected to happen (both the UI and the Python API
- // prevent duplicate drivers), it did happen in a file and it is easy to deal with here.
+ /* Duplicate drivers can exist (see T78615), but cannot be distinguished by OperationKey
+ * and thus have the same depsgraph node. Relations between those drivers should not be
+ * created. This not something that is expected to happen (both the UI and the Python API
+ * prevent duplicate drivers), it did happen in a file and it is easy to deal with here. */
if (op_from == op_to) {
continue;
}
if (from_index < to_index && driver_from.is_same_array_as(driver_to)) {
- // This is for adding a relation like `color[0]` -> `color[1]`.
- // When the search for another driver wraps around, we cannot blindly add relations any
- // more.
+ /* This is for adding a relation like `color[0]` -> `color[1]`.
+ * When the search for another driver wraps around,
+ * we cannot blindly add relations any more. */
}
else {
- // Investigate whether this relation would create a dependency cycle.
- // Example graph:
- // A -> B -> C
- // and investigating a potential connection C->A. Because A->C is an
- // existing transitive connection, adding C->A would create a cycle.
+ /* Investigate whether this relation would create a dependency cycle.
+ * Example graph:
+ * A -> B -> C
+ * and investigating a potential connection C->A. Because A->C is an
+ * existing transitive connection, adding C->A would create a cycle. */
if (is_reachable(op_to, op_from)) {
continue;
}
- // No need to directly connect this node if there is already a transitive connection.
+ /* No need to directly connect this node if there is already a transitive connection. */
if (is_reachable(op_from, op_to)) {
break;
}
diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
index e0a7a42ea4a..bad4e96c60b 100644
--- a/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
+++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_keys.cc
@@ -28,7 +28,7 @@
namespace blender::deg {
////////////////////////////////////////////////////////////////////////////////
-// Time source.
+/* Time source. */
TimeSourceKey::TimeSourceKey() : id(nullptr)
{
diff --git a/source/blender/depsgraph/intern/debug/deg_time_average.h b/source/blender/depsgraph/intern/debug/deg_time_average.h
index 838ceff8d96..4ed78fe70cb 100644
--- a/source/blender/depsgraph/intern/debug/deg_time_average.h
+++ b/source/blender/depsgraph/intern/debug/deg_time_average.h
@@ -26,8 +26,7 @@
namespace blender {
namespace deg {
-// Utility class which takes care of calculating average of time series, such as
-// FPS counters.
+/* Utility class which takes care of calculating average of time series, such as FPS counters. */
template<int MaxSamples> class AveragedTimeSampler {
public:
AveragedTimeSampler() : num_samples_(0), next_sample_index_(0)
@@ -38,13 +37,13 @@ template<int MaxSamples> class AveragedTimeSampler {
{
samples_[next_sample_index_] = value;
- // Move to the next index, keeping wrapping at the end of array into account.
+ /* Move to the next index, keeping wrapping at the end of array into account. */
++next_sample_index_;
if (next_sample_index_ == MaxSamples) {
next_sample_index_ = 0;
}
- // Update number of stored samples.
+ /* Update number of stored samples. */
if (num_samples_ != MaxSamples) {
++num_samples_;
}
@@ -62,10 +61,10 @@ template<int MaxSamples> class AveragedTimeSampler {
protected:
double samples_[MaxSamples];
- // Number of samples which are actually stored in the array.
+ /* Number of samples which are actually stored in the array. */
int num_samples_;
- // Index in the samples_ array under which next sample will be stored.
+ /* Index in the samples_ array under which next sample will be stored. */
int next_sample_index_;
};
diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
index df1cf8cc771..770d9775dd3 100644
--- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc
+++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc
@@ -51,9 +51,9 @@
# include "intern/eval/deg_eval_copy_on_write.h"
#endif
-// If defined, all working data will be set to an invalid state, helping
-// to catch issues when areas accessing data which is considered to be no
-// longer available.
+/* If defined, all working data will be set to an invalid state, helping
+ * to catch issues when areas accessing data which is considered to be no
+ * longer available. */
#undef INVALIDATE_WORK_DATA
#ifndef NDEBUG
@@ -79,22 +79,20 @@ void deg_invalidate_iterator_work_data(DEGObjectIterData *data)
void verify_id_properties_freed(DEGObjectIterData *data)
{
if (data->dupli_object_current == nullptr) {
- // We didn't enter duplication yet, so we can't have any dangling
- // pointers.
+ /* We didn't enter duplication yet, so we can't have any dangling pointers. */
return;
}
const Object *dupli_object = data->dupli_object_current->ob;
Object *temp_dupli_object = &data->temp_dupli_object;
if (temp_dupli_object->id.properties == nullptr) {
- // No ID properties in temp data-block -- no leak is possible.
+ /* No ID properties in temp data-block -- no leak is possible. */
return;
}
if (temp_dupli_object->id.properties == dupli_object->id.properties) {
- // Temp copy of object did not modify ID properties.
+ /* Temp copy of object did not modify ID properties. */
return;
}
- // Free memory which is owned by temporary storage which is about to
- // get overwritten.
+ /* Free memory which is owned by temporary storage which is about to get overwritten. */
IDP_FreeProperty(temp_dupli_object->id.properties);
temp_dupli_object->id.properties = nullptr;
}
diff --git a/source/blender/depsgraph/intern/depsgraph_registry.cc b/source/blender/depsgraph/intern/depsgraph_registry.cc
index f348ef6e6e9..cc9fcf78292 100644
--- a/source/blender/depsgraph/intern/depsgraph_registry.cc
+++ b/source/blender/depsgraph/intern/depsgraph_registry.cc
@@ -49,7 +49,7 @@ void unregister_graph(Depsgraph *depsgraph)
VectorSet<Depsgraph *> &graphs = graph_registry.lookup(bmain);
graphs.remove(depsgraph);
- // If this was the last depsgraph associated with the main, remove the main entry as well.
+ /* If this was the last depsgraph associated with the main, remove the main entry as well. */
if (graphs.is_empty()) {
graph_registry.remove(bmain);
}
diff --git a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc
index 34c23740730..166ca37bc35 100644
--- a/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc
+++ b/source/blender/depsgraph/intern/eval/deg_eval_runtime_backup_sequencer.cc
@@ -38,33 +38,43 @@ SequencerBackup::SequencerBackup(const Depsgraph *depsgraph) : depsgraph(depsgra
{
}
+static bool seq_init_cb(Sequence *seq, void *user_data)
+{
+ SequencerBackup *sb = (SequencerBackup *)user_data;
+ SequenceBackup sequence_backup(sb->depsgraph);
+ sequence_backup.init_from_sequence(seq);
+ if (!sequence_backup.isEmpty()) {
+ const SessionUUID &session_uuid = seq->runtime.session_uuid;
+ BLI_assert(BLI_session_uuid_is_generated(&session_uuid));
+ sb->sequences_backup.add(session_uuid, sequence_backup);
+ }
+ return true;
+}
+
void SequencerBackup::init_from_scene(Scene *scene)
{
- Sequence *sequence;
- SEQ_ALL_BEGIN (scene->ed, sequence) {
- SequenceBackup sequence_backup(depsgraph);
- sequence_backup.init_from_sequence(sequence);
- if (!sequence_backup.isEmpty()) {
- const SessionUUID &session_uuid = sequence->runtime.session_uuid;
- BLI_assert(BLI_session_uuid_is_generated(&session_uuid));
- sequences_backup.add(session_uuid, sequence_backup);
- }
+ if (scene->ed != nullptr) {
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_init_cb, this);
}
- SEQ_ALL_END;
+}
+
+static bool seq_restore_cb(Sequence *seq, void *user_data)
+{
+ SequencerBackup *sb = (SequencerBackup *)user_data;
+ const SessionUUID &session_uuid = seq->runtime.session_uuid;
+ BLI_assert(BLI_session_uuid_is_generated(&session_uuid));
+ SequenceBackup *sequence_backup = sb->sequences_backup.lookup_ptr(session_uuid);
+ if (sequence_backup != nullptr) {
+ sequence_backup->restore_to_sequence(seq);
+ }
+ return true;
}
void SequencerBackup::restore_to_scene(Scene *scene)
{
- Sequence *sequence;
- SEQ_ALL_BEGIN (scene->ed, sequence) {
- const SessionUUID &session_uuid = sequence->runtime.session_uuid;
- BLI_assert(BLI_session_uuid_is_generated(&session_uuid));
- SequenceBackup *sequence_backup = sequences_backup.lookup_ptr(session_uuid);
- if (sequence_backup != nullptr) {
- sequence_backup->restore_to_sequence(sequence);
- }
+ if (scene->ed != nullptr) {
+ SEQ_for_each_callback(&scene->ed->seqbase, seq_restore_cb, this);
}
- SEQ_ALL_END;
/* Cleanup audio while the scene is still known. */
for (SequenceBackup &sequence_backup : sequences_backup.values()) {
if (sequence_backup.scene_sound != nullptr) {
diff --git a/source/blender/depsgraph/intern/node/deg_node_component.cc b/source/blender/depsgraph/intern/node/deg_node_component.cc
index 431bf536b65..a29618cefa8 100644
--- a/source/blender/depsgraph/intern/node/deg_node_component.cc
+++ b/source/blender/depsgraph/intern/node/deg_node_component.cc
@@ -237,7 +237,7 @@ void ComponentNode::tag_update(Depsgraph *graph, eUpdateSource source)
for (OperationNode *op_node : operations) {
op_node->tag_update(graph, source);
}
- // It is possible that tag happens before finalization.
+ /* It is possible that tag happens before finalization. */
if (operations_map != nullptr) {
for (OperationNode *op_node : operations_map->values()) {
op_node->tag_update(graph, source);