11 this->fcurve =
nullptr;
12 this->curve_is_local_copy =
false;
17 this->min = other.min;
18 this->max = other.max;
19 this->fcurve = other.fcurve;
20 this->curve_key = other.curve_key;
21 this->curve_is_local_copy =
false;
22 this->id_ptr = other.id_ptr;
33 this->curve_key = key;
35 this->curve_is_local_copy =
false;
41 this->curve_key = key;
42 this->fcurve =
nullptr;
43 this->curve_is_local_copy =
false;
47 void BCAnimationCurve::init_pointer_rna(
Object *ob)
71 stderr,
"BC_animation_curve_type %d not supported", this->curve_key.
get_array_index());
76 void BCAnimationCurve::delete_fcurve(
FCurve *fcu)
81 FCurve *BCAnimationCurve::create_fcurve(
int array_index,
const char *rna_path)
90 void BCAnimationCurve::create_bezt(
float frame,
float output)
95 bez.
vec[1][0] = frame;
106 if (curve_is_local_copy && fcurve) {
108 delete_fcurve(fcurve);
109 this->fcurve =
nullptr;
120 const std::string path = curve_key.
get_path();
138 if (pose_bone_name == channel) {
145 return pose_bone_name;
158 if (fcurve ==
nullptr || fcurve->
rna_path ==
nullptr) {
164 name =
id_name(ob) +
"_" + std::string(boneName);
212 if (fcurve ==
nullptr) {
220 if (fcurve ==
nullptr) {
224 const int cframe = fcurve->
bezt[start_at].
vec[1][0];
226 if (
fabs(cframe - sample_frame) < 0.00001) {
229 return (fcurve->
totvert > start_at + 1) ? start_at + 1 : start_at;
234 if (fcurve ==
nullptr) {
238 float lower_frame = sample_frame;
239 float upper_frame = sample_frame;
243 for (
int fcu_index = 0; fcu_index < fcurve->
totvert; fcu_index++) {
244 upper_index = fcu_index;
246 const int cframe = fcurve->
bezt[fcu_index].
vec[1][0];
247 if (cframe <= sample_frame) {
248 lower_frame = cframe;
249 lower_index = fcu_index;
251 if (cframe >= sample_frame) {
252 upper_frame = cframe;
257 if (lower_index == upper_index) {
261 const float fraction =
float(sample_frame - lower_frame) / (upper_frame - lower_frame);
262 return (fraction < 0.5) ? lower_index : upper_index;
271 return fcurve->
bezt[index].
ipo;
281 if (!curve_is_local_copy) {
283 const std::string &path = curve_key.
get_path();
284 fcurve = create_fcurve(index, path.c_str());
291 curve_is_local_copy =
true;
298 if (fcurve ==
nullptr) {
305 fcurve->
bezt =
nullptr;
308 for (
int i = 0; i < totvert; i++) {
310 float x = bezt->
vec[1][0];
311 float y = bezt->
vec[1][1];
314 lastb->
f1 = lastb->
f2 = lastb->
f3 = 0;
326 return (
is_rotation_curve() || channel_type ==
"scale" || channel_type ==
"location");
332 return (channel_type ==
"rotation" || channel_type ==
"rotation_euler" ||
333 channel_type ==
"rotation_quaternion");
344 void BCAnimationCurve::update_range(
float val)
354 void BCAnimationCurve::init_range(
float val)
361 if (fcurve && fcurve->
totvert > 1) {
364 int first_frame = fcurve->
bezt[0].
vec[1][0];
365 if (first_frame == frame_index) {
399 bool good =
sample.get_value(channel_target, array_index, &val);
416 &id_ptr, full_path.c_str(), &
ptr, &prop, &array_index);
417 if (!path_resolved && array_index == 0) {
418 const std::string rna_path = curve_key.
get_path();
443 "Out of Bounds while reading data for Curve %s\n",
465 "property type %d not supported for Curve %s\n",
475 fprintf(stderr,
"Path not recognized for Curve %s\n", curve_key.
get_full_path().c_str());
486 if (fcurve ==
nullptr) {
490 for (
int i = 0; i < fcurve->
totvert; i++) {
491 const float frame = fcurve->
bezt[i].
vec[1][0];
492 const float val = fcurve->
bezt[i].
vec[1][1];
493 value_map[frame] = val;
501 for (
int i = 0; i < fcurve->
totvert; i++) {
502 const float val = fcurve->
bezt[i].
vec[1][0];
503 frames.push_back(val);
512 for (
int i = 0; i < fcurve->
totvert; i++) {
513 const float val = fcurve->
bezt[i].
vec[1][1];
514 values.push_back(val);
521 static float MIN_DISTANCE = 0.00001;
522 return fabs(max - min) > MIN_DISTANCE;
527 if (this->fcurve ==
nullptr) {
531 for (
int i = 0; i < fcurve->
totvert; i++) {
532 const int cframe = nearbyint(fcurve->
bezt[i].
vec[1][0]);
533 if (cframe == frame) {
536 if (cframe > frame) {
548 if (lhtgt == rhtgt) {
554 return lhtgt < rhtgt;
561 this->curve_array_index = 0;
562 this->curve_subindex = -1;
566 const std::string path,
567 const int array_index,
570 this->key_type =
type;
571 this->rna_path = path;
572 this->curve_array_index = array_index;
573 this->curve_subindex = subindex;
578 this->key_type = other.key_type;
579 this->rna_path = other.rna_path;
580 this->curve_array_index = other.curve_array_index;
581 this->curve_subindex = other.curve_subindex;
586 return this->rna_path +
'[' +
std::to_string(this->curve_array_index) +
']';
591 return this->rna_path;
596 return this->curve_array_index;
601 return this->curve_subindex;
606 this->key_type = object_type;
611 return this->key_type;
617 if (this->key_type != other.key_type) {
618 return this->key_type < other.key_type;
621 if (this->curve_subindex != other.curve_subindex) {
622 return this->curve_subindex < other.curve_subindex;
625 if (this->rna_path != other.rna_path) {
626 return this->rna_path < other.rna_path;
629 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 BKE_fcurve_handles_recalc(struct FCurve *fcu)
struct FCurve * BKE_fcurve_create(void)
struct Material * BKE_object_material_get(struct Object *ob, short act)
bool bool BLI_str_quoted_substr(const char *__restrict str, const char *__restrict prefix, char *result, size_t result_maxlen)
char * BLI_strdupn(const char *str, size_t len) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
_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
_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
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a point
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a or normal between camera
std::string get_rna_path() const
FCurve * get_edit_fcurve()
FCurve * get_fcurve() const
float get_value(float frame)
void get_values(BCValues &values) const
void add_value(float val, int frame)
bool add_value_from_matrix(const BCSample &sample, int frame)
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
int closest_index_below(float sample_frame) const
void get_frames(BCFrames &frames) const
int closest_index_above(float sample_frame, int start_at) const
bool is_transform_curve() const
std::string get_channel_posebone() const
bool add_value_from_rna(int frame)
std::string get_channel_target() const
int get_channel_index() const
std::string get_animation_name(Object *ob) 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)
ccl_global KernelShaderEvalInput ccl_global float * output
int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType keyframe_type, eInsertKeyFlags flag)
Main Key-framing API call.
int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag)
void(* MEM_freeN)(void *vmemh)
ccl_device_inline float2 fabs(const float2 &a)
std::string to_string(const T &n)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_array_check(PropertyRNA *prop)
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)
bool RNA_path_resolve_full(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)