Blender V5.3
deg_eval_runtime_backup_sequence.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
11#include "DNA_sequence_types.h"
12
13#include "SEQ_modifier.hh"
14#include "SEQ_sequencer.hh"
15
16#include "BLI_listbase.hh"
17
18namespace blender::deg {
19
24
26{
27 sound_in = nullptr;
28 sound_out = nullptr;
30 params_hash = 0;
31}
32
34{
36
37 if (smd->is_type_sound()) {
38 flag = runtime->flag;
39 sound_in = runtime->last_sound_in;
40 sound_out = runtime->last_sound_out;
41 params_hash = runtime->params_hash;
42
43 runtime->last_sound_in = nullptr;
44 runtime->last_sound_out = nullptr;
45 }
46}
47
49{
51
52 if (smd->is_type_sound()) {
53 runtime->flag = flag;
54 runtime->last_sound_in = sound_in;
55 runtime->last_sound_out = sound_out;
56 runtime->params_hash = params_hash;
57 }
58 reset();
59}
60
62{
63 return sound_in == nullptr && sound_out == nullptr;
64}
65
66StripBackup::StripBackup(const Depsgraph * /*depsgraph*/)
67{
68 reset();
69}
70
72{
73 scene_sound = nullptr;
74 sound_time_stretch = nullptr;
76 modifiers.clear();
77}
78
80{
81 scene_sound = strip->runtime->scene_sound;
82 sound_time_stretch = strip->runtime->sound_time_stretch;
83 sound_time_stretch_fps = strip->runtime->sound_time_stretch_fps;
84
85 for (StripModifierData &smd : strip->modifiers) {
86 StripModifierDataBackup mod_backup;
87 mod_backup.init_from_modifier(&smd);
88 if (!mod_backup.isEmpty()) {
89 modifiers.add(smd.persistent_uid, mod_backup);
90 }
91 }
92
93 strip->runtime->scene_sound = nullptr;
94 strip->runtime->sound_time_stretch = nullptr;
95 strip->runtime->sound_time_stretch_fps = 0.0f;
96}
97
99{
100 strip->runtime->scene_sound = scene_sound;
101 strip->runtime->sound_time_stretch = sound_time_stretch;
102 strip->runtime->sound_time_stretch_fps = sound_time_stretch_fps;
103
104 for (StripModifierData &smd : strip->modifiers) {
105 std::optional<StripModifierDataBackup> backup = modifiers.pop_try(smd.persistent_uid);
106 if (backup) {
107 backup->restore_to_modifier(&smd);
108 }
109 }
110
111 reset();
112}
113
115{
116 return (scene_sound == nullptr) && (sound_time_stretch == nullptr) && modifiers.is_empty();
117}
118
119} // namespace blender::deg
Map< int, StripModifierDataBackup > modifiers
blender::seq::StripModifierDataRuntime * runtime