Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/include/ED_keyframing.h')
-rw-r--r--source/blender/editors/include/ED_keyframing.h280
1 files changed, 177 insertions, 103 deletions
diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h
index 5191978c529..54570938de1 100644
--- a/source/blender/editors/include/ED_keyframing.h
+++ b/source/blender/editors/include/ED_keyframing.h
@@ -72,8 +72,13 @@ struct bAction *verify_adt_action(struct Main *bmain, struct ID *id, short add);
/* Get (or add relevant data to be able to do so) F-Curve from the given Action.
* This assumes that all the destinations are valid.
*/
-struct FCurve *verify_fcurve(struct Main *bmain, struct bAction *act, const char group[], struct PointerRNA *ptr,
- const char rna_path[], const int array_index, short add);
+struct FCurve *verify_fcurve(struct Main *bmain,
+ struct bAction *act,
+ const char group[],
+ struct PointerRNA *ptr,
+ const char rna_path[],
+ const int array_index,
+ short add);
/* -------- */
@@ -81,7 +86,9 @@ struct FCurve *verify_fcurve(struct Main *bmain, struct bAction *act, const char
* Update integer/discrete flags of the FCurve (used when creating/inserting keyframes,
* but also through RNA when editing an ID prop, see T37103).
*/
-void update_autoflags_fcurve(struct FCurve *fcu, struct bContext *C, struct ReportList *reports,
+void update_autoflags_fcurve(struct FCurve *fcu,
+ struct bContext *C,
+ struct ReportList *reports,
struct PointerRNA *ptr);
/* -------- */
@@ -97,7 +104,8 @@ int insert_bezt_fcurve(struct FCurve *fcu, const struct BezTriple *bezt, eInsert
* already exists. It will insert a keyframe using the current value being keyframed.
* Returns the index at which a keyframe was added (or -1 if failed)
*/
-int insert_vert_fcurve(struct FCurve *fcu, float x, float y, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag);
+int insert_vert_fcurve(
+ struct FCurve *fcu, float x, float y, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag);
/* -------- */
@@ -105,7 +113,15 @@ int insert_vert_fcurve(struct FCurve *fcu, float x, float y, eBezTriple_Keyframe
* Use this to insert a keyframe using the current value being keyframed, in the
* nominated F-Curve (no creation of animation data performed). Returns success.
*/
-bool insert_keyframe_direct(struct Depsgraph *depsgraph, struct ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, eBezTriple_KeyframeType keytype, struct NlaKeyframingContext *nla, eInsertKeyFlags flag);
+bool insert_keyframe_direct(struct Depsgraph *depsgraph,
+ struct ReportList *reports,
+ struct PointerRNA ptr,
+ struct PropertyRNA *prop,
+ struct FCurve *fcu,
+ float cfra,
+ eBezTriple_KeyframeType keytype,
+ struct NlaKeyframingContext *nla,
+ eInsertKeyFlags flag);
/* -------- */
@@ -113,16 +129,31 @@ bool insert_keyframe_direct(struct Depsgraph *depsgraph, struct ReportList *repo
* Use this to create any necessary animation data, and then insert a keyframe
* using the current value being keyframed, in the relevant place. Returns success.
*/
-short insert_keyframe(
- struct Main *bmain, struct Depsgraph *depsgraph, struct ReportList *reports, struct ID *id, struct bAction *act,
- const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, struct ListBase *nla_cache, eInsertKeyFlags flag);
+short insert_keyframe(struct Main *bmain,
+ struct Depsgraph *depsgraph,
+ struct ReportList *reports,
+ struct ID *id,
+ struct bAction *act,
+ const char group[],
+ const char rna_path[],
+ int array_index,
+ float cfra,
+ eBezTriple_KeyframeType keytype,
+ struct ListBase *nla_cache,
+ eInsertKeyFlags flag);
/* Main Keyframing API call:
* Use this to delete keyframe on current frame for relevant channel. Will perform checks just in case.
*/
-short delete_keyframe(
- struct Main *bmain, struct ReportList *reports, struct ID *id, struct bAction *act,
- const char group[], const char rna_path[], int array_index, float cfra, eInsertKeyFlags flag);
+short delete_keyframe(struct Main *bmain,
+ struct ReportList *reports,
+ struct ID *id,
+ struct bAction *act,
+ const char group[],
+ const char rna_path[],
+ int array_index,
+ float cfra,
+ eInsertKeyFlags flag);
/* ************ Keying Sets ********************** */
@@ -133,60 +164,66 @@ struct KeyingSetInfo;
/* Polling Callback for KeyingSets */
typedef bool (*cbKeyingSet_Poll)(struct KeyingSetInfo *ksi, struct bContext *C);
/* Context Iterator Callback for KeyingSets */
-typedef void (*cbKeyingSet_Iterator)(struct KeyingSetInfo *ksi, struct bContext *C, struct KeyingSet *ks);
+typedef void (*cbKeyingSet_Iterator)(struct KeyingSetInfo *ksi,
+ struct bContext *C,
+ struct KeyingSet *ks);
/* Property Specifier Callback for KeyingSets (called from iterators) */
-typedef void (*cbKeyingSet_Generate)(struct KeyingSetInfo *ksi, struct bContext *C, struct KeyingSet *ks, struct PointerRNA *ptr);
-
+typedef void (*cbKeyingSet_Generate)(struct KeyingSetInfo *ksi,
+ struct bContext *C,
+ struct KeyingSet *ks,
+ struct PointerRNA *ptr);
/* Callback info for 'Procedural' KeyingSets to use */
typedef struct KeyingSetInfo {
- struct KeyingSetInfo *next, *prev;
-
- /* info */
- /* identifier used for class name, which KeyingSet instances reference as "Typeinfo Name" */
- char idname[64];
- /* identifier so that user can hook this up to a KeyingSet (used as label). */
- char name[64];
- /* short help/description. */
- char description[240]; /* RNA_DYN_DESCR_MAX */
- /* keying settings */
- short keyingflag;
-
- /* polling callbacks */
- /* callback for polling the context for whether the right data is available */
- cbKeyingSet_Poll poll;
-
- /* generate callbacks */
- /* iterator to use to go through collections of data in context
- * - this callback is separate from the 'adding' stage, allowing
- * BuiltIn KeyingSets to be manually specified to use
- */
- cbKeyingSet_Iterator iter;
- /* generator to use to add properties based on the data found by iterator */
- cbKeyingSet_Generate generate;
-
- /* RNA integration */
- struct ExtensionRNA ext;
+ struct KeyingSetInfo *next, *prev;
+
+ /* info */
+ /* identifier used for class name, which KeyingSet instances reference as "Typeinfo Name" */
+ char idname[64];
+ /* identifier so that user can hook this up to a KeyingSet (used as label). */
+ char name[64];
+ /* short help/description. */
+ char description[240]; /* RNA_DYN_DESCR_MAX */
+ /* keying settings */
+ short keyingflag;
+
+ /* polling callbacks */
+ /* callback for polling the context for whether the right data is available */
+ cbKeyingSet_Poll poll;
+
+ /* generate callbacks */
+ /* iterator to use to go through collections of data in context
+ * - this callback is separate from the 'adding' stage, allowing
+ * BuiltIn KeyingSets to be manually specified to use
+ */
+ cbKeyingSet_Iterator iter;
+ /* generator to use to add properties based on the data found by iterator */
+ cbKeyingSet_Generate generate;
+
+ /* RNA integration */
+ struct ExtensionRNA ext;
} KeyingSetInfo;
/* -------- */
/* Add another data source for Relative Keying Sets to be evaluated with */
-void ANIM_relative_keyingset_add_source(ListBase *dsources, struct ID *id, struct StructRNA *srna, void *data);
-
+void ANIM_relative_keyingset_add_source(ListBase *dsources,
+ struct ID *id,
+ struct StructRNA *srna,
+ void *data);
/* mode for modify_keyframes */
typedef enum eModifyKey_Modes {
- MODIFYKEY_MODE_INSERT = 0,
- MODIFYKEY_MODE_DELETE,
+ MODIFYKEY_MODE_INSERT = 0,
+ MODIFYKEY_MODE_DELETE,
} eModifyKey_Modes;
/* return codes for errors (with Relative KeyingSets) */
typedef enum eModifyKey_Returns {
- /* context info was invalid for using the Keying Set */
- MODIFYKEY_INVALID_CONTEXT = -1,
- /* there isn't any typeinfo for generating paths from context */
- MODIFYKEY_MISSING_TYPEINFO = -2,
+ /* context info was invalid for using the Keying Set */
+ MODIFYKEY_INVALID_CONTEXT = -1,
+ /* there isn't any typeinfo for generating paths from context */
+ MODIFYKEY_MISSING_TYPEINFO = -2,
} eModifyKey_Returns;
/* poll the current KeyingSet, updating it's set of paths
@@ -194,7 +231,12 @@ typedef enum eModifyKey_Returns {
short ANIM_validate_keyingset(struct bContext *C, ListBase *dsources, struct KeyingSet *ks);
/* use the specified KeyingSet to add/remove various Keyframes on the specified frame */
-int ANIM_apply_keyingset(struct bContext *C, ListBase *dsources, struct bAction *act, struct KeyingSet *ks, short mode, float cfra);
+int ANIM_apply_keyingset(struct bContext *C,
+ ListBase *dsources,
+ struct bAction *act,
+ struct KeyingSet *ks,
+ short mode,
+ float cfra);
/* -------- */
@@ -224,10 +266,14 @@ struct KeyingSet *ANIM_scene_get_active_keyingset(struct Scene *scene);
int ANIM_scene_get_keyingset_index(struct Scene *scene, struct KeyingSet *ks);
/* Get Keying Set to use for Auto-Keyframing some transforms */
-struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene, const char *tranformKSName);
+struct KeyingSet *ANIM_get_keyingset_for_autokeying(struct Scene *scene,
+ const char *tranformKSName);
/* Dynamically populate an enum of Keying Sets */
-const struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
+const struct EnumPropertyItem *ANIM_keying_sets_enum_itemf(struct bContext *C,
+ struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ bool *r_free);
/* Use to get the keying set from the int value used by enums. */
KeyingSet *ANIM_keyingset_get_from_enum_type(struct Scene *scene, int type);
@@ -240,27 +286,27 @@ bool ANIM_keyingset_context_ok_poll(struct bContext *C, struct KeyingSet *ks);
/* Flags for use by driver creation calls */
typedef enum eCreateDriverFlags {
- /** create drivers with a default variable for nicer UI */
- CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0),
- /** create drivers with Generator FModifier (for backwards compat) */
- CREATEDRIVER_WITH_FMODIFIER = (1 << 1),
+ /** create drivers with a default variable for nicer UI */
+ CREATEDRIVER_WITH_DEFAULT_DVAR = (1 << 0),
+ /** create drivers with Generator FModifier (for backwards compat) */
+ CREATEDRIVER_WITH_FMODIFIER = (1 << 1),
} eCreateDriverFlags;
/* Heuristic to use for connecting target properties to driven ones */
typedef enum eCreateDriver_MappingTypes {
- /** 1 to Many - Use the specified index, and drive all elements with it */
- CREATEDRIVER_MAPPING_1_N = 0,
- /** 1 to 1 - Only for the specified index on each side */
- CREATEDRIVER_MAPPING_1_1 = 1,
- /** Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */
- CREATEDRIVER_MAPPING_N_N = 2,
-
- /** None (Single Prop):
- * Do not create driver with any targets; these will get added later instead */
- CREATEDRIVER_MAPPING_NONE = 3,
- /** None (All Properties):
- * Do not create driver with any targets; these will get added later instead */
- CREATEDRIVER_MAPPING_NONE_ALL = 4,
+ /** 1 to Many - Use the specified index, and drive all elements with it */
+ CREATEDRIVER_MAPPING_1_N = 0,
+ /** 1 to 1 - Only for the specified index on each side */
+ CREATEDRIVER_MAPPING_1_1 = 1,
+ /** Many to Many - Match up the indices one by one (only for drivers on vectors/arrays) */
+ CREATEDRIVER_MAPPING_N_N = 2,
+
+ /** None (Single Prop):
+ * Do not create driver with any targets; these will get added later instead */
+ CREATEDRIVER_MAPPING_NONE = 3,
+ /** None (All Properties):
+ * Do not create driver with any targets; these will get added later instead */
+ CREATEDRIVER_MAPPING_NONE_ALL = 4,
} eCreateDriver_MappingTypes;
/* RNA Enum of eCreateDriver_MappingTypes, for use by the appropriate operators */
@@ -271,7 +317,10 @@ extern EnumPropertyItem prop_driver_create_mapping_types[];
/* Low-level call to add a new driver F-Curve. This shouldn't be used directly for most tools,
* although there are special cases where this approach is preferable.
*/
-struct FCurve *verify_driver_fcurve(struct ID *id, const char rna_path[], const int array_index, short add);
+struct FCurve *verify_driver_fcurve(struct ID *id,
+ const char rna_path[],
+ const int array_index,
+ short add);
/* -------- */
@@ -286,23 +335,34 @@ struct FCurve *verify_driver_fcurve(struct ID *id, const char rna_path[], const
* - driver_type: eDriver_Types
* - mapping_type: eCreateDriver_MappingTypes
*/
-int ANIM_add_driver_with_target(
- struct ReportList *reports,
- struct ID *dst_id, const char dst_path[], int dst_index,
- struct ID *src_id, const char src_path[], int src_index,
- short flag, int driver_type, short mapping_type);
+int ANIM_add_driver_with_target(struct ReportList *reports,
+ struct ID *dst_id,
+ const char dst_path[],
+ int dst_index,
+ struct ID *src_id,
+ const char src_path[],
+ int src_index,
+ short flag,
+ int driver_type,
+ short mapping_type);
/* -------- */
/* Main Driver Management API calls:
* Add a new driver for the specified property on the given ID block
*/
-int ANIM_add_driver(struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag, int type);
+int ANIM_add_driver(struct ReportList *reports,
+ struct ID *id,
+ const char rna_path[],
+ int array_index,
+ short flag,
+ int type);
/* Main Driver Management API calls:
* Remove the driver for the specified property on the given ID block (if available)
*/
-bool ANIM_remove_driver(struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag);
+bool ANIM_remove_driver(
+ struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag);
/* -------- */
@@ -320,13 +380,15 @@ bool ANIM_driver_can_paste(void);
/* Main Driver Management API calls:
* Make a copy of the driver for the specified property on the given ID block
*/
-bool ANIM_copy_driver(struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag);
+bool ANIM_copy_driver(
+ struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag);
/* Main Driver Management API calls:
* Add a new driver for the specified property on the given ID block or replace an existing one
* with the driver + driver-curve data from the buffer
*/
-bool ANIM_paste_driver(struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag);
+bool ANIM_paste_driver(
+ struct ReportList *reports, struct ID *id, const char rna_path[], int array_index, short flag);
/* -------- */
@@ -351,15 +413,17 @@ bool ANIM_driver_vars_paste(struct ReportList *reports, struct FCurve *fcu, bool
/* Auto-Keying macros for use by various tools */
/* check if auto-keyframing is enabled (per scene takes precedence) */
-#define IS_AUTOKEY_ON(scene) ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
+#define IS_AUTOKEY_ON(scene) \
+ ((scene) ? (scene->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON))
/* check the mode for auto-keyframing (per scene takes precedence) */
-#define IS_AUTOKEY_MODE(scene, mode) ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : (U.autokey_mode == AUTOKEY_MODE_##mode))
+#define IS_AUTOKEY_MODE(scene, mode) \
+ ((scene) ? (scene->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : \
+ (U.autokey_mode == AUTOKEY_MODE_##mode))
/* check if a flag is set for auto-keyframing (per scene takes precedence) */
#define IS_AUTOKEY_FLAG(scene, flag) \
- ((scene) ? \
- ((scene->toolsettings->autokey_flag & AUTOKEY_FLAG_##flag) || (U.autokey_flag & AUTOKEY_FLAG_##flag)) \
- : \
- (U.autokey_flag & AUTOKEY_FLAG_##flag))
+ ((scene) ? ((scene->toolsettings->autokey_flag & AUTOKEY_FLAG_##flag) || \
+ (U.autokey_flag & AUTOKEY_FLAG_##flag)) : \
+ (U.autokey_flag & AUTOKEY_FLAG_##flag))
/* auto-keyframing feature - checks for whether anything should be done for the current frame */
bool autokeyframe_cfra_can_key(struct Scene *scene, struct ID *id);
@@ -375,7 +439,10 @@ bool fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter);
* - Returns whether the current value of a given property differs from the interpolated value.
* - Used for button drawing.
*/
-bool fcurve_is_changed(struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float frame);
+bool fcurve_is_changed(struct PointerRNA ptr,
+ struct PropertyRNA *prop,
+ struct FCurve *fcu,
+ float frame);
/**
* Main Keyframe Checking API call:
@@ -392,29 +459,36 @@ bool id_frame_has_keyframe(struct ID *id, float frame, short filter);
* (for v3d->keyflags)
*/
typedef enum eAnimFilterFlags {
- /* general */
- ANIMFILTER_KEYS_LOCAL = (1 << 0), /* only include locally available anim data */
- ANIMFILTER_KEYS_MUTED = (1 << 1), /* include muted elements */
- ANIMFILTER_KEYS_ACTIVE = (1 << 2), /* only include active-subelements */
-
- /* object specific */
- ANIMFILTER_KEYS_NOMAT = (1 << 9), /* don't include material keyframes */
- ANIMFILTER_KEYS_NOSKEY = (1 << 10), /* don't include shape keys (for geometry) */
+ /* general */
+ ANIMFILTER_KEYS_LOCAL = (1 << 0), /* only include locally available anim data */
+ ANIMFILTER_KEYS_MUTED = (1 << 1), /* include muted elements */
+ ANIMFILTER_KEYS_ACTIVE = (1 << 2), /* only include active-subelements */
+
+ /* object specific */
+ ANIMFILTER_KEYS_NOMAT = (1 << 9), /* don't include material keyframes */
+ ANIMFILTER_KEYS_NOSKEY = (1 << 10), /* don't include shape keys (for geometry) */
} eAnimFilterFlags;
/* utility funcs for auto keyframe */
-bool ED_autokeyframe_object(struct bContext *C, struct Scene *scene, struct Object *ob, struct KeyingSet *ks);
-bool ED_autokeyframe_pchan(struct bContext *C, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, struct KeyingSet *ks);
+bool ED_autokeyframe_object(struct bContext *C,
+ struct Scene *scene,
+ struct Object *ob,
+ struct KeyingSet *ks);
+bool ED_autokeyframe_pchan(struct bContext *C,
+ struct Scene *scene,
+ struct Object *ob,
+ struct bPoseChannel *pchan,
+ struct KeyingSet *ks);
/* Names for builtin keying sets so we don't confuse these with labels/text,
* defined in python script: keyingsets_builtins.py */
-#define ANIM_KS_LOCATION_ID "Location"
-#define ANIM_KS_ROTATION_ID "Rotation"
-#define ANIM_KS_SCALING_ID "Scaling"
-#define ANIM_KS_LOC_ROT_SCALE_ID "LocRotScale"
-#define ANIM_KS_AVAILABLE_ID "Available"
-#define ANIM_KS_WHOLE_CHARACTER_ID "WholeCharacter"
-#define ANIM_KS_WHOLE_CHARACTER_SELECTED_ID "WholeCharacterSelected"
+#define ANIM_KS_LOCATION_ID "Location"
+#define ANIM_KS_ROTATION_ID "Rotation"
+#define ANIM_KS_SCALING_ID "Scaling"
+#define ANIM_KS_LOC_ROT_SCALE_ID "LocRotScale"
+#define ANIM_KS_AVAILABLE_ID "Available"
+#define ANIM_KS_WHOLE_CHARACTER_ID "WholeCharacter"
+#define ANIM_KS_WHOLE_CHARACTER_SELECTED_ID "WholeCharacterSelected"
#ifdef __cplusplus
}