Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_fcurve.h
| Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | |||||
| float evaluate_driver(struct PathResolvedRNA *anim_rna, | float evaluate_driver(struct PathResolvedRNA *anim_rna, | ||||
| struct ChannelDriver *driver, | struct ChannelDriver *driver, | ||||
| struct ChannelDriver *driver_orig, | struct ChannelDriver *driver_orig, | ||||
| const float evaltime); | const float evaltime); | ||||
| /* ************** F-Curve Modifiers *************** */ | /* ************** F-Curve Modifiers *************** */ | ||||
| typedef struct GHash FModifierStackStorage; | |||||
| /* F-Curve Modifier Type-Info (fmi): | /* F-Curve Modifier Type-Info (fmi): | ||||
| * This struct provides function pointers for runtime, so that functions can be | * This struct provides function pointers for runtime, so that functions can be | ||||
| * written more generally (with fewer/no special exceptions for various modifiers). | * written more generally (with fewer/no special exceptions for various modifiers). | ||||
| * | * | ||||
| * Callers of these functions must check that they actually point to something useful, | * Callers of these functions must check that they actually point to something useful, | ||||
| * as some constraints don't define some of these. | * as some constraints don't define some of these. | ||||
| * | * | ||||
| * Warning: it is not too advisable to reorder order of members of this struct, | * Warning: it is not too advisable to reorder order of members of this struct, | ||||
| * as you'll have to edit quite a few ($FMODIFIER_NUM_TYPES) of these | * as you'll have to edit quite a few ($FMODIFIER_NUM_TYPES) of these | ||||
| * structs. | * structs. | ||||
| */ | */ | ||||
| typedef struct FModifierTypeInfo { | typedef struct FModifierTypeInfo { | ||||
| /* admin/ident */ | /* admin/ident */ | ||||
| short type; /* FMODIFIER_TYPE_### */ | short type; /* FMODIFIER_TYPE_### */ | ||||
| short size; /* size in bytes of the struct */ | short size; /* size in bytes of the struct */ | ||||
| short acttype; /* eFMI_Action_Types */ | short acttype; /* eFMI_Action_Types */ | ||||
| short requires; /* eFMI_Requirement_Flags */ | short requires; /* eFMI_Requirement_Flags */ | ||||
| char name[64]; /* name of modifier in interface */ | char name[64]; /* name of modifier in interface */ | ||||
| char structName[64]; /* name of struct for SDNA */ | char structName[64]; /* name of struct for SDNA */ | ||||
| uint storage_size; /* size of buffer that can be reused between time and value evaluation */ | |||||
| /* data management function pointers - special handling */ | /* data management function pointers - special handling */ | ||||
| /* free any data that is allocated separately (optional) */ | /* free any data that is allocated separately (optional) */ | ||||
| void (*free_data)(struct FModifier *fcm); | void (*free_data)(struct FModifier *fcm); | ||||
| /* copy any special data that is allocated separately (optional) */ | /* copy any special data that is allocated separately (optional) */ | ||||
| void (*copy_data)(struct FModifier *fcm, const struct FModifier *src); | void (*copy_data)(struct FModifier *fcm, const struct FModifier *src); | ||||
| /* set settings for data that will be used for FCuModifier.data (memory already allocated using MEM_callocN) */ | /* set settings for data that will be used for FCuModifier.data (memory already allocated using MEM_callocN) */ | ||||
| void (*new_data)(void *mdata); | void (*new_data)(void *mdata); | ||||
| /* verifies that the modifier settings are valid */ | /* verifies that the modifier settings are valid */ | ||||
| void (*verify_data)(struct FModifier *fcm); | void (*verify_data)(struct FModifier *fcm); | ||||
| /* evaluation */ | /* evaluation */ | ||||
| /* evaluate time that the modifier requires the F-Curve to be evaluated at */ | /* evaluate time that the modifier requires the F-Curve to be evaluated at */ | ||||
| float (*evaluate_modifier_time)(struct FCurve *fcu, | float (*evaluate_modifier_time)( | ||||
| struct FModifier *fcm, | struct FCurve *fcu, struct FModifier *fcm, float cvalue, float evaltime, void *storage); | ||||
| float cvalue, | |||||
| float evaltime); | |||||
| /* evaluate the modifier for the given time and 'accumulated' value */ | /* evaluate the modifier for the given time and 'accumulated' value */ | ||||
| void (*evaluate_modifier)(struct FCurve *fcu, | void (*evaluate_modifier)( | ||||
| struct FModifier *fcm, | struct FCurve *fcu, struct FModifier *fcm, float *cvalue, float evaltime, void *storage); | ||||
| float *cvalue, | |||||
| float evaltime); | |||||
| /* Same as above but for modifiers which requires storage */ | |||||
| float (*evaluate_modifier_time_storage)(FModifierStackStorage *storage, | |||||
| struct FCurve *fcu, | |||||
| struct FModifier *fcm, | |||||
| float cvalue, | |||||
| float evaltime); | |||||
| void (*evaluate_modifier_storage)(FModifierStackStorage *storage, | |||||
| struct FCurve *fcu, | |||||
| struct FModifier *fcm, | |||||
| float *cvalue, | |||||
| float evaltime); | |||||
| } FModifierTypeInfo; | } FModifierTypeInfo; | ||||
| /* Values which describe the behavior of a FModifier Type */ | /* Values which describe the behavior of a FModifier Type */ | ||||
| typedef enum eFMI_Action_Types { | typedef enum eFMI_Action_Types { | ||||
| /* modifier only modifies values outside of data range */ | /* modifier only modifies values outside of data range */ | ||||
| FMI_TYPE_EXTRAPOLATION = 0, | FMI_TYPE_EXTRAPOLATION = 0, | ||||
| /* modifier leaves data-points alone, but adjusts the interpolation between and around them */ | /* modifier leaves data-points alone, but adjusts the interpolation between and around them */ | ||||
| FMI_TYPE_INTERPOLATION, | FMI_TYPE_INTERPOLATION, | ||||
| /* modifier only modifies the values of points (but times stay the same) */ | /* modifier only modifies the values of points (but times stay the same) */ | ||||
| FMI_TYPE_REPLACE_VALUES, | FMI_TYPE_REPLACE_VALUES, | ||||
| /* modifier generates a curve regardless of what came before */ | /* modifier generates a curve regardless of what came before */ | ||||
| FMI_TYPE_GENERATE_CURVE, | FMI_TYPE_GENERATE_CURVE, | ||||
| } eFMI_Action_Types; | } eFMI_Action_Types; | ||||
| /* Flags for the requirements of a FModifier Type */ | /* Flags for the requirements of a FModifier Type */ | ||||
| typedef enum eFMI_Requirement_Flags { | typedef enum eFMI_Requirement_Flags { | ||||
| /* modifier requires original data-points (kindof beats the purpose of a modifier stack?) */ | /* modifier requires original data-points (kindof beats the purpose of a modifier stack?) */ | ||||
| FMI_REQUIRES_ORIGINAL_DATA = (1 << 0), | FMI_REQUIRES_ORIGINAL_DATA = (1 << 0), | ||||
| /* modifier doesn't require on any preceding data (i.e. it will generate a curve). | /* modifier doesn't require on any preceding data (i.e. it will generate a curve). | ||||
| * Use in conjunction with FMI_TYPE_GENRATE_CURVE | * Use in conjunction with FMI_TYPE_GENRATE_CURVE | ||||
| */ | */ | ||||
| FMI_REQUIRES_NOTHING = (1 << 1), | FMI_REQUIRES_NOTHING = (1 << 1), | ||||
| /* refer to modifier instance */ | /* refer to modifier instance */ | ||||
| FMI_REQUIRES_RUNTIME_CHECK = (1 << 2), | FMI_REQUIRES_RUNTIME_CHECK = (1 << 2), | ||||
| /* Requires to store data shared between time and valua evaluation */ | |||||
| FMI_REQUIRES_STORAGE = (1 << 3), | |||||
| } eFMI_Requirement_Flags; | } eFMI_Requirement_Flags; | ||||
| /* Function Prototypes for FModifierTypeInfo's */ | /* Function Prototypes for FModifierTypeInfo's */ | ||||
| const FModifierTypeInfo *fmodifier_get_typeinfo(const struct FModifier *fcm); | const FModifierTypeInfo *fmodifier_get_typeinfo(const struct FModifier *fcm); | ||||
| const FModifierTypeInfo *get_fmodifier_typeinfo(const int type); | const FModifierTypeInfo *get_fmodifier_typeinfo(const int type); | ||||
| /* ---------------------- */ | /* ---------------------- */ | ||||
| struct FModifier *add_fmodifier(ListBase *modifiers, int type, struct FCurve *owner_fcu); | struct FModifier *add_fmodifier(ListBase *modifiers, int type, struct FCurve *owner_fcu); | ||||
| struct FModifier *copy_fmodifier(const struct FModifier *src); | struct FModifier *copy_fmodifier(const struct FModifier *src); | ||||
| void copy_fmodifiers(ListBase *dst, const ListBase *src); | void copy_fmodifiers(ListBase *dst, const ListBase *src); | ||||
| bool remove_fmodifier(ListBase *modifiers, struct FModifier *fcm); | bool remove_fmodifier(ListBase *modifiers, struct FModifier *fcm); | ||||
| void free_fmodifiers(ListBase *modifiers); | void free_fmodifiers(ListBase *modifiers); | ||||
| struct FModifier *find_active_fmodifier(ListBase *modifiers); | struct FModifier *find_active_fmodifier(ListBase *modifiers); | ||||
| void set_active_fmodifier(ListBase *modifiers, struct FModifier *fcm); | void set_active_fmodifier(ListBase *modifiers, struct FModifier *fcm); | ||||
| bool list_has_suitable_fmodifier(ListBase *modifiers, int mtype, short acttype); | bool list_has_suitable_fmodifier(ListBase *modifiers, int mtype, short acttype); | ||||
| FModifierStackStorage *evaluate_fmodifiers_storage_new(ListBase *modifiers); | typedef struct FModifiersStackStorage { | ||||
| void evaluate_fmodifiers_storage_free(FModifierStackStorage *storage); | uint modifier_count; | ||||
angavrilov: modifier_count | |||||
| float evaluate_time_fmodifiers(FModifierStackStorage *storage, | uint size_per_modifier; | ||||
| void *buffer; | |||||
Done Inline ActionsMaybe call this 'data' or 'buffer' to avoid storage->storage? angavrilov: Maybe call this 'data' or 'buffer' to avoid storage->storage? | |||||
| } FModifiersStackStorage; | |||||
| uint evaluate_fmodifiers_storage_size_per_modifier(ListBase *modifiers); | |||||
| float evaluate_time_fmodifiers(FModifiersStackStorage *storage, | |||||
| ListBase *modifiers, | ListBase *modifiers, | ||||
| struct FCurve *fcu, | struct FCurve *fcu, | ||||
| float cvalue, | float cvalue, | ||||
| float evaltime); | float evaltime); | ||||
| void evaluate_value_fmodifiers(FModifierStackStorage *storage, | void evaluate_value_fmodifiers(FModifiersStackStorage *storage, | ||||
| ListBase *modifiers, | ListBase *modifiers, | ||||
| struct FCurve *fcu, | struct FCurve *fcu, | ||||
| float *cvalue, | float *cvalue, | ||||
| float evaltime); | float evaltime); | ||||
| void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end); | void fcurve_bake_modifiers(struct FCurve *fcu, int start, int end); | ||||
| int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, | int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, | ||||
| ▲ Show 20 Lines • Show All 142 Lines • Show Last 20 Lines | |||||
modifier_count