[Bf-blender-cvs] [fc8730d] master: DNA: partial revert of long removal

Campbell Barton noreply at git.blender.org
Thu Jan 14 23:26:23 CET 2016


Commit: fc8730d4c24027152c1a5c5bd1f2bbac7825578d
Author: Campbell Barton
Date:   Fri Jan 15 09:16:24 2016 +1100
Branches: master
https://developer.blender.org/rBfc8730d4c24027152c1a5c5bd1f2bbac7825578d

DNA: partial revert of long removal

924c626 broke loading on systems with different endian.
We could support reading values from SDNA, it isn't really worth the extra hassle.

Long support is still removed, just keep enum values the same.

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

M	source/blender/makesdna/DNA_genfile.h
M	source/blender/makesdna/intern/makesdna.c

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

diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h
index 0448266..2858de7 100644
--- a/source/blender/makesdna/DNA_genfile.h
+++ b/source/blender/makesdna/DNA_genfile.h
@@ -41,20 +41,28 @@ struct SDNA;
 extern const unsigned char DNAstr[];
 extern const int DNAlen; /* length of DNAstr */
 
-/* primitive (non-struct, non-pointer/function/array) types--do not change ordering! */
+/**
+ * Primitive (non-struct, non-pointer/function/array) types,
+ * \warning Don't change these values!
+ * Currently changes here here will work on native endianness,
+ * however #DNA_struct_switch_endian currently checks these
+ * hard-coded values against those from old files.
+ */
 typedef enum eSDNA_Type {
 	SDNA_TYPE_CHAR     = 0,
 	SDNA_TYPE_UCHAR    = 1,
 	SDNA_TYPE_SHORT    = 2,
 	SDNA_TYPE_USHORT   = 3,
 	SDNA_TYPE_INT      = 4,
-	SDNA_TYPE_FLOAT    = 5,
-	SDNA_TYPE_DOUBLE   = 6,
-	/* ,SDNA_TYPE_VOID = 7 */
+	/* SDNA_TYPE_LONG     = 5, */  /* deprecated (use as int) */
+	/* SDNA_TYPE_ULONG    = 6, */  /* deprecated (use as int) */
+	SDNA_TYPE_FLOAT    = 7,
+	SDNA_TYPE_DOUBLE   = 8,
+	/* ,SDNA_TYPE_VOID = 9 */
 /* define so switch statements don't complain */
-#define SDNA_TYPE_VOID 7
-	SDNA_TYPE_INT64    = 8,
-	SDNA_TYPE_UINT64   = 9,
+#define SDNA_TYPE_VOID 9
+	SDNA_TYPE_INT64    = 10,
+	SDNA_TYPE_UINT64   = 11
 } eSDNA_Type;
 
 
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c
index 0bdd428..651794d 100644
--- a/source/blender/makesdna/intern/makesdna.c
+++ b/source/blender/makesdna/intern/makesdna.c
@@ -994,6 +994,12 @@ static int make_structDNA(const char *baseDirectory, FILE *file)
 	add_type("short", 2);    /* SDNA_TYPE_SHORT */
 	add_type("ushort", 2);   /* SDNA_TYPE_USHORT */
 	add_type("int", 4);      /* SDNA_TYPE_INT */
+
+	/* note, long isn't supported,
+	 * these are place-holders to maintain alignment with eSDNA_Type*/
+	add_type("long", 4);     /* SDNA_TYPE_LONG */
+	add_type("ulong", 4);    /* SDNA_TYPE_ULONG */
+
 	add_type("float", 4);    /* SDNA_TYPE_FLOAT */
 	add_type("double", 8);   /* SDNA_TYPE_DOUBLE */
 	add_type("int64_t", 8);  /* SDNA_TYPE_INT64 */




More information about the Bf-blender-cvs mailing list