Blender  V2.93
deg_eval_runtime_backup_sequencer.cc
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or
3  * modify it under the terms of the GNU General Public License
4  * as published by the Free Software Foundation; either version 2
5  * of the License, or (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software Foundation,
14  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15  *
16  * The Original Code is Copyright (C) 2019 Blender Foundation.
17  * All rights reserved.
18  */
19 
25 
26 #include "DNA_scene_types.h"
27 #include "DNA_sequence_types.h"
28 
29 #include "BLI_assert.h"
30 
31 #include "BKE_sound.h"
32 
33 #include "SEQ_iterator.h"
34 
35 namespace blender::deg {
36 
38 {
39 }
40 
42 {
43  Sequence *sequence;
44  SEQ_ALL_BEGIN (scene->ed, sequence) {
45  SequenceBackup sequence_backup(depsgraph);
46  sequence_backup.init_from_sequence(sequence);
47  if (!sequence_backup.isEmpty()) {
48  const SessionUUID &session_uuid = sequence->runtime.session_uuid;
50  sequences_backup.add(session_uuid, sequence_backup);
51  }
52  }
54 }
55 
57 {
58  Sequence *sequence;
59  SEQ_ALL_BEGIN (scene->ed, sequence) {
60  const SessionUUID &session_uuid = sequence->runtime.session_uuid;
62  SequenceBackup *sequence_backup = sequences_backup.lookup_ptr(session_uuid);
63  if (sequence_backup != nullptr) {
64  sequence_backup->restore_to_sequence(sequence);
65  }
66  }
68  /* Cleanup audio while the scene is still known. */
69  for (SequenceBackup &sequence_backup : sequences_backup.values()) {
70  if (sequence_backup.scene_sound != nullptr) {
71  BKE_sound_remove_scene_sound(scene, sequence_backup.scene_sound);
72  }
73  }
74 }
75 
76 } // namespace blender::deg
void BKE_sound_remove_scene_sound(struct Scene *scene, void *handle)
#define BLI_assert(a)
Definition: BLI_assert.h:58
bool BLI_session_uuid_is_generated(const SessionUUID *uuid)
Definition: session_uuid.c:52
#define SEQ_ALL_END
Definition: SEQ_iterator.h:48
#define SEQ_ALL_BEGIN(ed, _seq)
Definition: SEQ_iterator.h:41
Map< SessionUUID, SequenceBackup > sequences_backup
Scene scene
const Depsgraph * depsgraph
struct Editing * ed
SessionUUID session_uuid
SequenceRuntime runtime