Blender
V2.93
source
blender
depsgraph
intern
eval
deg_eval_runtime_backup_scene.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
24
#include "
intern/eval/deg_eval_runtime_backup_scene.h
"
25
26
#include "
BKE_sound.h
"
27
28
#include "
DNA_rigidbody_types.h
"
29
#include "
DNA_scene_types.h
"
30
31
namespace
blender::deg
{
32
33
SceneBackup::SceneBackup
(
const
Depsgraph
*
depsgraph
) : sequencer_backup(
depsgraph
)
34
{
35
reset
();
36
}
37
38
void
SceneBackup::reset
()
39
{
40
sound_scene
=
nullptr
;
41
playback_handle
=
nullptr
;
42
sound_scrub_handle
=
nullptr
;
43
speaker_handles
=
nullptr
;
44
rigidbody_last_time
= -1;
45
}
46
47
void
SceneBackup::init_from_scene
(
Scene
*
scene
)
48
{
49
BKE_sound_lock
();
50
51
sound_scene
=
scene
->
sound_scene
;
52
playback_handle
=
scene
->
playback_handle
;
53
sound_scrub_handle
=
scene
->
sound_scrub_handle
;
54
speaker_handles
=
scene
->
speaker_handles
;
55
56
if
(
scene
->
rigidbody_world
!=
nullptr
) {
57
rigidbody_last_time
=
scene
->
rigidbody_world
->
ltime
;
58
}
59
60
/* Clear pointers stored in the scene, so they are not freed when copied-on-written datablock
61
* is freed for re-allocation. */
62
scene
->
sound_scene
=
nullptr
;
63
scene
->
playback_handle
=
nullptr
;
64
scene
->
sound_scrub_handle
=
nullptr
;
65
scene
->
speaker_handles
=
nullptr
;
66
67
sequencer_backup
.
init_from_scene
(
scene
);
68
}
69
70
void
SceneBackup::restore_to_scene
(
Scene
*
scene
)
71
{
72
scene
->
sound_scene
=
sound_scene
;
73
scene
->
playback_handle
=
playback_handle
;
74
scene
->
sound_scrub_handle
=
sound_scrub_handle
;
75
scene
->
speaker_handles
=
speaker_handles
;
76
77
if
(
scene
->
rigidbody_world
!=
nullptr
) {
78
scene
->
rigidbody_world
->
ltime
=
rigidbody_last_time
;
79
}
80
81
sequencer_backup
.
restore_to_scene
(
scene
);
82
83
BKE_sound_unlock
();
84
85
reset
();
86
}
87
88
}
// namespace blender::deg
BKE_sound.h
BKE_sound_lock
void BKE_sound_lock(void)
Definition:
blenkernel/intern/sound.c:1269
BKE_sound_unlock
void BKE_sound_unlock(void)
Definition:
blenkernel/intern/sound.c:1272
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:52
blender::deg::SceneBackup::reset
void reset()
Definition:
deg_eval_runtime_backup_scene.cc:38
blender::deg::SceneBackup::playback_handle
void * playback_handle
Definition:
deg_eval_runtime_backup_scene.h:51
blender::deg::SceneBackup::sound_scene
void * sound_scene
Definition:
deg_eval_runtime_backup_scene.h:50
blender::deg::SceneBackup::rigidbody_last_time
float rigidbody_last_time
Definition:
deg_eval_runtime_backup_scene.h:54
blender::deg::SceneBackup::sequencer_backup
SequencerBackup sequencer_backup
Definition:
deg_eval_runtime_backup_scene.h:56
blender::deg::SceneBackup::speaker_handles
void * speaker_handles
Definition:
deg_eval_runtime_backup_scene.h:53
blender::deg::SceneBackup::init_from_scene
void init_from_scene(Scene *scene)
Definition:
deg_eval_runtime_backup_scene.cc:47
blender::deg::SceneBackup::restore_to_scene
void restore_to_scene(Scene *scene)
Definition:
deg_eval_runtime_backup_scene.cc:70
blender::deg::SceneBackup::SceneBackup
SceneBackup(const Depsgraph *depsgraph)
Definition:
deg_eval_runtime_backup_scene.cc:33
blender::deg::SequencerBackup::init_from_scene
void init_from_scene(Scene *scene)
Definition:
deg_eval_runtime_backup_sequencer.cc:41
blender::deg::SequencerBackup::restore_to_scene
void restore_to_scene(Scene *scene)
Definition:
deg_eval_runtime_backup_sequencer.cc:56
scene
Scene scene
Definition:
deg_eval_copy_on_write.cc:120
depsgraph
const Depsgraph * depsgraph
Definition:
deg_eval_copy_on_write.cc:513
deg_eval_runtime_backup_scene.h
blender::deg
Definition:
deg_builder.cc:53
RigidBodyWorld::ltime
float ltime
Definition:
DNA_rigidbody_types.h:71
Scene
Definition:
DNA_scene_types.h:1684
Scene::sound_scrub_handle
void * sound_scrub_handle
Definition:
DNA_scene_types.h:1737
Scene::rigidbody_world
struct RigidBodyWorld * rigidbody_world
Definition:
DNA_scene_types.h:1782
Scene::sound_scene
void * sound_scene
Definition:
DNA_scene_types.h:1735
Scene::speaker_handles
void * speaker_handles
Definition:
DNA_scene_types.h:1738
Scene::playback_handle
void * playback_handle
Definition:
DNA_scene_types.h:1736
blender::deg::Depsgraph
Definition:
depsgraph.h:60
Generated on Tue Jan 31 2023 14:37:24 for Blender by
doxygen
1.9.1