Blender
V4.3
source
blender
depsgraph
intern
eval
deg_eval_runtime_backup_scene.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
9
#include "
intern/eval/deg_eval_runtime_backup_scene.h
"
10
11
#include "
BKE_sound.h
"
12
13
#include "
DNA_rigidbody_types.h
"
14
#include "
DNA_scene_types.h
"
15
16
namespace
blender::deg
{
17
18
SceneBackup::SceneBackup
(
const
Depsgraph
*
depsgraph
) : sequencer_backup(
depsgraph
)
19
{
20
reset
();
21
}
22
23
void
SceneBackup::reset
()
24
{
25
sound_scene
=
nullptr
;
26
playback_handle
=
nullptr
;
27
sound_scrub_handle
=
nullptr
;
28
speaker_handles
=
nullptr
;
29
rigidbody_last_time
= -1;
30
}
31
32
void
SceneBackup::init_from_scene
(
Scene
*scene)
33
{
34
BKE_sound_lock
();
35
36
sound_scene
= scene->sound_scene;
37
playback_handle
= scene->playback_handle;
38
sound_scrub_handle
= scene->sound_scrub_handle;
39
speaker_handles
= scene->speaker_handles;
40
41
if
(scene->rigidbody_world !=
nullptr
) {
42
rigidbody_last_time
= scene->rigidbody_world->ltime;
43
}
44
45
/* Clear pointers stored in the scene, so they are not freed when copied-on-written datablock
46
* is freed for re-allocation. */
47
scene->sound_scene =
nullptr
;
48
scene->playback_handle =
nullptr
;
49
scene->sound_scrub_handle =
nullptr
;
50
scene->speaker_handles =
nullptr
;
51
52
sequencer_backup
.
init_from_scene
(scene);
53
}
54
55
void
SceneBackup::restore_to_scene
(
Scene
*scene)
56
{
57
scene->sound_scene =
sound_scene
;
58
scene->playback_handle =
playback_handle
;
59
scene->sound_scrub_handle =
sound_scrub_handle
;
60
scene->speaker_handles =
speaker_handles
;
61
62
if
(scene->rigidbody_world !=
nullptr
) {
63
scene->rigidbody_world->ltime =
rigidbody_last_time
;
64
}
65
66
sequencer_backup
.
restore_to_scene
(scene);
67
68
BKE_sound_unlock
();
69
70
reset
();
71
}
72
73
}
// namespace blender::deg
BKE_sound.h
BKE_sound_lock
void BKE_sound_lock(void)
Definition
blenkernel/intern/sound.cc:1349
BKE_sound_unlock
void BKE_sound_unlock(void)
Definition
blenkernel/intern/sound.cc:1350
DNA_rigidbody_types.h
Types and defines for representing Rigid Body entities.
DNA_scene_types.h
blender::deg::SceneBackup::sound_scrub_handle
void * sound_scrub_handle
Definition
deg_eval_runtime_backup_scene.h:36
blender::deg::SceneBackup::reset
void reset()
Definition
deg_eval_runtime_backup_scene.cc:23
blender::deg::SceneBackup::playback_handle
void * playback_handle
Definition
deg_eval_runtime_backup_scene.h:35
blender::deg::SceneBackup::sound_scene
void * sound_scene
Definition
deg_eval_runtime_backup_scene.h:34
blender::deg::SceneBackup::rigidbody_last_time
float rigidbody_last_time
Definition
deg_eval_runtime_backup_scene.h:38
blender::deg::SceneBackup::sequencer_backup
SequencerBackup sequencer_backup
Definition
deg_eval_runtime_backup_scene.h:40
blender::deg::SceneBackup::speaker_handles
void * speaker_handles
Definition
deg_eval_runtime_backup_scene.h:37
blender::deg::SceneBackup::init_from_scene
void init_from_scene(Scene *scene)
Definition
deg_eval_runtime_backup_scene.cc:32
blender::deg::SceneBackup::restore_to_scene
void restore_to_scene(Scene *scene)
Definition
deg_eval_runtime_backup_scene.cc:55
blender::deg::SceneBackup::SceneBackup
SceneBackup(const Depsgraph *depsgraph)
Definition
deg_eval_runtime_backup_scene.cc:18
blender::deg::SequencerBackup::init_from_scene
void init_from_scene(Scene *scene)
Definition
deg_eval_runtime_backup_sequencer.cc:37
blender::deg::SequencerBackup::restore_to_scene
void restore_to_scene(Scene *scene)
Definition
deg_eval_runtime_backup_sequencer.cc:56
depsgraph
const Depsgraph * depsgraph
Definition
deg_eval_copy_on_write.cc:494
deg_eval_runtime_backup_scene.h
blender::deg
Definition
DEG_depsgraph_light_linking.hh:18
Scene
Definition
DNA_scene_types.h:1988
blender::deg::Depsgraph
Definition
depsgraph.hh:47
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0