Depsgraph: Initial work to cover sequencer
Just adds sequencer operation and links possible sound ID to it. No functional changes, just moving towards sound system integration into the dependency graph.
This commit is contained in:
@@ -58,6 +58,7 @@ extern "C" {
|
|||||||
#include "DNA_lightprobe_types.h"
|
#include "DNA_lightprobe_types.h"
|
||||||
#include "DNA_rigidbody_types.h"
|
#include "DNA_rigidbody_types.h"
|
||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
|
#include "DNA_sequence_types.h"
|
||||||
#include "DNA_sound_types.h"
|
#include "DNA_sound_types.h"
|
||||||
#include "DNA_speaker_types.h"
|
#include "DNA_speaker_types.h"
|
||||||
#include "DNA_texture_types.h"
|
#include "DNA_texture_types.h"
|
||||||
@@ -89,6 +90,7 @@ extern "C" {
|
|||||||
#include "BKE_particle.h"
|
#include "BKE_particle.h"
|
||||||
#include "BKE_pointcache.h"
|
#include "BKE_pointcache.h"
|
||||||
#include "BKE_rigidbody.h"
|
#include "BKE_rigidbody.h"
|
||||||
|
#include "BKE_sequencer.h"
|
||||||
#include "BKE_shader_fx.h"
|
#include "BKE_shader_fx.h"
|
||||||
#include "BKE_sound.h"
|
#include "BKE_sound.h"
|
||||||
#include "BKE_tracking.h"
|
#include "BKE_tracking.h"
|
||||||
@@ -1566,6 +1568,23 @@ void DepsgraphNodeBuilder::build_sound(bSound *sound)
|
|||||||
build_parameters(&sound->id);
|
build_parameters(&sound->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DepsgraphNodeBuilder::build_sequencer(Scene *scene)
|
||||||
|
{
|
||||||
|
if (scene->ed == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
add_operation_node(&scene->id, NodeType::SEQUENCER, OperationCode::SEQUENCES_EVAL);
|
||||||
|
/* Make sure data for sequences is in the graph. */
|
||||||
|
Sequence *seq;
|
||||||
|
SEQ_BEGIN (scene->ed, seq) {
|
||||||
|
if (seq->sound != NULL) {
|
||||||
|
build_sound(seq->sound);
|
||||||
|
}
|
||||||
|
/* TODO(sergey): Movie clip, scene, camera, mask. */
|
||||||
|
}
|
||||||
|
SEQ_END;
|
||||||
|
}
|
||||||
|
|
||||||
/* **** ID traversal callbacks functions **** */
|
/* **** ID traversal callbacks functions **** */
|
||||||
|
|
||||||
void DepsgraphNodeBuilder::modifier_walk(void *user_data,
|
void DepsgraphNodeBuilder::modifier_walk(void *user_data,
|
||||||
|
|||||||
@@ -208,6 +208,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder {
|
|||||||
void build_lightprobe(LightProbe *probe);
|
void build_lightprobe(LightProbe *probe);
|
||||||
void build_speaker(Speaker *speaker);
|
void build_speaker(Speaker *speaker);
|
||||||
void build_sound(bSound *sound);
|
void build_sound(bSound *sound);
|
||||||
|
void build_sequencer(Scene *scene);
|
||||||
|
|
||||||
/* Per-ID information about what was already in the dependency graph.
|
/* Per-ID information about what was already in the dependency graph.
|
||||||
* Allows to re-use certain values, to speed up following evaluation. */
|
* Allows to re-use certain values, to speed up following evaluation. */
|
||||||
|
|||||||
@@ -152,6 +152,10 @@ void DepsgraphNodeBuilder::build_view_layer(Scene *scene,
|
|||||||
build_collection(NULL, fls->group);
|
build_collection(NULL, fls->group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Sequencer. */
|
||||||
|
if (linked_state == DEG_ID_LINKED_DIRECTLY) {
|
||||||
|
build_sequencer(scene);
|
||||||
|
}
|
||||||
/* Collections. */
|
/* Collections. */
|
||||||
add_operation_node(
|
add_operation_node(
|
||||||
&scene->id,
|
&scene->id,
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ extern "C" {
|
|||||||
#include "DNA_object_types.h"
|
#include "DNA_object_types.h"
|
||||||
#include "DNA_rigidbody_types.h"
|
#include "DNA_rigidbody_types.h"
|
||||||
#include "DNA_scene_types.h"
|
#include "DNA_scene_types.h"
|
||||||
|
#include "DNA_sequence_types.h"
|
||||||
#include "DNA_sound_types.h"
|
#include "DNA_sound_types.h"
|
||||||
#include "DNA_speaker_types.h"
|
#include "DNA_speaker_types.h"
|
||||||
#include "DNA_texture_types.h"
|
#include "DNA_texture_types.h"
|
||||||
@@ -84,6 +85,7 @@ extern "C" {
|
|||||||
#include "BKE_particle.h"
|
#include "BKE_particle.h"
|
||||||
#include "BKE_pointcache.h"
|
#include "BKE_pointcache.h"
|
||||||
#include "BKE_rigidbody.h"
|
#include "BKE_rigidbody.h"
|
||||||
|
#include "BKE_sequencer.h"
|
||||||
#include "BKE_shader_fx.h"
|
#include "BKE_shader_fx.h"
|
||||||
#include "BKE_shrinkwrap.h"
|
#include "BKE_shrinkwrap.h"
|
||||||
#include "BKE_sound.h"
|
#include "BKE_sound.h"
|
||||||
@@ -2297,6 +2299,25 @@ void DepsgraphRelationBuilder::build_sound(bSound *sound)
|
|||||||
build_parameters(&sound->id);
|
build_parameters(&sound->id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DepsgraphRelationBuilder::build_sequencer(Scene *scene)
|
||||||
|
{
|
||||||
|
if (scene->ed == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
/* Make sure dependnecies from sequences data goes to the sequencer evaluation. */
|
||||||
|
ComponentKey sequencer_key(&scene->id, NodeType::SEQUENCER);
|
||||||
|
Sequence *seq;
|
||||||
|
SEQ_BEGIN (scene->ed, seq) {
|
||||||
|
if (seq->sound != NULL) {
|
||||||
|
build_sound(seq->sound);
|
||||||
|
ComponentKey sound_key(&seq->sound->id, NodeType::AUDIO);
|
||||||
|
add_relation(sound_key, sequencer_key, "Sound -> Sequencer");
|
||||||
|
}
|
||||||
|
/* TODO(sergey): Movie clip, scene, camera, mask. */
|
||||||
|
}
|
||||||
|
SEQ_END;
|
||||||
|
}
|
||||||
|
|
||||||
void DepsgraphRelationBuilder::build_copy_on_write_relations()
|
void DepsgraphRelationBuilder::build_copy_on_write_relations()
|
||||||
{
|
{
|
||||||
for (IDNode *id_node : graph_->id_nodes) {
|
for (IDNode *id_node : graph_->id_nodes) {
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
#include "intern/builder/deg_builder_rna.h"
|
#include "intern/builder/deg_builder_rna.h"
|
||||||
#include "intern/depsgraph.h"
|
#include "intern/depsgraph.h"
|
||||||
#include "intern/node/deg_node.h"
|
#include "intern/node/deg_node.h"
|
||||||
|
#include "intern/node/deg_node_id.h"
|
||||||
#include "intern/node/deg_node_component.h"
|
#include "intern/node/deg_node_component.h"
|
||||||
#include "intern/node/deg_node_operation.h"
|
#include "intern/node/deg_node_operation.h"
|
||||||
|
|
||||||
@@ -195,7 +196,9 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
|
|||||||
|
|
||||||
void build_id(ID *id);
|
void build_id(ID *id);
|
||||||
void build_layer_collections(ListBase *lb);
|
void build_layer_collections(ListBase *lb);
|
||||||
void build_view_layer(Scene *scene, ViewLayer *view_layer);
|
void build_view_layer(Scene *scene,
|
||||||
|
ViewLayer *view_layer,
|
||||||
|
eDepsNode_LinkedState_Type linked_state);
|
||||||
void build_collection(LayerCollection *from_layer_collection,
|
void build_collection(LayerCollection *from_layer_collection,
|
||||||
Object *object,
|
Object *object,
|
||||||
Collection *collection);
|
Collection *collection);
|
||||||
@@ -266,6 +269,7 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder {
|
|||||||
void build_lightprobe(LightProbe *probe);
|
void build_lightprobe(LightProbe *probe);
|
||||||
void build_speaker(Speaker *speaker);
|
void build_speaker(Speaker *speaker);
|
||||||
void build_sound(bSound *sound);
|
void build_sound(bSound *sound);
|
||||||
|
void build_sequencer(Scene *scene);
|
||||||
|
|
||||||
void build_nested_datablock(ID *owner, ID *id);
|
void build_nested_datablock(ID *owner, ID *id);
|
||||||
void build_nested_nodetree(ID *owner, bNodeTree *ntree);
|
void build_nested_nodetree(ID *owner, bNodeTree *ntree);
|
||||||
|
|||||||
@@ -75,7 +75,9 @@ void DepsgraphRelationBuilder::build_layer_collections(ListBase *lb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_layer)
|
void DepsgraphRelationBuilder::build_view_layer(Scene *scene,
|
||||||
|
ViewLayer *view_layer,
|
||||||
|
eDepsNode_LinkedState_Type linked_state)
|
||||||
{
|
{
|
||||||
/* Setup currently building context. */
|
/* Setup currently building context. */
|
||||||
scene_ = scene;
|
scene_ = scene;
|
||||||
@@ -128,10 +130,14 @@ void DepsgraphRelationBuilder::build_view_layer(Scene *scene, ViewLayer *view_la
|
|||||||
build_collection(NULL, NULL, fls->group);
|
build_collection(NULL, NULL, fls->group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Sequencer. */
|
||||||
|
if (linked_state == DEG_ID_LINKED_DIRECTLY) {
|
||||||
|
build_sequencer(scene);
|
||||||
|
}
|
||||||
/* Build all set scenes. */
|
/* Build all set scenes. */
|
||||||
if (scene->set != NULL) {
|
if (scene->set != NULL) {
|
||||||
ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set);
|
ViewLayer *set_view_layer = BKE_view_layer_default_render(scene->set);
|
||||||
build_view_layer(scene->set, set_view_layer);
|
build_view_layer(scene->set, set_view_layer, DEG_ID_LINKED_VIA_SET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph,
|
|||||||
* order. */
|
* order. */
|
||||||
DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
|
DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache);
|
||||||
relation_builder.begin_build();
|
relation_builder.begin_build();
|
||||||
relation_builder.build_view_layer(scene, view_layer);
|
relation_builder.build_view_layer(scene, view_layer, DEG::DEG_ID_LINKED_DIRECTLY);
|
||||||
relation_builder.build_copy_on_write_relations();
|
relation_builder.build_copy_on_write_relations();
|
||||||
/* Detect and solve cycles. */
|
/* Detect and solve cycles. */
|
||||||
DEG::deg_graph_detect_cycles(deg_graph);
|
DEG::deg_graph_detect_cycles(deg_graph);
|
||||||
|
|||||||
@@ -185,6 +185,9 @@ const char *operationCodeAsString(OperationCode opcode)
|
|||||||
/* Generic datablock. */
|
/* Generic datablock. */
|
||||||
case OperationCode::GENERIC_DATABLOCK_UPDATE:
|
case OperationCode::GENERIC_DATABLOCK_UPDATE:
|
||||||
return "GENERIC_DATABLOCK_UPDATE";
|
return "GENERIC_DATABLOCK_UPDATE";
|
||||||
|
/* Sequencer. */
|
||||||
|
case OperationCode::SEQUENCES_EVAL:
|
||||||
|
return "SEQUENCES_EVAL";
|
||||||
/* instancing/duplication. */
|
/* instancing/duplication. */
|
||||||
case OperationCode::DUPLI:
|
case OperationCode::DUPLI:
|
||||||
return "DUPLI";
|
return "DUPLI";
|
||||||
|
|||||||
@@ -185,12 +185,16 @@ enum class OperationCode {
|
|||||||
/* Images. -------------------------------------------------------------- */
|
/* Images. -------------------------------------------------------------- */
|
||||||
IMAGE_ANIMATION,
|
IMAGE_ANIMATION,
|
||||||
|
|
||||||
/* Synchronization clips. ----------------------------------------------- */
|
/* Synchronization. ----------------------------------------------------- */
|
||||||
SYNCHRONIZE_TO_ORIGINAL,
|
SYNCHRONIZE_TO_ORIGINAL,
|
||||||
|
|
||||||
/* Generic datablock ---------------------------------------------------- */
|
/* Generic datablock ---------------------------------------------------- */
|
||||||
GENERIC_DATABLOCK_UPDATE,
|
GENERIC_DATABLOCK_UPDATE,
|
||||||
|
|
||||||
|
/* Sequencer. ----------------------------------------------------------- */
|
||||||
|
|
||||||
|
SEQUENCES_EVAL,
|
||||||
|
|
||||||
/* Duplication/instancing system. --------------------------------------- */
|
/* Duplication/instancing system. --------------------------------------- */
|
||||||
DUPLI,
|
DUPLI,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user