[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [19077] branches/blender2.5/blender/source /blender/editors: Animation Editors: Bugfixes for channel selection tools
Joshua Leung
aligorith at gmail.com
Sun Feb 22 05:13:52 CET 2009
Revision: 19077
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=19077
Author: aligorith
Date: 2009-02-22 05:13:29 +0100 (Sun, 22 Feb 2009)
Log Message:
-----------
Animation Editors: Bugfixes for channel selection tools
* Ctrl-Shift select for Action Groups works again
* Clicking on a channel's data will select it, and also make it the active one in the list now
* Selecting keyframes in F-Curves will select the F-Curve channel too now (+ make it active)
Modified Paths:
--------------
branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
Modified: branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c 2009-02-21 19:17:31 UTC (rev 19076)
+++ branches/blender2.5/blender/source/blender/editors/animation/anim_channels.c 2009-02-22 04:13:29 UTC (rev 19077)
@@ -101,45 +101,56 @@
else (channel)->flag &= ~(sflag); \
}
-/* -------------------------- Internal Tools -------------------------------- */
+/* -------------------------- Exposed API ----------------------------------- */
-/* set the given Action Group to be the 'active' one in its Action */
-static void action_set_active_agrp (bAction *act, bActionGroup *agrp)
+/* Set the given animation-channel as the active one for the active context */
+void ANIM_set_active_channel (void *data, short datatype, int filter, void *channel_data, short channel_type)
{
- bActionGroup *grp;
+ ListBase anim_data = {NULL, NULL};
+ bAnimListElem *ale;
+ short smode;
- /* sanity check */
- if (act == NULL)
+ /* try to build list of filtered items */
+ // XXX we don't need/supply animcontext for now, since in this case, there's nothing really essential there that isn't already covered
+ ANIM_animdata_filter(NULL, &anim_data, filter, data, datatype);
+ if (anim_data.first == NULL)
return;
- /* clear active flag on all others */
- for (grp= act->groups.first; grp; grp= grp->next)
- grp->flag &= ~AGRP_ACTIVE;
+ /* only clear the 'active' flag for the channels of the same type */
+ for (ale= anim_data.first; ale; ale= ale->next) {
+ /* skip if types don't match */
+ if (channel_type != ale->type)
+ continue;
- /* set the given group to be the active one */
- if (agrp)
- agrp->flag |= AGRP_ACTIVE;
-}
-
-/* -------------------------- Exposed API ----------------------------------- */
-
-/* Set the given ActionChannel or ActionGroup as the active one in the given action
- * - data: should be bAction...
- * - datatype: should be ANIMCONT_ACTION
- * - channel_data: bActionChannel or bActionGroup
- * - channel_type: eAnim_ChannelType
- */
-void ANIM_action_set_active_channel (void *data, short datatype, void *channel_data, short channel_type)
-{
- /* sanity checks */
- if ((data == NULL) || (datatype != ANIMCONT_ACTION))
- return;
+ /* flag setting mode
+ * - depends on whether the provided channel is encountered
+ */
+ if (ale->data == channel_data)
+ smode= ACHANNEL_SETFLAG_ADD;
+ else
+ smode= ACHANNEL_SETFLAG_CLEAR;
- switch (channel_type) {
- case ANIMTYPE_GROUP:
- action_set_active_agrp((bAction *)data, (bActionGroup *)channel_data);
- break;
+ /* flag to set depends on type */
+ switch (ale->type) {
+ case ANIMTYPE_GROUP:
+ {
+ bActionGroup *agrp= (bActionGroup *)ale->data;
+
+ ACHANNEL_SET_FLAG(agrp, smode, AGRP_ACTIVE);
+ }
+ break;
+ case ANIMTYPE_FCURVE:
+ {
+ FCurve *fcu= (FCurve *)ale->data;
+
+ ACHANNEL_SET_FLAG(fcu, smode, FCURVE_ACTIVE);
+ }
+ break;
+ }
}
+
+ /* clean up */
+ BLI_freelistN(&anim_data);
}
/* Deselect all animation channels
@@ -1192,14 +1203,14 @@
}
else if (selectmode == -1) {
/* select all in group (and deselect everthing else) */
- bActionChannel *achan;
+ FCurve *fcu;
/* deselect all other channels */
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
/* only select channels in group and group itself */
- for (achan= agrp->channels.first; achan && achan->grp==agrp; achan= achan->next)
- achan->flag |= ACHAN_SELECTED;
+ for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next)
+ fcu->flag |= FCURVE_SELECTED;
agrp->flag |= AGRP_SELECTED;
}
else {
@@ -1208,12 +1219,9 @@
agrp->flag |= AGRP_SELECTED;
}
- /* if group is selected now, and we're in Action Editor mode (so that we have pointer to active action),
- * we can make this group the 'active' one in that action
- */
- // TODO: we should be able to do this through dopesheet + f-curves editor too...
- if ((agrp->flag & AGRP_SELECTED) && (ac->datatype == ANIMCONT_ACTION))
- action_set_active_agrp((bAction *)ac->data, agrp);
+ /* if group is selected now, make group the 'active' one in the visible list */
+ if ((agrp->flag & AGRP_SELECTED) && (selectmode != SELECT_INVERT))
+ ANIM_set_active_channel(ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
}
}
break;
Modified: branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h 2009-02-21 19:17:31 UTC (rev 19076)
+++ branches/blender2.5/blender/source/blender/editors/include/ED_anim_api.h 2009-02-22 04:13:29 UTC (rev 19077)
@@ -243,7 +243,7 @@
void ANIM_deselect_anim_channels(void *data, short datatype, short test, short sel);
/* Set the 'active' channel of type channel_type, in the given action */
-void ANIM_action_set_active_channel(void *data, short datatype, void *channel_data, short channel_type);
+void ANIM_set_active_channel(void *data, short datatype, int filter, void *channel_data, short channel_type);
/* --------------- Settings and/or Defines -------------- */
Modified: branches/blender2.5/blender/source/blender/editors/space_action/action_select.c
===================================================================
--- branches/blender2.5/blender/source/blender/editors/space_action/action_select.c 2009-02-21 19:17:31 UTC (rev 19076)
+++ branches/blender2.5/blender/source/blender/editors/space_action/action_select.c 2009-02-22 04:13:29 UTC (rev 19077)
@@ -839,13 +839,20 @@
deselect_action_keys(ac, 0, SELECT_SUBTRACT);
if (ELEM(ac->datatype, ANIMCONT_ACTION, ANIMCONT_DOPESHEET)) {
+ int filter= (ANIMFILTER_VISIBLE | ANIMFILTER_CHANNELS); /* this should suffice for now */
+
+ /* deselect all other channels first */
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
- /* Highlight Action-Group? */
+ /* Highlight Action-Group or F-Curve? */
if (agrp) {
agrp->flag |= AGRP_SELECTED;
- ANIM_action_set_active_channel(ac->data, ac->datatype, agrp, ANIMTYPE_GROUP);
+ ANIM_set_active_channel(ac->data, ac->datatype, filter, agrp, ANIMTYPE_GROUP);
}
+ else if (fcu) {
+ fcu->flag |= FCURVE_SELECTED;
+ ANIM_set_active_channel(ac->data, ac->datatype, filter, fcu, ANIMTYPE_FCURVE);
+ }
}
else if (ac->datatype == ANIMCONT_GPENCIL) {
ANIM_deselect_anim_channels(ac->data, ac->datatype, 0, ACHANNEL_SETFLAG_CLEAR);
More information about the Bf-blender-cvs
mailing list