DNA: partial revert of long removal
authorCampbell Barton <ideasman42@gmail.com>
Thu, 14 Jan 2016 22:16:24 +0000 (09:16 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 14 Jan 2016 22:18:50 +0000 (09:18 +1100)
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.

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

index 0448266330c9b412c3e0be4dc74db55a893b1955..2858de74776cbeea6b735313efe23ad4e0e12529 100644 (file)
@@ -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;
 
 
index 0bdd428bef9a7550f0d638ed53f0794d0b18b30a..651794da50d5c492682839879e99aff8385fb3c0 100644 (file)
@@ -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 */