forked from bartvdbraak/blender
2.5 - Animation Editors - Filtering API
Brought back the Filtering API for Animation Editors. This is the 'backbone' of the current Action/Dopesheet Editor code, so it is essential to have this working.
This commit is contained in:
parent
62f4d2884c
commit
e2cca3320a
File diff suppressed because it is too large
Load Diff
@ -2100,7 +2100,7 @@ short ipo_frame_has_keyframe (Ipo *ipo, float frame, short filter)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* if only check non-muted, check if muted */
|
/* if only check non-muted, check if muted */
|
||||||
if ((filter & ANIMFILTER_MUTED) || (ipo->muteipo))
|
if ((filter & ANIMFILTER_KEYS_MUTED) || (ipo->muteipo))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* loop over IPO-curves, using binary-search to try to find matches
|
/* loop over IPO-curves, using binary-search to try to find matches
|
||||||
@ -2110,7 +2110,7 @@ short ipo_frame_has_keyframe (Ipo *ipo, float frame, short filter)
|
|||||||
/* only check if there are keyframes (currently only of type BezTriple) */
|
/* only check if there are keyframes (currently only of type BezTriple) */
|
||||||
if (icu->bezt) {
|
if (icu->bezt) {
|
||||||
/* we either include all regardless of muting, or only non-muted */
|
/* we either include all regardless of muting, or only non-muted */
|
||||||
if ((filter & ANIMFILTER_MUTED) || (icu->flag & IPO_MUTE)==0) {
|
if ((filter & ANIMFILTER_KEYS_MUTED) || (icu->flag & IPO_MUTE)==0) {
|
||||||
short replace = -1;
|
short replace = -1;
|
||||||
int i = binarysearch_bezt_index(icu->bezt, frame, icu->totvert, &replace);
|
int i = binarysearch_bezt_index(icu->bezt, frame, icu->totvert, &replace);
|
||||||
|
|
||||||
@ -2146,7 +2146,7 @@ short action_frame_has_keyframe (bAction *act, float frame, short filter)
|
|||||||
/* we either include all regardless of muting, or only non-muted
|
/* we either include all regardless of muting, or only non-muted
|
||||||
* - here we include 'hidden' channels in the muted definition
|
* - here we include 'hidden' channels in the muted definition
|
||||||
*/
|
*/
|
||||||
if ((filter & ANIMFILTER_MUTED) || (achan->flag & ACHAN_HIDDEN)==0) {
|
if ((filter & ANIMFILTER_KEYS_MUTED) || (achan->flag & ACHAN_HIDDEN)==0) {
|
||||||
if (ipo_frame_has_keyframe(achan->ipo, frame, filter))
|
if (ipo_frame_has_keyframe(achan->ipo, frame, filter))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -2176,7 +2176,7 @@ short object_frame_has_keyframe (Object *ob, float frame, short filter)
|
|||||||
/* priority check here goes to pose-channel checks (for armatures) */
|
/* priority check here goes to pose-channel checks (for armatures) */
|
||||||
if ((ob->pose) && (ob->flag & OB_POSEMODE)) {
|
if ((ob->pose) && (ob->flag & OB_POSEMODE)) {
|
||||||
/* only relevant check here is to only show active... */
|
/* only relevant check here is to only show active... */
|
||||||
if (filter & ANIMFILTER_ACTIVE) {
|
if (filter & ANIMFILTER_KEYS_ACTIVE) {
|
||||||
bPoseChannel *pchan= get_active_posechannel(ob);
|
bPoseChannel *pchan= get_active_posechannel(ob);
|
||||||
bActionChannel *achan= (pchan) ? get_action_channel(ob->action, pchan->name) : NULL;
|
bActionChannel *achan= (pchan) ? get_action_channel(ob->action, pchan->name) : NULL;
|
||||||
|
|
||||||
@ -2196,7 +2196,7 @@ short object_frame_has_keyframe (Object *ob, float frame, short filter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* try shapekey keyframes (if available, and allowed by filter) */
|
/* try shapekey keyframes (if available, and allowed by filter) */
|
||||||
if ( !(filter & ANIMFILTER_LOCAL) && !(filter & ANIMFILTER_NOSKEY) ) {
|
if ( !(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY) ) {
|
||||||
Key *key= ob_get_key(ob);
|
Key *key= ob_get_key(ob);
|
||||||
|
|
||||||
/* shapekeys can have keyframes ('Relative Shape Keys')
|
/* shapekeys can have keyframes ('Relative Shape Keys')
|
||||||
@ -2212,9 +2212,9 @@ short object_frame_has_keyframe (Object *ob, float frame, short filter)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* try materials */
|
/* try materials */
|
||||||
if ( !(filter & ANIMFILTER_LOCAL) && !(filter & ANIMFILTER_NOMAT) ) {
|
if ( !(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOMAT) ) {
|
||||||
/* if only active, then we can skip a lot of looping */
|
/* if only active, then we can skip a lot of looping */
|
||||||
if (filter & ANIMFILTER_ACTIVE) {
|
if (filter & ANIMFILTER_KEYS_ACTIVE) {
|
||||||
Material *ma= give_current_material(ob, (ob->actcol + 1));
|
Material *ma= give_current_material(ob, (ob->actcol + 1));
|
||||||
|
|
||||||
/* we only retrieve the active material... */
|
/* we only retrieve the active material... */
|
||||||
|
@ -122,17 +122,63 @@ typedef enum eAnimCont_Types {
|
|||||||
/* filtering flags - under what circumstances should a channel be added */
|
/* filtering flags - under what circumstances should a channel be added */
|
||||||
// XXX was ACTFILTER_*
|
// XXX was ACTFILTER_*
|
||||||
typedef enum eAnimFilter_Flags {
|
typedef enum eAnimFilter_Flags {
|
||||||
ALEFILTER_VISIBLE = (1<<0), /* should channels be visible */
|
ANIMFILTER_VISIBLE = (1<<0), /* should channels be visible */
|
||||||
ALEFILTER_SEL = (1<<1), /* should channels be selected */
|
ANIMFILTER_SEL = (1<<1), /* should channels be selected */
|
||||||
ALEFILTER_FOREDIT = (1<<2), /* does editable status matter */
|
ANIMFILTER_FOREDIT = (1<<2), /* does editable status matter */
|
||||||
ALEFILTER_CHANNELS = (1<<3), /* do we only care that it is a channel */
|
ANIMFILTER_CHANNELS = (1<<3), /* do we only care that it is a channel */
|
||||||
ALEFILTER_IPOKEYS = (1<<4), /* only channels referencing ipo's */
|
ANIMFILTER_IPOKEYS = (1<<4), /* only channels referencing ipo's */
|
||||||
ALEFILTER_ONLYICU = (1<<5), /* only reference ipo-curves */
|
ANIMFILTER_ONLYICU = (1<<5), /* only reference ipo-curves */
|
||||||
ALEFILTER_FORDRAWING = (1<<6), /* make list for interface drawing */
|
ANIMFILTER_FORDRAWING = (1<<6), /* make list for interface drawing */
|
||||||
ALEFILTER_ACTGROUPED = (1<<7), /* belongs to the active actiongroup */
|
ANIMFILTER_ACTGROUPED = (1<<7), /* belongs to the active actiongroup */
|
||||||
} eAnimFilter_Flags;
|
} eAnimFilter_Flags;
|
||||||
|
|
||||||
|
|
||||||
|
/* ---------- Flag Checking Macros ------------ */
|
||||||
|
|
||||||
|
/* Dopesheet only */
|
||||||
|
/* 'Object' channels */
|
||||||
|
#define SEL_OBJC(base) ((base->flag & SELECT))
|
||||||
|
#define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED)==0)
|
||||||
|
/* 'Sub-object' channels (flags stored in Object block) */
|
||||||
|
#define FILTER_IPO_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWIPO))
|
||||||
|
#define FILTER_CON_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWCONS))
|
||||||
|
#define FILTER_MAT_OBJC(ob) ((ob->nlaflag & OB_ADS_SHOWMATS))
|
||||||
|
/* 'Sub-object' channels (flags stored in Data block) */
|
||||||
|
#define FILTER_SKE_OBJD(key) ((key->flag & KEYBLOCK_DS_EXPAND))
|
||||||
|
#define FILTER_MAT_OBJD(ma) ((ma->flag & MA_DS_EXPAND))
|
||||||
|
#define FILTER_LAM_OBJD(la) ((la->flag & LA_DS_EXPAND))
|
||||||
|
#define FILTER_CAM_OBJD(ca) ((ca->flag & CAM_DS_EXPAND))
|
||||||
|
#define FILTER_CUR_OBJD(cu) ((cu->flag & CU_DS_EXPAND))
|
||||||
|
/* 'Sub-object/Action' channels (flags stored in Action) */
|
||||||
|
#define SEL_ACTC(actc) ((actc->flag & ACTC_SELECTED))
|
||||||
|
#define EXPANDED_ACTC(actc) ((actc->flag & ACTC_EXPANDED))
|
||||||
|
|
||||||
|
/* Actions (also used for Dopesheet) */
|
||||||
|
/* Action Channel Group */
|
||||||
|
#define EDITABLE_AGRP(agrp) ((agrp->flag & AGRP_PROTECTED)==0)
|
||||||
|
#define EXPANDED_AGRP(agrp) (agrp->flag & AGRP_EXPANDED)
|
||||||
|
#define SEL_AGRP(agrp) ((agrp->flag & AGRP_SELECTED) || (agrp->flag & AGRP_ACTIVE))
|
||||||
|
/* Action Channel Settings */
|
||||||
|
#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
|
||||||
|
#define EDITABLE_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && ((achan->flag & ACHAN_PROTECTED)==0))
|
||||||
|
#define EXPANDED_ACHAN(achan) ((VISIBLE_ACHAN(achan)) && (achan->flag & ACHAN_EXPANDED))
|
||||||
|
#define SEL_ACHAN(achan) ((achan->flag & ACHAN_SELECTED) || (achan->flag & ACHAN_HILIGHTED))
|
||||||
|
#define FILTER_IPO_ACHAN(achan) ((achan->flag & ACHAN_SHOWIPO))
|
||||||
|
#define FILTER_CON_ACHAN(achan) ((achan->flag & ACHAN_SHOWCONS))
|
||||||
|
/* Constraint Channel Settings */
|
||||||
|
#define EDITABLE_CONCHAN(conchan) ((conchan->flag & CONSTRAINT_CHANNEL_PROTECTED)==0)
|
||||||
|
#define SEL_CONCHAN(conchan) (conchan->flag & CONSTRAINT_CHANNEL_SELECT)
|
||||||
|
/* IPO Curve Channels */
|
||||||
|
#define EDITABLE_ICU(icu) ((icu->flag & IPO_PROTECT)==0)
|
||||||
|
#define SEL_ICU(icu) (icu->flag & IPO_SELECT)
|
||||||
|
|
||||||
|
/* Grease Pencil only */
|
||||||
|
/* Grease Pencil datablock settings */
|
||||||
|
#define EXPANDED_GPD(gpd) (gpd->flag & GP_DATA_EXPAND)
|
||||||
|
/* Grease Pencil Layer settings */
|
||||||
|
#define EDITABLE_GPL(gpl) ((gpl->flag & GP_LAYER_LOCKED)==0)
|
||||||
|
#define SEL_GPL(gpl) ((gpl->flag & GP_LAYER_ACTIVE) || (gpl->flag & GP_LAYER_SELECT))
|
||||||
|
|
||||||
/* ---------------- API -------------------- */
|
/* ---------------- API -------------------- */
|
||||||
|
|
||||||
/* Obtain list of filtered Animation channels to operate on */
|
/* Obtain list of filtered Animation channels to operate on */
|
||||||
|
@ -122,13 +122,13 @@ short id_frame_has_keyframe(struct ID *id, float frame, short filter);
|
|||||||
*/
|
*/
|
||||||
enum {
|
enum {
|
||||||
/* general */
|
/* general */
|
||||||
ANIMFILTER_LOCAL = (1<<0), /* only include locally available anim data */
|
ANIMFILTER_KEYS_LOCAL = (1<<0), /* only include locally available anim data */
|
||||||
ANIMFILTER_MUTED = (1<<1), /* include muted elements */
|
ANIMFILTER_KEYS_MUTED = (1<<1), /* include muted elements */
|
||||||
ANIMFILTER_ACTIVE = (1<<2), /* only include active-subelements */
|
ANIMFILTER_KEYS_ACTIVE = (1<<2), /* only include active-subelements */
|
||||||
|
|
||||||
/* object specific */
|
/* object specific */
|
||||||
ANIMFILTER_NOMAT = (1<<9), /* don't include material keyframes */
|
ANIMFILTER_KEYS_NOMAT = (1<<9), /* don't include material keyframes */
|
||||||
ANIMFILTER_NOSKEY = (1<<10), /* don't include shape keys (for geometry) */
|
ANIMFILTER_KEYS_NOSKEY = (1<<10), /* don't include shape keys (for geometry) */
|
||||||
} eAnimFilterFlags;
|
} eAnimFilterFlags;
|
||||||
|
|
||||||
#endif /* BIF_KEYFRAMING_H */
|
#endif /* BIF_KEYFRAMING_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user