[Bf-blender-cvs] [55173b1583a] master: Cleanup: draw_common: Use switch instead of ifs

Clément Foucault noreply at git.blender.org
Wed May 8 17:59:36 CEST 2019


Commit: 55173b1583a67308b053d57f960738b55fe81abb
Author: Clément Foucault
Date:   Tue May 7 22:01:45 2019 +0200
Branches: master
https://developer.blender.org/rB55173b1583a67308b053d57f960738b55fe81abb

Cleanup: draw_common: Use switch instead of ifs

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

M	source/blender/draw/intern/draw_common.c

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

diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index b4eb354ec59..e832b8bc742 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -1075,22 +1075,27 @@ int DRW_object_wire_theme_get(Object *ob, ViewLayer *view_layer, float **r_color
       theme_id = (active) ? TH_ACTIVE : TH_SELECT;
     }
     else {
-      if (ob->type == OB_LAMP) {
-        theme_id = TH_LIGHT;
-      }
-      else if (ob->type == OB_SPEAKER) {
-        theme_id = TH_SPEAKER;
-      }
-      else if (ob->type == OB_CAMERA) {
-        theme_id = TH_CAMERA;
-      }
-      else if (ob->type == OB_EMPTY) {
-        theme_id = TH_EMPTY;
+      switch (ob->type) {
+        case OB_LAMP:
+          theme_id = TH_LIGHT;
+          break;
+        case OB_SPEAKER:
+          theme_id = TH_SPEAKER;
+          break;
+        case OB_CAMERA:
+          theme_id = TH_CAMERA;
+          break;
+        case OB_EMPTY:
+          theme_id = TH_EMPTY;
+          break;
+        case OB_LIGHTPROBE:
+          /* TODO add lightprobe color */
+          theme_id = TH_EMPTY;
+          break;
+        default:
+          /* fallback to TH_WIRE */
+          break;
       }
-      else if (ob->type == OB_LIGHTPROBE) {
-        theme_id = TH_EMPTY;
-      } /* TODO add lightprobe color */
-      /* fallback to TH_WIRE */
     }
   }



More information about the Bf-blender-cvs mailing list