Blender V5.0
deg_eval_runtime_backup.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2017 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
10
12
13#include "DRW_engine.hh"
14
15namespace blender::deg {
16
19 id_data({nullptr}),
20 animation_backup(depsgraph),
21 scene_backup(depsgraph),
22 sound_backup(depsgraph),
23 object_backup(depsgraph),
24 movieclip_backup(depsgraph),
25 volume_backup(depsgraph)
26{
27}
28
30{
32 return;
33 }
34 have_backup = true;
35
36 /* Clear, so freeing the expanded data doesn't touch this Python reference. */
37 id_data.py_instance = id->py_instance;
38 id->py_instance = nullptr;
39
40 animation_backup.init_from_id(id);
41
42 const ID_Type id_type = GS(id->name);
43 switch (id_type) {
44 case ID_OB:
45 object_backup.init_from_object(reinterpret_cast<Object *>(id));
46 break;
47 case ID_SCE:
48 scene_backup.init_from_scene(reinterpret_cast<Scene *>(id));
49 break;
50 case ID_SO:
51 sound_backup.init_from_sound(reinterpret_cast<bSound *>(id));
52 break;
53 case ID_MC:
54 movieclip_backup.init_from_movieclip(reinterpret_cast<MovieClip *>(id));
55 break;
56 case ID_VO:
57 volume_backup.init_from_volume(reinterpret_cast<Volume *>(id));
58 break;
59 default:
60 break;
61 }
62}
63
65{
66 if (!have_backup) {
67 return;
68 }
69
70 id->py_instance = id_data.py_instance;
71
72 animation_backup.restore_to_id(id);
73
74 const ID_Type id_type = GS(id->name);
75 switch (id_type) {
76 case ID_OB:
77 object_backup.restore_to_object(reinterpret_cast<Object *>(id));
78 break;
79 case ID_SCE:
80 scene_backup.restore_to_scene(reinterpret_cast<Scene *>(id));
81 break;
82 case ID_SO:
83 sound_backup.restore_to_sound(reinterpret_cast<bSound *>(id));
84 break;
85 case ID_MC:
86 movieclip_backup.restore_to_movieclip(reinterpret_cast<MovieClip *>(id));
87 break;
88 case ID_VO:
89 volume_backup.restore_to_volume(reinterpret_cast<Volume *>(id));
90 break;
91 default:
92 break;
93 }
94}
95
96} // namespace blender::deg
ID_Type
@ ID_MC
@ ID_VO
@ ID_SO
@ ID_SCE
@ ID_OB
BPy_StructRNA * depsgraph
struct blender::deg::RuntimeBackup::@174342006056032174270360334042251111060023007145 id_data
RuntimeBackup(const Depsgraph *depsgraph)
#define GS(x)
bool deg_eval_copy_is_expanded(const ID *id_cow)
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432