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 | |
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')
-rw-r--r-- | source/blender/makesdna/DNA_armature_types.h | 2 | ||||
-rw-r--r-- | source/blender/src/drawaction.c | 3 | ||||
-rw-r--r-- | source/blender/src/drawarmature.c | 15 | ||||
-rw-r--r-- | source/blender/src/editaction.c | 61 |
4 files changed, 55 insertions, 26 deletions
diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index fc17ba62b44..fcc847a1b30 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -100,7 +100,7 @@ typedef enum eArmature_Flag { ARM_MIRROR_EDIT = (1<<8), ARM_AUTO_IK = (1<<9), ARM_NO_CUSTOM = (1<<10), /* made option negative, for backwards compat */ - ARM_COL_CUSTOM = (1<<11), /* draw custom colours - not yet used... */ + ARM_COL_CUSTOM = (1<<11), /* draw custom colours */ ARM_GHOST_ONLYSEL = (1<<12) /* when ghosting, only show selected bones (this should belong to ghostflag instead) */ } eArmature_Flag; diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index 74c9cc1edc3..0909c643d11 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -1118,6 +1118,7 @@ static void add_bezt_to_keyblockslist(ListBase *blocks, IpoCurve *icu, int index /* get beztriples */ beztn= (icu->bezt + index); + /* we need to go through all beztriples, as they may not be in order (i.e. during transform) */ for (v=0, bezt=icu->bezt; v<icu->totvert; v++, bezt++) { /* skip if beztriple is current */ if (v != index) { @@ -1270,7 +1271,7 @@ static void draw_keylist(gla2DDrawInfo *di, ListBase *keys, ListBase *blocks, fl /* get co-ordinate to draw at */ gla2DDrawTranslatePt(di, ak->cfra, ypos, &sc_x, &sc_y); - /* draw using icons - slower */ + /* draw using icons - old way which is slower but more proven */ //if(ak->sel & 1) BIF_icon_draw_aspect(sc_x-7, sc_y-6, ICON_SPACE2, 1.0f); //else BIF_icon_draw_aspect(sc_x-7, sc_y-6, ICON_SPACE3, 1.0f); diff --git a/source/blender/src/drawarmature.c b/source/blender/src/drawarmature.c index 67c598f993f..18cb05dbdd0 100644 --- a/source/blender/src/drawarmature.c +++ b/source/blender/src/drawarmature.c @@ -1589,9 +1589,15 @@ static void draw_pose_channels(Base *base, int dt) set_pchan_colorset(ob, pchan); if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) { - /* BONE_DRAWWIRE case is here too, as sometimes wire overlay won't be done */ - if (pchan->bone->flag & BONE_DRAWWIRE) - draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length); + /* BONE_DRAWWIRE case is here too, as wire overlay won't be done when in Object Mode + * It's a bit of a hack, and we make sure TH_WIRE is used (just in case). + */ + if (pchan->bone->flag & BONE_DRAWWIRE) { + if ((arm->flag & ARM_POSEMODE) == 0) { + BIF_ThemeColor(TH_WIRE); + draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length); + } + } else draw_custom_bone(pchan->custom, OB_SOLID, arm->flag, flag, index, bone->length); } @@ -1695,8 +1701,9 @@ static void draw_pose_channels(Base *base, int dt) set_pchan_colorset(ob, pchan); if ((pchan->custom) && !(arm->flag & ARM_NO_CUSTOM)) { - if ((dt < OB_SOLID) || (pchan->bone->flag & BONE_DRAWWIRE)) + if ((dt < OB_SOLID) || (pchan->bone->flag & BONE_DRAWWIRE)) { draw_custom_bone(pchan->custom, OB_WIRE, arm->flag, flag, index, bone->length); + } } else if (arm->drawtype==ARM_ENVELOPE) { if (dt < OB_SOLID) 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); |