== Action Editor - Bugfixes ==

* With "AfterTrans Delete Duplicates" and NLA-scaling on, IPO-curve handles were not updated after the operation.

* Sliders drew in the wrong places. Now they are drawn using the Action-Editor api stuff, so they should appear in the right places. I've also tweaked this so that sliders are now shown for ANY selected action channel's ipo-channels and constraint-channels, provided that the channel is in view.
This commit is contained in:
Joshua Leung
2008-02-06 23:27:03 +00:00
parent eb281bff39
commit bb7690c729
3 changed files with 66 additions and 44 deletions

View File

@@ -275,10 +275,12 @@ static void make_icu_slider(uiBlock *block, IpoCurve *icu,
/* sliders for ipo-curves of active action-channel */
static void action_icu_buts(SpaceAction *saction)
{
bAction *act= saction->action;
bActionChannel *achan;
bConstraintChannel *conchan;
IpoCurve *icu;
ListBase act_data = {NULL, NULL};
bActListElem *ale;
int filter;
void *data;
short datatype;
char str[64];
float x, y;
uiBlock *block;
@@ -303,51 +305,69 @@ static void action_icu_buts(SpaceAction *saction)
if (G.saction->flag & SACTION_SLIDERS) {
/* sliders are open so draw them */
/* get editor data */
data= get_action_context(&datatype);
if (data == NULL) return;
/* build list of channels to draw */
filter= (ACTFILTER_FORDRAWING|ACTFILTER_VISIBLE|ACTFILTER_CHANNELS);
actdata_filter(&act_data, filter, data, datatype);
/* draw backdrop first */
BIF_ThemeColor(TH_FACE); // change this color... it's ugly
glRects(NAMEWIDTH, G.v2d->cur.ymin, NAMEWIDTH+SLIDERWIDTH, G.v2d->cur.ymax);
uiBlockSetEmboss(block, UI_EMBOSS);
for (achan=act->chanbase.first; achan; achan= achan->next) {
if(VISIBLE_ACHAN(achan)) {
y-=CHANNELHEIGHT+CHANNELSKIP;
if (EXPANDED_ACHAN(achan)) {
if (achan->ipo) {
y-=CHANNELHEIGHT+CHANNELSKIP;
for (ale= act_data.first; ale; ale= ale->next) {
const float yminc= y-CHANNELHEIGHT/2;
const float ymaxc= y+CHANNELHEIGHT/2;
/* check if visible */
if ( IN_RANGE(yminc, G.v2d->cur.ymin, G.v2d->cur.ymax) ||
IN_RANGE(ymaxc, G.v2d->cur.ymin, G.v2d->cur.ymax) )
{
/* determine what needs to be drawn */
switch (ale->type) {
case ACTTYPE_CONCHAN: /* constraint channel */
{
bActionChannel *achan = (bActionChannel *)ale->owner;
IpoCurve *icu = (IpoCurve *)ale->key_data;
if (FILTER_IPO_ACHAN(achan)) {
for (icu= achan->ipo->curve.first; icu; icu=icu->next) {
if (achan->flag & ACHAN_HILIGHTED) {
make_icu_slider(block, icu,
x, y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
"Slider to control current value of IPO-Curve");
}
y-=CHANNELHEIGHT+CHANNELSKIP;
}
/* only show if action channel is selected */
if (SEL_ACHAN(achan)) {
make_icu_slider(block, icu,
x, y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
"Slider to control current value of Constraint Influence");
}
}
if (achan->constraintChannels.first) {
y-=CHANNELHEIGHT+CHANNELSKIP;
break;
case ACTTYPE_ICU: /* ipo-curve channel */
{
bActionChannel *achan = (bActionChannel *)ale->owner;
IpoCurve *icu = (IpoCurve *)ale->key_data;
if (FILTER_CON_ACHAN(achan)) {
for (conchan= achan->constraintChannels.first; conchan; conchan=conchan->next) {
if ((achan->flag & ACHAN_HILIGHTED) && EDITABLE_CONCHAN(conchan)) {
icu= (IpoCurve *)conchan->ipo->curve.first;
make_icu_slider(block, icu,
x, y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
"Slider to control current value of Constraint Channel");
}
y-=CHANNELHEIGHT+CHANNELSKIP;
}
/* only show if action channel is selected */
if (SEL_ACHAN(achan)) {
make_icu_slider(block, icu,
x, y, SLIDERWIDTH-2, CHANNELHEIGHT-2,
"Slider to control current value of IPO-Curve");
}
}
}
break;
case ACTTYPE_SHAPEKEY: /* shapekey channel */
{
// TODO...
}
break;
}
}
/* adjust y-position for next one */
y-=CHANNELHEIGHT+CHANNELSKIP;
}
/* free tempolary channels */
BLI_freelistN(&act_data);
}
uiDrawBlock(block);
}

View File

@@ -4248,7 +4248,7 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
case DELKEY:
case XKEY:
if (okee("Erase selected")) {
if (mval[0]<NAMEWIDTH)
if (mval[0] < NAMEWIDTH)
delete_action_channels();
else
delete_action_keys();

View File

@@ -3400,9 +3400,6 @@ void special_aftertrans_update(TransInfo *t)
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
}
/* Do curve updates */
remake_action_ipos((bAction *)data);
/* Do curve cleanups? */
if ( (G.saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
(cancelled == 0) )
@@ -3410,6 +3407,9 @@ void special_aftertrans_update(TransInfo *t)
posttrans_action_clean((bAction *)data);
}
/* Do curve updates */
remake_action_ipos((bAction *)data);
G.saction->flag &= ~SACTION_MOVING;
}
else if (datatype == ACTCONT_SHAPEKEY) {
@@ -3418,16 +3418,18 @@ void special_aftertrans_update(TransInfo *t)
if (key->ipo) {
IpoCurve *icu;
for (icu = key->ipo->curve.first; icu; icu=icu->next) {
sort_time_ipocurve(icu);
testhandles_ipocurve(icu);
}
if ( (G.saction->flag & SACTION_NOTRANSKEYCULL)==0 &&
(cancelled == 0) )
{
posttrans_ipo_clean(key->ipo);
}
for (icu = key->ipo->curve.first; icu; icu=icu->next) {
sort_time_ipocurve(icu);
testhandles_ipocurve(icu);
}
}
DAG_object_flush_update(G.scene, OBACT, OB_RECALC_DATA);