diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-02-06 14:10:34 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-02-06 14:10:34 +0300 |
commit | 14ea52bdd8ecdcc0d7af8ec1b49c51779fc1a085 (patch) | |
tree | 51db2ae7b75389d23b761b9ca832e19c86b2ca30 /source/blender/src/editaction.c | |
parent | f05778a980b823f556b94dd2ff7b37564a0d4437 (diff) |
Bugfixes:
* Action Editor "Open/Close Level" now works with Action Groups. Groups have priority over Action Channels for collapsing/expanding.
* Custom bone shapes using the new 'wire' option, were drawing with the wrong wireframe colour at times (i.e. when out of posemode, this happened quite often).
* Fixed/added a few comments in various places
Diffstat (limited to 'source/blender/src/editaction.c')
-rw-r--r-- | source/blender/src/editaction.c | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 7da84b81df3..d93ee44a42d 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -3675,15 +3675,19 @@ void rearrange_action_channels (short mode) /* Expand all channels to show full hierachy */ void expand_all_action (void) { + void *data; + short datatype; + bAction *act; bActionChannel *achan; bActionGroup *agrp; short mode= 1; /* Get the selected action, exit if none are selected */ - // TODO: really this should be done with the "action editor api" stuff, but this will suffice for now - act = G.saction->action; - if (act == NULL) return; + data = get_action_context(&datatype); + if (data == NULL) return; + if (datatype != ACTCONT_ACTION) return; + act= (bAction *)data; /* check if expand all, or close all */ for (agrp= act->groups.first; agrp; agrp= agrp->next) { @@ -3729,40 +3733,57 @@ void expand_all_action (void) /* For visible channels, expand/collapse one level */ void openclose_level_action (short mode) { + void *data; + short datatype; + bAction *act; bActionChannel *achan; + bActionGroup *agrp; /* Get the selected action, exit if none are selected */ - // TODO: really this should be done with the "action editor api" stuff, but this will suffice for now - act = G.saction->action; - if (act == NULL) return; + data = get_action_context(&datatype); + if (data == NULL) return; + if (datatype != ACTCONT_ACTION) return; + act= (bAction *)data; /* Abort if no operation required */ if (mode == 0) return; /* Only affect selected channels */ - // FIXME: check for action-groups for (achan= act->chanbase.first; achan; achan= achan->next) { - if (VISIBLE_ACHAN(achan) && SEL_ACHAN(achan)) { - if (EXPANDED_ACHAN(achan)) { - if (FILTER_IPO_ACHAN(achan) || FILTER_CON_ACHAN(achan)) { - if (mode < 0) - achan->flag &= ~(ACHAN_SHOWIPO|ACHAN_SHOWCONS); + /* make sure if there is a group, it isn't about to be collapsed and is open */ + if ( (achan->grp==NULL) || (EXPANDED_AGRP(achan->grp) && SEL_AGRP(achan->grp)==0) ) { + if (VISIBLE_ACHAN(achan) && SEL_ACHAN(achan)) { + if (EXPANDED_ACHAN(achan)) { + if (FILTER_IPO_ACHAN(achan) || FILTER_CON_ACHAN(achan)) { + if (mode < 0) + achan->flag &= ~(ACHAN_SHOWIPO|ACHAN_SHOWCONS); + } + else { + if (mode > 0) + achan->flag |= (ACHAN_SHOWIPO|ACHAN_SHOWCONS); + else + achan->flag &= ~ACHAN_EXPANDED; + } } else { if (mode > 0) - achan->flag |= (ACHAN_SHOWIPO|ACHAN_SHOWCONS); - else - achan->flag &= ~ACHAN_EXPANDED; - } - } - else { - if (mode > 0) - achan->flag |= ACHAN_EXPANDED; + achan->flag |= ACHAN_EXPANDED; + } } } } + /* Expand/collapse selected groups */ + for (agrp= act->groups.first; agrp; agrp= agrp->next) { + if (SEL_AGRP(agrp)) { + if (mode < 0) + agrp->flag &= ~AGRP_EXPANDED; + else + agrp->flag |= AGRP_EXPANDED; + } + } + /* Cleanup and do redraws */ BIF_undo_push("Expand/Collapse Action Level"); allqueue(REDRAWACTION, 0); |