Bugfix: (2nd part of bug #5393)

Action Channel 'protecting' now works for the NLA editor. Action
channels in the active action that are 'protected' cannot get
transformed, duplicated, or deleted in the NLA editor.
This commit is contained in:
Joshua Leung
2006-12-10 05:52:51 +00:00
parent b17ac64640
commit c9b23feaf5
3 changed files with 43 additions and 20 deletions

View File

@@ -50,6 +50,10 @@
#define SLIDERWIDTH 125
#define ACTWIDTH (G.saction->actwidth)
#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
#define EDITABLE_ACHAN(achan) (((achan->flag & ACHAN_HIDDEN)==0) && ((achan->flag & ACHAN_PROTECTED)==0))
#define EDITABLE_CONCHAN(conchan) ((conchan->flag & CONSTRAINT_CHANNEL_PROTECTED)==0)
#define CHANNEL_FILTER_LOC 0x00000001 /* Show location keys */
#define CHANNEL_FILTER_ROT 0x00000002 /* Show rotation keys */
#define CHANNEL_FILTER_SIZE 0x00000004 /* Show size keys */

View File

@@ -98,10 +98,6 @@
/* Useful macros ----------------------------------------------- */
#define BEZSELECTED(bezt) (((bezt)->f1 & 1) || ((bezt)->f2 & 1) || ((bezt)->f3 & 1))
#define VISIBLE_ACHAN(achan) ((achan->flag & ACHAN_HIDDEN)==0)
#define EDITABLE_ACHAN(achan) (((achan->flag & ACHAN_HIDDEN)==0) && ((achan->flag & ACHAN_PROTECTED)==0))
#define EDITABLE_CONCHAN(conchan) ((conchan->flag & CONSTRAINT_CHANNEL_PROTECTED)==0)
/* Local Function prototypes, are forward needed */
static void hilight_channel (bAction *act, bActionChannel *chan, short hilight);
@@ -1734,10 +1730,12 @@ static void mouse_actionchannels_protect (bAction *act, short *mval)
if ( clickmin <= 0) {
/* invert the channel's protect property */
lock = (achan->flag & ACHAN_PROTECTED);
if (lock)
if (lock) {
achan->flag &= ~ACHAN_PROTECTED;
else
}
else {
achan->flag |= ACHAN_PROTECTED;
}
}
--clickmin;
--clickmax;

View File

@@ -71,6 +71,7 @@
#include "BIF_editview.h"
#include "BIF_toolbox.h"
#include "BIF_editnla.h"
#include "BIF_editaction.h"
#include "BSE_editipo.h"
#include "BSE_editnla_types.h"
@@ -328,6 +329,11 @@ static void convert_nla(short mval[2])
/* Area that encloses object name (or ipo) */
ymin=ymax-(NLACHANNELHEIGHT+NLACHANNELSKIP);
/* skip if object collapsed */
if (base->object->nlaflag & OB_NLA_COLLAPSED)
continue;
ymax=ymin;
/* Check action ipo */
@@ -768,13 +774,17 @@ void transform_nlachannel_keys(int mode, int dummy)
if(strip==NULL) {
for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
i= fullselect_ipo_keys(chan->ipo);
if(i) base->flag |= BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA;
tvtot+=i;
if (EDITABLE_ACHAN(chan)) {
i= fullselect_ipo_keys(chan->ipo);
if(i) base->flag |= BA_HAS_RECALC_OB|BA_HAS_RECALC_DATA;
tvtot+=i;
}
/* Check action constraint ipos */
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
tvtot+=fullselect_ipo_keys(conchan->ipo);
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
if (EDITABLE_CONCHAN(conchan))
tvtot+=fullselect_ipo_keys(conchan->ipo);
}
}
}
}
@@ -819,11 +829,14 @@ void transform_nlachannel_keys(int mode, int dummy)
if(strip==NULL) {
for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
tvtot=add_trans_ipo_keys(chan->ipo, tv, tvtot);
if (EDITABLE_ACHAN(chan))
tvtot=add_trans_ipo_keys(chan->ipo, tv, tvtot);
/* Manipulate action constraint ipos */
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
tvtot=add_trans_ipo_keys(conchan->ipo, tv, tvtot);
for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
if (EDITABLE_CONCHAN(conchan))
tvtot=add_trans_ipo_keys(conchan->ipo, tv, tvtot);
}
}
}
}
@@ -1032,10 +1045,14 @@ void delete_nlachannel_keys(void)
/* Delete action ipos */
if (base->object->action){
for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
delete_ipo_keys(chan->ipo);
if (EDITABLE_ACHAN(chan))
delete_ipo_keys(chan->ipo);
/* Delete action constraint keys */
for(conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
delete_ipo_keys(conchan->ipo);
for(conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
if (EDITABLE_CONCHAN(conchan))
delete_ipo_keys(conchan->ipo);
}
}
}
}
@@ -1092,10 +1109,14 @@ void duplicate_nlachannel_keys(void)
/* Duplicate actionchannel keys */
if (base->object->action){
for (chan=base->object->action->chanbase.first; chan; chan=chan->next){
duplicate_ipo_keys(chan->ipo);
if (EDITABLE_ACHAN(chan))
duplicate_ipo_keys(chan->ipo);
/* Duplicate action constraint keys */
for(conchan=chan->constraintChannels.first; conchan; conchan=conchan->next)
duplicate_ipo_keys(conchan->ipo);
for(conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
if (EDITABLE_CONCHAN(conchan))
duplicate_ipo_keys(conchan->ipo);
}
}
}
}