1
1

Cleanup: Clang tidy

Mainly duplicate includes and else after return.
This commit is contained in:
2022-06-22 18:58:25 -05:00
parent d2a3b99ff7
commit 1160a3a3f8
18 changed files with 75 additions and 67 deletions

View File

@@ -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,

View File

@@ -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),

View File

@@ -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"

View File

@@ -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,

View File

@@ -4,7 +4,7 @@
#include "BLI_kdtree.h"
#include <math.h>
#include <cmath>
/* -------------------------------------------------------------------- */
/* Tests */

View File

@@ -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"

View File

@@ -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;
}

View File

@@ -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],

View File

@@ -86,9 +86,7 @@ void TreeElementOverridesBase::expand(SpaceOutliner &space_outliner) const
do_skip = false;
break;
}
else {
is_system_override = true;
}
is_system_override = true;
}
}

View File

@@ -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) {

View File

@@ -2481,22 +2481,21 @@ static ImBuf *imbuf_ensure_editable(ImBuf *ibuf, ImBuf *colormanaged_ibuf, bool
IMB_metadata_copy(colormanaged_ibuf, ibuf);
return colormanaged_ibuf;
}
else {
/* Render pipeline is constructing image buffer itself,
* but it's re-using byte and float buffers from render result make copy of this buffers
* here sine this buffers would be transformed to other color space here. */
if (ibuf->rect && (ibuf->mall & IB_rect) == 0) {
ibuf->rect = MEM_dupallocN(ibuf->rect);
ibuf->mall |= IB_rect;
}
if (ibuf->rect_float && (ibuf->mall & IB_rectfloat) == 0) {
ibuf->rect_float = MEM_dupallocN(ibuf->rect_float);
ibuf->mall |= IB_rectfloat;
}
return ibuf;
/* Render pipeline is constructing image buffer itself,
* but it's re-using byte and float buffers from render result make copy of this buffers
* here sine this buffers would be transformed to other color space here. */
if (ibuf->rect && (ibuf->mall & IB_rect) == 0) {
ibuf->rect = MEM_dupallocN(ibuf->rect);
ibuf->mall |= IB_rect;
}
if (ibuf->rect_float && (ibuf->mall & IB_rectfloat) == 0) {
ibuf->rect_float = MEM_dupallocN(ibuf->rect_float);
ibuf->mall |= IB_rectfloat;
}
return ibuf;
}
ImBuf *IMB_colormanagement_imbuf_for_write(ImBuf *ibuf,

View File

@@ -22,7 +22,6 @@
#include "IMB_colormanagement.h"
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
#include <math.h>
void IMB_convert_rgba_to_abgr(struct ImBuf *ibuf)
{

View File

@@ -524,8 +524,8 @@ struct ImBuf *imb_thumbnail_jpeg(const char *filepath,
unsigned int i = JPEG_APP1_MAX;
/* All EXIF data is within this 64K header segment. Skip ahead until next SOI for thumbnail. */
while (!((fgetc(infile) == JPEG_MARKER_MSB) && (fgetc(infile) == JPEG_MARKER_SOI)) &&
!feof(infile) && i--)
;
!feof(infile) && i--) {
}
if (i > 0 && !feof(infile)) {
/* We found a JPEG thumbnail inside this image. */
ImBuf *ibuf = NULL;

View File

@@ -39,7 +39,7 @@ std::string path_reference(StringRefNull filepath,
if (mode == PATH_REFERENCE_ABSOLUTE) {
return filepath_abs;
}
else if (mode == PATH_REFERENCE_RELATIVE) {
if (mode == PATH_REFERENCE_RELATIVE) {
char rel_path[PATH_MAX];
BLI_strncpy(rel_path, filepath_abs, PATH_MAX);
BLI_path_rel(rel_path, base_dst.c_str());
@@ -49,7 +49,7 @@ std::string path_reference(StringRefNull filepath,
}
return rel_path + 2; /* Skip blender's internal "//" prefix. */
}
else if (mode == PATH_REFERENCE_STRIP) {
if (mode == PATH_REFERENCE_STRIP) {
return BLI_path_basename(filepath_abs);
}
BLI_assert_msg(false, "Invalid path reference mode");

View File

@@ -87,11 +87,9 @@ static Material *find_existing_material(
if (mat_iter != mat_map.end()) {
return mat_iter->second;
}
else {
/* We can't find the Blender material which was previously created for this USD
* material, which should never happen. */
BLI_assert_unreachable();
}
/* We can't find the Blender material which was previously created for this USD
* material, which should never happen. */
BLI_assert_unreachable();
}
}
else {

View File

@@ -100,7 +100,7 @@ std::optional<std::string> USDVolumeWriter::resolve_vdb_file(const Volume *volum
vdb_file_path = construct_vdb_file_path(volume);
if (!BKE_volume_save(
volume, usd_export_context_.bmain, NULL, vdb_file_path.value_or("").c_str())) {
volume, usd_export_context_.bmain, nullptr, vdb_file_path.value_or("").c_str())) {
return std::nullopt;
}
}

View File

@@ -42,8 +42,8 @@ TEST_F(USDImagingTest, CapsuleAdapterTest)
}
pxr::UsdImagingCapsuleAdapter capsule_adapter;
pxr::VtValue points_value = capsule_adapter.GetMeshPoints(capsule.GetPrim(),
pxr::UsdTimeCode::Default());
pxr::VtValue points_value = pxr::UsdImagingCapsuleAdapter::GetMeshPoints(
capsule.GetPrim(), pxr::UsdTimeCode::Default());
if (!points_value.IsHolding<pxr::VtArray<pxr::GfVec3f>>()) {
FAIL() << "Mesh points value holding unexpected type.";
return;
@@ -52,7 +52,7 @@ TEST_F(USDImagingTest, CapsuleAdapterTest)
pxr::VtArray<pxr::GfVec3f> points = points_value.Get<pxr::VtArray<pxr::GfVec3f>>();
EXPECT_FALSE(points.empty());
pxr::VtValue topology_value = capsule_adapter.GetMeshTopology();
pxr::VtValue topology_value = pxr::UsdImagingCapsuleAdapter::GetMeshTopology();
if (!topology_value.IsHolding<pxr::HdMeshTopology>()) {
FAIL() << "Mesh topology value holding unexpected type.";

View File

@@ -20,12 +20,10 @@
#include "../generic/python_utildefines.h"
#include "../mathutils/mathutils.h"
#include "gpu_py.h"
#include "gpu_py_texture.h"
#include "gpu_py.h"
#include "gpu_py_buffer.h"
#include "gpu_py_framebuffer.h" /* own include */
#include "gpu_py_texture.h"
/* -------------------------------------------------------------------- */
/** \name GPUFrameBuffer Common Utilities