From ff839fb6c1c4b45786f9bbcb302d0af4d03c004a Mon Sep 17 00:00:00 2001 From: Gaia Clary Date: Wed, 18 Apr 2018 18:21:27 +0200 Subject: Fix: D3160 Propose to use proper typedefs to avoid confusion Differential Revision: https://developer.blender.org/D3160 --- source/blender/collada/AnimationImporter.cpp | 4 ++-- source/blender/editors/animation/keyframing.c | 21 +++++++++++---------- source/blender/editors/include/ED_keyframing.h | 11 ++++++----- source/blender/makesdna/DNA_anim_types.h | 1 + source/blender/makesdna/DNA_curve_types.h | 2 +- 5 files changed, 21 insertions(+), 18 deletions(-) (limited to 'source') diff --git a/source/blender/collada/AnimationImporter.cpp b/source/blender/collada/AnimationImporter.cpp index 226f8309ffb..75017ce32b4 100644 --- a/source/blender/collada/AnimationImporter.cpp +++ b/source/blender/collada/AnimationImporter.cpp @@ -81,7 +81,7 @@ void AnimationImporter::add_bezt(FCurve *fcu, float frame, float value, eBezTrip bez.ipo = ipo; /* use default interpolation mode here... */ bez.f1 = bez.f2 = bez.f3 = SELECT; bez.h1 = bez.h2 = HD_AUTO; - insert_bezt_fcurve(fcu, &bez, 0); + insert_bezt_fcurve(fcu, &bez, INSERTKEY_NOFLAGS); calchandles_fcurve(fcu); } @@ -148,7 +148,7 @@ void AnimationImporter::animation_to_fcurves(COLLADAFW::AnimationCurve *curve) // bez.ipo = U.ipo_new; /* use default interpolation mode here... */ bez.f1 = bez.f2 = bez.f3 = SELECT; - insert_bezt_fcurve(fcu, &bez, 0); + insert_bezt_fcurve(fcu, &bez, INSERTKEY_NOFLAGS); } calchandles_fcurve(fcu); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 9c30b6c30a0..c2a0b6579bb 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -90,7 +90,7 @@ /* Get the active settings for keyframing settings from context (specifically the given scene) */ short ANIM_get_keyframing_flags(Scene *scene, short incl_mode) { - short flag = 0; + eInsertKeyFlags flag = INSERTKEY_NOFLAGS; /* standard flags */ { @@ -302,7 +302,7 @@ void update_autoflags_fcurve(FCurve *fcu, bContext *C, ReportList *reports, Poin * NOTE: any recalculate of the F-Curve that needs to be done will need to * be done by the caller. */ -int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, short flag) +int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, eInsertKeyFlags flag) { int i = 0; @@ -389,11 +389,11 @@ int insert_bezt_fcurve(FCurve *fcu, const BezTriple *bezt, short flag) * adding a new keyframe to a curve, when the keyframe doesn't exist anywhere else yet. * It returns the index at which the keyframe was added. * - * \param keyframe_type: The type of keyframe (eBezTriple_KeyframeTypes) + * \param keyframe_type: The type of keyframe (eBezTriple_KeyframeType) * \param flag: Optional flags (eInsertKeyFlags) for controlling how keys get added * and/or whether updates get done */ -int insert_vert_fcurve(FCurve *fcu, float x, float y, char keyframe_type, short flag) +int insert_vert_fcurve(FCurve *fcu, float x, float y, eBezTriple_KeyframeType keyframe_type, eInsertKeyFlags flag) { BezTriple beztr = {{{0}}}; unsigned int oldTot = fcu->totvert; @@ -881,13 +881,13 @@ static float visualkey_get_value(PointerRNA *ptr, PropertyRNA *prop, int array_i * Use this when validation of necessary animation data is not necessary, since an RNA-pointer to the necessary * data being keyframed, and a pointer to the F-Curve to use have both been provided. * - * keytype is the "keyframe type" (eBezTriple_KeyframeTypes), as shown in the Dope Sheet. + * keytype is the "keyframe type" (eBezTriple_KeyframeType), as shown in the Dope Sheet. * * The flag argument is used for special settings that alter the behavior of * the keyframe insertion. These include the 'visual' keyframing modes, quick refresh, * and extra keyframe filtering. */ -bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, char keytype, short flag) +bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag) { float curval = 0.0f; @@ -1006,7 +1006,7 @@ bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *pr * * index of -1 keys all array indices */ -short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, char keytype, short flag) +short insert_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag) { PointerRNA id_ptr, ptr; PropertyRNA *prop = NULL; @@ -1129,7 +1129,7 @@ static bool delete_keyframe_fcurve(AnimData *adt, FCurve *fcu, float cfra) return false; } -short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short UNUSED(flag)) +short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eInsertKeyFlags UNUSED(flag)) { AnimData *adt = BKE_animdata_from_id(id); PointerRNA id_ptr, ptr; @@ -1218,7 +1218,7 @@ short delete_keyframe(ReportList *reports, ID *id, bAction *act, const char grou * The flag argument is used for special settings that alter the behavior of * the keyframe deletion. These include the quick refresh options. */ -static short clear_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, short UNUSED(flag)) +static short clear_keyframe(ReportList *reports, ID *id, bAction *act, const char group[], const char rna_path[], int array_index, eInsertKeyFlags UNUSED(flag)) { AnimData *adt = BKE_animdata_from_id(id); PointerRNA id_ptr, ptr; @@ -1767,7 +1767,8 @@ static int insert_key_button_exec(bContext *C, wmOperator *op) short success = 0; int index; const bool all = RNA_boolean_get(op->ptr, "all"); - short flag = 0; + eInsertKeyFlags flag = INSERTKEY_NOFLAGS; + /* flags for inserting keyframes */ flag = ANIM_get_keyframing_flags(scene, 1); diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 4279e3d202c..4e3c92f0dc4 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -54,6 +54,7 @@ struct PointerRNA; struct PropertyRNA; struct EnumPropertyItem; +#include "DNA_anim_types.h" #include "RNA_types.h" /* ************ Keyframing Management **************** */ @@ -91,14 +92,14 @@ void update_autoflags_fcurve(struct FCurve *fcu, struct bContext *C, struct Repo * Use this when validation of necessary animation data isn't necessary as it already * exists, and there is a beztriple that can be directly copied into the array. */ -int insert_bezt_fcurve(struct FCurve *fcu, const struct BezTriple *bezt, short flag); +int insert_bezt_fcurve(struct FCurve *fcu, const struct BezTriple *bezt, eInsertKeyFlags flag); /* Main Keyframing API call: * Use this when validation of necessary animation data isn't necessary as it * 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, char keytype, short flag); +int insert_vert_fcurve(struct FCurve *fcu, float x, float y, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag); /* -------- */ @@ -106,7 +107,7 @@ int insert_vert_fcurve(struct FCurve *fcu, float x, float y, char keytype, short * 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 ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, char keytype, short flag); +bool insert_keyframe_direct(struct ReportList *reports, struct PointerRNA ptr, struct PropertyRNA *prop, struct FCurve *fcu, float cfra, eBezTriple_KeyframeType keytype, eInsertKeyFlags flag); /* -------- */ @@ -114,12 +115,12 @@ bool insert_keyframe_direct(struct ReportList *reports, struct PointerRNA ptr, s * 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 ReportList *reports, struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, char keytype, short flag); +short insert_keyframe(struct ReportList *reports, struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, eBezTriple_KeyframeType keytype, 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 ReportList *reports, struct ID *id, struct bAction *act, const char group[], const char rna_path[], int array_index, float cfra, short flag); +short delete_keyframe(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 ********************** */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index 099d5da7c49..e6df276c44e 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -840,6 +840,7 @@ typedef enum eKS_Settings { /* Flags for use by keyframe creation/deletion calls */ typedef enum eInsertKeyFlags { + INSERTKEY_NOFLAGS = 0, INSERTKEY_NEEDED = (1<<0), /* only insert keyframes where they're needed */ INSERTKEY_MATRIX = (1<<1), /* insert 'visual' keyframes where possible/needed */ INSERTKEY_FAST = (1<<2), /* don't recalculate handles,etc. after adding key */ diff --git a/source/blender/makesdna/DNA_curve_types.h b/source/blender/makesdna/DNA_curve_types.h index 6a95865c11f..91b64b793c1 100644 --- a/source/blender/makesdna/DNA_curve_types.h +++ b/source/blender/makesdna/DNA_curve_types.h @@ -116,7 +116,7 @@ typedef struct BezTriple { char h1, h2; /* h1, h2: the handle type of the two handles */ char f1, f2, f3; /* f1, f2, f3: used for selection status */ - char hide; /* hide: used to indicate whether BezTriple is hidden (3D), type of keyframe (eBezTriple_KeyframeTypes) */ + char hide; /* hide: used to indicate whether BezTriple is hidden (3D), type of keyframe (eBezTriple_KeyframeType) */ char easing; /* easing: easing type for interpolation mode (eBezTriple_Easing) */ float back; /* BEZT_IPO_BACK */ -- cgit v1.2.3