Refactor: move BEZKEYTYPE define to DNA

Recently this was inlined [0] however the purpose of this define is to
allow for the method of setting the value to be changed.
It also means the hack doesn't have to be explained whenever it's used.

Move the BEZKEYTYPE to DNA, update it's doc-string and restore the
original comment.

[0]: fd3629b80a
This commit is contained in:
Campbell Barton 2023-12-14 11:20:27 +11:00
parent d8ffa648eb
commit 931b2554e2
3 changed files with 14 additions and 10 deletions

View File

@ -239,8 +239,9 @@ void initialize_bezt(BezTriple *beztr,
beztr->ipo = BEZT_IPO_LIN;
}
/* The keytype is hackily stored on the hide flag since that isn't used in animation. */
beztr->hide = settings.keyframe_type;
/* Set keyframe type value (supplied),
* which should come from the scene settings in most cases. */
BEZKEYTYPE(beztr) = settings.keyframe_type;
/* Set default values for "easing" interpolation mode settings.
* NOTE: Even if these modes aren't currently used, if users switch

View File

@ -957,12 +957,6 @@ float ANIM_unit_mapping_get_factor(Scene *scene, ID *id, FCurve *fcu, short flag
/** \name Utility macros
* \{ */
/**
* Provide access to Keyframe Type info in #BezTriple.
* NOTE: this is so that we can change it from being stored in 'hide'
*/
#define BEZKEYTYPE(bezt) ((bezt)->hide)
/**
* Set/Clear/Toggle macro.
* \param channel: Channel with a 'flag' member that we're setting.

View File

@ -88,8 +88,11 @@ typedef struct BezTriple {
/** F1, f2, f3: used for selection status. */
uint8_t f1, f2, f3;
/** Hide: used to indicate whether BezTriple is hidden (3D),
* type of keyframe (eBezTriple_KeyframeType). */
/**
* Hide is used to indicate whether BezTriple is hidden (3D).
*
* \warning For #FCurve this is used to store the key-type, see #BEZKEYTYPE.
*/
char hide;
/** Easing: easing type for interpolation mode (eBezTriple_Easing). */
@ -104,6 +107,12 @@ typedef struct BezTriple {
char _pad[3];
} BezTriple;
/**
* Provide access to Keyframe Type info #eBezTriple_KeyframeType in #BezTriple::hide.
* \note this is so that we can change it to another location.
*/
#define BEZKEYTYPE(bezt) ((bezt)->hide)
/**
* \note #BPoint.tilt location in struct is abused by Key system.
*/