diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-11-19 22:48:35 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-11-19 22:49:18 +0300 |
commit | 0cb1c2cdeebd62d15c29d57b20ace99377e22c8f (patch) | |
tree | 9b0b2c0322f2d9585ae5d82bff48ac78ed0279bc /source/blender/makesdna/DNA_ID.h | |
parent | 82d2718c8fe463ef6461544dd69a4f76e835736d (diff) |
Cleanup: #define -> enums.
Diffstat (limited to 'source/blender/makesdna/DNA_ID.h')
-rw-r--r-- | source/blender/makesdna/DNA_ID.h | 129 |
1 files changed, 71 insertions, 58 deletions
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 33d1445fb93..64543709252 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -44,54 +44,65 @@ struct FileData; struct ID; struct PackedFile; struct GPUTexture; - + typedef struct IDPropertyData { void *pointer; ListBase group; - int val, val2; /*note, we actually fit a double into these two ints*/ + int val, val2; /* note, we actually fit a double into these two ints */ } IDPropertyData; typedef struct IDProperty { struct IDProperty *next, *prev; char type, subtype; short flag; - char name[64]; /* MAX_IDPROP_NAME */ - int saved; /* saved is used to indicate if this struct has been saved yet. - * seemed like a good idea as a pad var was needed anyway :)*/ - IDPropertyData data; /* note, alignment for 64 bits */ - int len; /* array length, also (this is important!) string length + 1. - * the idea is to be able to reuse array realloc functions on strings.*/ + char name[64]; /* MAX_IDPROP_NAME */ + + /* saved is used to indicate if this struct has been saved yet. + * seemed like a good idea as a pad var was needed anyway :) */ + int saved; + IDPropertyData data; /* note, alignment for 64 bits */ + + /* array length, also (this is important!) string length + 1. + * the idea is to be able to reuse array realloc functions on strings.*/ + int len; + + /* Strings and arrays are both buffered, though the buffer isn't saved. */ /* totallen is total length of allocated array/string, including a buffer. - * Note that the buffering is mild; the code comes from python's list implementation.*/ - int totallen; /*strings and arrays are both buffered, though the buffer isn't saved.*/ + * Note that the buffering is mild; the code comes from python's list implementation. */ + int totallen; } IDProperty; -#define MAX_IDPROP_NAME 64 -#define DEFAULT_ALLOC_FOR_NULL_STRINGS 64 +#define MAX_IDPROP_NAME 64 +#define DEFAULT_ALLOC_FOR_NULL_STRINGS 64 /*->type*/ -#define IDP_STRING 0 -#define IDP_INT 1 -#define IDP_FLOAT 2 -#define IDP_ARRAY 5 -#define IDP_GROUP 6 -/* the ID link property type hasn't been implemented yet, this will require - * some cleanup of blenkernel, most likely.*/ -#define IDP_ID 7 -#define IDP_DOUBLE 8 -#define IDP_IDPARRAY 9 -#define IDP_NUMTYPES 10 +enum { + IDP_STRING = 0, + IDP_INT = 1, + IDP_FLOAT = 2, + IDP_ARRAY = 5, + IDP_GROUP = 6, + /* the ID link property type hasn't been implemented yet, this will require + * some cleanup of blenkernel, most likely. */ + IDP_ID = 7, + IDP_DOUBLE = 8, + IDP_IDPARRAY = 9, + IDP_NUMTYPES = 10, +}; /*->subtype */ /* IDP_STRING */ -#define IDP_STRING_SUB_UTF8 0 /* default */ -#define IDP_STRING_SUB_BYTE 1 /* arbitrary byte array, _not_ null terminated */ -/*->flag*/ -#define IDP_FLAG_GHOST (1<<7) /* this means the property is set but RNA will return - * false when checking 'RNA_property_is_set', - * currently this is a runtime flag */ +enum { + IDP_STRING_SUB_UTF8 = 0, /* default */ + IDP_STRING_SUB_BYTE = 1, /* arbitrary byte array, _not_ null terminated */ +}; +/*->flag*/ +enum { + IDP_FLAG_GHOST = 1 << 7, /* this means the property is set but RNA will return false when checking + * 'RNA_property_is_set', currently this is a runtime flag */ +}; /* add any future new id property types here.*/ @@ -102,7 +113,7 @@ typedef struct IDProperty { * */ /* 2 characters for ID code and 64 for actual name */ -#define MAX_ID_NAME 66 +#define MAX_ID_NAME 66 /* There's a nasty circular dependency here.... 'void *' to the rescue! I * really wonder why this is needed. */ @@ -129,14 +140,14 @@ typedef struct Library { ID id; ID *idblock; struct FileData *filedata; - char name[1024]; /* path name used for reading, can be relative and edited in the outliner */ - char filepath[1024]; /* absolute filepath, this is only for convenience, - * 'name' is the real path used on file read but in - * some cases its useful to access the absolute one, - * This is set on file read. - * Use BKE_library_filepath_set() rather than - * setting 'name' directly and it will be kept in - * sync - campbell */ + char name[1024]; /* path name used for reading, can be relative and edited in the outliner */ + + /* absolute filepath, this is only for convenience, 'name' is the real path used on file read but in + * some cases its useful to access the absolute one. + * This is set on file read. + * Use BKE_library_filepath_set() rather than setting 'name' directly and it will be kept in sync - campbell */ + char filepath[1024]; + struct Library *parent; /* set for indirectly linked libs, used in the outliner and while reading */ struct PackedFile *packedfile; @@ -239,26 +250,28 @@ typedef struct PreviewImage { #define ID_NEW_US(a) if ( (a)->id.newid) { (a) = (void *)(a)->id.newid; (a)->id.us++; } #define ID_NEW_US2(a) if (((ID *)a)->newid) { (a) = ((ID *)a)->newid; ((ID *)a)->us++; } -/* id->flag: set frist 8 bits always at zero while reading */ -#define LIB_LOCAL 0 -#define LIB_EXTERN 1 -#define LIB_INDIRECT 2 -#define LIB_NEED_EXPAND 8 -#define LIB_TESTEXT (LIB_NEED_EXPAND | LIB_EXTERN) -#define LIB_TESTIND (LIB_NEED_EXPAND | LIB_INDIRECT) -#define LIB_READ 16 -#define LIB_NEED_LINK 32 - -#define LIB_NEW 256 -#define LIB_FAKEUSER 512 -/* free test flag */ -#define LIB_DOIT 1024 -/* tag existing data before linking so we know what is new */ -#define LIB_PRE_EXISTING 2048 -/* runtime */ -#define LIB_ID_RECALC 4096 -#define LIB_ID_RECALC_DATA 8192 -#define LIB_ANIM_NO_RECALC 16384 +/* id->flag: set first 8 bits always at zero while reading */ +enum { + LIB_LOCAL = 0, + LIB_EXTERN = 1 << 0, + LIB_INDIRECT = 1 << 1, + LIB_NEED_EXPAND = 1 << 3, + LIB_TESTEXT = (LIB_NEED_EXPAND | LIB_EXTERN), + LIB_TESTIND = (LIB_NEED_EXPAND | LIB_INDIRECT), + LIB_READ = 1 << 4, + LIB_NEED_LINK = 1 << 5, + + LIB_NEW = 1 << 8, + LIB_FAKEUSER = 1 << 9, + /* free test flag */ + LIB_DOIT = 1 << 10, + /* tag existing data before linking so we know what is new */ + LIB_PRE_EXISTING = 1 << 11, + /* runtime */ + LIB_ID_RECALC = 1 << 12, + LIB_ID_RECALC_DATA = 1 << 13, + LIB_ANIM_NO_RECALC = 1 << 14, +}; #ifdef __cplusplus } |