Cleanup: Various clang tidy changes

This commit is contained in:
Hans Goudey 2024-01-19 12:08:40 -05:00
parent 7ca4dcac5a
commit 21407901f8
54 changed files with 188 additions and 206 deletions

View File

@ -65,7 +65,7 @@ static FTC_CMapCache ftc_charmap_cache = nullptr;
static ThreadMutex ft_lib_mutex; static ThreadMutex ft_lib_mutex;
/* May be set to #UI_widgetbase_draw_cache_flush. */ /* May be set to #UI_widgetbase_draw_cache_flush. */
static void (*blf_draw_cache_flush)(void) = nullptr; static void (*blf_draw_cache_flush)() = nullptr;
static ft_pix blf_font_height_max_ft_pix(FontBLF *font); static ft_pix blf_font_height_max_ft_pix(FontBLF *font);
static ft_pix blf_font_width_max_ft_pix(FontBLF *font); static ft_pix blf_font_width_max_ft_pix(FontBLF *font);
@ -1334,7 +1334,7 @@ void blf_font_exit()
blf_batch_draw_exit(); blf_batch_draw_exit();
} }
void BLF_cache_flush_set_fn(void (*cache_flush_fn)(void)) void BLF_cache_flush_set_fn(void (*cache_flush_fn)())
{ {
blf_draw_cache_flush = cache_flush_fn; blf_draw_cache_flush = cache_flush_fn;
} }

View File

@ -32,7 +32,7 @@ void BKE_cachefile_eval(struct Main *bmain,
struct CacheFile *cache_file); struct CacheFile *cache_file);
bool BKE_cachefile_filepath_get(const struct Main *bmain, bool BKE_cachefile_filepath_get(const struct Main *bmain,
const struct Depsgraph *depsgrah, const struct Depsgraph *depsgraph,
const struct CacheFile *cache_file, const struct CacheFile *cache_file,
char r_filepath[1024]); char r_filepath[1024]);

View File

@ -395,7 +395,7 @@ BMCustomDataCopyMap CustomData_bmesh_copy_map_calc(const CustomData &src,
void CustomData_bmesh_copy_block(CustomData &dst_data, void CustomData_bmesh_copy_block(CustomData &dst_data,
const BMCustomDataCopyMap &map, const BMCustomDataCopyMap &map,
const void *src_block, const void *src_block,
void **dest_block); void **dst_block);
/** /**
* Copies data of a single layer of a given type. * Copies data of a single layer of a given type.

View File

@ -155,7 +155,7 @@ bool BKE_object_data_transfer_mesh(struct Depsgraph *depsgraph,
int map_vert_mode, int map_vert_mode,
int map_edge_mode, int map_edge_mode,
int map_loop_mode, int map_loop_mode,
int map_poly_mode, int map_face_mode,
struct SpaceTransform *space_transform, struct SpaceTransform *space_transform,
bool auto_transform, bool auto_transform,
float max_distance, float max_distance,
@ -177,7 +177,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph,
int map_vert_mode, int map_vert_mode,
int map_edge_mode, int map_edge_mode,
int map_loop_mode, int map_loop_mode,
int map_poly_mode, int map_face_mode,
struct SpaceTransform *space_transform, struct SpaceTransform *space_transform,
bool auto_transform, bool auto_transform,
float max_distance, float max_distance,

View File

@ -485,7 +485,7 @@ bool BKE_mesh_validate_arrays(struct Mesh *mesh,
int *corner_verts, int *corner_verts,
int *corner_edges, int *corner_edges,
unsigned int corners_num, unsigned int corners_num,
int *face_offsets, const int *face_offsets,
unsigned int faces_num, unsigned int faces_num,
struct MDeformVert *dverts, /* assume totvert length */ struct MDeformVert *dverts, /* assume totvert length */
bool do_verbose, bool do_verbose,
@ -498,7 +498,7 @@ bool BKE_mesh_validate_arrays(struct Mesh *mesh,
* \returns is_valid. * \returns is_valid.
*/ */
bool BKE_mesh_validate_all_customdata(struct CustomData *vert_data, bool BKE_mesh_validate_all_customdata(struct CustomData *vert_data,
uint totvert, uint verts_num,
struct CustomData *edge_data, struct CustomData *edge_data,
uint edges_num, uint edges_num,
struct CustomData *corner_data, struct CustomData *corner_data,

View File

@ -119,7 +119,7 @@ void BKE_mesh_vert_corner_tri_map_create(MeshElemMap **r_map,
int **r_mem, int **r_mem,
int totvert, int totvert,
const blender::int3 *corner_tris, const blender::int3 *corner_tris,
int tottris, int tris_num,
const int *corner_verts, const int *corner_verts,
int corners_num); int corners_num);
/** /**

View File

@ -21,8 +21,6 @@
#include "FN_field.hh" #include "FN_field.hh"
#include "BLT_translation.h"
#include "CLG_log.h" #include "CLG_log.h"
#include "attribute_access_intern.hh" #include "attribute_access_intern.hh"

View File

@ -334,10 +334,10 @@ static std::shared_ptr<DictionaryValue> write_blob_shared_simple_gspan(
const int size, const int size,
const ImplicitSharingInfo **r_sharing_info) const ImplicitSharingInfo **r_sharing_info)
{ {
const char *func = __func__;
const std::optional<ImplicitSharingInfoAndData> sharing_info_and_data = blob_sharing.read_shared( const std::optional<ImplicitSharingInfoAndData> sharing_info_and_data = blob_sharing.read_shared(
io_data, [&]() -> std::optional<ImplicitSharingInfoAndData> { io_data, [&]() -> std::optional<ImplicitSharingInfoAndData> {
void *data_mem = MEM_mallocN_aligned( void *data_mem = MEM_mallocN_aligned(size * cpp_type.size(), cpp_type.alignment(), func);
size * cpp_type.size(), cpp_type.alignment(), __func__);
if (!read_blob_simple_gspan(blob_reader, io_data, {cpp_type, data_mem, size})) { if (!read_blob_simple_gspan(blob_reader, io_data, {cpp_type, data_mem, size})) {
MEM_freeN(data_mem); MEM_freeN(data_mem);
return std::nullopt; return std::nullopt;
@ -378,7 +378,7 @@ template<typename T>
const std::optional<StringRefNull> name = io_attribute->lookup_str("name"); const std::optional<StringRefNull> name = io_attribute->lookup_str("name");
const std::optional<StringRefNull> domain_str = io_attribute->lookup_str("domain"); const std::optional<StringRefNull> domain_str = io_attribute->lookup_str("domain");
const std::optional<StringRefNull> type_str = io_attribute->lookup_str("type"); const std::optional<StringRefNull> type_str = io_attribute->lookup_str("type");
auto io_data = io_attribute->lookup_dict("data"); const auto *io_data = io_attribute->lookup_dict("data");
if (!name || !domain_str || !type_str || !io_data) { if (!name || !domain_str || !type_str || !io_data) {
return false; return false;
} }
@ -479,7 +479,7 @@ static Curves *try_load_curves(const DictionaryValue &io_geometry,
}; };
if (curves.curves_num() > 0) { if (curves.curves_num() > 0) {
const auto io_curve_offsets = io_curves->lookup_dict("curve_offsets"); const auto *io_curve_offsets = io_curves->lookup_dict("curve_offsets");
if (!io_curve_offsets) { if (!io_curve_offsets) {
return cancel(); return cancel();
} }
@ -534,7 +534,7 @@ static Mesh *try_load_mesh(const DictionaryValue &io_geometry,
}; };
if (mesh->faces_num > 0) { if (mesh->faces_num > 0) {
const auto io_poly_offsets = io_mesh->lookup_dict("poly_offsets"); const auto *io_poly_offsets = io_mesh->lookup_dict("poly_offsets");
if (!io_poly_offsets) { if (!io_poly_offsets) {
return cancel(); return cancel();
} }
@ -594,7 +594,7 @@ static std::unique_ptr<Instances> try_load_instances(const DictionaryValue &io_g
instances->add_reference(std::move(reference_geometry)); instances->add_reference(std::move(reference_geometry));
} }
const auto io_transforms = io_instances->lookup_dict("transforms"); const auto *io_transforms = io_instances->lookup_dict("transforms");
if (!io_transforms) { if (!io_transforms) {
return {}; return {};
} }
@ -602,7 +602,7 @@ static std::unique_ptr<Instances> try_load_instances(const DictionaryValue &io_g
return {}; return {};
} }
const auto io_handles = io_instances->lookup_dict("handles"); const auto *io_handles = io_instances->lookup_dict("handles");
if (!io_handles) { if (!io_handles) {
return {}; return {};
} }
@ -1031,9 +1031,7 @@ static std::unique_ptr<BakeItem> deserialize_bake_item(const DictionaryValue &io
const io::serialize::StringValue &io_string = *io_data->get()->as_string_value(); const io::serialize::StringValue &io_string = *io_data->get()->as_string_value();
return std::make_unique<StringBakeItem>(io_string.value()); return std::make_unique<StringBakeItem>(io_string.value());
} }
else if (const io::serialize::DictionaryValue *io_string = if (const io::serialize::DictionaryValue *io_string = io_data->get()->as_dictionary_value()) {
io_data->get()->as_dictionary_value())
{
const std::optional<int64_t> size = io_string->lookup_int("size"); const std::optional<int64_t> size = io_string->lookup_int("size");
if (!size) { if (!size) {
return {}; return {};

View File

@ -269,11 +269,11 @@ static void data_transfer_mesh_attributes_transfer_active_color_string(
{ {
return; return;
} }
else if ((data_type == CD_PROP_BYTE_COLOR) && if ((data_type == CD_PROP_BYTE_COLOR) &&
!BKE_id_attribute_search(&const_cast<ID &>(mesh_src->id), !BKE_id_attribute_search(&const_cast<ID &>(mesh_src->id),
active_color_src, active_color_src,
CD_MASK_PROP_BYTE_COLOR, CD_MASK_PROP_BYTE_COLOR,
ATTR_DOMAIN_MASK_COLOR)) ATTR_DOMAIN_MASK_COLOR))
{ {
return; return;
} }
@ -320,11 +320,11 @@ static void data_transfer_mesh_attributes_transfer_default_color_string(
{ {
return; return;
} }
else if ((data_type == CD_PROP_BYTE_COLOR) && if ((data_type == CD_PROP_BYTE_COLOR) &&
!BKE_id_attribute_search(&const_cast<ID &>(mesh_src->id), !BKE_id_attribute_search(&const_cast<ID &>(mesh_src->id),
default_color_src, default_color_src,
CD_MASK_PROP_BYTE_COLOR, CD_MASK_PROP_BYTE_COLOR,
ATTR_DOMAIN_MASK_COLOR)) ATTR_DOMAIN_MASK_COLOR))
{ {
return; return;
} }

View File

@ -157,7 +157,7 @@ void BKE_editmesh_loop_tangent_calc(BMEditMesh *em,
const char (*tangent_names)[MAX_CUSTOMDATA_LAYER_NAME], const char (*tangent_names)[MAX_CUSTOMDATA_LAYER_NAME],
int tangent_names_len, int tangent_names_len,
const float (*face_normals)[3], const float (*face_normals)[3],
const float (*loop_normals)[3], const float (*corner_normals)[3],
const float (*vert_orco)[3], const float (*vert_orco)[3],
/* result */ /* result */
CustomData *loopdata_out, CustomData *loopdata_out,
@ -257,7 +257,7 @@ void BKE_editmesh_loop_tangent_calc(BMEditMesh *em,
mesh2tangent->precomputedFaceNormals = face_normals; mesh2tangent->precomputedFaceNormals = face_normals;
/* NOTE: we assume we do have tessellated loop normals at this point /* NOTE: we assume we do have tessellated loop normals at this point
* (in case it is object-enabled), have to check this is valid. */ * (in case it is object-enabled), have to check this is valid. */
mesh2tangent->precomputedLoopNormals = loop_normals; mesh2tangent->precomputedLoopNormals = corner_normals;
mesh2tangent->cd_loop_uv_offset = CustomData_get_n_offset(&bm->ldata, CD_PROP_FLOAT2, n); mesh2tangent->cd_loop_uv_offset = CustomData_get_n_offset(&bm->ldata, CD_PROP_FLOAT2, n);
/* needed for indexing loop-tangents */ /* needed for indexing loop-tangents */

View File

@ -174,9 +174,8 @@ std::optional<AttributeAccessor> GeometryFieldContext::attributes() const
if (domain_ == AttrDomain::Layer) { if (domain_ == AttrDomain::Layer) {
return grease_pencil->attributes(); return grease_pencil->attributes();
} }
else if (const greasepencil::Drawing *drawing = if (const greasepencil::Drawing *drawing = greasepencil::get_eval_grease_pencil_layer_drawing(
greasepencil::get_eval_grease_pencil_layer_drawing(*grease_pencil, *grease_pencil, grease_pencil_layer_index_))
grease_pencil_layer_index_))
{ {
return drawing->strokes().attributes(); return drawing->strokes().attributes();
} }
@ -380,7 +379,7 @@ GVArray AttributeFieldInput::get_varray_for_context(const GeometryFieldContext &
if (domain == AttrDomain::Layer) { if (domain == AttrDomain::Layer) {
return *layer_attributes.lookup(name_, data_type); return *layer_attributes.lookup(name_, data_type);
} }
else if (ELEM(domain, AttrDomain::Point, AttrDomain::Curve)) { if (ELEM(domain, AttrDomain::Point, AttrDomain::Curve)) {
const int layer_index = context.grease_pencil_layer_index(); const int layer_index = context.grease_pencil_layer_index();
const AttributeAccessor curves_attributes = *context.attributes(); const AttributeAccessor curves_attributes = *context.attributes();
if (const GAttributeReader reader = curves_attributes.lookup(name_, domain, data_type)) { if (const GAttributeReader reader = curves_attributes.lookup(name_, domain, data_type)) {

View File

@ -305,8 +305,9 @@ Drawing::~Drawing()
Span<uint3> Drawing::triangles() const Span<uint3> Drawing::triangles() const
{ {
const char *func = __func__;
this->runtime->triangles_cache.ensure([&](Vector<uint3> &r_data) { this->runtime->triangles_cache.ensure([&](Vector<uint3> &r_data) {
MemArena *pf_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__); MemArena *pf_arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, func);
const CurvesGeometry &curves = this->strokes(); const CurvesGeometry &curves = this->strokes();
const Span<float3> positions = curves.positions(); const Span<float3> positions = curves.positions();
@ -479,7 +480,7 @@ DrawingReference::DrawingReference(const DrawingReference &other)
this->id_reference = other.id_reference; this->id_reference = other.id_reference;
} }
DrawingReference::~DrawingReference() {} DrawingReference::~DrawingReference() = default;
const Drawing *get_eval_grease_pencil_layer_drawing(const GreasePencil &grease_pencil, const Drawing *get_eval_grease_pencil_layer_drawing(const GreasePencil &grease_pencil,
const int layer_index) const int layer_index)
@ -709,23 +710,24 @@ Layer::SortedKeysIterator Layer::remove_leading_null_frames_in_range(
return next_it; return next_it;
} }
GreasePencilFrame *Layer::add_frame_internal(const FramesMapKey key, const int drawing_index) GreasePencilFrame *Layer::add_frame_internal(const FramesMapKey frame_number,
const int drawing_index)
{ {
BLI_assert(drawing_index != -1); BLI_assert(drawing_index != -1);
if (!this->frames().contains(key)) { if (!this->frames().contains(frame_number)) {
GreasePencilFrame frame{}; GreasePencilFrame frame{};
frame.drawing_index = drawing_index; frame.drawing_index = drawing_index;
this->frames_for_write().add_new(key, frame); this->frames_for_write().add_new(frame_number, frame);
this->tag_frames_map_keys_changed(); this->tag_frames_map_keys_changed();
return this->frames_for_write().lookup_ptr(key); return this->frames_for_write().lookup_ptr(frame_number);
} }
/* Overwrite null-frames. */ /* Overwrite null-frames. */
if (this->frames().lookup(key).is_null()) { if (this->frames().lookup(frame_number).is_null()) {
GreasePencilFrame frame{}; GreasePencilFrame frame{};
frame.drawing_index = drawing_index; frame.drawing_index = drawing_index;
this->frames_for_write().add_overwrite(key, frame); this->frames_for_write().add_overwrite(frame_number, frame);
this->tag_frames_map_changed(); this->tag_frames_map_changed();
return this->frames_for_write().lookup_ptr(key); return this->frames_for_write().lookup_ptr(frame_number);
} }
return nullptr; return nullptr;
} }
@ -2232,9 +2234,9 @@ blender::IndexMask GreasePencil::layer_selection_by_name(const blender::StringRe
if (node->is_layer()) { if (node->is_layer()) {
const int index = *this->get_layer_index(node->as_layer()); const int index = *this->get_layer_index(node->as_layer());
return blender::IndexMask::from_indices(Span{index}, memory); return blender::IndexMask::from_indices(blender::Span<int>{index}, memory);
} }
else if (node->is_group()) { if (node->is_group()) {
blender::Vector<int64_t> layer_indices; blender::Vector<int64_t> layer_indices;
for (const int64_t layer_index : this->layers().index_range()) { for (const int64_t layer_index : this->layers().index_range()) {
const Layer &layer = *this->layers()[layer_index]; const Layer &layer = *this->layers()[layer_index];
@ -2344,7 +2346,7 @@ static void read_drawing_array(GreasePencil &grease_pencil, BlendDataReader *rea
for (int i = 0; i < grease_pencil.drawing_array_num; i++) { for (int i = 0; i < grease_pencil.drawing_array_num; i++) {
BLO_read_data_address(reader, &grease_pencil.drawing_array[i]); BLO_read_data_address(reader, &grease_pencil.drawing_array[i]);
GreasePencilDrawingBase *drawing_base = grease_pencil.drawing_array[i]; GreasePencilDrawingBase *drawing_base = grease_pencil.drawing_array[i];
switch (drawing_base->type) { switch (GreasePencilDrawingType(drawing_base->type)) {
case GP_DRAWING: { case GP_DRAWING: {
GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base); GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base);
drawing->wrap().strokes_for_write().blend_read(*reader); drawing->wrap().strokes_for_write().blend_read(*reader);
@ -2368,7 +2370,7 @@ static void write_drawing_array(GreasePencil &grease_pencil, BlendWriter *writer
BLO_write_pointer_array(writer, grease_pencil.drawing_array_num, grease_pencil.drawing_array); BLO_write_pointer_array(writer, grease_pencil.drawing_array_num, grease_pencil.drawing_array);
for (int i = 0; i < grease_pencil.drawing_array_num; i++) { for (int i = 0; i < grease_pencil.drawing_array_num; i++) {
GreasePencilDrawingBase *drawing_base = grease_pencil.drawing_array[i]; GreasePencilDrawingBase *drawing_base = grease_pencil.drawing_array[i];
switch (drawing_base->type) { switch (GreasePencilDrawingType(drawing_base->type)) {
case GP_DRAWING: { case GP_DRAWING: {
GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base); GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base);
bke::CurvesGeometry::BlendWriteData write_data = bke::CurvesGeometry::BlendWriteData write_data =
@ -2394,7 +2396,7 @@ static void free_drawing_array(GreasePencil &grease_pencil)
} }
for (int i = 0; i < grease_pencil.drawing_array_num; i++) { for (int i = 0; i < grease_pencil.drawing_array_num; i++) {
GreasePencilDrawingBase *drawing_base = grease_pencil.drawing_array[i]; GreasePencilDrawingBase *drawing_base = grease_pencil.drawing_array[i];
switch (drawing_base->type) { switch (GreasePencilDrawingType(drawing_base->type)) {
case GP_DRAWING: { case GP_DRAWING: {
GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base); GreasePencilDrawing *drawing = reinterpret_cast<GreasePencilDrawing *>(drawing_base);
MEM_delete(&drawing->wrap()); MEM_delete(&drawing->wrap());

View File

@ -2752,7 +2752,7 @@ static void lib_override_resync_tagging_finalize_recurse(Main *bmain,
BLI_assert(is_in_partial_resync_hierarchy); BLI_assert(is_in_partial_resync_hierarchy);
return; return;
} }
else if (!is_in_partial_resync_hierarchy) { if (!is_in_partial_resync_hierarchy) {
/* This ID is not tagged for resync, and is part of a loop where none of the other IDs are /* This ID is not tagged for resync, and is part of a loop where none of the other IDs are
* tagged for resync, nothing else to do. */ * tagged for resync, nothing else to do. */
return; return;
@ -2795,7 +2795,7 @@ static void lib_override_resync_tagging_finalize_recurse(Main *bmain,
} }
/* Else, if it is not being processed as part of a resync hierarchy, nothing more to do either, /* Else, if it is not being processed as part of a resync hierarchy, nothing more to do either,
* its current status and the one of its whole dependency tree is also assumed valid. */ * its current status and the one of its whole dependency tree is also assumed valid. */
else if (!is_in_partial_resync_hierarchy) { if (!is_in_partial_resync_hierarchy) {
return; return;
} }
@ -3619,13 +3619,11 @@ void BKE_lib_override_library_main_resync(Main *bmain,
level_reprocess_count); level_reprocess_count);
break; break;
} }
else { CLOG_INFO(&LOG_RESYNC,
CLOG_INFO(&LOG_RESYNC, 4,
4, "Applying reprocess %d for resyncing at library level %d",
"Applying reprocess %d for resyncing at library level %d", level_reprocess_count,
level_reprocess_count, library_indirect_level);
library_indirect_level);
}
} }
library_indirect_level--; library_indirect_level--;
} }

View File

@ -710,7 +710,7 @@ static bool lib_query_unused_ids_tag_recurse(Main *bmain,
if ((id_relations->tags & MAINIDRELATIONS_ENTRY_TAGS_PROCESSED) != 0) { if ((id_relations->tags & MAINIDRELATIONS_ENTRY_TAGS_PROCESSED) != 0) {
return false; return false;
} }
else if ((id_relations->tags & MAINIDRELATIONS_ENTRY_TAGS_INPROGRESS) != 0) { if ((id_relations->tags & MAINIDRELATIONS_ENTRY_TAGS_INPROGRESS) != 0) {
/* This ID has not yet been fully processed. If this condition is reached, it means this is a /* This ID has not yet been fully processed. If this condition is reached, it means this is a
* dependency loop case. */ * dependency loop case. */
return true; return true;

View File

@ -756,7 +756,7 @@ Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
const int edges_num, const int edges_num,
const int tessface_num, const int tessface_num,
const int faces_num, const int faces_num,
const int loops_num, const int corners_num,
const CustomData_MeshMasks mask) const CustomData_MeshMasks mask)
{ {
/* Only do tessface if we are creating tessfaces or copying from mesh with only tessfaces. */ /* Only do tessface if we are creating tessfaces or copying from mesh with only tessfaces. */
@ -770,7 +770,7 @@ Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
me_dst->verts_num = verts_num; me_dst->verts_num = verts_num;
me_dst->edges_num = edges_num; me_dst->edges_num = edges_num;
me_dst->faces_num = faces_num; me_dst->faces_num = faces_num;
me_dst->corners_num = loops_num; me_dst->corners_num = corners_num;
me_dst->totface_legacy = tessface_num; me_dst->totface_legacy = tessface_num;
BKE_mesh_copy_parameters_for_eval(me_dst, me_src); BKE_mesh_copy_parameters_for_eval(me_dst, me_src);
@ -782,7 +782,7 @@ Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
CustomData_copy_layout( CustomData_copy_layout(
&me_src->face_data, &me_dst->face_data, mask.pmask, CD_SET_DEFAULT, faces_num); &me_src->face_data, &me_dst->face_data, mask.pmask, CD_SET_DEFAULT, faces_num);
CustomData_copy_layout( CustomData_copy_layout(
&me_src->corner_data, &me_dst->corner_data, mask.lmask, CD_SET_DEFAULT, loops_num); &me_src->corner_data, &me_dst->corner_data, mask.lmask, CD_SET_DEFAULT, corners_num);
if (do_tessface) { if (do_tessface) {
CustomData_copy_layout( CustomData_copy_layout(
&me_src->fdata_legacy, &me_dst->fdata_legacy, mask.fmask, CD_SET_DEFAULT, tessface_num); &me_src->fdata_legacy, &me_dst->fdata_legacy, mask.fmask, CD_SET_DEFAULT, tessface_num);
@ -806,10 +806,10 @@ Mesh *BKE_mesh_new_nomain_from_template(const Mesh *me_src,
const int verts_num, const int verts_num,
const int edges_num, const int edges_num,
const int faces_num, const int faces_num,
const int loops_num) const int corners_num)
{ {
return BKE_mesh_new_nomain_from_template_ex( return BKE_mesh_new_nomain_from_template_ex(
me_src, verts_num, edges_num, 0, faces_num, loops_num, CD_MASK_EVERYTHING); me_src, verts_num, edges_num, 0, faces_num, corners_num, CD_MASK_EVERYTHING);
} }
void BKE_mesh_eval_delete(Mesh *mesh_eval) void BKE_mesh_eval_delete(Mesh *mesh_eval)

View File

@ -192,7 +192,7 @@ void BKE_mesh_vert_corner_tri_map_create(MeshElemMap **r_map,
const blender::int3 *corner_tris, const blender::int3 *corner_tris,
const int tris_num, const int tris_num,
const int *corner_verts, const int *corner_verts,
const int /*totloop*/) const int /*corners_num*/)
{ {
MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totvert), __func__); MeshElemMap *map = MEM_cnew_array<MeshElemMap>(size_t(totvert), __func__);
int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(tris_num) * 3, __func__)); int *indices = static_cast<int *>(MEM_mallocN(sizeof(int) * size_t(tris_num) * 3, __func__));
@ -407,9 +407,9 @@ GroupedSpan<int> build_vert_to_edge_map(const Span<int2> edges,
void build_vert_to_face_indices(const OffsetIndices<int> faces, void build_vert_to_face_indices(const OffsetIndices<int> faces,
const Span<int> corner_verts, const Span<int> corner_verts,
const OffsetIndices<int> offsets, const OffsetIndices<int> offsets,
MutableSpan<int> r_indices) MutableSpan<int> face_indices)
{ {
reverse_group_indices_in_groups(faces, corner_verts, offsets, r_indices); reverse_group_indices_in_groups(faces, corner_verts, offsets, face_indices);
} }
GroupedSpan<int> build_vert_to_face_map(const OffsetIndices<int> faces, GroupedSpan<int> build_vert_to_face_map(const OffsetIndices<int> faces,
@ -822,7 +822,7 @@ static bool mesh_calc_islands_loop_face_uv(const int totedge,
const blender::OffsetIndices<int> faces, const blender::OffsetIndices<int> faces,
const int *corner_verts, const int *corner_verts,
const int *corner_edges, const int *corner_edges,
const int totloop, const int corners_num,
const float (*luvs)[2], const float (*luvs)[2],
MeshIslandStore *r_island_store) MeshIslandStore *r_island_store)
{ {
@ -847,19 +847,19 @@ static bool mesh_calc_islands_loop_face_uv(const int totedge,
BKE_mesh_loop_islands_clear(r_island_store); BKE_mesh_loop_islands_clear(r_island_store);
BKE_mesh_loop_islands_init( BKE_mesh_loop_islands_init(
r_island_store, MISLAND_TYPE_LOOP, totloop, MISLAND_TYPE_POLY, MISLAND_TYPE_EDGE); r_island_store, MISLAND_TYPE_LOOP, corners_num, MISLAND_TYPE_POLY, MISLAND_TYPE_EDGE);
Array<int> edge_to_face_offsets; Array<int> edge_to_face_offsets;
Array<int> edge_to_face_indices; Array<int> edge_to_face_indices;
const GroupedSpan<int> edge_to_face_map = bke::mesh::build_edge_to_face_map( const GroupedSpan<int> edge_to_face_map = bke::mesh::build_edge_to_face_map(
faces, {corner_edges, totloop}, totedge, edge_to_face_offsets, edge_to_face_indices); faces, {corner_edges, corners_num}, totedge, edge_to_face_offsets, edge_to_face_indices);
Array<int> edge_to_loop_offsets; Array<int> edge_to_loop_offsets;
Array<int> edge_to_loop_indices; Array<int> edge_to_loop_indices;
GroupedSpan<int> edge_to_loop_map; GroupedSpan<int> edge_to_loop_map;
if (luvs) { if (luvs) {
edge_to_loop_map = bke::mesh::build_edge_to_corner_map( edge_to_loop_map = bke::mesh::build_edge_to_corner_map(
{corner_edges, totloop}, totedge, edge_to_loop_offsets, edge_to_loop_indices); {corner_edges, corners_num}, totedge, edge_to_loop_offsets, edge_to_loop_indices);
} }
/* TODO: I'm not sure edge seam flag is enough to define UV islands? /* TODO: I'm not sure edge seam flag is enough to define UV islands?
@ -909,7 +909,7 @@ static bool mesh_calc_islands_loop_face_uv(const int totedge,
face_edge_loop_islands_calc(totedge, face_edge_loop_islands_calc(totedge,
faces, faces,
{corner_edges, totloop}, {corner_edges, corners_num},
edge_to_face_map, edge_to_face_map,
false, false,
mesh_check_island_boundary_uv, mesh_check_island_boundary_uv,
@ -935,7 +935,7 @@ static bool mesh_calc_islands_loop_face_uv(const int totedge,
face_indices = static_cast<int *>( face_indices = static_cast<int *>(
MEM_mallocN(sizeof(*face_indices) * size_t(faces.size()), __func__)); MEM_mallocN(sizeof(*face_indices) * size_t(faces.size()), __func__));
loop_indices = static_cast<int *>( loop_indices = static_cast<int *>(
MEM_mallocN(sizeof(*loop_indices) * size_t(totloop), __func__)); MEM_mallocN(sizeof(*loop_indices) * size_t(corners_num), __func__));
/* NOTE: here we ignore '0' invalid group - this should *never* happen in this case anyway? */ /* NOTE: here we ignore '0' invalid group - this should *never* happen in this case anyway? */
for (grp_idx = 1; grp_idx <= num_face_groups; grp_idx++) { for (grp_idx = 1; grp_idx <= num_face_groups; grp_idx++) {
@ -996,12 +996,12 @@ bool BKE_mesh_calc_islands_loop_face_edgeseam(const float (*vert_positions)[3],
const blender::OffsetIndices<int> faces, const blender::OffsetIndices<int> faces,
const int *corner_verts, const int *corner_verts,
const int *corner_edges, const int *corner_edges,
const int totloop, const int corners_num,
MeshIslandStore *r_island_store) MeshIslandStore *r_island_store)
{ {
UNUSED_VARS(vert_positions, totvert, edges); UNUSED_VARS(vert_positions, totvert, edges);
return mesh_calc_islands_loop_face_uv( return mesh_calc_islands_loop_face_uv(
totedge, uv_seams, faces, corner_verts, corner_edges, totloop, nullptr, r_island_store); totedge, uv_seams, faces, corner_verts, corner_edges, corners_num, nullptr, r_island_store);
} }
bool BKE_mesh_calc_islands_loop_face_uvmap(float (*vert_positions)[3], bool BKE_mesh_calc_islands_loop_face_uvmap(float (*vert_positions)[3],
@ -1012,14 +1012,14 @@ bool BKE_mesh_calc_islands_loop_face_uvmap(float (*vert_positions)[3],
const blender::OffsetIndices<int> faces, const blender::OffsetIndices<int> faces,
const int *corner_verts, const int *corner_verts,
const int *corner_edges, const int *corner_edges,
const int totloop, const int corners_num,
const float (*luvs)[2], const float (*luvs)[2],
MeshIslandStore *r_island_store) MeshIslandStore *r_island_store)
{ {
UNUSED_VARS(vert_positions, totvert, edges); UNUSED_VARS(vert_positions, totvert, edges);
BLI_assert(luvs != nullptr); BLI_assert(luvs != nullptr);
return mesh_calc_islands_loop_face_uv( return mesh_calc_islands_loop_face_uv(
totedge, uv_seams, faces, corner_verts, corner_edges, totloop, luvs, r_island_store); totedge, uv_seams, faces, corner_verts, corner_edges, corners_num, luvs, r_island_store);
} }
/** \} */ /** \} */

View File

@ -62,7 +62,7 @@ static void free_batch_cache(MeshRuntime &mesh_runtime)
} }
} }
MeshRuntime::MeshRuntime() {} MeshRuntime::MeshRuntime() = default;
MeshRuntime::~MeshRuntime() MeshRuntime::~MeshRuntime()
{ {

View File

@ -200,7 +200,7 @@ static void sample_nearest_weights(const Span<float3> vert_positions,
int sample_surface_points_spherical(RandomNumberGenerator &rng, int sample_surface_points_spherical(RandomNumberGenerator &rng,
const Mesh &mesh, const Mesh &mesh,
const Span<int> tri_indices_to_sample, const Span<int> tris_to_sample,
const float3 &sample_pos, const float3 &sample_pos,
const float sample_radius, const float sample_radius,
const float approximate_density, const float approximate_density,
@ -219,7 +219,7 @@ int sample_surface_points_spherical(RandomNumberGenerator &rng,
const int old_num = r_bary_coords.size(); const int old_num = r_bary_coords.size();
for (const int tri_index : tri_indices_to_sample) { for (const int tri_index : tris_to_sample) {
const int3 &tri = corner_tris[tri_index]; const int3 &tri = corner_tris[tri_index];
const float3 &v0 = positions[corner_verts[tri[0]]]; const float3 &v0 = positions[corner_verts[tri[0]]];

View File

@ -221,7 +221,7 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
int *corner_verts, int *corner_verts,
int *corner_edges, int *corner_edges,
uint corners_num, uint corners_num,
int *face_offsets, const int *face_offsets,
uint faces_num, uint faces_num,
MDeformVert *dverts, /* assume verts_num length */ MDeformVert *dverts, /* assume verts_num length */
const bool do_verbose, const bool do_verbose,

View File

@ -166,7 +166,7 @@ class bNodeTreeToDotOptionsForAnonymousAttributeInferencing : public bNodeTreeTo
{ {
} }
std::string socket_name(const bNodeSocket &socket) const std::string socket_name(const bNodeSocket &socket) const override
{ {
if (socket.type == SOCK_GEOMETRY) { if (socket.type == SOCK_GEOMETRY) {
std::stringstream ss; std::stringstream ss;
@ -180,7 +180,7 @@ class bNodeTreeToDotOptionsForAnonymousAttributeInferencing : public bNodeTreeTo
ss << "]"; ss << "]";
return ss.str(); return ss.str();
} }
else if (nodes::socket_type_supports_fields(eNodeSocketDatatype(socket.type))) { if (nodes::socket_type_supports_fields(eNodeSocketDatatype(socket.type))) {
std::stringstream ss; std::stringstream ss;
ss << socket.identifier << " ["; ss << socket.identifier << " [";
bits::foreach_1_index(result_.propagated_fields_by_socket[socket.index_in_tree()], bits::foreach_1_index(result_.propagated_fields_by_socket[socket.index_in_tree()],
@ -699,7 +699,7 @@ bool update_anonymous_attribute_relations(bNodeTree &tree)
tree.ensure_topology_cache(); tree.ensure_topology_cache();
if (tree.has_available_link_cycle()) { if (tree.has_available_link_cycle()) {
const bool changed = tree.runtime->anonymous_attribute_inferencing.get() != nullptr; const bool changed = bool(tree.runtime->anonymous_attribute_inferencing);
tree.runtime->anonymous_attribute_inferencing.reset(); tree.runtime->anonymous_attribute_inferencing.reset();
return changed; return changed;
} }

View File

@ -45,7 +45,7 @@ typedef struct BoxPack {
* \param r_tot_x, r_tot_y: set so you can normalize the data. * \param r_tot_x, r_tot_y: set so you can normalize the data.
*/ */
void BLI_box_pack_2d( void BLI_box_pack_2d(
BoxPack *box_array, unsigned int len, bool sort_boxes, float *r_tot_x, float *r_tot_y); BoxPack *boxarray, unsigned int len, bool sort_boxes, float *r_tot_x, float *r_tot_y);
typedef struct FixedSizeBoxPack { typedef struct FixedSizeBoxPack {
struct FixedSizeBoxPack *next, *prev; struct FixedSizeBoxPack *next, *prev;

View File

@ -128,7 +128,10 @@ float volume_tri_tetrahedron_signed_v3(const float v1[3], const float v2[3], con
* (depends on face winding) * (depends on face winding)
* Copied from BM_edge_is_convex(). * Copied from BM_edge_is_convex().
*/ */
bool is_edge_convex_v3(const float v1[3], const float v2[3], const float v3[3], const float v4[3]); bool is_edge_convex_v3(const float v1[3],
const float v2[3],
const float f1_no[3],
const float f2_no[3]);
/** /**
* Evaluate if entire quad is a proper convex quad * Evaluate if entire quad is a proper convex quad
*/ */
@ -759,7 +762,7 @@ bool isect_ray_tri_watertight_v3(const float ray_origin[3],
const float v0[3], const float v0[3],
const float v1[3], const float v1[3],
const float v2[3], const float v2[3],
float *r_dist, float *r_lambda,
float r_uv[2]); float r_uv[2]);
/** /**
* Slower version which calculates #IsectRayPrecalc each time. * Slower version which calculates #IsectRayPrecalc each time.

View File

@ -39,9 +39,9 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2);
* Empty the pool, as if it were just created. * Empty the pool, as if it were just created.
* *
* \param pool: The pool to clear. * \param pool: The pool to clear.
* \param totelem_reserve: Optionally reserve how many items should be kept from clearing. * \param elem_num_reserve: Optionally reserve how many items should be kept from clearing.
*/ */
void BLI_mempool_clear_ex(BLI_mempool *pool, int totelem_reserve) ATTR_NONNULL(1); void BLI_mempool_clear_ex(BLI_mempool *pool, int elem_num_reserve) ATTR_NONNULL(1);
/** /**
* Wrap #BLI_mempool_clear_ex with no reserve set. * Wrap #BLI_mempool_clear_ex with no reserve set.
*/ */

View File

@ -177,7 +177,7 @@ void build_reverse_map(OffsetIndices<int> offsets, MutableSpan<int> r_map);
/** /**
* Build offsets to group the elements of \a indices pointing to the same index. * Build offsets to group the elements of \a indices pointing to the same index.
*/ */
void build_reverse_offsets(Span<int> indices, MutableSpan<int> r_map); void build_reverse_offsets(Span<int> indices, MutableSpan<int> offsets);
} // namespace blender::offset_indices } // namespace blender::offset_indices

View File

@ -807,10 +807,8 @@ void *mempool_iter_threadsafe_step(BLI_mempool_threadsafe_iter *ts_iter)
mempool_asan_unlock(iter->pool); mempool_asan_unlock(iter->pool);
return NULL; return NULL;
} }
else { mempool_asan_unlock(iter->pool);
mempool_asan_unlock(iter->pool); return ret;
return ret;
}
} }
/* End `threadsafe` exception. */ /* End `threadsafe` exception. */
@ -824,10 +822,8 @@ void *mempool_iter_threadsafe_step(BLI_mempool_threadsafe_iter *ts_iter)
mempool_asan_unlock(iter->pool); mempool_asan_unlock(iter->pool);
return NULL; return NULL;
} }
else { mempool_asan_unlock(iter->pool);
mempool_asan_unlock(iter->pool); return ret;
return ret;
}
} }
curnode = CHUNK_DATA(iter->curchunk); curnode = CHUNK_DATA(iter->curchunk);

View File

@ -102,6 +102,8 @@
/* Only for #BLI_array_store_is_valid. */ /* Only for #BLI_array_store_is_valid. */
#include "BLI_ghash.h" #include "BLI_ghash.h"
struct BChunkList;
/* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */
/** \name Defines /** \name Defines
* *
@ -236,9 +238,9 @@
/** \name Internal Structs /** \name Internal Structs
* \{ */ * \{ */
typedef uint32_t hash_key; using hash_key = uint32_t;
typedef struct BArrayInfo { struct BArrayInfo {
size_t chunk_stride; size_t chunk_stride;
// uint chunk_count; /* UNUSED (other values are derived from this) */ // uint chunk_count; /* UNUSED (other values are derived from this) */
@ -256,13 +258,13 @@ typedef struct BArrayInfo {
size_t accum_steps; size_t accum_steps;
size_t accum_read_ahead_len; size_t accum_read_ahead_len;
#endif #endif
} BArrayInfo; };
typedef struct BArrayMemory { struct BArrayMemory {
BLI_mempool *chunk_list; /* #BChunkList. */ BLI_mempool *chunk_list; /* #BChunkList. */
BLI_mempool *chunk_ref; /* #BChunkRef. */ BLI_mempool *chunk_ref; /* #BChunkRef. */
BLI_mempool *chunk; /* #BChunk. */ BLI_mempool *chunk; /* #BChunk. */
} BArrayMemory; };
/** /**
* Main storage for all states. * Main storage for all states.
@ -294,10 +296,10 @@ struct BArrayState {
/** linked list in #BArrayStore.states. */ /** linked list in #BArrayStore.states. */
BArrayState *next, *prev; BArrayState *next, *prev;
/** Shared chunk list, this reference must hold a #BChunkList::users. */ /** Shared chunk list, this reference must hold a #BChunkList::users. */
struct BChunkList *chunk_list; BChunkList *chunk_list;
}; };
typedef struct BChunkList { struct BChunkList {
/** List of #BChunkRef's. */ /** List of #BChunkRef's. */
ListBase chunk_refs; ListBase chunk_refs;
/** Result of `BLI_listbase_count(chunks)`, store for reuse. */ /** Result of `BLI_listbase_count(chunks)`, store for reuse. */
@ -307,10 +309,10 @@ typedef struct BChunkList {
/** Number of #BArrayState using this. */ /** Number of #BArrayState using this. */
int users; int users;
} BChunkList; };
/** A chunk of memory in an array (unit of de-duplication). */ /** A chunk of memory in an array (unit of de-duplication). */
typedef struct BChunk { struct BChunk {
const uchar *data; const uchar *data;
size_t data_len; size_t data_len;
/** number of #BChunkList using this. */ /** number of #BChunkList using this. */
@ -319,15 +321,15 @@ typedef struct BChunk {
#ifdef USE_HASH_TABLE_KEY_CACHE #ifdef USE_HASH_TABLE_KEY_CACHE
hash_key key; hash_key key;
#endif #endif
} BChunk; };
/** /**
* Links to store #BChunk data in #BChunkList.chunk_refs. * Links to store #BChunk data in #BChunkList.chunk_refs.
*/ */
typedef struct BChunkRef { struct BChunkRef {
BChunkRef *next, *prev; BChunkRef *next, *prev;
BChunk *link; BChunk *link;
} BChunkRef; };
/** /**
* Single linked list used when putting chunks into a temporary table, * Single linked list used when putting chunks into a temporary table,
@ -337,10 +339,10 @@ typedef struct BChunkRef {
* to allow talking down the chunks in-order until a mismatch is found, * to allow talking down the chunks in-order until a mismatch is found,
* this avoids having to do so many table lookups. * this avoids having to do so many table lookups.
*/ */
typedef struct BTableRef { struct BTableRef {
BTableRef *next; BTableRef *next;
const BChunkRef *cref; const BChunkRef *cref;
} BTableRef; };
/** \} */ /** \} */

View File

@ -6,8 +6,8 @@
* \ingroup bli * \ingroup bli
*/ */
#include <math.h> #include <cmath>
#include <string.h> #include <cstring>
#include "BLI_math_base.h" #include "BLI_math_base.h"
#include "BLI_math_interp.hh" #include "BLI_math_interp.hh"

View File

@ -556,9 +556,7 @@ float perlin_fbm(
return normalize ? mix(0.5f * sum / maxamp + 0.5f, 0.5f * sum2 / (maxamp + amp) + 0.5f, rmd) : return normalize ? mix(0.5f * sum / maxamp + 0.5f, 0.5f * sum2 / (maxamp + amp) + 0.5f, rmd) :
mix(sum, sum2, rmd); mix(sum, sum2, rmd);
} }
else { return normalize ? 0.5f * sum / maxamp + 0.5f : sum;
return normalize ? 0.5f * sum / maxamp + 0.5f : sum;
}
} }
/* Explicit instantiation for Wave Texture. */ /* Explicit instantiation for Wave Texture. */
@ -1909,7 +1907,7 @@ VoronoiOutput fractal_voronoi_x_fx(const VoronoiParams &params,
output = octave; output = octave;
break; break;
} }
else if (i <= params.detail) { if (i <= params.detail) {
max_amplitude += amplitude; max_amplitude += amplitude;
output.distance += octave.distance * amplitude; output.distance += octave.distance * amplitude;
output.color += octave.color * amplitude; output.color += octave.color * amplitude;
@ -1960,7 +1958,7 @@ float fractal_voronoi_distance_to_edge(const VoronoiParams &params, const T coor
distance = octave_distance; distance = octave_distance;
break; break;
} }
else if (i <= params.detail) { if (i <= params.detail) {
max_amplitude = mix(max_amplitude, params.max_distance / scale, amplitude); max_amplitude = mix(max_amplitude, params.max_distance / scale, amplitude);
distance = mix(distance, math::min(distance, octave_distance / scale), amplitude); distance = mix(distance, math::min(distance, octave_distance / scale), amplitude);
scale *= params.lacunarity; scale *= params.lacunarity;

View File

@ -882,15 +882,15 @@ bool BLI_path_parent_dir(char *path)
return true; return true;
} }
bool BLI_path_parent_dir_until_exists(char *dir) bool BLI_path_parent_dir_until_exists(char *path)
{ {
bool valid_path = true; bool valid_path = true;
/* Loop as long as cur path is not a dir, and we can get a parent path. */ /* Loop as long as cur path is not a dir, and we can get a parent path. */
while ((BLI_access(dir, R_OK) != 0) && (valid_path = BLI_path_parent_dir(dir))) { while ((BLI_access(path, R_OK) != 0) && (valid_path = BLI_path_parent_dir(path))) {
/* Pass. */ /* Pass. */
} }
return (valid_path && dir[0]); return (valid_path && path[0]);
} }
/** /**

View File

@ -430,9 +430,9 @@ int BLI_stat(const char *path, struct stat *buffer)
} }
#endif #endif
bool BLI_is_dir(const char *file) bool BLI_is_dir(const char *path)
{ {
return S_ISDIR(BLI_exists(file)); return S_ISDIR(BLI_exists(path));
} }
bool BLI_is_file(const char *path) bool BLI_is_file(const char *path)

View File

@ -96,15 +96,15 @@ void BLI_string_replace_char(char *str, char src, char dst)
} }
bool BLI_string_replace_table_exact(char *string, bool BLI_string_replace_table_exact(char *string,
const size_t string_maxncpy, const size_t string_len,
const char *replace_table[][2], const char *replace_table[][2],
int replace_table_len) int replace_table_len)
{ {
BLI_string_debug_size_after_nil(string, string_maxncpy); BLI_string_debug_size_after_nil(string, string_len);
for (int i = 0; i < replace_table_len; i++) { for (int i = 0; i < replace_table_len; i++) {
if (STREQ(string, replace_table[i][0])) { if (STREQ(string, replace_table[i][0])) {
BLI_strncpy(string, replace_table[i][1], string_maxncpy); BLI_strncpy(string, replace_table[i][1], string_len);
return true; return true;
} }
} }

View File

@ -731,17 +731,17 @@ static uiBlock *wm_block_insert_unicode_create(bContext *C, ARegion *region, voi
if (windows_layout) { if (windows_layout) {
confirm = uiDefIconTextBut( confirm = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, 0, "Insert", 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, nullptr); block, UI_BTYPE_BUT, 0, 0, "Insert", 0, 0, 0, UI_UNIT_Y, nullptr, 0, 0, 0, 0, nullptr);
uiLayoutColumn(split, false); uiLayoutColumn(split, false);
} }
cancel = uiDefIconTextBut( cancel = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, 0, "Cancel", 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, nullptr); block, UI_BTYPE_BUT, 0, 0, "Cancel", 0, 0, 0, UI_UNIT_Y, nullptr, 0, 0, 0, 0, nullptr);
if (!windows_layout) { if (!windows_layout) {
uiLayoutColumn(split, false); uiLayoutColumn(split, false);
confirm = uiDefIconTextBut( confirm = uiDefIconTextBut(
block, UI_BTYPE_BUT, 0, 0, "Insert", 0, 0, 0, UI_UNIT_Y, 0, 0, 0, 0, 0, nullptr); block, UI_BTYPE_BUT, 0, 0, "Insert", 0, 0, 0, UI_UNIT_Y, nullptr, 0, 0, 0, 0, nullptr);
} }
UI_block_func_set(block, nullptr, nullptr, nullptr); UI_block_func_set(block, nullptr, nullptr, nullptr);

View File

@ -532,12 +532,12 @@ void ED_mesh_faces_remove(Mesh *mesh, ReportList *reports, int count);
void ED_mesh_geometry_clear(Mesh *mesh); void ED_mesh_geometry_clear(Mesh *mesh);
bool *ED_mesh_uv_map_vert_select_layer_ensure(Mesh *mesh, int uv_map_index); bool *ED_mesh_uv_map_vert_select_layer_ensure(Mesh *mesh, int uv_index);
bool *ED_mesh_uv_map_edge_select_layer_ensure(Mesh *mesh, int uv_map_index); bool *ED_mesh_uv_map_edge_select_layer_ensure(Mesh *mesh, int uv_index);
bool *ED_mesh_uv_map_pin_layer_ensure(Mesh *mesh, int uv_map_index); bool *ED_mesh_uv_map_pin_layer_ensure(Mesh *mesh, int uv_index);
const bool *ED_mesh_uv_map_vert_select_layer_get(const Mesh *mesh, int uv_map_index); const bool *ED_mesh_uv_map_vert_select_layer_get(const Mesh *mesh, int uv_index);
const bool *ED_mesh_uv_map_edge_select_layer_get(const Mesh *mesh, int uv_map_index); const bool *ED_mesh_uv_map_edge_select_layer_get(const Mesh *mesh, int uv_index);
const bool *ED_mesh_uv_map_pin_layer_get(const Mesh *mesh, int uv_map_index); const bool *ED_mesh_uv_map_pin_layer_get(const Mesh *mesh, int uv_index);
void ED_mesh_uv_ensure(Mesh *mesh, const char *name); void ED_mesh_uv_ensure(Mesh *mesh, const char *name);
int ED_mesh_uv_add( int ED_mesh_uv_add(

View File

@ -90,8 +90,8 @@ bool ED_transform_snap_object_project_ray(SnapObjectContext *sctx,
Depsgraph *depsgraph, Depsgraph *depsgraph,
const View3D *v3d, const View3D *v3d,
const SnapObjectParams *params, const SnapObjectParams *params,
const float ray_origin[3], const float ray_start[3],
const float ray_direction[3], const float ray_normal[3],
float *ray_depth, float *ray_depth,
float r_co[3], float r_co[3],
float r_no[3]); float r_no[3]);

View File

@ -96,7 +96,7 @@ void ED_slider_factor_bounds_set(tSlider *slider, float lower_bound, float upper
bool ED_slider_allow_increments_get(tSlider *slider); bool ED_slider_allow_increments_get(tSlider *slider);
void ED_slider_allow_increments_set(tSlider *slider, bool value); void ED_slider_allow_increments_set(tSlider *slider, bool value);
void ED_slider_mode_set(tSlider *slider, SliderMode unit); void ED_slider_mode_set(tSlider *slider, SliderMode mode);
SliderMode ED_slider_mode_get(tSlider *slider); SliderMode ED_slider_mode_get(tSlider *slider);
void ED_slider_unit_set(tSlider *slider, const char *unit); void ED_slider_unit_set(tSlider *slider, const char *unit);

View File

@ -7238,7 +7238,7 @@ static void uiTemplateRecentFiles_tooltip_func(bContext * /*C*/, uiTooltipData *
if (BLI_stat(path, &status) != -1) { if (BLI_stat(path, &status) != -1) {
char date_st[FILELIST_DIRENTRY_DATE_LEN], time_st[FILELIST_DIRENTRY_TIME_LEN]; char date_st[FILELIST_DIRENTRY_DATE_LEN], time_st[FILELIST_DIRENTRY_TIME_LEN];
bool is_today, is_yesterday; bool is_today, is_yesterday;
std::string day_string = (""); std::string day_string;
BLI_filelist_entry_datetime_to_string( BLI_filelist_entry_datetime_to_string(
nullptr, int64_t(status.st_mtime), false, time_st, date_st, &is_today, &is_yesterday); nullptr, int64_t(status.st_mtime), false, time_st, date_st, &is_today, &is_yesterday);
if (is_today || is_yesterday) { if (is_today || is_yesterday) {

View File

@ -14,7 +14,6 @@
#include "DNA_windowmanager_types.h" #include "DNA_windowmanager_types.h"
#ifdef WITH_FREESTYLE #ifdef WITH_FREESTYLE
# include "BKE_customdata.hh"
# include "DNA_meshdata_types.h" # include "DNA_meshdata_types.h"
#endif #endif

View File

@ -3050,9 +3050,9 @@ static std::string vertex_group_lock_description(bContext * /*C*/,
} }
break; break;
default: default:
return nullptr; return {};
} }
return nullptr; return {};
} }
void OBJECT_OT_vertex_group_lock(wmOperatorType *ot) void OBJECT_OT_vertex_group_lock(wmOperatorType *ot)

View File

@ -1317,14 +1317,14 @@ bool ED_region_is_overlap(int spacetype, int regiontype)
bTheme *theme = UI_GetTheme(); bTheme *theme = UI_GetTheme();
return theme->space_view3d.header[3] != 255; return theme->space_view3d.header[3] != 255;
} }
else if (ELEM(regiontype, if (ELEM(regiontype,
RGN_TYPE_TOOLS, RGN_TYPE_TOOLS,
RGN_TYPE_UI, RGN_TYPE_UI,
RGN_TYPE_TOOL_PROPS, RGN_TYPE_TOOL_PROPS,
RGN_TYPE_FOOTER, RGN_TYPE_FOOTER,
RGN_TYPE_TOOL_HEADER, RGN_TYPE_TOOL_HEADER,
RGN_TYPE_ASSET_SHELF, RGN_TYPE_ASSET_SHELF,
RGN_TYPE_ASSET_SHELF_HEADER)) RGN_TYPE_ASSET_SHELF_HEADER))
{ {
return true; return true;
} }

View File

@ -4226,16 +4226,14 @@ static bool project_paint_check_face_paintable(const ProjPaintState *ps,
} }
return ps->select_poly_eval && ps->select_poly_eval[face_i]; return ps->select_poly_eval && ps->select_poly_eval[face_i];
} }
else { int orig_index;
int orig_index; const int face_i = ps->corner_tri_faces_eval[tri_i];
const int face_i = ps->corner_tri_faces_eval[tri_i]; if ((face_lookup->index_mp_to_orig != nullptr) &&
if ((face_lookup->index_mp_to_orig != nullptr) && ((orig_index = (face_lookup->index_mp_to_orig[face_i])) != ORIGINDEX_NONE))
((orig_index = (face_lookup->index_mp_to_orig[face_i])) != ORIGINDEX_NONE)) {
{ return !(face_lookup->hide_poly_orig && face_lookup->hide_poly_orig[orig_index]);
return !(face_lookup->hide_poly_orig && face_lookup->hide_poly_orig[orig_index]);
}
return !(ps->hide_poly_eval && ps->hide_poly_eval[face_i]);
} }
return !(ps->hide_poly_eval && ps->hide_poly_eval[face_i]);
} }
struct ProjPaintFaceCoSS { struct ProjPaintFaceCoSS {

View File

@ -135,7 +135,7 @@ void neighbor_coords_average(SculptSession *ss, float result[3], PBVHVertRef ver
} }
float neighbor_mask_average(SculptSession *ss, float neighbor_mask_average(SculptSession *ss,
const SculptMaskWriteInfo mask_write, const SculptMaskWriteInfo write_info,
PBVHVertRef vertex) PBVHVertRef vertex)
{ {
float avg = 0.0f; float avg = 0.0f;
@ -144,7 +144,7 @@ float neighbor_mask_average(SculptSession *ss,
switch (BKE_pbvh_type(ss->pbvh)) { switch (BKE_pbvh_type(ss->pbvh)) {
case PBVH_FACES: case PBVH_FACES:
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vertex, ni) { SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vertex, ni) {
avg += mask_write.layer[ni.vertex.i]; avg += write_info.layer[ni.vertex.i];
total++; total++;
} }
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);
@ -160,7 +160,7 @@ float neighbor_mask_average(SculptSession *ss,
case PBVH_BMESH: case PBVH_BMESH:
SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vertex, ni) { SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, vertex, ni) {
BMVert *vert = reinterpret_cast<BMVert *>(vertex.i); BMVert *vert = reinterpret_cast<BMVert *>(vertex.i);
avg += BM_ELEM_CD_GET_FLOAT(vert, mask_write.bm_offset); avg += BM_ELEM_CD_GET_FLOAT(vert, write_info.bm_offset);
total++; total++;
} }
SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); SCULPT_VERTEX_NEIGHBORS_ITER_END(ni);

View File

@ -1340,8 +1340,9 @@ static void store_hidden(Object *ob, Node *unode)
PBVHNode *node = static_cast<PBVHNode *>(unode->node); PBVHNode *node = static_cast<PBVHNode *>(unode->node);
const Span<int> verts = BKE_pbvh_node_get_vert_indices(node); const Span<int> verts = BKE_pbvh_node_get_vert_indices(node);
for (const int i : verts.index_range()) for (const int i : verts.index_range()) {
unode->vert_hidden[i].set(hide_vert[verts[i]]); unode->vert_hidden[i].set(hide_vert[verts[i]]);
}
} }
static void store_face_hidden(Object &object, Node &unode) static void store_face_hidden(Object &object, Node &unode)
@ -1354,8 +1355,9 @@ static void store_face_hidden(Object &object, Node &unode)
return; return;
} }
const Span<int> faces = unode.face_indices; const Span<int> faces = unode.face_indices;
for (const int i : faces.index_range()) for (const int i : faces.index_range()) {
unode.face_hidden[i].set(hide_poly[faces[i]]); unode.face_hidden[i].set(hide_poly[faces[i]]);
}
} }
static void store_mask(Object *ob, Node *unode) static void store_mask(Object *ob, Node *unode)

View File

@ -1047,12 +1047,10 @@ static uchar mute_overlap_alpha_factor_get(const ListBase *channels, const Seque
return MUTE_ALPHA; return MUTE_ALPHA;
} }
/* Draw background semi-transparent when overlapping strips. */ /* Draw background semi-transparent when overlapping strips. */
else if (seq->flag & SEQ_OVERLAP) { if (seq->flag & SEQ_OVERLAP) {
return OVERLAP_ALPHA; return OVERLAP_ALPHA;
} }
else { return 255;
return 255;
}
} }
static void draw_strip_color_band(TimelineDrawContext *timeline_ctx, static void draw_strip_color_band(TimelineDrawContext *timeline_ctx,
@ -1115,10 +1113,10 @@ static void draw_strip_background(TimelineDrawContext *timeline_ctx,
} }
} }
typedef enum { enum TransitionType {
STRIP_TRANSITION_IN, STRIP_TRANSITION_IN,
STRIP_TRANSITION_OUT, STRIP_TRANSITION_OUT,
} TransitionType; };
static void draw_seq_transition_strip_half(TimelineDrawContext *timeline_ctx, static void draw_seq_transition_strip_half(TimelineDrawContext *timeline_ctx,
const StripDrawContext *strip_ctx, const StripDrawContext *strip_ctx,

View File

@ -1141,7 +1141,7 @@ bool ED_view3d_navigation_do(bContext *C,
return true; return true;
} }
else if (vod->rv3d->rflag & RV3D_NAVIGATING) { if (vod->rv3d->rflag & RV3D_NAVIGATING) {
/* Add a fake confirmation. */ /* Add a fake confirmation. */
vod->rv3d->rflag &= ~RV3D_NAVIGATING; vod->rv3d->rflag &= ~RV3D_NAVIGATING;
return true; return true;

View File

@ -1044,7 +1044,7 @@ bool ED_view3d_minmax_verts(Object *obedit, float r_min[3], float r_max[3])
} }
return changed; return changed;
} }
else if (obedit->type == OB_CURVES) { if (obedit->type == OB_CURVES) {
const Object &ob_orig = *DEG_get_original_object(obedit); const Object &ob_orig = *DEG_get_original_object(obedit);
const Curves &curves_id = *static_cast<const Curves *>(ob_orig.data); const Curves &curves_id = *static_cast<const Curves *>(ob_orig.data);
const bke::CurvesGeometry &curves = curves_id.geometry.wrap(); const bke::CurvesGeometry &curves = curves_id.geometry.wrap();

View File

@ -558,11 +558,8 @@ static bool transform_modal_item_poll(const wmOperator *op, int value)
if (value == TFM_MODAL_EDIT_SNAP_SOURCE_OFF) { if (value == TFM_MODAL_EDIT_SNAP_SOURCE_OFF) {
return true; return true;
} }
else if (!ELEM(value, if (!ELEM(
TFM_MODAL_CANCEL, value, TFM_MODAL_CANCEL, TFM_MODAL_CONFIRM, TFM_MODAL_ADD_SNAP, TFM_MODAL_REMOVE_SNAP))
TFM_MODAL_CONFIRM,
TFM_MODAL_ADD_SNAP,
TFM_MODAL_REMOVE_SNAP))
{ {
return false; return false;
} }

View File

@ -653,10 +653,8 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene,
handle_armature_parent_orientation(ob, r_mat); handle_armature_parent_orientation(ob, r_mat);
break; break;
} }
else { handle_object_parent_orientation(ob, r_mat);
handle_object_parent_orientation(ob, r_mat); break;
break;
}
} }
/* No break; we define 'parent' as 'normal' otherwise. */ /* No break; we define 'parent' as 'normal' otherwise. */
ATTR_FALLTHROUGH; ATTR_FALLTHROUGH;

View File

@ -848,10 +848,8 @@ static eSnapMode snap_polygon(SnapObjectContext *sctx, eSnapMode snap_to_flag)
return snap_polygon_mesh( return snap_polygon_mesh(
sctx, sctx->ret.ob, sctx->ret.data, sctx->ret.obmat, snap_to_flag, sctx->ret.index); sctx, sctx->ret.ob, sctx->ret.data, sctx->ret.obmat, snap_to_flag, sctx->ret.index);
} }
else { return snap_polygon_editmesh(
return snap_polygon_editmesh( sctx, sctx->ret.ob, sctx->ret.data, sctx->ret.obmat, snap_to_flag, sctx->ret.index);
sctx, sctx->ret.ob, sctx->ret.data, sctx->ret.obmat, snap_to_flag, sctx->ret.index);
}
} }
static eSnapMode snap_edge_points(SnapObjectContext *sctx, const float dist_px_sq_orig) static eSnapMode snap_edge_points(SnapObjectContext *sctx, const float dist_px_sq_orig)
@ -870,10 +868,8 @@ static eSnapMode snap_edge_points(SnapObjectContext *sctx, const float dist_px_s
return snap_edge_points_mesh( return snap_edge_points_mesh(
sctx, sctx->ret.ob, sctx->ret.data, sctx->ret.obmat, dist_px_sq_orig, sctx->ret.index); sctx, sctx->ret.ob, sctx->ret.data, sctx->ret.obmat, dist_px_sq_orig, sctx->ret.index);
} }
else { return snap_edge_points_editmesh(
return snap_edge_points_editmesh( sctx, sctx->ret.ob, sctx->ret.data, sctx->ret.obmat, dist_px_sq_orig, sctx->ret.index);
sctx, sctx->ret.ob, sctx->ret.data, sctx->ret.obmat, dist_px_sq_orig, sctx->ret.index);
}
} }
/* May extend later (for now just snaps to empty or camera center). */ /* May extend later (for now just snaps to empty or camera center). */

View File

@ -215,7 +215,7 @@ eSnapMode snap_polygon_editmesh(SnapObjectContext *sctx,
const ID *id, const ID *id,
const blender::float4x4 &obmat, const blender::float4x4 &obmat,
eSnapMode snap_to_flag, eSnapMode snap_to_flag,
int polygon); int face);
eSnapMode snap_edge_points_editmesh(SnapObjectContext *sctx, eSnapMode snap_edge_points_editmesh(SnapObjectContext *sctx,
Object *ob_eval, Object *ob_eval,
@ -238,7 +238,7 @@ eSnapMode snap_polygon_mesh(SnapObjectContext *sctx,
const ID *id, const ID *id,
const blender::float4x4 &obmat, const blender::float4x4 &obmat,
eSnapMode snap_to_flag, eSnapMode snap_to_flag,
int polygon); int face);
eSnapMode snap_edge_points_mesh(SnapObjectContext *sctx, eSnapMode snap_edge_points_mesh(SnapObjectContext *sctx,
Object *ob_eval, Object *ob_eval,

View File

@ -52,7 +52,7 @@ struct SnapCache_EditMesh : public SnapObjectContext::SnapCache {
} }
} }
~SnapCache_EditMesh() ~SnapCache_EditMesh() override
{ {
this->clear(); this->clear();
} }
@ -430,20 +430,20 @@ class SnapData_EditMesh : public SnapData {
SnapData_EditMesh(SnapObjectContext *sctx, BMesh *bm, const float4x4 &obmat) SnapData_EditMesh(SnapObjectContext *sctx, BMesh *bm, const float4x4 &obmat)
: SnapData(sctx, obmat), bm(bm){}; : SnapData(sctx, obmat), bm(bm){};
void get_vert_co(const int index, const float **r_co) void get_vert_co(const int index, const float **r_co) override
{ {
BMVert *eve = BM_vert_at_index(this->bm, index); BMVert *eve = BM_vert_at_index(this->bm, index);
*r_co = eve->co; *r_co = eve->co;
} }
void get_edge_verts_index(const int index, int r_v_index[2]) void get_edge_verts_index(const int index, int r_v_index[2]) override
{ {
BMEdge *eed = BM_edge_at_index(this->bm, index); BMEdge *eed = BM_edge_at_index(this->bm, index);
r_v_index[0] = BM_elem_index_get(eed->v1); r_v_index[0] = BM_elem_index_get(eed->v1);
r_v_index[1] = BM_elem_index_get(eed->v2); r_v_index[1] = BM_elem_index_get(eed->v2);
} }
void copy_vert_no(const int index, float r_no[3]) void copy_vert_no(const int index, float r_no[3]) override
{ {
BMVert *eve = BM_vert_at_index(this->bm, index); BMVert *eve = BM_vert_at_index(this->bm, index);
copy_v3_v3(r_no, eve->no); copy_v3_v3(r_no, eve->no);

View File

@ -241,19 +241,19 @@ class SnapData_Mesh : public SnapData {
this->corner_tris = mesh_eval->corner_tris().data(); this->corner_tris = mesh_eval->corner_tris().data();
}; };
void get_vert_co(const int index, const float **r_co) void get_vert_co(const int index, const float **r_co) override
{ {
*r_co = this->vert_positions[index]; *r_co = this->vert_positions[index];
} }
void get_edge_verts_index(const int index, int r_v_index[2]) void get_edge_verts_index(const int index, int r_v_index[2]) override
{ {
const blender::int2 &edge = this->edges[index]; const blender::int2 &edge = this->edges[index];
r_v_index[0] = edge[0]; r_v_index[0] = edge[0];
r_v_index[1] = edge[1]; r_v_index[1] = edge[1];
} }
void copy_vert_no(const int index, float r_no[3]) void copy_vert_no(const int index, float r_no[3]) override
{ {
copy_v3_v3(r_no, this->vert_normals[index]); copy_v3_v3(r_no, this->vert_normals[index]);
} }

View File

@ -144,7 +144,7 @@ static const char *to_string(const Type &type)
return "unknown"; return "unknown";
} }
static const int to_component_count(const Type &type) static int to_component_count(const Type &type)
{ {
switch (type) { switch (type) {
case Type::FLOAT: case Type::FLOAT:
@ -200,7 +200,7 @@ static const int to_component_count(const Type &type)
return -1; return -1;
} }
static const Type to_component_type(const Type &type) static Type to_component_type(const Type &type)
{ {
switch (type) { switch (type) {
case Type::FLOAT: case Type::FLOAT:

View File

@ -171,7 +171,7 @@ static void dna_write(FILE *file, const void *pntr, const int size);
/** /**
* Report all structures found so far, and print their lengths. * Report all structures found so far, and print their lengths.
*/ */
void print_struct_sizes(void); void print_struct_sizes();
/** \} */ /** \} */

View File

@ -877,9 +877,9 @@ const char *WM_drag_get_single_path(const wmDrag *drag, int file_type)
return nullptr; return nullptr;
} }
const wmDragPath *path_data = static_cast<const wmDragPath *>(drag->poin); const wmDragPath *path_data = static_cast<const wmDragPath *>(drag->poin);
auto const file_types = path_data->file_types; const blender::Span<int> file_types = path_data->file_types;
auto itr = std::find_if( const auto *itr = std::find_if(
file_types.begin(), file_types.end(), [file_type](const int file_fype_test) { file_types.begin(), file_types.end(), [file_type](const int file_fype_test) {
return file_fype_test & file_type; return file_fype_test & file_type;
}); });