[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13599] trunk/blender/source/blender/src: == Action Editor - Bugfixes ==
Joshua Leung
aligorith at gmail.com
Thu Feb 7 00:27:03 CET 2008
Revision: 13599
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13599
Author: aligorith
Date: 2008-02-07 00:27:03 +0100 (Thu, 07 Feb 2008)
Log Message:
-----------
== 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.
Modified Paths:
--------------
trunk/blender/source/blender/src/drawaction.c
trunk/blender/source/blender/src/editaction.c
trunk/blender/source/blender/src/transform_conversions.c
Modified: trunk/blender/source/blender/src/drawaction.c
===================================================================
--- trunk/blender/source/blender/src/drawaction.c 2008-02-06 22:59:56 UTC (rev 13598)
+++ trunk/blender/source/blender/src/drawaction.c 2008-02-06 23:27:03 UTC (rev 13599)
@@ -275,10 +275,12 @@
/* 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 @@
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);
}
Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c 2008-02-06 22:59:56 UTC (rev 13598)
+++ trunk/blender/source/blender/src/editaction.c 2008-02-06 23:27:03 UTC (rev 13599)
@@ -4248,7 +4248,7 @@
case DELKEY:
case XKEY:
if (okee("Erase selected")) {
- if (mval[0]<NAMEWIDTH)
+ if (mval[0] < NAMEWIDTH)
delete_action_channels();
else
delete_action_keys();
Modified: trunk/blender/source/blender/src/transform_conversions.c
===================================================================
--- trunk/blender/source/blender/src/transform_conversions.c 2008-02-06 22:59:56 UTC (rev 13598)
+++ trunk/blender/source/blender/src/transform_conversions.c 2008-02-06 23:27:03 UTC (rev 13599)
@@ -3400,9 +3400,6 @@
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 @@
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 @@
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);
More information about the Bf-blender-cvs
mailing list