Blender  V2.93
versioning_dna.c
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 
23 #include "BLI_compiler_attrs.h"
24 #include "BLI_utildefines.h"
25 
26 #include "DNA_genfile.h"
27 #include "DNA_listBase.h"
28 
29 #include "BLO_readfile.h"
30 #include "readfile.h"
31 
42 void blo_do_versions_dna(SDNA *sdna, const int versionfile, const int subversionfile)
43 {
44 #define DNA_VERSION_ATLEAST(ver, subver) \
45  (versionfile > (ver) || (versionfile == (ver) && (subversionfile >= (subver))))
46 
47  if (!DNA_VERSION_ATLEAST(280, 2)) {
48  /* Version files created in the 'blender2.8' branch
49  * between October 2016, and November 2017 (>=280.0 and < 280.2). */
50  if (versionfile >= 280) {
51  DNA_sdna_patch_struct(sdna, "SceneLayer", "ViewLayer");
52  DNA_sdna_patch_struct(sdna, "SceneLayerEngineData", "ViewLayerEngineData");
53  DNA_sdna_patch_struct_member(sdna, "FileGlobal", "cur_render_layer", "cur_view_layer");
54  DNA_sdna_patch_struct_member(sdna, "ParticleEditSettings", "scene_layer", "view_layer");
55  DNA_sdna_patch_struct_member(sdna, "Scene", "active_layer", "active_view_layer");
56  DNA_sdna_patch_struct_member(sdna, "Scene", "render_layers", "view_layers");
57  DNA_sdna_patch_struct_member(sdna, "WorkSpace", "render_layer", "view_layer");
58  }
59  }
60 
61 #undef DNA_VERSION_ATLEAST
62 }
external readfile function prototypes.
blenloader genfile private function prototypes
bool DNA_sdna_patch_struct_member(struct SDNA *sdna, const char *struct_name, const char *elem_old, const char *elem_new)
Definition: dna_genfile.c:1788
bool DNA_sdna_patch_struct(struct SDNA *sdna, const char *struct_name_old, const char *struct_name_new)
Definition: dna_genfile.c:1726
These structs are the foundation for all linked lists in the library system.
#define DNA_VERSION_ATLEAST(ver, subver)
void blo_do_versions_dna(SDNA *sdna, const int versionfile, const int subversionfile)