Code cleanup: better warning in case of modifier icons in outliner.
authorNicholas Bishop <nicholasbishop@gmail.com>
Tue, 22 May 2012 18:40:31 +0000 (18:40 +0000)
committerNicholas Bishop <nicholasbishop@gmail.com>
Tue, 22 May 2012 18:40:31 +0000 (18:40 +0000)
Modified the switch statement to use the ModifierType enum and changed
the default case to use specific missing values. Compiler can then
issue warnings when new modifier types are added (at least gcc 4.6.3
does)

source/blender/editors/space_outliner/outliner_draw.c

index 3662cfb..fddd7af 100644 (file)
@@ -932,7 +932,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
                        {
                                Object *ob = (Object *)tselem->id;
                                ModifierData *md = BLI_findlink(&ob->modifiers, tselem->nr);
-                               switch (md->type) {
+                               switch ((ModifierType)md->type) {
                                        case eModifierType_Subsurf: 
                                                UI_icon_draw(x, y, ICON_MOD_SUBSURF); break;
                                        case eModifierType_Armature: 
@@ -986,6 +986,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
                                        case eModifierType_Explode:
                                                UI_icon_draw(x, y, ICON_MOD_EXPLODE); break;
                                        case eModifierType_Collision:
+                                       case eModifierType_Surface:
                                                UI_icon_draw(x, y, ICON_MOD_PHYSICS); break;
                                        case eModifierType_Fluidsim:
                                                UI_icon_draw(x, y, ICON_MOD_FLUIDSIM); break;
@@ -1011,7 +1012,11 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
                                                UI_icon_draw(x, y, ICON_MOD_WARP); break;
                                        case eModifierType_Skin:
                                                UI_icon_draw(x, y, ICON_MOD_SKIN); break;
-                                       default:
+
+                                       /* Default */
+                                       case eModifierType_None:
+                                       case eModifierType_ShapeKey:
+                               case NUM_MODIFIER_TYPES:
                                                UI_icon_draw(x, y, ICON_DOT); break;
                                }
                                break;