diff options
author | Joshua Leung <aligorith@gmail.com> | 2009-07-28 11:24:25 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2009-07-28 11:24:25 +0400 |
commit | 17b0a794c7b72b9e18c029c4892b49dc9a381363 (patch) | |
tree | 586e089ae51e4a7f1cadce8583c98b176383f77a /source | |
parent | 61178b19eabdc3e3833c167cdc8128db8994f9ca (diff) |
NLA: Mute/Disable NLA Playback
Exposed toggles (defined on AnimData) that will mute the evaluation of that AnimData block's NLA stack. It's active action will then be the only thing that gets evaluated.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_channels.c | 91 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_draw.c | 85 |
3 files changed, 185 insertions, 9 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index 2e755a360fa..5970cf481ac 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -459,6 +459,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= sce; ale->datatype= ALE_SCE; + + ale->adt= BKE_animdata_from_id(data); } break; case ANIMTYPE_OBJECT: @@ -470,6 +472,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= ob; ale->datatype= ALE_OB; + + ale->adt= BKE_animdata_from_id(&ob->id); } break; case ANIMTYPE_FILLACTD: @@ -523,6 +527,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= (adt) ? adt->action : NULL; ale->datatype= ALE_ACT; + + ale->adt= BKE_animdata_from_id(data); } break; case ANIMTYPE_DSLAM: @@ -534,6 +540,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= (adt) ? adt->action : NULL; ale->datatype= ALE_ACT; + + ale->adt= BKE_animdata_from_id(data); } break; case ANIMTYPE_DSCAM: @@ -545,6 +553,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= (adt) ? adt->action : NULL; ale->datatype= ALE_ACT; + + ale->adt= BKE_animdata_from_id(data); } break; case ANIMTYPE_DSCUR: @@ -556,6 +566,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= (adt) ? adt->action : NULL; ale->datatype= ALE_ACT; + + ale->adt= BKE_animdata_from_id(data); } break; case ANIMTYPE_DSSKEY: @@ -567,6 +579,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= (adt) ? adt->action : NULL; ale->datatype= ALE_ACT; + + ale->adt= BKE_animdata_from_id(data); } break; case ANIMTYPE_DSWOR: @@ -578,6 +592,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= (adt) ? adt->action : NULL; ale->datatype= ALE_ACT; + + ale->adt= BKE_animdata_from_id(data); } break; case ANIMTYPE_DSPART: @@ -589,6 +605,8 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s ale->key_data= (adt) ? adt->action : NULL; ale->datatype= ALE_ACT; + + ale->adt= BKE_animdata_from_id(data); } break; diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c index fae6d8ecd8b..98dacc8ef5b 100644 --- a/source/blender/editors/space_nla/nla_channels.c +++ b/source/blender/editors/space_nla/nla_channels.c @@ -117,6 +117,7 @@ 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 */ @@ -124,6 +125,12 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho 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 { /* set selection status */ if (selectmode == SELECT_INVERT) { @@ -144,12 +151,19 @@ 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) { /* set selection status */ if (selectmode == SELECT_INVERT) { @@ -197,49 +211,112 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho case ANIMTYPE_DSMAT: { Material *ma= (Material *)ale->data; - ma->flag ^= MA_DS_EXPAND; + 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; - la->flag ^= LA_DS_EXPAND; + 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; - ca->flag ^= CAM_DS_EXPAND; + 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; - cu->flag ^= CU_DS_EXPAND; + 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; - key->flag ^= KEYBLOCK_DS_EXPAND; + 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; - wo->flag ^= WO_DS_EXPAND; + 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; - part->flag ^= PART_DS_EXPAND; + 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; diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index d36cc32fa84..3feefcc11ab 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -638,6 +638,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) case ANIMTYPE_SCENE: /* scene */ { Scene *sce= (Scene *)ale->data; + AnimData *adt= ale->adt; group= 4; indent= 0; @@ -649,6 +650,14 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) expand= ICON_TRIA_DOWN; else expand= ICON_TRIA_RIGHT; + + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } sel = SEL_SCEC(sce); strcpy(name, sce->id.name+2); @@ -658,6 +667,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) { Base *base= (Base *)ale->data; Object *ob= base->object; + AnimData *adt= ale->adt; group= 4; indent= 0; @@ -674,6 +684,14 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) else expand= ICON_TRIA_RIGHT; + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } + sel = SEL_OBJC(base); strcpy(name, ob->id.name+2); } @@ -706,7 +724,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) expand = ICON_TRIA_DOWN; else expand = ICON_TRIA_RIGHT; - + strcpy(name, "Particles"); } break; @@ -715,6 +733,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) case ANIMTYPE_DSMAT: /* single material (dopesheet) expand widget */ { Material *ma = (Material *)ale->data; + AnimData *adt= ale->adt; group = 0; indent = 0; @@ -725,6 +744,14 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) expand = ICON_TRIA_DOWN; else expand = ICON_TRIA_RIGHT; + + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } strcpy(name, ma->id.name+2); } @@ -732,6 +759,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) case ANIMTYPE_DSLAM: /* lamp (dopesheet) expand widget */ { Lamp *la = (Lamp *)ale->data; + AnimData *adt= ale->adt; group = 4; indent = 1; @@ -741,6 +769,14 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) expand = ICON_TRIA_DOWN; else expand = ICON_TRIA_RIGHT; + + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } strcpy(name, la->id.name+2); } @@ -748,6 +784,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) case ANIMTYPE_DSCAM: /* camera (dopesheet) expand widget */ { Camera *ca = (Camera *)ale->data; + AnimData *adt= ale->adt; group = 4; indent = 1; @@ -757,6 +794,14 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) expand = ICON_TRIA_DOWN; else expand = ICON_TRIA_RIGHT; + + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } strcpy(name, ca->id.name+2); } @@ -764,6 +809,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) case ANIMTYPE_DSCUR: /* curve (dopesheet) expand widget */ { Curve *cu = (Curve *)ale->data; + AnimData *adt= ale->adt; group = 4; indent = 1; @@ -773,6 +819,14 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) expand = ICON_TRIA_DOWN; else expand = ICON_TRIA_RIGHT; + + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } strcpy(name, cu->id.name+2); } @@ -780,16 +834,25 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) case ANIMTYPE_DSSKEY: /* shapekeys (dopesheet) expand widget */ { Key *key= (Key *)ale->data; + AnimData *adt= ale->adt; group = 4; indent = 1; - special = ICON_SHAPEKEY_DATA; // XXX + special = ICON_SHAPEKEY_DATA; if (FILTER_SKE_OBJD(key)) expand = ICON_TRIA_DOWN; else expand = ICON_TRIA_RIGHT; + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } + //sel = SEL_OBJC(base); strcpy(name, "Shape Keys"); } @@ -797,6 +860,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) case ANIMTYPE_DSWOR: /* world (dopesheet) expand widget */ { World *wo= (World *)ale->data; + AnimData *adt= ale->adt; group = 4; indent = 1; @@ -806,6 +870,14 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) expand = ICON_TRIA_DOWN; else expand = ICON_TRIA_RIGHT; + + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } strcpy(name, wo->id.name+2); } @@ -813,6 +885,7 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) case ANIMTYPE_DSPART: /* particle (dopesheet) expand widget */ { ParticleSettings *part= (ParticleSettings*)ale->data; + AnimData *adt= ale->adt; group = 0; indent = 0; @@ -823,6 +896,14 @@ void draw_nla_channel_list (bAnimContext *ac, SpaceNla *snla, ARegion *ar) expand = ICON_TRIA_DOWN; else expand = ICON_TRIA_RIGHT; + + /* NLA evaluation on/off button */ + if (adt) { + if (adt->flag & ADT_NLA_EVAL_OFF) + mute = ICON_MUTE_IPO_ON; + else + mute = ICON_MUTE_IPO_OFF; + } strcpy(name, part->id.name+2); } |