[Bf-blender-cvs] [0ed2e254bbf] blender2.8: Use enum for custom data allocation type

Sergey Sharybin noreply at git.blender.org
Wed May 30 10:23:07 CEST 2018


Commit: 0ed2e254bbfced045bc5651f65b41e2ba9cf9b35
Author: Sergey Sharybin
Date:   Tue May 29 14:45:38 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB0ed2e254bbfced045bc5651f65b41e2ba9cf9b35

Use enum for custom data allocation type

Allows to easily see human readable value in debugger.

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

M	source/blender/blenkernel/BKE_customdata.h

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

diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h
index 51cd4da183a..a9ded0b8356 100644
--- a/source/blender/blenkernel/BKE_customdata.h
+++ b/source/blender/blenkernel/BKE_customdata.h
@@ -67,12 +67,14 @@ extern const CustomDataMask CD_MASK_EVERYTHING;
  * CD_NUMTYPES elements, that indicate if a layer can be copied. */
 
 /* add/copy/merge allocation types */
-#define CD_ASSIGN    0  /* use the data pointer */
-#define CD_CALLOC    1  /* allocate blank memory */
-#define CD_DEFAULT   2  /* allocate and set to default */
-#define CD_REFERENCE 3  /* use data pointers, set layer flag NOFREE */
-#define CD_DUPLICATE 4  /* do a full copy of all layers, only allowed if source
-                         * has same number of elements */
+typedef enum CDAllocType {
+	CD_ASSIGN    = 0,  /* use the data pointer */
+	CD_CALLOC    = 1,  /* allocate blank memory */
+	CD_DEFAULT   = 2,  /* allocate and set to default */
+	CD_REFERENCE = 3,  /* use data pointers, set layer flag NOFREE */
+	CD_DUPLICATE = 4,  /* do a full copy of all layers, only allowed if source
+	                    * has same number of elements */
+} CDAllocType;
 
 #define CD_TYPE_AS_MASK(_type) (CustomDataMask)((CustomDataMask)1 << (CustomDataMask)(_type))



More information about the Bf-blender-cvs mailing list