From b257acfed11e8d98eb7c86e0908acf80fb9e27af Mon Sep 17 00:00:00 2001 From: Joshua Leung Date: Sun, 16 Aug 2009 02:21:43 +0000 Subject: Animation Editors: Code Cleanups (for Channel Lists) Part 2 Now the mute/protect/expand/etc. toggles are drawn using UI widgets. This means that special event handling code to determine when they were clicked on is no longer needed, and also means that there can now be tooltips for these items too. Also, added visibility toggles for ID-block expanders, which will cause all the F-Curves in the linked datablock to not get drawn. The backend filtering code to make this work will come later... --- source/blender/editors/space_nla/nla_channels.c | 187 ++---------------------- 1 file changed, 9 insertions(+), 178 deletions(-) (limited to 'source/blender/editors/space_nla/nla_channels.c') diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index ab918519ec0..063b329b7a1 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -89,6 +89,7 @@ * part of the channel is relevant. * * NOTE: eventually, this should probably be phased out when many of these things are replaced with buttons + * --> Most channels are now selection only... */ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, short selectmode) @@ -118,32 +119,17 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho case ANIMTYPE_SCENE: { Scene *sce= (Scene *)ale->data; - AnimData *adt= ale->data; - if (x < 16) { - /* toggle expand */ - sce->flag ^= SCE_DS_COLLAPSED; - - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - - notifierFlags |= ND_ANIMCHAN_EDIT; + /* set selection status */ + if (selectmode == SELECT_INVERT) { + /* swap select */ + sce->flag ^= SCE_DS_SELECTED; } else { - /* set selection status */ - if (selectmode == SELECT_INVERT) { - /* swap select */ - sce->flag ^= SCE_DS_SELECTED; - } - else { - sce->flag |= SCE_DS_SELECTED; - } - - notifierFlags |= ND_ANIMCHAN_SELECT; + sce->flag |= SCE_DS_SELECTED; } + + notifierFlags |= ND_ANIMCHAN_SELECT; } break; case ANIMTYPE_OBJECT: @@ -152,20 +138,8 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho Scene *sce= (Scene *)ads->source; Base *base= (Base *)ale->data; Object *ob= base->object; - AnimData *adt= ale->adt; - if (x < 16) { - /* toggle expand */ - ob->nlaflag ^= OB_ADS_COLLAPSED; // XXX - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - - notifierFlags |= ND_ANIMCHAN_EDIT; - } - else if (nlaedit_is_tweakmode_on(ac) == 0) { + if (nlaedit_is_tweakmode_on(ac) == 0) { /* set selection status */ if (selectmode == SELECT_INVERT) { /* swap select */ @@ -194,149 +168,6 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho } } break; - case ANIMTYPE_FILLMATD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWMATS; // XXX - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_FILLPARTD: - { - Object *ob= (Object *)ale->data; - ob->nlaflag ^= OB_ADS_SHOWPARTS; // XXX - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - - case ANIMTYPE_DSMAT: - { - Material *ma= (Material *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - ma->flag ^= MA_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSLAM: - { - Lamp *la= (Lamp *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - la->flag ^= LA_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSCAM: - { - Camera *ca= (Camera *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - ca->flag ^= CAM_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSCUR: - { - Curve *cu= (Curve *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - cu->flag ^= CU_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSSKEY: - { - Key *key= (Key *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - key->flag ^= KEYBLOCK_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSWOR: - { - World *wo= (World *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - wo->flag ^= WO_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSPART: - { - ParticleSettings *part= (ParticleSettings *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - part->flag ^= PART_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; - case ANIMTYPE_DSMBALL: - { - MetaBall *mb= (MetaBall *)ale->data; - AnimData *adt= ale->adt; - - if ( (adt) && (x >= (NLACHANNEL_NAMEWIDTH-NLACHANNEL_BUTTON_WIDTH)) ) { - /* toggle mute */ - adt->flag ^= ADT_NLA_EVAL_OFF; - } - else { - /* toggle expand */ - mb->flag2 ^= MB_DS_EXPAND; - } - notifierFlags |= ND_ANIMCHAN_EDIT; - } - break; case ANIMTYPE_NLATRACK: { -- cgit v1.2.3