[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59523] trunk/blender/source/blender/ makesdna/DNA_object_types.h: Cleanup: move defines into anon enums, as suggested by Joshua, thx.

Bastien Montagne montagne29 at wanadoo.fr
Mon Aug 26 16:30:00 CEST 2013


Revision: 59523
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59523
Author:   mont29
Date:     2013-08-26 14:30:00 +0000 (Mon, 26 Aug 2013)
Log Message:
-----------
Cleanup: move defines into anon enums, as suggested by Joshua, thx.

Note I let a few as defines for now (esp. base options are not clear to me, how they should be aranged in groups).

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/DNA_object_types.h

Modified: trunk/blender/source/blender/makesdna/DNA_object_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_object_types.h	2013-08-26 14:13:04 UTC (rev 59522)
+++ trunk/blender/source/blender/makesdna/DNA_object_types.h	2013-08-26 14:30:00 UTC (rev 59523)
@@ -326,23 +326,25 @@
 #define SELECT          1
 
 /* type */
-#define OB_EMPTY        0
-#define OB_MESH         1
-#define OB_CURVE        2
-#define OB_SURF         3
-#define OB_FONT         4
-#define OB_MBALL        5
+enum {
+	OB_EMPTY      = 0,
+	OB_MESH       = 1,
+	OB_CURVE      = 2,
+	OB_SURF       = 3,
+	OB_FONT       = 4,
+	OB_MBALL      = 5,
 
-#define OB_LAMP         10
-#define OB_CAMERA       11
+	OB_LAMP       = 10,
+	OB_CAMERA     = 11,
 
-#define OB_SPEAKER      12
+	OB_SPEAKER    = 12,
 
-/* #define OB_WAVE         21 */
-#define OB_LATTICE      22
+/*	OB_WAVE       = 21, */
+	OB_LATTICE    = 22,
 
 /* 23 and 24 are for life and sector (old file compat.) */
-#define	OB_ARMATURE     25
+	OB_ARMATURE   = 25,
+};
 
 /* check if the object type supports materials */
 #define OB_TYPE_SUPPORT_MATERIAL(_type) \
@@ -360,36 +362,40 @@
 	ID_ME: case ID_CU: case ID_MB: case ID_LA: case ID_SPK: case ID_CA: case ID_LT: case ID_AR
 
 /* partype: first 4 bits: type */
-#define PARTYPE         ((1 << 4) - 1)
-#define PAROBJECT       0
-#define PARCURVE        1
-#define PARKEY          2
+enum {
+	PARTYPE       = (1 << 4) - 1,
+	PAROBJECT     = 0,
+	PARCURVE      = 1,
+	PARKEY        = 2,
 
-#define PARSKEL         4
-#define PARVERT1        5
-#define PARVERT3        6
-#define PARBONE         7
+	PARSKEL       = 4,
+	PARVERT1      = 5,
+	PARVERT3      = 6,
+	PARBONE       = 7,
 
-    /* slow parenting - is not threadsafe and/or may give errors after jumping  */
-#define PARSLOW         16
+	/* slow parenting - is not threadsafe and/or may give errors after jumping  */
+	PARSLOW       = 16,
+};
 
 /* (short) transflag */
 /* flags 1 and 2 were unused or relics from past features */
-#define OB_NEG_SCALE        (1 << 2)
-#define OB_DUPLIFRAMES      (1 << 3)
-#define OB_DUPLIVERTS       (1 << 4)
-#define OB_DUPLIROT         (1 << 5)
-#define OB_DUPLINOSPEED     (1 << 6)
-/*#define OB_POWERTRACK       (1 << 7)*/ /*UNUSED*/
-#define OB_DUPLIGROUP       (1 << 8)
-#define OB_DUPLIFACES       (1 << 9)
-#define OB_DUPLIFACES_SCALE (1 << 10)
-#define OB_DUPLIPARTS       (1 << 11)
-#define OB_RENDER_DUPLI     (1 << 12)
-#define OB_NO_CONSTRAINTS   (1 << 13)  /* runtime constraints disable */
-#define OB_NO_PSYS_UPDATE   (1 << 14)  /* hack to work around particle issue */
+enum {
+	OB_NEG_SCALE        = 1 << 2,
+	OB_DUPLIFRAMES      = 1 << 3,
+	OB_DUPLIVERTS       = 1 << 4,
+	OB_DUPLIROT         = 1 << 5,
+	OB_DUPLINOSPEED     = 1 << 6,
+/*	OB_POWERTRACK       = 1 << 7,*/ /*UNUSED*/
+	OB_DUPLIGROUP       = 1 << 8,
+	OB_DUPLIFACES       = 1 << 9,
+	OB_DUPLIFACES_SCALE = 1 << 10,
+	OB_DUPLIPARTS       = 1 << 11,
+	OB_RENDER_DUPLI     = 1 << 12,
+	OB_NO_CONSTRAINTS   = 1 << 13,  /* runtime constraints disable */
+	OB_NO_PSYS_UPDATE   = 1 << 14,  /* hack to work around particle issue */
 
-#define OB_DUPLI            (OB_DUPLIFRAMES | OB_DUPLIVERTS | OB_DUPLIGROUP | OB_DUPLIFACES | OB_DUPLIPARTS)
+	OB_DUPLI            = OB_DUPLIFRAMES | OB_DUPLIVERTS | OB_DUPLIGROUP | OB_DUPLIFACES | OB_DUPLIPARTS,
+};
 
 /* (short) ipoflag */
 /* XXX: many old flags for features removed due to incompatibility
@@ -399,58 +405,68 @@
 #define OB_DISABLE_PATH     (1 << 10)
 
 /* (short) trackflag / upflag */
-#define OB_POSX    0
-#define OB_POSY    1
-#define OB_POSZ    2
-#define OB_NEGX    3
-#define OB_NEGY    4
-#define OB_NEGZ    5
+enum {
+	OB_POSX = 0,
+	OB_POSY = 1,
+	OB_POSZ = 2,
+	OB_NEGX = 3,
+	OB_NEGY = 4,
+	OB_NEGZ = 5,
+};
 
 /* gameflag in game.h */
 
 /* dt: no flags */
-#define OB_BOUNDBOX    1
-#define OB_WIRE        2
-#define OB_SOLID       3
-#define OB_MATERIAL    4
-#define OB_TEXTURE     5
-#define OB_RENDER      6
+enum {
+	OB_BOUNDBOX  = 1,
+	OB_WIRE      = 2,
+	OB_SOLID     = 3,
+	OB_MATERIAL  = 4,
+	OB_TEXTURE   = 5,
+	OB_RENDER    = 6,
 
-#define OB_PAINT       100  /* temporary used in draw code */
+	OB_PAINT     = 100,  /* temporary used in draw code */
+};
 
 /* dtx: flags (short) */
-#define OB_DRAWBOUNDOX    (1 << 0)
-#define OB_AXIS           (1 << 1)
-#define OB_TEXSPACE       (1 << 2)
-#define OB_DRAWNAME       (1 << 3)
-#define OB_DRAWIMAGE      (1 << 4)
+enum {
+	OB_DRAWBOUNDOX    = 1 << 0,
+	OB_AXIS           = 1 << 1,
+	OB_TEXSPACE       = 1 << 2,
+	OB_DRAWNAME       = 1 << 3,
+	OB_DRAWIMAGE      = 1 << 4,
 	/* for solid+wire display */
-#define OB_DRAWWIRE       (1 << 5)
+	OB_DRAWWIRE       = 1 << 5,
 	/* for overdraw s*/
-#define OB_DRAWXRAY       (1 << 6)
+	OB_DRAWXRAY       = 1 << 6,
 	/* enable transparent draw */
-#define OB_DRAWTRANSP     (1 << 7)
-#define OB_DRAW_ALL_EDGES (1 << 8)  /* only for meshes currently */
+	OB_DRAWTRANSP     = 1 << 7,
+	OB_DRAW_ALL_EDGES = 1 << 8,  /* only for meshes currently */
+};
 
 /* empty_drawtype: no flags */
-#define OB_ARROWS        1
-#define OB_PLAINAXES     2
-#define OB_CIRCLE        3
-#define OB_SINGLE_ARROW  4
-#define OB_CUBE          5
-#define OB_EMPTY_SPHERE  6
-#define OB_EMPTY_CONE    7
-#define OB_EMPTY_IMAGE   8
+enum {
+	OB_ARROWS        = 1,
+	OB_PLAINAXES     = 2,
+	OB_CIRCLE        = 3,
+	OB_SINGLE_ARROW  = 4,
+	OB_CUBE          = 5,
+	OB_EMPTY_SPHERE  = 6,
+	OB_EMPTY_CONE    = 7,
+	OB_EMPTY_IMAGE   = 8,
+};
 
 /* boundtype */
-#define OB_BOUND_BOX           0
-#define OB_BOUND_SPHERE        1
-#define OB_BOUND_CYLINDER      2
-#define OB_BOUND_CONE          3
-#define OB_BOUND_TRIANGLE_MESH 4
-#define OB_BOUND_CONVEX_HULL   5
-/* #define OB_BOUND_DYN_MESH   6 */ /*UNUSED*/
-#define OB_BOUND_CAPSULE       7
+enum {
+	OB_BOUND_BOX           = 0,
+	OB_BOUND_SPHERE        = 1,
+	OB_BOUND_CYLINDER      = 2,
+	OB_BOUND_CONE          = 3,
+	OB_BOUND_TRIANGLE_MESH = 4,
+	OB_BOUND_CONVEX_HULL   = 5,
+/*	OB_BOUND_DYN_MESH      = 6, */ /*UNUSED*/
+	OB_BOUND_CAPSULE       = 7,
+};
 
 
 /* **************** BASE ********************* */
@@ -482,12 +498,14 @@
 
 /* WARNING - when adding flags check on PSYS_RECALC */
 /* ob->recalc (flag bits!) */
-#define OB_RECALC_OB        (1 << 0)
-#define OB_RECALC_DATA      (1 << 1)
+enum {
+	OB_RECALC_OB        = 1 << 0,
+	OB_RECALC_DATA      = 1 << 1,
 /* time flag is set when time changes need recalc, so baked systems can ignore it */
-#define OB_RECALC_TIME      (1 << 2)
+	OB_RECALC_TIME      = 1 << 2,
 /* only use for matching any flag, NOT as an argument since more flags may be added. */
-#define OB_RECALC_ALL       (OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME)
+	OB_RECALC_ALL       = OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME,
+};
 
 /* controller state */
 #define OB_MAX_STATES       30
@@ -496,124 +514,144 @@
 #define OB_MAX_COL_MASKS    8
 
 /* ob->gameflag */
-#define OB_DYNAMIC               (1 << 0)
-#define OB_CHILD                 (1 << 1)
-#define OB_ACTOR                 (1 << 2)
-#define OB_INERTIA_LOCK_X        (1 << 3)
-#define OB_INERTIA_LOCK_Y        (1 << 4)
-#define OB_INERTIA_LOCK_Z        (1 << 5)
-#define OB_DO_FH                 (1 << 6)
-#define OB_ROT_FH                (1 << 7)
-#define OB_ANISOTROPIC_FRICTION  (1 << 8)
-#define OB_GHOST                 (1 << 9)
-#define OB_RIGID_BODY            (1 << 10)
-#define OB_BOUNDS                (1 << 11)
+enum {
+	OB_DYNAMIC               = 1 << 0,
+	OB_CHILD                 = 1 << 1,
+	OB_ACTOR                 = 1 << 2,
+	OB_INERTIA_LOCK_X        = 1 << 3,
+	OB_INERTIA_LOCK_Y        = 1 << 4,
+	OB_INERTIA_LOCK_Z        = 1 << 5,
+	OB_DO_FH                 = 1 << 6,
+	OB_ROT_FH                = 1 << 7,
+	OB_ANISOTROPIC_FRICTION  = 1 << 8,
+	OB_GHOST                 = 1 << 9,
+	OB_RIGID_BODY            = 1 << 10,
+	OB_BOUNDS                = 1 << 11,
 
-#define OB_COLLISION_RESPONSE    (1 << 12)
-#define OB_SECTOR                (1 << 13)
-#define OB_PROP                  (1 << 14)
-#define OB_MAINACTOR             (1 << 15)
+	OB_COLLISION_RESPONSE    = 1 << 12,
+	OB_SECTOR                = 1 << 13,
+	OB_PROP                  = 1 << 14,
+	OB_MAINACTOR             = 1 << 15,
 
-#define OB_COLLISION             (1 << 16)
-#define OB_SOFT_BODY             (1 << 17)
-#define OB_OCCLUDER              (1 << 18)
-#define OB_SENSOR                (1 << 19)
-#define OB_NAVMESH               (1 << 20)
-#define OB_HASOBSTACLE           (1 << 21)
-#define OB_CHARACTER             (1 << 22)
+	OB_COLLISION             = 1 << 16,
+	OB_SOFT_BODY             = 1 << 17,
+	OB_OCCLUDER              = 1 << 18,
+	OB_SENSOR                = 1 << 19,
+	OB_NAVMESH               = 1 << 20,
+	OB_HASOBSTACLE           = 1 << 21,
+	OB_CHARACTER             = 1 << 22,
+};
 
 /* ob->gameflag2 */
-#define OB_NEVER_DO_ACTIVITY_CULLING    (1 << 0)
-#define OB_LOCK_RIGID_BODY_X_AXIS       (1 << 2)
-#define OB_LOCK_RIGID_BODY_Y_AXIS       (1 << 3)
-#define OB_LOCK_RIGID_BODY_Z_AXIS       (1 << 4)
-#define OB_LOCK_RIGID_BODY_X_ROT_AXIS   (1 << 5)
-#define OB_LOCK_RIGID_BODY_Y_ROT_AXIS   (1 << 6)
-#define OB_LOCK_RIGID_BODY_Z_ROT_AXIS   (1 << 7)
+enum {
+	OB_NEVER_DO_ACTIVITY_CULLING    = 1 << 0,
+	OB_LOCK_RIGID_BODY_X_AXIS       = 1 << 2,
+	OB_LOCK_RIGID_BODY_Y_AXIS       = 1 << 3,
+	OB_LOCK_RIGID_BODY_Z_AXIS       = 1 << 4,
+	OB_LOCK_RIGID_BODY_X_ROT_AXIS   = 1 << 5,
+	OB_LOCK_RIGID_BODY_Y_ROT_AXIS   = 1 << 6,
+	OB_LOCK_RIGID_BODY_Z_ROT_AXIS   = 1 << 7,
 
-/* #define OB_LIFE     (OB_PROP | OB_DYNAMIC | OB_ACTOR | OB_MAINACTOR | OB_CHILD) */
+/*	OB_LIFE     = OB_PROP | OB_DYNAMIC | OB_ACTOR | OB_MAINACTOR | OB_CHILD, */
+};
 
 /* ob->body_type */
-#define OB_BODY_TYPE_NO_COLLISION   0
-#define OB_BODY_TYPE_STATIC         1
-#define OB_BODY_TYPE_DYNAMIC        2
-#define OB_BODY_TYPE_RIGID          3
-#define OB_BODY_TYPE_SOFT           4
-#define OB_BODY_TYPE_OCCLUDER       5
-#define OB_BODY_TYPE_SENSOR         6
-#define OB_BODY_TYPE_NAVMESH        7
-#define OB_BODY_TYPE_CHARACTER      8
+enum {
+	OB_BODY_TYPE_NO_COLLISION   = 0,
+	OB_BODY_TYPE_STATIC         = 1,
+	OB_BODY_TYPE_DYNAMIC        = 2,
+	OB_BODY_TYPE_RIGID          = 3,
+	OB_BODY_TYPE_SOFT           = 4,
+	OB_BODY_TYPE_OCCLUDER       = 5,
+	OB_BODY_TYPE_SENSOR         = 6,
+	OB_BODY_TYPE_NAVMESH        = 7,
+	OB_BODY_TYPE_CHARACTER      = 8,
+};
 
 /* ob->depsflag */
-#define OB_DEPS_EXTRA_OB_RECALC     (1 << 0)
-#define OB_DEPS_EXTRA_DATA_RECALC   (1 << 1)
+enum {
+	OB_DEPS_EXTRA_OB_RECALC     = 1 << 0,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list