Blender V5.0
versioning_dna.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
10
11#include "DNA_genfile.h"
12
13#include "readfile.hh"
14
15void blo_do_versions_dna(SDNA *sdna, const int versionfile, const int subversionfile)
16{
17#define DNA_VERSION_ATLEAST(ver, subver) \
18 (versionfile > (ver) || (versionfile == (ver) && (subversionfile >= (subver))))
19
20 if (!DNA_VERSION_ATLEAST(280, 2)) {
21 /* Version files created in the 'blender2.8' branch
22 * between October 2016, and November 2017 (>=280.0 and < 280.2). */
23 if (versionfile >= 280) {
24 DNA_sdna_patch_struct_by_name(sdna, "SceneLayer", "ViewLayer");
26 sdna, "FileGlobal", "cur_render_layer", "cur_view_layer");
28 sdna, "ParticleEditSettings", "scene_layer", "view_layer");
29 DNA_sdna_patch_struct_member_by_name(sdna, "Scene", "active_layer", "active_view_layer");
30 DNA_sdna_patch_struct_member_by_name(sdna, "Scene", "render_layers", "view_layers");
31 DNA_sdna_patch_struct_member_by_name(sdna, "WorkSpace", "render_layer", "view_layer");
32 }
33 }
34
35 if (!DNA_VERSION_ATLEAST(500, 51)) {
36 /* These old struct names were only used by an experimental feature. They were renamed before
37 * the feature became official. This versioning just allows to read old files but does not
38 * provide forward compatibility. */
39 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometryClosureInput", "NodeClosureInput");
40 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometryClosureInputItem", "NodeClosureInputItem");
41 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometryClosureOutputItem", "NodeClosureOutputItem");
42 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometryClosureInputItems", "NodeClosureInputItems");
44 sdna, "NodeGeometryClosureOutputItems", "NodeClosureOutputItems");
45 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometryClosureOutput", "NodeClosureOutput");
47 sdna, "NodeGeometryEvaluateClosureInputItem", "NodeEvaluateClosureInputItem");
49 sdna, "NodeGeometryEvaluateClosureOutputItem", "NodeEvaluateClosureOutputItem");
51 sdna, "NodeGeometryEvaluateClosureInputItems", "NodeEvaluateClosureInputItems");
53 sdna, "NodeGeometryEvaluateClosureOutputItems", "NodeEvaluateClosureOutputItems");
54 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometryEvaluateClosure", "NodeEvaluateClosure");
55 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometryCombineBundleItem", "NodeCombineBundleItem");
56 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometryCombineBundle", "NodeCombineBundle");
58 sdna, "NodeGeometrySeparateBundleItem", "NodeSeparateBundleItem");
59 DNA_sdna_patch_struct_by_name(sdna, "NodeGeometrySeparateBundle", "NodeSeparateBundle");
60 }
61
62#undef DNA_VERSION_ATLEAST
63}
blenloader genfile private function prototypes
bool DNA_sdna_patch_struct_by_name(struct SDNA *sdna, const char *old_type_name, const char *new_type_name)
bool DNA_sdna_patch_struct_member_by_name(struct SDNA *sdna, const char *type_name, const char *old_member_name, const char *new_member_name)
#define DNA_VERSION_ATLEAST(ver, subver)
void blo_do_versions_dna(SDNA *sdna, const int versionfile, const int subversionfile)