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); }