Cleanup: Various clang-tidy warnings in animrig

Pull Request: https://projects.blender.org/blender/blender/pulls/133734
This commit is contained in:
Brecht Van Lommel
2025-01-26 20:07:58 +01:00
parent c335ff596c
commit 936b90ce56
26 changed files with 24 additions and 64 deletions

View File

@@ -1097,7 +1097,7 @@ class Channelbag : public ::ActionChannelbag {
*
* \see fcurve_remove
*/
void fcurve_remove_by_index(int64_t fcurve_array_index);
void fcurve_remove_by_index(int64_t fcurve_index);
/**
* Detach an F-Curve from the Channelbag.

View File

@@ -14,8 +14,6 @@
# error This is a C++ header.
#endif
#include <stdbool.h>
#include "BLI_map.hh"
#include "BKE_armature.hh"

View File

@@ -14,7 +14,7 @@
# error This is a C++ header.
#endif
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
struct bPoseChannel;
struct ThemeWireColor;

View File

@@ -92,7 +92,6 @@ class EvaluationResult {
EvaluationResult(const EvaluationResult &other) = default;
~EvaluationResult() = default;
public:
operator bool() const
{
return !this->is_empty();

View File

@@ -16,8 +16,6 @@
#include "DNA_anim_types.h"
#include "ANIM_keyframing.hh"
struct AnimData;
struct FCurve;

View File

@@ -92,8 +92,8 @@ class CombinedKeyingResult {
* For example, for object location/rotation/scale this returns the standard
* "Object Transforms" channel group name.
*/
const std::optional<StringRefNull> default_channel_group_for_path(
const PointerRNA *animated_struct, const StringRef prop_rna_path);
std::optional<StringRefNull> default_channel_group_for_path(const PointerRNA *animated_struct,
const StringRef prop_rna_path);
/* -------------------------------------------------------------------- */

View File

@@ -6,7 +6,6 @@
* \ingroup animrig
*/
#include "DNA_action_defaults.h"
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "DNA_array_utils.hh"
@@ -14,7 +13,6 @@
#include "DNA_scene_types.h"
#include "BLI_listbase.h"
#include "BLI_listbase_wrapper.hh"
#include "BLI_map.hh"
#include "BLI_math_base.h"
#include "BLI_string.h"
@@ -28,7 +26,6 @@
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
#include "BKE_nla.hh"
#include "BKE_preview_image.hh"
#include "BKE_report.hh"
#include "RNA_access.hh"
@@ -46,12 +43,9 @@
#include "ANIM_action_legacy.hh"
#include "ANIM_animdata.hh"
#include "ANIM_fcurve.hh"
#include "ANIM_nla.hh"
#include "action_runtime.hh"
#include "atomic_ops.h"
#include <cstdio>
#include <cstring>

View File

@@ -11,7 +11,6 @@
#include "BKE_object.hh"
#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "BLI_listbase.h"

View File

@@ -17,8 +17,6 @@
#include "BLI_set.hh"
#include "DNA_anim_types.h"
#include "ANIM_action.hh"
#include "ANIM_action_iterators.hh"

View File

@@ -9,15 +9,12 @@
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "BLI_listbase.h"
#include "BLI_set.hh"
#include "BKE_anim_data.hh"
#include "BKE_fcurve.hh"
#include "ANIM_action.hh"
#include "ANIM_action_legacy.hh"
#include "ANIM_fcurve.hh"
namespace blender::animrig {

View File

@@ -2063,12 +2063,12 @@ TEST_F(ActionFCurveMoveTest, test_fcurve_move_legacy)
Action &action_dst = action_add(*this->bmain, "DestinationAction");
/* Add F-Curves to source Action. */
BLI_addtail(&action_src.curves, this->fcurve_create("source_prop", 0));
FCurve *fcurve_to_move = this->fcurve_create("source_prop", 2);
BLI_addtail(&action_src.curves, fcurve_create("source_prop", 0));
FCurve *fcurve_to_move = fcurve_create("source_prop", 2);
BLI_addtail(&action_src.curves, fcurve_to_move);
/* Add F-Curves to destination Action. */
BLI_addtail(&action_dst.curves, this->fcurve_create("dest_prop", 0));
BLI_addtail(&action_dst.curves, fcurve_create("dest_prop", 0));
ASSERT_TRUE(action_src.is_action_legacy());
ASSERT_TRUE(action_dst.is_action_legacy());

View File

@@ -40,7 +40,7 @@ Vector<float> get_rna_values(PointerRNA *ptr, PropertyRNA *prop)
}
case PROP_FLOAT: {
values.reinitialize(length);
RNA_property_float_get_array(ptr, prop, &values[0]);
RNA_property_float_get_array(ptr, prop, values.data());
break;
}
default:

View File

@@ -28,11 +28,9 @@
#include "DNA_anim_types.h"
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_particle_types.h"
#include "RNA_access.hh"
#include "RNA_path.hh"
namespace blender::animrig {

View File

@@ -30,7 +30,6 @@
#include "intern/bone_collections_internal.hh"
#include <cstring>
#include <string>
using std::strcmp;

View File

@@ -968,13 +968,13 @@ TEST_F(ArmatureBoneCollections, bcoll_move_to_parent__root_unroot)
TEST_F(ArmatureBoneCollections, bcoll_move_to_parent__within_siblings)
{
/* Set up a small hierarchy. */
auto bcoll_root_0 = ANIM_armature_bonecoll_new(&arm, "root_0");
auto bcoll_root_1 = ANIM_armature_bonecoll_new(&arm, "root_1");
auto bcoll_r1_child0 = ANIM_armature_bonecoll_new(&arm, "r1_child0", 1);
auto bcoll_r0_child0 = ANIM_armature_bonecoll_new(&arm, "r0_child0", 0);
auto bcoll_r0_child1 = ANIM_armature_bonecoll_new(&arm, "r0_child1", 0);
auto bcoll_r0_child2 = ANIM_armature_bonecoll_new(&arm, "r0_child2", 0);
auto bcoll_r0_child3 = ANIM_armature_bonecoll_new(&arm, "r0_child3", 0);
auto *bcoll_root_0 = ANIM_armature_bonecoll_new(&arm, "root_0");
auto *bcoll_root_1 = ANIM_armature_bonecoll_new(&arm, "root_1");
auto *bcoll_r1_child0 = ANIM_armature_bonecoll_new(&arm, "r1_child0", 1);
auto *bcoll_r0_child0 = ANIM_armature_bonecoll_new(&arm, "r0_child0", 0);
auto *bcoll_r0_child1 = ANIM_armature_bonecoll_new(&arm, "r0_child1", 0);
auto *bcoll_r0_child2 = ANIM_armature_bonecoll_new(&arm, "r0_child2", 0);
auto *bcoll_r0_child3 = ANIM_armature_bonecoll_new(&arm, "r0_child3", 0);
ASSERT_EQ(2, arm.collection_root_count);
ASSERT_EQ(7, arm.collection_array_num);
@@ -1321,7 +1321,7 @@ class ArmatureBoneCollectionsTestList : public testing::Test {
{
std::vector<std::string> actual_names;
for (const BoneCollection *bcoll : arm.collections_span()) {
actual_names.push_back(bcoll->name);
actual_names.emplace_back(bcoll->name);
}
if (expect_names == actual_names) {

View File

@@ -10,6 +10,8 @@
#include "BLI_hash.hh"
#include "DNA_action_types.h"
#include "UI_resources.hh"
#include <cstring>
@@ -25,7 +27,7 @@ BoneColor::BoneColor(const BoneColor &other)
this->palette_index = other.palette_index;
std::memcpy(&this->custom, &other.custom, sizeof(this->custom));
}
BoneColor::~BoneColor() {}
BoneColor::~BoneColor() = default;
const ThemeWireColor *BoneColor::effective_color() const
{

View File

@@ -4,8 +4,6 @@
#include "ANIM_evaluation.hh"
#include "RNA_access.hh"
#include "BKE_animsys.h"
#include "BKE_fcurve.hh"

View File

@@ -19,7 +19,6 @@
#include "RNA_prototypes.hh"
#include "BLI_math_base.h"
#include "BLI_string_utf8.h"
#include <optional>

View File

@@ -195,8 +195,8 @@ void CombinedKeyingResult::generate_reports(ReportList *reports, const eReportTy
BKE_report(reports, report_level, error_message.c_str());
}
const std::optional<StringRefNull> default_channel_group_for_path(
const PointerRNA *animated_struct, const StringRef prop_rna_path)
std::optional<StringRefNull> default_channel_group_for_path(const PointerRNA *animated_struct,
const StringRef prop_rna_path)
{
if (animated_struct->type == &RNA_PoseBone) {
bPoseChannel *pose_channel = static_cast<bPoseChannel *>(animated_struct->data);
@@ -1154,7 +1154,7 @@ CombinedKeyingResult insert_keyframes(Main *bmain,
struct_pointer,
prop,
channel_group,
rna_path_id_to_prop->c_str(),
*rna_path_id_to_prop,
nla_frame,
rna_values.as_span(),
insert_key_flags_adjusted,

View File

@@ -11,9 +11,6 @@
#include "BKE_fcurve.hh"
#include "BKE_scene.hh"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "DNA_scene_types.h"
#include "RNA_access.hh"

View File

@@ -27,9 +27,6 @@
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_string_utf8.h"
#include <limits>
#include "CLG_log.h"
#include "testing/testing.h"

View File

@@ -8,12 +8,6 @@
#include "ANIM_nla.hh"
#include "BKE_anim_data.hh"
#include "BKE_lib_id.hh"
#include "BKE_nla.hh"
#include "BLI_string_utf8.h"
namespace blender::animrig::nla {
bool assign_action(NlaStrip &strip, Action &action, ID &animated_id)

View File

@@ -7,7 +7,6 @@
#include "BKE_action.hh"
#include "BKE_anim_data.hh"
#include "BKE_fcurve.hh"
#include "BKE_idtype.hh"
#include "BKE_lib_id.hh"
#include "BKE_main.hh"
@@ -18,9 +17,6 @@
#include "DNA_object_types.h"
#include "BLI_listbase.h"
#include "BLI_string_utf8.h"
#include <limits>
#include "CLG_log.h"
#include "testing/testing.h"

View File

@@ -32,7 +32,7 @@ void pose_apply_restore_fcurves(const Span<FCurve *> fcurves)
}
/* Returns a vector of all FCurves on which the fcurve flag was modified. */
static Vector<FCurve *> pose_apply_disable_fcurves_for_unselected_bones(
Vector<FCurve *> pose_apply_disable_fcurves_for_unselected_bones(
bAction *action,
const slot_handle_t slot_handle,
const blender::bke::BoneNameSet &selected_bone_names)

View File

@@ -8,12 +8,9 @@
#include "ANIM_versioning.hh"
#include "DNA_action_types.h"
#include "DNA_anim_types.h"
#include "BLI_listbase.h"
#include "MEM_guardedalloc.h"
#include "testing/testing.h"
namespace blender::animrig::versioning::tests {

View File

@@ -254,7 +254,7 @@ Vector<float> visualkey_get_values(PointerRNA *ptr, PropertyRNA *prop)
if (strstr(identifier, "rotation_axis_angle")) {
/* w = 0, x,y,z = 1,2,3 */
values.resize(4);
mat4_to_axis_angle(&values[1], &values[0], tmat);
mat4_to_axis_angle(values.data() + 1, values.data() + 0, tmat);
return values;
}