5#include "testing/testing.h"
31#include "testing/testing.h"
46 fcurve.
bezt[0].
vec[1][0] = 10.0f;
47 fcurve.
bezt[0].
vec[1][1] = 1.0f;
48 fcurve.
bezt[1].
vec[1][0] = 20.0f;
49 fcurve.
bezt[1].
vec[1][1] = 2.0f;
50 fcurve.
bezt[2].
vec[1][0] = 30.0f;
51 fcurve.
bezt[2].
vec[1][1] = 1.0f;
68 const std::optional<float> expected_frame)
70 if (expected_frame.has_value()) {
71 ASSERT_NE(column,
nullptr) <<
"Expected a frame to be found at " << *expected_frame;
75 EXPECT_EQ(column,
nullptr) <<
"Expected no frame to be found, but found " << column->
cfra;
83 const float frame_from,
85 const std::optional<float> expected_frame)
87 float cfra = frame_from;
89 const ActKeyColumn *found = keylist_find_func(keylist, cfra);
95 const float frame_from,
97 const std::optional<float> expected_frame)
115 const float frame_from,
116 const float frame_to,
117 const std::optional<float> expected_frame)
135 const float frame_from,
136 const float frame_to,
137 const std::optional<float> expected_frame)
259 ac.active_action =
nullptr;
260 ac.active_action_user =
nullptr;
274 Slot &slot_cube = action->slot_add_for_id(cube->id);
292 ac.active_action_user = &cube->id;
294 &ac, &cube->id, *action, slot_cube.
handle, keylist, 0, {0.0, 6.0});
307 EXPECT_NE(
nullptr, col_1);
308 EXPECT_NE(
nullptr, col_2);
309 EXPECT_NE(
nullptr, col_3);
311 EXPECT_NE(
nullptr, col_5);
330 Slot &slot_armature = action->slot_add_for_id(armature->id);
336 bmain, {
"pose.bones[\"Bone.001\"].location", 0, {}, {},
"Bone.001"});
338 bmain, {
"pose.bones[\"Bone.002\"].location", 0, {}, {},
"Bone.002"});
347 ASSERT_NE(pose_bone1,
nullptr);
356 ac.active_action_user = &armature->id;
359 &ac, &armature->id, *action, slot_armature.
handle, keylist, 0, {0.0, 6.0});
367 EXPECT_NE(
nullptr, col_1);
368 EXPECT_NE(
nullptr, col_2);
Functions and classes to work with Actions.
Functions to modify FCurves.
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
void BKE_armature_bone_hash_make(bArmature *arm)
void BKE_pose_ensure(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
bArmature * BKE_armature_add(Main *bmain, const char *name)
FCurve * BKE_fcurve_create()
void BKE_fcurve_free(FCurve *fcu)
void * BKE_id_new(Main *bmain, short type, const char *name)
void BKE_main_free(Main *bmain)
General operations, lookup, etc. for blender objects.
Object * BKE_object_add_only_object(Main *bmain, int type, const char *name) ATTR_RETURNS_NONNULL
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define STRNCPY_UTF8(dst, src)
Read Guarded memory(de)allocation.
bool closest(btVector3 &v)
FCurve & fcurve_ensure(Main *bmain, const FCurveDescriptor &fcurve_descriptor)
static void SetUpTestSuite()
static void TearDownTestSuite()
blender::animrig::Action * action
bArmature * armature_data
const ActKeyColumn * ED_keylist_find_prev(const AnimKeylist *keylist, const float cfra)
void action_slot_summary_to_keylist(bAnimContext *ac, ID *animated_id, animrig::Action &action, const animrig::slot_handle_t slot_handle, AnimKeylist *keylist, const int saction_flag, blender::float2 range)
void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const int saction_flag, blender::float2 range, const bool use_nla_remapping)
const ActKeyColumn * ED_keylist_find_closest(const AnimKeylist *keylist, const float cfra)
void ED_keylist_prepare_for_direct_access(AnimKeylist *keylist)
AnimKeylist * ED_keylist_create()
void ED_keylist_free(AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_next(const AnimKeylist *keylist, const float cfra)
const ActKeyColumn * ED_keylist_find_exact(const AnimKeylist *keylist, const float cfra)
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_callocN(size_t len, const char *str)
ActionSlotAssignmentResult assign_action_and_slot(Action *action, Slot *slot_to_assign, ID &animated_id)
Channelbag & action_channelbag_ensure(bAction &dna_action, ID &animated_id)
SingleKeyingResult insert_vert_fcurve(FCurve *fcu, const float2 position, const KeyframeSettings &settings, eInsertKeyFlags flag)
Main Key-framing API call.
static void check_keylist_find_next_range(const AnimKeylist *keylist, const float frame_from, const float frame_to, const std::optional< float > expected_frame)
static void check_keylist_find_exact_range(const AnimKeylist *keylist, const float frame_from, const float frame_to, const std::optional< float > expected_frame)
static void assert_act_key_column(const ActKeyColumn *column, const std::optional< float > expected_frame)
static void build_fcurve(FCurve &fcurve)
static void check_keylist_find_prev_range(const AnimKeylist *keylist, const float frame_from, const float frame_to, const std::optional< float > expected_frame)
std::function< const ActKeyColumn *(const AnimKeylist *, float)> KeylistFindFunction
const float KEYLIST_NEAR_ERROR
static void check_keylist_find_range(const AnimKeylist *keylist, KeylistFindFunction keylist_find_func, const float frame_from, const float frame_to, const std::optional< float > expected_frame)
static AnimKeylist * create_test_keylist()
TEST_F(KeylistSummaryTest, slot_summary_simple)