[Bf-blender-cvs] [fc4d4727b0f] temp-dna-rename: Correct missing files

Campbell Barton noreply at git.blender.org
Tue Feb 12 22:11:22 CET 2019


Commit: fc4d4727b0fed9a2cada453efdbff4a4833d0c76
Author: Campbell Barton
Date:   Wed Feb 13 00:31:29 2019 +1100
Branches: temp-dna-rename
https://developer.blender.org/rBfc4d4727b0fed9a2cada453efdbff4a4833d0c76

Correct missing files

===================================================================

M	source/blender/blenloader/intern/versioning_dna.c
M	source/blender/makesdna/DNA_genfile.h
M	source/blender/makesdna/DNA_sdna_types.h
M	source/blender/makesdna/intern/CMakeLists.txt

===================================================================

diff --git a/source/blender/blenloader/intern/versioning_dna.c b/source/blender/blenloader/intern/versioning_dna.c
index c855971d131..f081f8c2312 100644
--- a/source/blender/blenloader/intern/versioning_dna.c
+++ b/source/blender/blenloader/intern/versioning_dna.c
@@ -16,12 +16,18 @@
 
 /** \file \ingroup blenloader
  *
- * Apply edits to DNA at load time.
+ * Support for version patching DNA, there are two kinds.
+ *
+ * - #DNA_MAKESDNA defined:
+ *   Defines store files with old names but run-time uses new names.
+ *
+ *   Allows us to rename variables & structs without breaking compatibility.
  *
  * - #DNA_MAKESDNA undefined:
  *   Behave as if old files were written new names.
- * - #DNA_MAKESDNA defined:
- *   Defines store files with old names but runtime uses new names.
+ *
+ *   This means older versions of Blender won't have access to this data *USE WITH CARE*.
+ *
  */
 
 #ifndef DNA_MAKESDNA
@@ -35,8 +41,20 @@
 #  include "readfile.h"
 #endif
 
+#ifdef DNA_MAKESDNA
+
+/**
+ * Included in DNA versioning code.
+ *
+ * Currently use 'old' names when replacing struct members.
+ */
+DNA_STRUCT_REPLACE(Lamp, Light)
+DNA_STRUCT_MEMBER_REPLACE(Lamp, clipsta, clip_start)
+DNA_STRUCT_MEMBER_REPLACE(Lamp, clipend, clip_end)
+DNA_STRUCT_MEMBER_REPLACE(Camera, YF_dofdist, dof_dist)
+
+#else /* !DNA_MAKESDNA */
 
-#ifndef DNA_MAKESDNA
 /**
  * Manipulates SDNA before calling #DNA_struct_get_compareflags,
  * allowing us to rename structs and struct members.
@@ -66,14 +84,4 @@ void blo_do_versions_dna(SDNA *sdna, const int versionfile, const int subversion
 #undef DNA_VERSION_ATLEAST
 }
 
-#else /* !DNA_MAKESDNA */
-
-/* Included in DNA versioning code. */
-
-DNA_STRUCT_REPLACE(Lamp, Light)
-DNA_STRUCT_MEMBER_REPLACE(Lamp, clipsta, clip_start)
-DNA_STRUCT_MEMBER_REPLACE(Lamp, clipend, clip_end)
-
-DNA_STRUCT_MEMBER_REPLACE(Camera, YF_dofdist, dof_dist)
-
 #endif /* !DNA_MAKESDNA */
diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 0d330c8999a..8ecb7c2e0d7 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -109,4 +109,6 @@ bool DNA_sdna_patch_struct(
 bool DNA_sdna_patch_struct_member(
         struct SDNA *sdna, const char *struct_name, const char *member_old, const char *member_new);
 
+void DNA_sdna_softpatch_runtime_ensure(struct SDNA *sdna);
+
 #endif /* __DNA_GENFILE_H__ */
diff --git a/source/blender/makesdna/DNA_sdna_types.h b/source/blender/makesdna/DNA_sdna_types.h
index 3ca2ce2fca4..4da559ad8ab 100644
--- a/source/blender/makesdna/DNA_sdna_types.h
+++ b/source/blender/makesdna/DNA_sdna_types.h
@@ -64,6 +64,14 @@ typedef struct SDNA {
 
 	/** Temporary memory currently only used for version patching DNA. */
 	struct MemArena *mem_arena;
+	/** Runtime versions of data stored in DNA, lazy initialized,
+	 * only different when renaming is done. */
+	struct {
+		/** Aligned with #SDNA.names, same pointers when unchanged. */
+		const char **names;
+		/** Aligned with #SDNA.types, same pointers when unchanged. */
+		const char **types;
+	} runtime;
 } SDNA;
 
 #
diff --git a/source/blender/makesdna/intern/CMakeLists.txt b/source/blender/makesdna/intern/CMakeLists.txt
index d6ad251d373..294fb861912 100644
--- a/source/blender/makesdna/intern/CMakeLists.txt
+++ b/source/blender/makesdna/intern/CMakeLists.txt
@@ -39,7 +39,7 @@ set(SRC
 	../../blenlib/intern/BLI_ghash_utils.c
 	../../blenlib/intern/BLI_memarena.c
 	../../blenlib/intern/BLI_mempool.c
-	../../blenlib/intern/hash_mm2a.c
+	../../blenlib/intern/hash_mm2a.c  # needed by 'BLI_ghash_utils.c', not used directly.
 	../../../../intern/guardedalloc/intern/mallocn.c
 	../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
 	../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c



More information about the Bf-blender-cvs mailing list