Animation Editors - Moved the code for drawing the filtering toggles into a single function.
This commit is contained in:
@@ -55,6 +55,7 @@
|
||||
|
||||
#include "ED_anim_api.h"
|
||||
#include "ED_keyframes_edit.h"
|
||||
#include "ED_types.h"
|
||||
#include "ED_util.h"
|
||||
|
||||
#include "WM_api.h"
|
||||
@@ -316,3 +317,52 @@ void ANIM_nla_mapping_apply_fcurve (AnimData *adt, FCurve *fcu, short restore, s
|
||||
}
|
||||
|
||||
/* *************************************************** */
|
||||
/* ANIMATION EDITOR UI-WIDGETS */
|
||||
|
||||
/* ui button event */
|
||||
#define B_REDR 1
|
||||
|
||||
/* standard header buttons for Animation Editors */
|
||||
short ANIM_headerUI_standard_buttons (const bContext *C, bDopeSheet *ads, uiBlock *block, short xco, short yco)
|
||||
{
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA));
|
||||
|
||||
/* check if the DopeSheet data exists, just in case... */
|
||||
if (ads) {
|
||||
/* more 'generic' filtering options */
|
||||
if (nlaActive) uiBlockBeginAlign(block);
|
||||
uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Only display selected Objects");
|
||||
if (nlaActive) uiDefIconButBitI(block, TOGN, ADS_FILTER_NLA_NOACT, B_REDR, ICON_ACTION, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Include AnimData blocks with no NLA Data");
|
||||
if (nlaActive) uiBlockEndAlign(block);
|
||||
xco += 5;
|
||||
|
||||
/* datatype based */
|
||||
// TODO: only show the datablocks which exist
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Scene Animation");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display World Animation");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Material Data");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Lamp Data");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Camera Data");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Curve Data");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display MetaBall Data");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Armature Data");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Particle Data");
|
||||
uiBlockEndAlign(block);
|
||||
xco += 30;
|
||||
}
|
||||
else {
|
||||
// XXX this case shouldn't happen at all... for now, just pad out same amount of space
|
||||
printf("ERROR: dopesheet data not available when drawing Animation Editor header \n");
|
||||
xco += 11*XIC + 30;
|
||||
}
|
||||
|
||||
// TODO: include auto-snapping menu here too...
|
||||
|
||||
/* return the width of the buttons */
|
||||
return xco;
|
||||
}
|
||||
|
||||
/* *************************************************** */
|
||||
|
||||
@@ -42,11 +42,14 @@ struct View2D;
|
||||
struct Scene;
|
||||
struct Object;
|
||||
|
||||
struct bDopeSheet;
|
||||
|
||||
struct bActionGroup;
|
||||
struct FCurve;
|
||||
struct FModifier;
|
||||
|
||||
struct uiBlock;
|
||||
struct uiLayout;
|
||||
|
||||
/* ************************************************ */
|
||||
/* ANIMATION CHANNEL FILTERING */
|
||||
@@ -394,11 +397,14 @@ void ANIM_draw_cfra(const struct bContext *C, struct View2D *v2d, short flag);
|
||||
/* main call to draw preview range curtains */
|
||||
void ANIM_draw_previewrange(const struct bContext *C, struct View2D *v2d);
|
||||
|
||||
/* ------------- Preview Range Drawing -------------- */
|
||||
|
||||
/* standard header buttons for Animation Editors */
|
||||
short ANIM_headerUI_standard_buttons(const struct bContext *C, struct bDopeSheet *ads, struct uiBlock *block, short xco, short yco);
|
||||
|
||||
/* ************************************************* */
|
||||
/* F-MODIFIER TOOLS */
|
||||
|
||||
struct uiLayout;
|
||||
|
||||
/* draw a given F-Modifier for some layout/UI-Block */
|
||||
void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
|
||||
|
||||
|
||||
@@ -336,24 +336,7 @@ void action_header_buttons(const bContext *C, ARegion *ar)
|
||||
/* FILTERING OPTIONS */
|
||||
xco -= 10;
|
||||
|
||||
//uiBlockBeginAlign(block);
|
||||
uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Only display selected Objects");
|
||||
//uiBlockEndAlign(block);
|
||||
xco += 5;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Scene Animation");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display World Animation");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display ShapeKeys");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Materials");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Lamps");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Cameras");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Curves");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display MetaBalls");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Armature/Bone");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(saction->ads.filterflag), 0, 0, 0, 0, "Display Particles");
|
||||
uiBlockEndAlign(block);
|
||||
xco += 30;
|
||||
xco= ANIM_headerUI_standard_buttons(C, &saction->ads, block, xco, yco);
|
||||
}
|
||||
else if (saction->mode == SACTCONT_ACTION) {
|
||||
uiLayout *layout;
|
||||
|
||||
@@ -298,30 +298,7 @@ void graph_header_buttons(const bContext *C, ARegion *ar)
|
||||
xco+= 120;
|
||||
|
||||
/* filtering buttons */
|
||||
if (sipo->ads) {
|
||||
//uiBlockBeginAlign(block);
|
||||
uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Only display selected Objects");
|
||||
//uiBlockEndAlign(block);
|
||||
xco += 5;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Scene Animation");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display World Animation");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Materials");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Lamps");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Cameras");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Curves");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display MetaBalls");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOARM, B_REDR, ICON_ARMATURE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Armature/Bone data");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(sipo->ads->filterflag), 0, 0, 0, 0, "Display Particles");
|
||||
uiBlockEndAlign(block);
|
||||
xco += 30;
|
||||
}
|
||||
else {
|
||||
// XXX this case shouldn't happen at all... for now, just pad out same amount of space
|
||||
xco += 10*XIC + 30;
|
||||
}
|
||||
xco= ANIM_headerUI_standard_buttons(C, sipo->ads, block, xco, yco);
|
||||
|
||||
/* auto-snap selector */
|
||||
if (sipo->flag & SIPO_DRAWTIME) {
|
||||
|
||||
@@ -289,7 +289,6 @@ int graphop_active_fcurve_poll (bContext *C)
|
||||
int graphop_selected_fcurve_poll (bContext *C)
|
||||
{
|
||||
bAnimContext ac;
|
||||
bAnimListElem *ale;
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ScrArea *sa= CTX_wm_area(C);
|
||||
int filter, items;
|
||||
|
||||
@@ -246,31 +246,7 @@ void nla_header_buttons(const bContext *C, ARegion *ar)
|
||||
uiBlockSetEmboss(block, UI_EMBOSS);
|
||||
|
||||
/* filtering buttons */
|
||||
if (snla->ads) {
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconButBitI(block, TOG, ADS_FILTER_ONLYSEL, B_REDR, ICON_RESTRICT_SELECT_OFF, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Only display selected Objects");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NLA_NOACT, B_REDR, ICON_ACTION, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Include AnimData blocks with no NLA Data");
|
||||
uiBlockEndAlign(block);
|
||||
xco += 5;
|
||||
|
||||
uiBlockBeginAlign(block);
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Scene Animation");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display World Animation");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMAT, B_REDR, ICON_MATERIAL_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Materials");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOLAM, B_REDR, ICON_LAMP_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Lamps");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCAM, B_REDR, ICON_CAMERA_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Cameras");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOCUR, B_REDR, ICON_CURVE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Curves");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOMBA, B_REDR, ICON_META_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display MetaBalls");
|
||||
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOPART, B_REDR, ICON_PARTICLE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(snla->ads->filterflag), 0, 0, 0, 0, "Display Particles");
|
||||
uiBlockEndAlign(block);
|
||||
xco += 15;
|
||||
}
|
||||
else {
|
||||
// XXX this case shouldn't happen at all... for now, just pad out same amount of space
|
||||
xco += 10*XIC + 15;
|
||||
}
|
||||
xco += (XIC + 8);
|
||||
xco= ANIM_headerUI_standard_buttons(C, snla->ads, block, xco, yco);
|
||||
|
||||
/* auto-snap selector */
|
||||
if (snla->flag & SNLA_DRAWTIME) {
|
||||
|
||||
@@ -433,7 +433,7 @@ typedef enum DOPESHEET_FILTERFLAG {
|
||||
ADS_FILTER_NLA_NOACT = (1<<20), /* if the AnimData block has no NLA data, don't include to just show Action-line */
|
||||
|
||||
/* combination filters (some only used at runtime) */
|
||||
ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM|ADS_FILTER_NOMAT|ADS_FILTER_NOLAM|ADS_FILTER_NOCUR|ADS_FILTER_NOPART),
|
||||
ADS_FILTER_NOOBDATA = (ADS_FILTER_NOCAM|ADS_FILTER_NOMAT|ADS_FILTER_NOLAM|ADS_FILTER_NOCUR|ADS_FILTER_NOPART|ADS_FILTER_NOARM),
|
||||
} DOPESHEET_FILTERFLAG;
|
||||
|
||||
/* DopeSheet general flags */
|
||||
|
||||
Reference in New Issue
Block a user