[Bf-blender-cvs] [1160a3a3f83] master: Cleanup: Clang tidy

Hans Goudey noreply at git.blender.org
Thu Jun 23 01:58:42 CEST 2022


Commit: 1160a3a3f83cafda98e7bf6fb111bdacc5f28a63
Author: Hans Goudey
Date:   Wed Jun 22 18:58:25 2022 -0500
Branches: master
https://developer.blender.org/rB1160a3a3f83cafda98e7bf6fb111bdacc5f28a63

Cleanup: Clang tidy

Mainly duplicate includes and else after return.

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

M	release/scripts/startup/bl_ui/space_view3d.py
M	source/blender/blenkernel/intern/gpencil.c
M	source/blender/blenkernel/intern/gpencil_geom.cc
M	source/blender/blenkernel/intern/subdiv_modifier.c
M	source/blender/blenlib/tests/BLI_kdtree_test.cc
M	source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
M	source/blender/editors/sculpt_paint/paint_ops.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/space_outliner/tree/tree_element_overrides.cc
M	source/blender/editors/uvedit/uvedit_select.c
M	source/blender/imbuf/intern/colormanagement.c
M	source/blender/imbuf/intern/imageprocess.c
M	source/blender/imbuf/intern/jpeg.c
M	source/blender/io/common/intern/path_util.cc
M	source/blender/io/usd/intern/usd_reader_mesh.cc
M	source/blender/io/usd/intern/usd_writer_volume.cc
M	source/blender/io/usd/tests/usd_imaging_test.cc
M	source/blender/python/gpu/gpu_py_framebuffer.c

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

diff --git a/release/scripts/startup/bl_ui/space_view3d.py b/release/scripts/startup/bl_ui/space_view3d.py
index 5e5e7a79035..1f69705db8e 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -6621,6 +6621,29 @@ class VIEW3D_PT_overlay_sculpt(Panel):
         row.prop(overlay, "sculpt_mode_face_sets_opacity", text="Face Sets")
 
 
+class VIEW3D_PT_overlay_sculpt_curves(Panel):
+    bl_space_type = 'VIEW_3D'
+    bl_context = ".curves_sculpt"
+    bl_region_type = 'HEADER'
+    bl_parent_id = 'VIEW3D_PT_overlay'
+    bl_label = "Sculpt"
+
+    @classmethod
+    def poll(cls, context):
+        return context.mode == 'SCULPT_CURVES' and (context.object)
+
+    def draw(self, context):
+        layout = self.layout
+        tool_settings = context.tool_settings
+        sculpt = tool_settings.sculpt
+
+        view = context.space_data
+        overlay = view.overlay
+
+        row = layout.row(align=True)
+        row.prop(overlay, "sculpt_mode_mask_opacity", text="Selection Opacity")
+
+
 class VIEW3D_PT_overlay_bones(Panel):
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'HEADER'
@@ -7908,6 +7931,7 @@ classes = (
     VIEW3D_PT_overlay_weight_paint,
     VIEW3D_PT_overlay_bones,
     VIEW3D_PT_overlay_sculpt,
+    VIEW3D_PT_overlay_sculpt_curves,
     VIEW3D_PT_snapping,
     VIEW3D_PT_proportional_edit,
     VIEW3D_PT_gpencil_origin,
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index f86e947910b..3d546c5c36a 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -55,8 +55,6 @@
 
 #include "BLO_read_write.h"
 
-#include "BKE_gpencil.h"
-
 static CLG_LogRef LOG = {"bke.gpencil"};
 
 static void greasepencil_copy_data(Main *UNUSED(bmain),
diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc
index 792474d30ea..0445a1540c7 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -25,8 +25,6 @@
 #include "BLI_polyfill_2d.h"
 #include "BLI_span.hh"
 
-#include "BLT_translation.h"
-
 #include "DNA_gpencil_modifier_types.h"
 #include "DNA_gpencil_types.h"
 #include "DNA_material_types.h"
diff --git a/source/blender/blenkernel/intern/subdiv_modifier.c b/source/blender/blenkernel/intern/subdiv_modifier.c
index f5423dccc0f..57af0192d59 100644
--- a/source/blender/blenkernel/intern/subdiv_modifier.c
+++ b/source/blender/blenkernel/intern/subdiv_modifier.c
@@ -44,15 +44,14 @@ bool BKE_subsurf_modifier_runtime_init(SubsurfModifierData *smd, const bool use_
 
     return false;
   }
-  else {
-    /* Allocate runtime data if it did not exist yet. */
-    if (runtime_data == NULL) {
-      runtime_data = MEM_callocN(sizeof(*runtime_data), "subsurf runtime");
-      smd->modifier.runtime = runtime_data;
-    }
-    runtime_data->settings = settings;
-    return true;
+
+  /* Allocate runtime data if it did not exist yet. */
+  if (runtime_data == NULL) {
+    runtime_data = MEM_callocN(sizeof(*runtime_data), "subsurf runtime");
+    smd->modifier.runtime = runtime_data;
   }
+  runtime_data->settings = settings;
+  return true;
 }
 
 static ModifierData *modifier_get_last_enabled_for_mode(const Scene *scene,
diff --git a/source/blender/blenlib/tests/BLI_kdtree_test.cc b/source/blender/blenlib/tests/BLI_kdtree_test.cc
index f8675ef332d..d040ea15172 100644
--- a/source/blender/blenlib/tests/BLI_kdtree_test.cc
+++ b/source/blender/blenlib/tests/BLI_kdtree_test.cc
@@ -4,7 +4,7 @@
 
 #include "BLI_kdtree.h"
 
-#include <math.h>
+#include <cmath>
 
 /* -------------------------------------------------------------------- */
 /* Tests */
diff --git a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
index 8c6ef34ef26..1c785fa6452 100644
--- a/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
+++ b/source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
@@ -9,8 +9,6 @@
 #include "BKE_context.h"
 #include "BKE_curves.hh"
 
-#include "DNA_meshdata_types.h"
-
 #include "ED_view3d.h"
 
 #include "UI_interface.h"
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index 0f2b02ed3ab..ce6b397af15 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -90,13 +90,13 @@ static eGPBrush_Presets gpencil_get_brush_preset_from_tool(bToolRef *tool,
       if (STREQ(tool->runtime->data_block, "DRAW")) {
         return GP_BRUSH_PRESET_PENCIL;
       }
-      else if (STREQ(tool->runtime->data_block, "FILL")) {
+      if (STREQ(tool->runtime->data_block, "FILL")) {
         return GP_BRUSH_PRESET_FILL_AREA;
       }
-      else if (STREQ(tool->runtime->data_block, "ERASE")) {
+      if (STREQ(tool->runtime->data_block, "ERASE")) {
         return GP_BRUSH_PRESET_ERASER_SOFT;
       }
-      else if (STREQ(tool->runtime->data_block, "TINT")) {
+      if (STREQ(tool->runtime->data_block, "TINT")) {
         return GP_BRUSH_PRESET_TINT;
       }
       break;
@@ -105,28 +105,28 @@ static eGPBrush_Presets gpencil_get_brush_preset_from_tool(bToolRef *tool,
       if (STREQ(tool->runtime->data_block, "SMOOTH")) {
         return GP_BRUSH_PRESET_SMOOTH_STROKE;
       }
-      else if (STREQ(tool->runtime->data_block, "STRENGTH")) {
+      if (STREQ(tool->runtime->data_block, "STRENGTH")) {
         return GP_BRUSH_PRESET_STRENGTH_STROKE;
       }
-      else if (STREQ(tool->runtime->data_block, "THICKNESS")) {
+      if (STREQ(tool->runtime->data_block, "THICKNESS")) {
         return GP_BRUSH_PRESET_THICKNESS_STROKE;
       }
-      else if (STREQ(tool->runtime->data_block, "GRAB")) {
+      if (STREQ(tool->runtime->data_block, "GRAB")) {
         return GP_BRUSH_PRESET_GRAB_STROKE;
       }
-      else if (STREQ(tool->runtime->data_block, "PUSH")) {
+      if (STREQ(tool->runtime->data_block, "PUSH")) {
         return GP_BRUSH_PRESET_PUSH_STROKE;
       }
-      else if (STREQ(tool->runtime->data_block, "TWIST")) {
+      if (STREQ(tool->runtime->data_block, "TWIST")) {
         return GP_BRUSH_PRESET_TWIST_STROKE;
       }
-      else if (STREQ(tool->runtime->data_block, "PINCH")) {
+      if (STREQ(tool->runtime->data_block, "PINCH")) {
         return GP_BRUSH_PRESET_PINCH_STROKE;
       }
-      else if (STREQ(tool->runtime->data_block, "RANDOMIZE")) {
+      if (STREQ(tool->runtime->data_block, "RANDOMIZE")) {
         return GP_BRUSH_PRESET_RANDOMIZE_STROKE;
       }
-      else if (STREQ(tool->runtime->data_block, "CLONE")) {
+      if (STREQ(tool->runtime->data_block, "CLONE")) {
         return GP_BRUSH_PRESET_CLONE_STROKE;
       }
       break;
@@ -138,23 +138,22 @@ static eGPBrush_Presets gpencil_get_brush_preset_from_tool(bToolRef *tool,
       if (STREQ(tool->runtime->data_block, "DRAW")) {
         return GP_BRUSH_PRESET_VERTEX_DRAW;
       }
-      else if (STREQ(tool->runtime->data_block, "BLUR")) {
+      if (STREQ(tool->runtime->data_block, "BLUR")) {
         return GP_BRUSH_PRESET_VERTEX_BLUR;
       }
-      else if (STREQ(tool->runtime->data_block, "AVERAGE")) {
+      if (STREQ(tool->runtime->data_block, "AVERAGE")) {
         return GP_BRUSH_PRESET_VERTEX_AVERAGE;
       }
-      else if (STREQ(tool->runtime->data_block, "SMEAR")) {
+      if (STREQ(tool->runtime->data_block, "SMEAR")) {
         return GP_BRUSH_PRESET_VERTEX_SMEAR;
       }
-      else if (STREQ(tool->runtime->data_block, "REPLACE")) {
+      if (STREQ(tool->runtime->data_block, "REPLACE")) {
         return GP_BRUSH_PRESET_VERTEX_REPLACE;
       }
       break;
     }
     default:
       return GP_BRUSH_PRESET_UNKNOWN;
-      break;
   }
   return GP_BRUSH_PRESET_UNKNOWN;
 }
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index 0693b445fe5..fe96257dc01 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -858,7 +858,7 @@ void SCULPT_geometry_preview_lines_update(bContext *C, struct SculptSession *ss,
 
 void SCULPT_stroke_modifiers_check(const bContext *C, Object *ob, const Brush *brush);
 float SCULPT_raycast_init(struct ViewContext *vc,
-                          const float mouse[2],
+                          const float mval[2],
                           float ray_start[3],
                           float ray_end[3],
                           float ray_normal[3],
diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
index 871de39b1dd..d1babda642e 100644
--- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
+++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc
@@ -86,9 +86,7 @@ void TreeElementOverridesBase::expand(SpaceOutliner &space_outliner) const
             do_skip = false;
             break;
           }
-          else {
-            is_system_override = true;
-          }
+          is_system_override = true;
         }
       }
 
diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c
index 8dcf2ceb679..964ac5f650b 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -4914,7 +4914,7 @@ static int uv_select_similar_exec(bContext *C, wmOperator *op)
   if (selectmode & UV_SELECT_EDGE) {
     return uv_select_similar_edge_exec(C, op);
   }
-  else if (selectmode & UV_SELECT_FACE) {
+  if (selectmode & UV_SELECT_FACE) {
     return uv_select_similar_face_exec(C, op);
   }
   if (selectmode & UV_SELECT_ISLAND) {
diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c
index 33873b5daa7..a58c2ba4c44 100644
--- a/source/blender/imbuf/intern/colormanagement.c
+++ b/source/blender/imbuf/intern/colormanagement.c
@@ -2481,22 +2481,21 @@ static ImBuf *imbuf_ensure_editable(ImBuf *ibuf, ImBuf *colormanaged_ibuf, bool
     IMB_metadata_copy(colormanaged_ibuf, i

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list