Cleanup: Various clang-tidy warnings in geometry

Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
Brecht Van Lommel
2025-01-26 20:07:59 +01:00
parent 4856ad3efc
commit d2c688e381
22 changed files with 26 additions and 50 deletions

View File

@@ -4,12 +4,9 @@
#pragma once
#include "BLI_span.hh"
#include "DNA_node_types.h"
#include "BKE_curves.hh"
#include "BKE_curves_utils.hh"
#include "BKE_geometry_set.hh"
namespace blender::geometry {

View File

@@ -4,7 +4,6 @@
#pragma once
#include "BLI_function_ref.hh"
#include "BLI_index_mask.hh"
#include "BKE_curves.hh"

View File

@@ -4,9 +4,6 @@
#pragma once
#include "FN_field.hh"
#include "BKE_attribute.hh"
#include "BKE_curves.hh"
namespace blender::geometry {

View File

@@ -4,7 +4,6 @@
#pragma once
#include "BKE_anonymous_attribute_id.hh"
#include "BKE_geometry_set.hh"
namespace blender::geometry {

View File

@@ -6,7 +6,7 @@
#include <optional>
#include "BLI_index_mask.hh"
#include "BLI_virtual_array.hh"
#include "BKE_attribute_filter.hh"

View File

@@ -5,7 +5,6 @@
#pragma once
#include <optional>
#include <string>
#include "BLI_math_vector_types.hh"
#include "BLI_string_ref.hh"

View File

@@ -13,7 +13,7 @@ struct Mesh;
namespace blender::geometry {
void split_edges(Mesh &mesh,
const IndexMask &mask,
const IndexMask &selected_edges,
const bke::AttributeFilter &attribute_filter = {});
} // namespace blender::geometry

View File

@@ -4,7 +4,7 @@
#pragma once
#include "BLI_bounds.hh"
#include "BLI_bounds_types.hh"
#include "BLI_function_ref.hh"
#include "BLI_math_matrix_types.hh"
#include "BLI_math_vector_types.hh"

View File

@@ -7,7 +7,6 @@
#include "BLI_multi_value_map.hh"
#include "BLI_span.hh"
#include "BKE_anonymous_attribute_id.hh"
#include "BKE_attribute.hh"
#include "BKE_curves.hh"
#include "BKE_geometry_set.hh"

View File

@@ -6,7 +6,6 @@
#include "FN_field.hh"
#include "BKE_attribute.hh"
#include "BKE_curves.hh"
namespace blender::geometry {

View File

@@ -4,10 +4,7 @@
#pragma once
#include <optional>
#include "BLI_math_vector_types.hh"
#include "BLI_multi_value_map.hh"
#include "BLI_span.hh"
namespace blender::geometry {

View File

@@ -4,7 +4,6 @@
#pragma once
#include "BLI_function_ref.hh"
#include "BLI_index_mask.hh"
#include "BKE_curves.hh"

View File

@@ -4,7 +4,10 @@
#pragma once
#include "BKE_curves.hh"
#include "BLI_generic_span.hh"
#include "BLI_index_mask.hh"
#include "BLI_math_vector_types.hh"
#include "BLI_span.hh"
namespace blender::geometry {

View File

@@ -4,7 +4,6 @@
#pragma once
#include "BLI_function_ref.hh"
#include "BLI_index_mask.hh"
#include "BLI_virtual_array.hh"

View File

@@ -4,12 +4,9 @@
#pragma once
#include "BLI_span.hh"
#include "DNA_node_types.h"
#include "BKE_curves.hh"
#include "BKE_curves_utils.hh"
#include "BKE_geometry_set.hh"
namespace blender::geometry {

View File

@@ -5,13 +5,11 @@
#pragma once
#include "BLI_heap.h"
#include "BLI_math_matrix.hh"
#include "BLI_memarena.h"
#include "BLI_span.hh"
#include "BLI_vector.hh"
#include "DNA_space_types.h"
#include "DNA_vec_types.h"
/** \file
* \ingroup geo

View File

@@ -4,7 +4,7 @@
#pragma once
#include "BLI_sys_types.h" /* for intptr_t support */
#include <cstdint>
namespace slim {
struct MatrixTransfer;

View File

@@ -1337,7 +1337,7 @@ static void customdata_weld(
return;
}
CustomData_interp(source, dest, (const int *)src_indices, nullptr, nullptr, count, dest_index);
CustomData_interp(source, dest, src_indices, nullptr, nullptr, count, dest_index);
int src_i, dest_i;
int j;
@@ -1819,9 +1819,9 @@ std::optional<Mesh *> mesh_merge_by_distance_connected(const Mesh &mesh,
Mesh *mesh_merge_verts(const Mesh &mesh,
MutableSpan<int> vert_dest_map,
int vert_dest_map_len,
const bool do_mix_vert_data)
const bool do_mix_data)
{
return create_merged_mesh(mesh, vert_dest_map, vert_dest_map_len, do_mix_vert_data);
return create_merged_mesh(mesh, vert_dest_map, vert_dest_map_len, do_mix_data);
}
/** \} */

View File

@@ -381,22 +381,22 @@ bke::GeometryComponentPtr reordered_component(const bke::GeometryComponent &src_
*src_mesh_component->get(), old_by_new_map, domain, attribute_filter);
return bke::GeometryComponentPtr(new bke::MeshComponent(result_mesh));
}
else if (const bke::PointCloudComponent *src_points_component =
dynamic_cast<const bke::PointCloudComponent *>(&src_component))
if (const bke::PointCloudComponent *src_points_component =
dynamic_cast<const bke::PointCloudComponent *>(&src_component))
{
PointCloud *result_point_cloud = reorder_points(
*src_points_component->get(), old_by_new_map, attribute_filter);
return bke::GeometryComponentPtr(new bke::PointCloudComponent(result_point_cloud));
}
else if (const bke::CurveComponent *src_curves_component =
dynamic_cast<const bke::CurveComponent *>(&src_component))
if (const bke::CurveComponent *src_curves_component = dynamic_cast<const bke::CurveComponent *>(
&src_component))
{
Curves *result_curves = reorder_curves(
*src_curves_component->get(), old_by_new_map, attribute_filter);
return bke::GeometryComponentPtr(new bke::CurveComponent(result_curves));
}
else if (const bke::InstancesComponent *src_instances_component =
dynamic_cast<const bke::InstancesComponent *>(&src_component))
if (const bke::InstancesComponent *src_instances_component =
dynamic_cast<const bke::InstancesComponent *>(&src_component))
{
bke::Instances *result_instances = reorder_instaces(
*src_instances_component->get(), old_by_new_map, attribute_filter);

View File

@@ -10,6 +10,7 @@
#include "BLI_bounds.hh"
#include "BLI_enumerable_thread_specific.hh"
#include "BLI_linear_allocator_chunked_list.hh"
#include "BLI_map.hh"
#include "BLI_math_geom.h"
#include "BLI_math_vector.hh"
#include "BLI_offset_indices.hh"

View File

@@ -30,19 +30,14 @@ namespace blender::geometry {
/** Store information about an island's placement such as translation, rotation and reflection. */
class UVPhi {
public:
UVPhi();
UVPhi() = default;
bool is_valid() const;
float2 translation;
float rotation;
// bool reflect;
float2 translation = float2(-1.0f, -1.0f);
float rotation = 0.0f;
// bool reflect = false;
};
UVPhi::UVPhi() : translation(-1.0f, -1.0f), rotation(0.0f)
{
/* Initialize invalid. */
}
bool UVPhi::is_valid() const
{
return translation.x != -1.0f;
@@ -1152,8 +1147,8 @@ class Occupancy {
const float margin,
const bool write) const;
int bitmap_radix; /* Width and Height of `bitmap`. */
float bitmap_scale_reciprocal; /* == 1.0f / `bitmap_scale`. */
int bitmap_radix = 800; /* Width and Height of `bitmap`. */
float bitmap_scale_reciprocal = 1.0f; /* == 1.0f / `bitmap_scale`. */
private:
mutable Array<float> bitmap_;
@@ -1164,10 +1159,8 @@ class Occupancy {
const float terminal = 1048576.0f; /* 4 * bitmap_radix < terminal < INT_MAX / 4. */
};
Occupancy::Occupancy(const float initial_scale)
: bitmap_radix(800), bitmap_(bitmap_radix * bitmap_radix, false)
Occupancy::Occupancy(const float initial_scale) : bitmap_(bitmap_radix * bitmap_radix, false)
{
bitmap_scale_reciprocal = 1.0f; /* lint, prevent uninitialized memory access. */
increase_scale();
bitmap_scale_reciprocal = bitmap_radix / initial_scale; /* Actually set the value. */
}

View File

@@ -1834,7 +1834,7 @@ static bool p_collapse_allowed_topologic(PEdge *edge, PEdge *pair)
if (edge && !edge->next->pair && !edge->next->next->pair) {
return false;
}
else if (pair && !pair->next->pair && !pair->next->next->pair) {
if (pair && !pair->next->pair && !pair->next->next->pair) {
return false;
}
}