1 /* Testing code for new animation system in 2.5
2 * Copyright 2009, Joshua Leung
14 /* ************** Keyframe Tools ***************** */
16 // XXX this stuff is defined in BKE_ipo.h too, so maybe skip for now?
17 typedef struct CfraElem {
18 struct CfraElem *next, *prev;
23 void bezt_add_to_cfra_elem(ListBase *lb, struct BezTriple *bezt);
25 /* ************** F-Curve Drivers ***************** */
27 void fcurve_free_driver(struct FCurve *fcu);
28 struct ChannelDriver *fcurve_copy_driver(struct ChannelDriver *driver);
30 /* ************** F-Curve Modifiers *************** */
32 /* F-Curve Modifier Type-Info (fmi):
33 * This struct provides function pointers for runtime, so that functions can be
34 * written more generally (with fewer/no special exceptions for various modifiers).
36 * Callers of these functions must check that they actually point to something useful,
37 * as some constraints don't define some of these.
39 * Warning: it is not too advisable to reorder order of members of this struct,
40 * as you'll have to edit quite a few ($FMODIFIER_NUM_TYPES) of these
43 typedef struct FModifierTypeInfo {
45 short type; /* FMODIFIER_TYPE_### */
46 short size; /* size in bytes of the struct */
47 char name[32]; /* name of modifier in interface */
48 char structName[32]; /* name of struct for SDNA */
50 /* data management function pointers - special handling */
51 /* free any data that is allocated separately (optional) */
52 void (*free_data)(struct FModifier *fcm);
53 /* copy any special data that is allocated separately (optional) */
54 void (*copy_data)(struct FModifier *fcm, struct FModifier *src);
55 /* set settings for data that will be used for FCuModifier.data (memory already allocated using MEM_callocN) */
56 void (*new_data)(void *mdata);
59 /* evaluate the modifier for the given time and 'accumulated' value */
60 void (*evaluate_modifier)(struct FCurve *fcu, struct FModifier *fcm, float *cvalue, float evaltime);
63 /* Function Prototypes for FModifierTypeInfo's */
64 FModifierTypeInfo *fmodifier_get_typeinfo(struct FModifier *fcm);
65 FModifierTypeInfo *get_fmodifier_typeinfo(int type);
67 /* ---------------------- */
69 // TODO... general API here..
70 struct FModifier *fcurve_add_modifier(struct FCurve *fcu, int type);
71 void fcurve_copy_modifiers(ListBase *dst, ListBase *src);
72 void fcurve_remove_modifier(struct FCurve *fcu, struct FModifier *fcm);
73 void fcurve_free_modifiers(struct FCurve *fcu);
74 void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end);
76 /* ************** F-Curves API ******************** */
78 /* -------- Data Managemnt -------- */
80 void free_fcurve(struct FCurve *fcu);
81 struct FCurve *copy_fcurve(struct FCurve *fcu);
83 void free_fcurves(ListBase *list);
84 void copy_fcurves(ListBase *dst, ListBase *src);
86 /* find matching F-Curve in the given list of F-Curves */
87 struct FCurve *list_find_fcurve(ListBase *list, const char rna_path[], const int array_index);
89 /* get the time extents for F-Curve */
90 void calc_fcurve_range(struct FCurve *fcu, float *min, float *max);
92 /* get the bounding-box extents for F-Curve */
93 void calc_fcurve_bounds(struct FCurve *fcu, float *xmin, float *xmax, float *ymin, float *ymax);
95 /* -------- Curve Sanity -------- */
97 void calchandles_fcurve(struct FCurve *fcu);
98 void testhandles_fcurve(struct FCurve *fcu);
99 void sort_time_fcurve(struct FCurve *fcu);
100 short test_time_fcurve(struct FCurve *fcu);
102 void correct_bezpart(float *v1, float *v2, float *v3, float *v4);
104 /* -------- Evaluation -------- */
106 /* evaluate fcurve */
107 float evaluate_fcurve(struct FCurve *fcu, float evaltime);
108 /* evaluate fcurve and store value */
109 void calculate_fcurve(struct FCurve *fcu, float ctime);
112 #endif /* BKE_FCURVE_H*/