3 #include "testing/testing.h"
42 float time_epsilon = 0.00008f;
98 fcu->
bezt[0].
vec[0][0] = 0.71855f;
99 fcu->
bezt[0].
vec[0][1] = 6.22482f;
100 fcu->
bezt[0].
vec[2][0] = 1.35148f;
101 fcu->
bezt[0].
vec[2][1] = 7.96806f;
103 fcu->
bezt[1].
vec[0][0] = 1.66667f;
104 fcu->
bezt[1].
vec[0][1] = 10.4136f;
105 fcu->
bezt[1].
vec[2][0] = 2.33333f;
106 fcu->
bezt[1].
vec[2][1] = 15.5864f;
171 fcu->
bezt[0].
vec[0][0] = 0.71855f;
172 fcu->
bezt[0].
vec[0][1] = 6.22482f;
173 fcu->
bezt[0].
vec[2][0] = 1.35148f;
174 fcu->
bezt[0].
vec[2][1] = 7.96806f;
176 fcu->
bezt[1].
vec[0][0] = 1.66667f;
177 fcu->
bezt[1].
vec[0][1] = 10.4136f;
178 fcu->
bezt[1].
vec[2][0] = 2.33333f;
179 fcu->
bezt[1].
vec[2][1] = 15.5864f;
209 fcu->
bezt[0].
vec[0][0] = -5.0f;
215 fcu->
bezt[1].
vec[0][0] = 13.0f;
216 fcu->
bezt[1].
vec[0][1] = -2.0f;
217 fcu->
bezt[1].
vec[2][0] = 16.0f;
218 fcu->
bezt[1].
vec[2][1] = -3.0f;
222 const float x = 7.375f;
223 const float y = 1.000f;
224 beztr.
vec[0][0] =
x - 1.0f;
228 beztr.
vec[2][0] =
x + 1.0f;
237 EXPECT_FLOAT_EQ(y_delta, 0.0f);
239 EXPECT_FLOAT_EQ(fcu->
bezt[0].
vec[0][0], -5.0f);
240 EXPECT_FLOAT_EQ(fcu->
bezt[0].
vec[0][1], 0.0f);
241 EXPECT_FLOAT_EQ(fcu->
bezt[0].
vec[1][0], 1.0f);
242 EXPECT_FLOAT_EQ(fcu->
bezt[0].
vec[1][1], 0.0f);
243 EXPECT_FLOAT_EQ(fcu->
bezt[0].
vec[2][0], 1.5f);
244 EXPECT_FLOAT_EQ(fcu->
bezt[0].
vec[2][1], 2.0f);
246 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[0][0], 13.0f);
247 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[0][1], 0.0f);
248 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[1][0], 13.0f);
249 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[1][1], 2.0f);
250 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[2][0], 16.0f);
251 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[2][1], -3.0f);
253 EXPECT_FLOAT_EQ(beztr.
vec[0][0], 4.5f);
254 EXPECT_FLOAT_EQ(beztr.
vec[0][1], 1.5f);
255 EXPECT_FLOAT_EQ(beztr.
vec[1][0], 7.375f);
256 EXPECT_FLOAT_EQ(beztr.
vec[1][1], 1.0f);
257 EXPECT_FLOAT_EQ(beztr.
vec[2][0], 10.250);
258 EXPECT_FLOAT_EQ(beztr.
vec[2][1], 0.5);
263 TEST(fcurve_active_keyframe, ActiveKeyframe)
291 "active keyframe must be selected");
297 <<
"Setting out-of-bounds value via the API should result in valid active_keyframe_index";
302 <<
"Even with active_keyframe_index out of bounds, getting it via the API should produce a "
308 <<
"Setting out-of-bounds value via the API should result in valid active_keyframe_index";
313 <<
"Even with active_keyframe_index out of bounds, getting it via the API should produce a "
327 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[0][0], 5.2671194f);
328 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[0][1], 15.0f);
330 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[1][0], 8.0f);
331 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[1][1], 15.0f);
333 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[2][0], 10.342469f);
334 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[2][1], 15.0f);
338 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[0][0], 5.2671194f) <<
"Left handle should not move in time";
339 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[0][1], 47.0f) <<
"Left handle value should have been updated";
341 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[1][0], 8.0f) <<
"Frame should not move in time";
342 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[1][1], 47.0f) <<
"Frame value should have been updated";
344 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[2][0], 10.342469f) <<
"Right handle should not move in time";
345 EXPECT_FLOAT_EQ(fcu->
bezt[1].
vec[2][1], 47.0f) <<
"Right handle value should have been updated";
void BKE_fcurve_active_keyframe_set(struct FCurve *fcu, const struct BezTriple *active_bezt)
float evaluate_fcurve(struct FCurve *fcu, float evaltime)
bool BKE_fcurve_bezt_subdivide_handles(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, float *r_pdelta)
void BKE_fcurve_keyframe_move_value_with_handles(struct BezTriple *keyframe, float new_value)
void BKE_fcurve_free(struct FCurve *fcu)
int BKE_fcurve_active_keyframe_index(const struct FCurve *fcu)
struct FCurve * BKE_fcurve_create(void)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
#define FCURVE_ACTIVE_KEYFRAME_NONE
@ FCURVE_EXTRAPOLATE_CONSTANT
@ FCURVE_EXTRAPOLATE_LINEAR
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint y
Read Guarded memory(de)allocation.
int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType keyframe_type, eInsertKeyFlags flag)
Main Key-framing API call.
static const float EPSILON
TEST(action_groups, ReconstructGroupsWithReordering)
int active_keyframe_index