[Bf-blender-cvs] [c9d1143b334] master: Cleanup: Reduce indentation by returning early

Hans Goudey noreply at git.blender.org
Thu Apr 29 17:47:07 CEST 2021


Commit: c9d1143b334527d5b9dfb886f8fdba986bd1ec53
Author: Hans Goudey
Date:   Thu Apr 29 10:46:55 2021 -0500
Branches: master
https://developer.blender.org/rBc9d1143b334527d5b9dfb886f8fdba986bd1ec53

Cleanup: Reduce indentation by returning early

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

M	source/blender/modifiers/intern/MOD_nodes.cc

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

diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc
index 1ee9043d46c..6f674798a59 100644
--- a/source/blender/modifiers/intern/MOD_nodes.cc
+++ b/source/blender/modifiers/intern/MOD_nodes.cc
@@ -1084,36 +1084,37 @@ static void draw_property_for_socket(uiLayout *layout,
 
   /* IDProperties can be removed with python, so there could be a situation where
    * there isn't a property for a socket or it doesn't have the correct type. */
-  if (property != nullptr && property_type->is_correct_type(*property)) {
+  if (property == nullptr || !property_type->is_correct_type(*property)) {
+    return;
+  }
 
-    char socket_id_esc[sizeof(socket.identifier) * 2];
-    BLI_str_escape(socket_id_esc, socket.identifier, sizeof(socket_id_esc));
+  char socket_id_esc[sizeof(socket.identifier) * 2];
+  BLI_str_escape(socket_id_esc, socket.identifier, sizeof(socket_id_esc));
 
-    char rna_path[sizeof(socket_id_esc) + 4];
-    BLI_snprintf(rna_path, ARRAY_SIZE(rna_path), "[\"%s\"]", socket_id_esc);
+  char rna_path[sizeof(socket_id_esc) + 4];
+  BLI_snprintf(rna_path, ARRAY_SIZE(rna_path), "[\"%s\"]", socket_id_esc);
 
-    /* Use #uiItemPointerR to draw pointer properties because #uiItemR would not have enough
-     * information about what type of ID to select for editing the values. This is because
-     * pointer IDProperties contain no information about their type. */
-    switch (socket.type) {
-      case SOCK_OBJECT: {
-        uiItemPointerR(
-            layout, md_ptr, rna_path, bmain_ptr, "objects", socket.name, ICON_OBJECT_DATA);
-        break;
-      }
-      case SOCK_COLLECTION: {
-        uiItemPointerR(layout,
-                       md_ptr,
-                       rna_path,
-                       bmain_ptr,
-                       "collections",
-                       socket.name,
-                       ICON_OUTLINER_COLLECTION);
-        break;
-      }
-      default:
-        uiItemR(layout, md_ptr, rna_path, 0, socket.name, ICON_NONE);
+  /* Use #uiItemPointerR to draw pointer properties because #uiItemR would not have enough
+   * information about what type of ID to select for editing the values. This is because
+   * pointer IDProperties contain no information about their type. */
+  switch (socket.type) {
+    case SOCK_OBJECT: {
+      uiItemPointerR(
+          layout, md_ptr, rna_path, bmain_ptr, "objects", socket.name, ICON_OBJECT_DATA);
+      break;
+    }
+    case SOCK_COLLECTION: {
+      uiItemPointerR(layout,
+                     md_ptr,
+                     rna_path,
+                     bmain_ptr,
+                     "collections",
+                     socket.name,
+                     ICON_OUTLINER_COLLECTION);
+      break;
     }
+    default:
+      uiItemR(layout, md_ptr, rna_path, 0, socket.name, ICON_NONE);
   }
 }



More information about the Bf-blender-cvs mailing list