From d4ffd1d91f84e956c1f9832700b0f42cd150c2f1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 24 Apr 2020 15:49:25 +1000 Subject: Cleanup: declare values for enum types Avoids accidents when adding/removing items from an enum. --- source/blender/makesdna/DNA_armature_types.h | 18 +++++----- source/blender/makesdna/DNA_brush_types.h | 4 +-- source/blender/makesdna/DNA_constraint_types.h | 36 +++++++++---------- .../blender/makesdna/DNA_gpencil_modifier_types.h | 1 + source/blender/makesdna/DNA_gpencil_types.h | 1 + source/blender/makesdna/DNA_material_types.h | 20 +++++------ source/blender/makesdna/DNA_modifier_types.h | 32 ++++++++--------- source/blender/makesdna/DNA_object_force_types.h | 1 + source/blender/makesdna/DNA_object_types.h | 1 + source/blender/makesdna/DNA_scene_types.h | 42 +++++++++++----------- source/blender/makesdna/DNA_screen_types.h | 4 +-- source/blender/makesdna/DNA_sequence_types.h | 2 +- source/blender/makesdna/DNA_shader_fx_types.h | 1 + source/blender/makesdna/DNA_space_types.h | 2 +- source/blender/makesdna/DNA_userdef_types.h | 4 +-- source/blender/makesdna/DNA_volume_types.h | 6 ++-- 16 files changed, 90 insertions(+), 85 deletions(-) (limited to 'source') diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index b29816c735b..635c155dec6 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -261,23 +261,23 @@ typedef enum eBone_InheritScaleMode { /* Inherit all scale and shear. */ BONE_INHERIT_SCALE_FULL = 0, /* Inherit scale, but remove final shear. */ - BONE_INHERIT_SCALE_FIX_SHEAR, + BONE_INHERIT_SCALE_FIX_SHEAR = 1, /* Inherit average scale. */ - BONE_INHERIT_SCALE_AVERAGE, + BONE_INHERIT_SCALE_AVERAGE = 2, /* Inherit no scale or shear. */ - BONE_INHERIT_SCALE_NONE, + BONE_INHERIT_SCALE_NONE = 3, /* Inherit effects of shear on parent (same as old disabled Inherit Scale). */ - BONE_INHERIT_SCALE_NONE_LEGACY, + BONE_INHERIT_SCALE_NONE_LEGACY = 4, /* Inherit parent X scale as child X scale etc. */ - BONE_INHERIT_SCALE_ALIGNED, + BONE_INHERIT_SCALE_ALIGNED = 5, } eBone_InheritScaleMode; /* bone->bbone_prev_type, bbone_next_type */ typedef enum eBone_BBoneHandleType { - BBONE_HANDLE_AUTO = 0, /* Default mode based on parents & children. */ - BBONE_HANDLE_ABSOLUTE, /* Custom handle in absolute position mode. */ - BBONE_HANDLE_RELATIVE, /* Custom handle in relative position mode. */ - BBONE_HANDLE_TANGENT, /* Custom handle in tangent mode (use direction, not location). */ + BBONE_HANDLE_AUTO = 0, /* Default mode based on parents & children. */ + BBONE_HANDLE_ABSOLUTE = 1, /* Custom handle in absolute position mode. */ + BBONE_HANDLE_RELATIVE = 2, /* Custom handle in relative position mode. */ + BBONE_HANDLE_TANGENT = 3, /* Custom handle in tangent mode (use direction, not location). */ } eBone_BBoneHandleType; #define MAXBONENAME 64 diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 041943bc5e4..0e16abf76f7 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -805,8 +805,8 @@ typedef enum { /* blur kernel types, Brush.blur_mode */ typedef enum eBlurKernelType { - KERNEL_GAUSSIAN, - KERNEL_BOX, + KERNEL_GAUSSIAN = 0, + KERNEL_BOX = 1, } eBlurKernelType; /* Brush.falloff_shape */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index 9efd2116601..65087a6d459 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -735,11 +735,11 @@ typedef enum eConstraint_EulerOrder { /** Explicit euler rotation modes - must sync with BLI_math_rotation.h defines. */ CONSTRAINT_EULER_XYZ = 1, - CONSTRAINT_EULER_XZY, - CONSTRAINT_EULER_YXZ, - CONSTRAINT_EULER_YZX, - CONSTRAINT_EULER_ZXY, - CONSTRAINT_EULER_ZYX, + CONSTRAINT_EULER_XZY = 2, + CONSTRAINT_EULER_YXZ = 3, + CONSTRAINT_EULER_YZX = 4, + CONSTRAINT_EULER_ZXY = 5, + CONSTRAINT_EULER_ZYX = 6, } eConstraint_EulerOrder; /* -------------------------------------- */ @@ -762,13 +762,13 @@ typedef enum eCopyRotation_MixMode { /* Replace rotation channel values. */ ROTLIKE_MIX_REPLACE = 0, /* Legacy Offset mode - don't use. */ - ROTLIKE_MIX_OFFSET, + ROTLIKE_MIX_OFFSET = 1, /* Add Euler components together. */ - ROTLIKE_MIX_ADD, + ROTLIKE_MIX_ADD = 2, /* Multiply the copied rotation on the left. */ - ROTLIKE_MIX_BEFORE, + ROTLIKE_MIX_BEFORE = 3, /* Multiply the copied rotation on the right. */ - ROTLIKE_MIX_AFTER, + ROTLIKE_MIX_AFTER = 4, } eCopyRotation_MixMode; /* bLocateLikeConstraint.flag */ @@ -799,9 +799,9 @@ typedef enum eCopyTransforms_MixMode { /* Replace rotation channel values. */ TRANSLIKE_MIX_REPLACE = 0, /* Multiply the copied transformation on the left, with anti-shear scale handling. */ - TRANSLIKE_MIX_BEFORE, + TRANSLIKE_MIX_BEFORE = 1, /* Multiply the copied transformation on the right, with anti-shear scale handling. */ - TRANSLIKE_MIX_AFTER, + TRANSLIKE_MIX_AFTER = 2, } eCopyTransforms_MixMode; /* bTransformConstraint.to/from */ @@ -816,7 +816,7 @@ typedef enum eTransform_MixModeLoc { /* Add component values together (default). */ TRANS_MIXLOC_ADD = 0, /* Replace component values. */ - TRANS_MIXLOC_REPLACE, + TRANS_MIXLOC_REPLACE = 1, } eTransform_MixModeLoc; /* bTransformConstraint.mix_mode_rot */ @@ -824,11 +824,11 @@ typedef enum eTransform_MixModeRot { /* Add component values together (default). */ TRANS_MIXROT_ADD = 0, /* Replace component values. */ - TRANS_MIXROT_REPLACE, + TRANS_MIXROT_REPLACE = 1, /* Multiply the generated rotation on the left. */ - TRANS_MIXROT_BEFORE, + TRANS_MIXROT_BEFORE = 2, /* Multiply the generated rotation on the right. */ - TRANS_MIXROT_AFTER, + TRANS_MIXROT_AFTER = 3, } eTransform_MixModeRot; /* bTransformConstraint.mix_mode_scale */ @@ -836,7 +836,7 @@ typedef enum eTransform_MixModeScale { /* Replace component values (default). */ TRANS_MIXSCALE_REPLACE = 0, /* Multiply component values together. */ - TRANS_MIXSCALE_MULTIPLY, + TRANS_MIXSCALE_MULTIPLY = 1, } eTransform_MixModeScale; /* bSameVolumeConstraint.free_axis */ @@ -867,9 +867,9 @@ typedef enum eActionConstraint_MixMode { /* Multiply the action transformation on the right. */ ACTCON_MIX_AFTER_FULL = 0, /* Multiply the action transformation on the right, with anti-shear scale handling. */ - ACTCON_MIX_AFTER, + ACTCON_MIX_AFTER = 1, /* Multiply the action transformation on the left, with anti-shear scale handling. */ - ACTCON_MIX_BEFORE, + ACTCON_MIX_BEFORE = 2, } eActionConstraint_MixMode; /* Locked-Axis Values (Locked Track) */ diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 1265ce0983c..deb955f5551 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -48,6 +48,7 @@ typedef enum GpencilModifierType { eGpencilModifierType_Time = 16, eGpencilModifierType_Multiply = 17, eGpencilModifierType_Texture = 18, + /* Keep last. */ NUM_GREASEPENCIL_MODIFIER_TYPES, } GpencilModifierType; diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index d3d7ca1cc3b..bf9f228b53f 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -276,6 +276,7 @@ typedef enum eGPDstroke_Caps { GP_STROKE_CAP_ROUND = 0, GP_STROKE_CAP_FLAT = 1, + /* Keeo last. */ GP_STROKE_CAP_MAX, } GPDstroke_Caps; diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 10a549edc17..357c3260121 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -324,35 +324,35 @@ enum { /* blend_shadow */ enum { MA_BS_NONE = 0, - MA_BS_SOLID, - MA_BS_CLIP, - MA_BS_HASHED, + MA_BS_SOLID = 1, + MA_BS_CLIP = 2, + MA_BS_HASHED = 3, }; /* Grease Pencil Stroke styles */ enum { GP_MATERIAL_STROKE_STYLE_SOLID = 0, - GP_MATERIAL_STROKE_STYLE_TEXTURE, + GP_MATERIAL_STROKE_STYLE_TEXTURE = 1, }; /* Grease Pencil Fill styles */ enum { GP_MATERIAL_FILL_STYLE_SOLID = 0, - GP_MATERIAL_FILL_STYLE_GRADIENT, - GP_MATERIAL_FILL_STYLE_CHECKER, /* DEPRECATED (only for convert old files) */ - GP_MATERIAL_FILL_STYLE_TEXTURE, + GP_MATERIAL_FILL_STYLE_GRADIENT = 1, + GP_MATERIAL_FILL_STYLE_CHECKER = 2, /* DEPRECATED (only for convert old files) */ + GP_MATERIAL_FILL_STYLE_TEXTURE = 3, }; /* Grease Pencil Gradient Types */ enum { GP_MATERIAL_GRADIENT_LINEAR = 0, - GP_MATERIAL_GRADIENT_RADIAL, + GP_MATERIAL_GRADIENT_RADIAL = 1, }; /* Grease Pencil Follow Drawing Modes */ enum { GP_MATERIAL_FOLLOW_PATH = 0, - GP_MATERIAL_FOLLOW_OBJ, - GP_MATERIAL_FOLLOW_FIXED, + GP_MATERIAL_FOLLOW_OBJ = 1, + GP_MATERIAL_FOLLOW_FIXED = 2, }; #endif diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 9e58d7df042..8e7dc1fa266 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -452,23 +452,23 @@ enum { /* BevelModifierData->face_str_mode */ enum { - MOD_BEVEL_FACE_STRENGTH_NONE, - MOD_BEVEL_FACE_STRENGTH_NEW, - MOD_BEVEL_FACE_STRENGTH_AFFECTED, - MOD_BEVEL_FACE_STRENGTH_ALL, + MOD_BEVEL_FACE_STRENGTH_NONE = 0, + MOD_BEVEL_FACE_STRENGTH_NEW = 1, + MOD_BEVEL_FACE_STRENGTH_AFFECTED = 2, + MOD_BEVEL_FACE_STRENGTH_ALL = 3, }; /* BevelModifier->miter_inner and ->miter_outer */ enum { - MOD_BEVEL_MITER_SHARP, - MOD_BEVEL_MITER_PATCH, - MOD_BEVEL_MITER_ARC, + MOD_BEVEL_MITER_SHARP = 0, + MOD_BEVEL_MITER_PATCH = 1, + MOD_BEVEL_MITER_ARC = 2, }; /* BevelModifier->vmesh_method */ enum { - MOD_BEVEL_VMESH_ADJ, - MOD_BEVEL_VMESH_CUTOFF, + MOD_BEVEL_VMESH_ADJ = 0, + MOD_BEVEL_VMESH_CUTOFF = 1, }; typedef struct FluidModifierData { @@ -594,10 +594,10 @@ enum { }; enum { - MOD_DECIM_MODE_COLLAPSE, - MOD_DECIM_MODE_UNSUBDIV, + MOD_DECIM_MODE_COLLAPSE = 0, + MOD_DECIM_MODE_UNSUBDIV = 1, /** called planar in the UI */ - MOD_DECIM_MODE_DISSOLVE, + MOD_DECIM_MODE_DISSOLVE = 2, }; typedef struct SmoothModifierData { @@ -1694,15 +1694,15 @@ enum { /* Triangulate methods - NGons */ enum { MOD_TRIANGULATE_NGON_BEAUTY = 0, - MOD_TRIANGULATE_NGON_EARCLIP, + MOD_TRIANGULATE_NGON_EARCLIP = 1, }; /* Triangulate methods - Quads */ enum { MOD_TRIANGULATE_QUAD_BEAUTY = 0, - MOD_TRIANGULATE_QUAD_FIXED, - MOD_TRIANGULATE_QUAD_ALTERNATE, - MOD_TRIANGULATE_QUAD_SHORTEDGE, + MOD_TRIANGULATE_QUAD_FIXED = 1, + MOD_TRIANGULATE_QUAD_ALTERNATE = 2, + MOD_TRIANGULATE_QUAD_SHORTEDGE = 3, }; typedef struct LaplacianSmoothModifierData { diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h index 88c712b5b28..daa3a629d27 100644 --- a/source/blender/makesdna/DNA_object_force_types.h +++ b/source/blender/makesdna/DNA_object_force_types.h @@ -62,6 +62,7 @@ typedef enum ePFieldType { /** Force based on smoke simulation air flow. */ PFIELD_SMOKEFLOW = 13, + /* Keep last. */ NUM_PFIELD_TYPES, } ePFieldType; diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 1a76d32dc2c..47e6db835c9 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -462,6 +462,7 @@ enum { OB_VOLUME = 29, + /* Keep last. */ OB_TYPE_MAX, }; diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index f4834355223..357c1158b47 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -99,19 +99,19 @@ typedef struct AviCodecData { } AviCodecData; typedef enum eFFMpegPreset { - FFM_PRESET_NONE, + FFM_PRESET_NONE = 0, #ifdef DNA_DEPRECATED_ALLOW /* Previously used by h.264 to control encoding speed vs. file size. */ - FFM_PRESET_ULTRAFAST, /* DEPRECATED */ - FFM_PRESET_SUPERFAST, /* DEPRECATED */ - FFM_PRESET_VERYFAST, /* DEPRECATED */ - FFM_PRESET_FASTER, /* DEPRECATED */ - FFM_PRESET_FAST, /* DEPRECATED */ - FFM_PRESET_MEDIUM, /* DEPRECATED */ - FFM_PRESET_SLOW, /* DEPRECATED */ - FFM_PRESET_SLOWER, /* DEPRECATED */ - FFM_PRESET_VERYSLOW, /* DEPRECATED */ + FFM_PRESET_ULTRAFAST = 1, /* DEPRECATED */ + FFM_PRESET_SUPERFAST = 2, /* DEPRECATED */ + FFM_PRESET_VERYFAST = 3, /* DEPRECATED */ + FFM_PRESET_FASTER = 4, /* DEPRECATED */ + FFM_PRESET_FAST = 5, /* DEPRECATED */ + FFM_PRESET_MEDIUM = 6, /* DEPRECATED */ + FFM_PRESET_SLOW = 7, /* DEPRECATED */ + FFM_PRESET_SLOWER = 8, /* DEPRECATED */ + FFM_PRESET_VERYSLOW = 9, /* DEPRECATED */ #endif /* Used by WEBM/VP9 and h.264 to control encoding speed vs. file size. @@ -121,9 +121,9 @@ typedef enum eFFMpegPreset { /** the default and recommended for most applications */ FFM_PRESET_GOOD = 10, /** recommended if you have lots of time and want the best compression efficiency */ - FFM_PRESET_BEST, + FFM_PRESET_BEST = 11, /** recommended for live / fast encoding */ - FFM_PRESET_REALTIME, + FFM_PRESET_REALTIME = 12, } eFFMpegPreset; /* Mapping from easily-understandable descriptions to CRF values. @@ -2194,14 +2194,14 @@ typedef enum eSculptFlags { /* ImagePaintSettings.mode */ typedef enum eImagePaintMode { - IMAGEPAINT_MODE_MATERIAL, /* detect texture paint slots from the material */ - IMAGEPAINT_MODE_IMAGE, /* select texture paint image directly */ + IMAGEPAINT_MODE_MATERIAL = 0, /* detect texture paint slots from the material */ + IMAGEPAINT_MODE_IMAGE = 1, /* select texture paint image directly */ } eImagePaintMode; /* ImagePaintSettings.interp */ enum { IMAGEPAINT_INTERP_LINEAR = 0, - IMAGEPAINT_INTERP_CLOSEST, + IMAGEPAINT_INTERP_CLOSEST = 1, }; /* ImagePaintSettings.flag */ @@ -2301,17 +2301,17 @@ typedef enum eGPencil_Selectmode_types { /* ToolSettings.gpencil_guide_types */ typedef enum eGPencil_GuideTypes { GP_GUIDE_CIRCULAR = 0, - GP_GUIDE_RADIAL, - GP_GUIDE_PARALLEL, - GP_GUIDE_GRID, - GP_GUIDE_ISO, + GP_GUIDE_RADIAL = 1, + GP_GUIDE_PARALLEL = 2, + GP_GUIDE_GRID = 3, + GP_GUIDE_ISO = 4, } eGPencil_GuideTypes; /* ToolSettings.gpencil_guide_references */ typedef enum eGPencil_Guide_Reference { GP_GUIDE_REF_CURSOR = 0, - GP_GUIDE_REF_CUSTOM, - GP_GUIDE_REF_OBJECT, + GP_GUIDE_REF_CUSTOM = 1, + GP_GUIDE_REF_OBJECT = 2, } eGPencil_Guide_Reference; /* ToolSettings.particle flag */ diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 9a59b69604d..8497d363179 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -306,8 +306,8 @@ enum GlobalAreaFlag { }; typedef enum GlobalAreaAlign { - GLOBAL_AREA_ALIGN_TOP, - GLOBAL_AREA_ALIGN_BOTTOM, + GLOBAL_AREA_ALIGN_TOP = 0, + GLOBAL_AREA_ALIGN_BOTTOM = 1, } GlobalAreaAlign; typedef struct ScrArea_Runtime { diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 17b3528aadf..1714ec8b498 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -634,7 +634,7 @@ enum { seqModifierType_Mask = 5, seqModifierType_WhiteBalance = 6, seqModifierType_Tonemap = 7, - + /* Keep last. */ NUM_SEQUENCE_MODIFIER_TYPES, }; diff --git a/source/blender/makesdna/DNA_shader_fx_types.h b/source/blender/makesdna/DNA_shader_fx_types.h index e0931d8cac3..18a4e8655a3 100644 --- a/source/blender/makesdna/DNA_shader_fx_types.h +++ b/source/blender/makesdna/DNA_shader_fx_types.h @@ -42,6 +42,7 @@ typedef enum ShaderFxType { eShaderFxType_Colorize = 8, eShaderFxType_Shadow = 9, eShaderFxType_Glow = 10, + /* Keep last. */ NUM_SHADER_FX_TYPES, } ShaderFxType; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 90af60447fe..c1bfbe8a8b2 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -212,7 +212,7 @@ typedef enum eSpaceButtons_Context { BCONTEXT_SHADERFX = 15, BCONTEXT_OUTPUT = 16, - /* always as last... */ + /* Keep last. */ BCONTEXT_TOT, } eSpaceButtons_Context; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 622222307c7..d40f07c1fff 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1289,8 +1289,8 @@ typedef enum eUserpref_RenderDisplayType { } eUserpref_RenderDisplayType; typedef enum eUserpref_TempSpaceDisplayType { - USER_TEMP_SPACE_DISPLAY_FULLSCREEN, - USER_TEMP_SPACE_DISPLAY_WINDOW, + USER_TEMP_SPACE_DISPLAY_FULLSCREEN = 0, + USER_TEMP_SPACE_DISPLAY_WINDOW = 1, } eUserpref_TempSpaceDisplayType; typedef enum eUserpref_EmulateMMBMod { diff --git a/source/blender/makesdna/DNA_volume_types.h b/source/blender/makesdna/DNA_volume_types.h index 1a49df86761..b3615e87a50 100644 --- a/source/blender/makesdna/DNA_volume_types.h +++ b/source/blender/makesdna/DNA_volume_types.h @@ -95,9 +95,9 @@ enum { /* Volume.sequence_mode */ typedef enum VolumeSequenceMode { VOLUME_SEQUENCE_CLIP = 0, - VOLUME_SEQUENCE_EXTEND, - VOLUME_SEQUENCE_REPEAT, - VOLUME_SEQUENCE_PING_PONG, + VOLUME_SEQUENCE_EXTEND = 1, + VOLUME_SEQUENCE_REPEAT = 2, + VOLUME_SEQUENCE_PING_PONG = 3, } VolumeSequenceMode; /* VolumeDisplay.wireframe_type */ -- cgit v1.2.3