25 this->fcurve =
nullptr;
26 this->curve_is_local_copy =
false;
31 this->min = other.min;
32 this->max = other.max;
33 this->fcurve = other.fcurve;
34 this->curve_key = other.curve_key;
35 this->curve_is_local_copy =
false;
36 this->id_ptr = other.id_ptr;
47 this->curve_key = key;
49 this->curve_is_local_copy =
false;
55 this->curve_key = key;
56 this->fcurve =
nullptr;
57 this->curve_is_local_copy =
false;
61 void BCAnimationCurve::init_pointer_rna(
Object *ob)
85 stderr,
"BC_animation_curve_type %d not supported", this->curve_key.
get_array_index());
90 void BCAnimationCurve::delete_fcurve(
FCurve *fcu)
95 FCurve *BCAnimationCurve::create_fcurve(
int array_index,
const char *rna_path)
104 void BCAnimationCurve::create_bezt(
float frame,
float output)
109 bez.
vec[1][0] = frame;
120 if (curve_is_local_copy && fcurve) {
122 delete_fcurve(fcurve);
123 this->fcurve =
nullptr;
134 const std::string path = curve_key.
get_path();
152 if (pose_bone_name == channel) {
159 return pose_bone_name;
172 if (fcurve ==
nullptr || fcurve->
rna_path ==
nullptr) {
178 name =
id_name(ob) +
"_" + std::string(boneName);
227 if (fcurve ==
nullptr) {
235 if (fcurve ==
nullptr) {
239 const int cframe = fcurve->
bezt[start_at].
vec[1][0];
241 if (
fabs(cframe - sample_frame) < 0.00001) {
244 return (fcurve->
totvert > start_at + 1) ? start_at + 1 : start_at;
249 if (fcurve ==
nullptr) {
253 float lower_frame = sample_frame;
254 float upper_frame = sample_frame;
258 for (
int fcu_index = 0; fcu_index < fcurve->
totvert; fcu_index++) {
259 upper_index = fcu_index;
261 const int cframe = fcurve->
bezt[fcu_index].
vec[1][0];
262 if (cframe <= sample_frame) {
263 lower_frame = cframe;
264 lower_index = fcu_index;
266 if (cframe >= sample_frame) {
267 upper_frame = cframe;
272 if (lower_index == upper_index) {
276 const float fraction =
float(sample_frame - lower_frame) / (upper_frame - lower_frame);
277 return (fraction < 0.5) ? lower_index : upper_index;
286 return fcurve->
bezt[index].
ipo;
296 if (!curve_is_local_copy) {
298 const std::string &path = curve_key.
get_path();
299 fcurve = create_fcurve(index, path.c_str());
306 curve_is_local_copy =
true;
313 if (fcurve ==
nullptr) {
320 fcurve->
bezt =
nullptr;
323 for (
int i = 0; i < totvert; i++) {
325 float x = bezt->
vec[1][0];
326 float y = bezt->
vec[1][1];
329 lastb->
f1 = lastb->
f2 = lastb->
f3 = 0;
341 return (
is_rotation_curve() || channel_type ==
"scale" || channel_type ==
"location");
347 return (channel_type ==
"rotation" || channel_type ==
"rotation_euler" ||
348 channel_type ==
"rotation_quaternion");
359 void BCAnimationCurve::update_range(
float val)
369 void BCAnimationCurve::init_range(
float val)
376 if (fcurve && fcurve->
totvert > 1) {
379 int first_frame = fcurve->
bezt[0].
vec[1][0];
380 if (first_frame == frame_index) {
414 bool good =
sample.get_value(channel_target, array_index, &val);
431 &id_ptr, full_path.c_str(), &
ptr, &prop, &array_index);
432 if (!path_resolved && array_index == 0) {
433 const std::string rna_path = curve_key.
get_path();
458 "Out of Bounds while reading data for Curve %s\n",
480 "property type %d not supported for Curve %s\n",
490 fprintf(stderr,
"Path not recognized for Curve %s\n", curve_key.
get_full_path().c_str());
501 if (fcurve ==
nullptr) {
505 for (
int i = 0; i < fcurve->
totvert; i++) {
506 const float frame = fcurve->
bezt[i].
vec[1][0];
507 const float val = fcurve->
bezt[i].
vec[1][1];
508 value_map[frame] = val;
516 for (
int i = 0; i < fcurve->
totvert; i++) {
517 const float val = fcurve->
bezt[i].
vec[1][0];
518 frames.push_back(val);
527 for (
int i = 0; i < fcurve->
totvert; i++) {
528 const float val = fcurve->
bezt[i].
vec[1][1];
529 values.push_back(val);
536 static float MIN_DISTANCE = 0.00001;
537 return fabs(max - min) > MIN_DISTANCE;
542 if (this->fcurve ==
nullptr) {
546 for (
int i = 0; i < fcurve->
totvert; i++) {
547 const int cframe = nearbyint(fcurve->
bezt[i].
vec[1][0]);
548 if (cframe == frame) {
551 if (cframe > frame) {
563 if (lhtgt == rhtgt) {
569 return lhtgt < rhtgt;
576 this->curve_array_index = 0;
577 this->curve_subindex = -1;
581 const std::string path,
582 const int array_index,
585 this->key_type =
type;
586 this->rna_path = path;
587 this->curve_array_index = array_index;
588 this->curve_subindex = subindex;
593 this->key_type = other.key_type;
594 this->rna_path = other.rna_path;
595 this->curve_array_index = other.curve_array_index;
596 this->curve_subindex = other.curve_subindex;
601 return this->rna_path +
'[' +
std::to_string(this->curve_array_index) +
']';
606 return this->rna_path;
611 return this->curve_array_index;
616 return this->curve_subindex;
621 this->key_type = object_type;
626 return this->key_type;
632 if (this->key_type != other.key_type) {
633 return this->key_type < other.key_type;
636 if (this->curve_subindex != other.curve_subindex) {
637 return this->curve_subindex < other.curve_subindex;
640 if (this->rna_path != other.rna_path) {
641 return this->rna_path < other.rna_path;
644 return this->curve_array_index < other.curve_array_index;
bool operator<(const BCAnimationCurve &lhs, const BCAnimationCurve &rhs)
std::vector< float > BCValues
typedef float(TangentPoint)[2]
std::map< int, float > BCValueMap
@ BC_ANIMATION_TYPE_MATERIAL
@ BC_ANIMATION_TYPE_LIGHT
@ BC_ANIMATION_TYPE_OBJECT
@ BC_ANIMATION_TYPE_CAMERA
std::vector< float > BCFrames
float evaluate_fcurve(struct FCurve *fcu, float evaltime)
void BKE_fcurve_free(struct FCurve *fcu)
void calchandles_fcurve(struct FCurve *fcu)
struct FCurve * BKE_fcurve_create(void)
struct Material * BKE_object_material_get(struct Object *ob, short act)
char * BLI_strdupn(const char *str, const size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * BLI_str_quoted_substrN(const char *__restrict str, const char *__restrict prefix) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL() ATTR_MALLOC
_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 type
_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
std::string get_rna_path() const
FCurve * get_edit_fcurve()
FCurve * get_fcurve() const
int closest_index_below(const float sample_frame) const
bool add_value_from_matrix(const BCSample &sample, const int frame)
float get_value(const float frame)
void get_values(BCValues &values) const
std::string get_channel_type() const
void adjust_range(int frame)
bool is_rotation_curve() const
void get_value_map(BCValueMap &value_map)
bool is_keyframe(int frame)
int get_interpolation_type(float sample_frame) const
bool is_of_animation_type(BC_animation_type type) const
void get_frames(BCFrames &frames) const
bool is_transform_curve() const
std::string get_channel_posebone() const
bool add_value_from_rna(const int frame)
std::string get_channel_target() const
void add_value(const float val, const int frame)
int get_channel_index() const
std::string get_animation_name(Object *ob) const
int closest_index_above(const float sample_frame, const int start_at) const
void get_tangent(Scene *scene, float point[2], bool as_angle, int index) const
BCBezTriple(BezTriple &bezt)
float get_time(Scene *scene) const
void get_out_tangent(Scene *scene, float point[2], bool as_angle) const
void get_in_tangent(Scene *scene, float point[2], bool as_angle) const
std::string get_path() const
std::string get_full_path() const
void set_object_type(BC_animation_type object_type)
int get_array_index() const
void operator=(const BCCurveKey &other)
BC_animation_type get_animation_type() const
bool operator<(const BCCurveKey &other) const
std::string id_name(void *id)
std::string bc_string_after(const std::string &s, const std::string probe)
std::string bc_string_before(const std::string &s, const std::string probe)
bool bc_startswith(std::string const &value, std::string const &starting)
int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType keyframe_type, eInsertKeyFlags flag)
int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
void(* MEM_freeN)(void *vmemh)
static void sample(SocketReader *reader, int x, int y, float color[4])
std::string to_string(const T &n)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_array_check(PropertyRNA *prop)
bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
PropertyType RNA_property_type(PropertyRNA *prop)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
ccl_device_inline float2 fabs(const float2 &a)