[Bf-blender-cvs] [a4644c3] alembic_pointcache: Cleanup: Use enums where appropriate instead of #defines.

Lukas Tönne noreply at git.blender.org
Tue Feb 10 17:57:27 CET 2015


Commit: a4644c360506274ea1dd91a4bb862d0d2395b366
Author: Lukas Tönne
Date:   Tue Feb 10 17:56:56 2015 +0100
Branches: alembic_pointcache
https://developer.blender.org/rBa4644c360506274ea1dd91a4bb862d0d2395b366

Cleanup: Use enums where appropriate instead of #defines.

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

M	source/blender/blenkernel/BKE_pointcache.h
M	source/blender/blenkernel/intern/pointcache.c

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

diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h
index 05cc068..76af442 100644
--- a/source/blender/blenkernel/BKE_pointcache.h
+++ b/source/blender/blenkernel/BKE_pointcache.h
@@ -40,46 +40,51 @@
 
 /* Point cache clearing option, for BKE_ptcache_id_clear, before
  * and after are non inclusive (they wont remove the cfra) */
-#define PTCACHE_CLEAR_ALL       0
-#define PTCACHE_CLEAR_FRAME     1
-#define PTCACHE_CLEAR_BEFORE    2
-#define PTCACHE_CLEAR_AFTER     3
+typedef enum ePointCache_ClearMode {
+	PTCACHE_CLEAR_ALL       = 0,
+	PTCACHE_CLEAR_FRAME     = 1,
+	PTCACHE_CLEAR_BEFORE    = 2,
+	PTCACHE_CLEAR_AFTER     = 3,
+} ePointCache_ClearMode;
 
 /* Point cache reset options */
-#define PTCACHE_RESET_DEPSGRAPH     0
-#define PTCACHE_RESET_BAKED         1
-#define PTCACHE_RESET_OUTDATED      2
-/* #define PTCACHE_RESET_FREE			3 */ /*UNUSED*/
+typedef enum ePointCache_ResetMode {
+	PTCACHE_RESET_DEPSGRAPH     = 0,
+	PTCACHE_RESET_BAKED         = 1,
+	PTCACHE_RESET_OUTDATED      = 2,
+/*	PTCACHE_RESET_FREE			= 3, */ /*UNUSED*/
+} ePointCache_ResetMode;
 
 /* Add the blendfile name after blendcache_ */
 #define PTCACHE_EXT ".bphys"
 #define PTCACHE_PATH "blendcache_"
 
-/* File open options, for BKE_ptcache_file_open */
-#define PTCACHE_FILE_READ   0
-#define PTCACHE_FILE_WRITE  1
-#define PTCACHE_FILE_UPDATE 2
-
 /* PTCacheID types */
-#define PTCACHE_TYPE_SOFTBODY           0
-#define PTCACHE_TYPE_PARTICLES          1
-#define PTCACHE_TYPE_CLOTH              2
-#define PTCACHE_TYPE_SMOKE_DOMAIN       3
-#define PTCACHE_TYPE_SMOKE_HIGHRES      4
-#define PTCACHE_TYPE_DYNAMICPAINT       5
-#define PTCACHE_TYPE_RIGIDBODY          6
+typedef enum ePointCache_Type {
+	PTCACHE_TYPE_SOFTBODY           = 0,
+	PTCACHE_TYPE_PARTICLES          = 1,
+	PTCACHE_TYPE_CLOTH              = 2,
+	PTCACHE_TYPE_SMOKE_DOMAIN       = 3,
+	PTCACHE_TYPE_SMOKE_HIGHRES      = 4,
+	PTCACHE_TYPE_DYNAMICPAINT       = 5,
+	PTCACHE_TYPE_RIGIDBODY          = 6,
+} ePointCache_Type;
 
 /* high bits reserved for flags that need to be stored in file */
-#define PTCACHE_TYPEFLAG_COMPRESS       (1 << 16)
-#define PTCACHE_TYPEFLAG_EXTRADATA      (1 << 17)
+typedef enum ePointCache_Flag {
+	PTCACHE_TYPEFLAG_COMPRESS       = (1 << 16),
+	PTCACHE_TYPEFLAG_EXTRADATA      = (1 << 17),
+} ePointCache_Flag;
 
 #define PTCACHE_TYPEFLAG_TYPEMASK           0x0000FFFF
 #define PTCACHE_TYPEFLAG_FLAGMASK           0xFFFF0000
 
 /* PTCache read return code */
-#define PTCACHE_READ_EXACT              1
-#define PTCACHE_READ_INTERPOLATED       2
-#define PTCACHE_READ_OLD                3
+typedef enum ePointCache_ReadResult {
+	PTCACHE_READ_EXACT              = 1,
+	PTCACHE_READ_INTERPOLATED       = 2,
+	PTCACHE_READ_OLD                = 3,
+} ePointCache_ReadResult;
 
 /* Structs */
 struct ClothModifierData;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index a9780ef..779217d 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -104,6 +104,14 @@
 #  include "BLI_winstuff.h"
 #endif
 
+
+/* File open options, for BKE_ptcache_file_open */
+typedef enum ePointCache_FileMode {
+	PTCACHE_FILE_READ   = 0,
+	PTCACHE_FILE_WRITE  = 1,
+	PTCACHE_FILE_UPDATE = 2,
+} ePointCache_FileMode;
+
 #define PTCACHE_DATA_FROM(data, type, from)  \
 	if (data[type]) { \
 		memcpy(data[type], from, ptcache_data_size[type]); \




More information about the Bf-blender-cvs mailing list