Bugfixes:
authorJoshua Leung <aligorith@gmail.com>
Wed, 6 Feb 2008 11:10:34 +0000 (11:10 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 6 Feb 2008 11:10:34 +0000 (11:10 +0000)
* 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

source/blender/makesdna/DNA_armature_types.h
source/blender/src/drawaction.c
source/blender/src/drawarmature.c
source/blender/src/editaction.c

index fc17ba62b4424c9fb9e9d31ead799e535246f7e0..fcc847a1b30a18cc95aea7b99b482cf197585940 100644 (file)
@@ -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;
 
index 74c9cc1edc3baa8f02b00ac0305125d0f4a411de..0909c643d117cb662f0e84705f7b440b4c8e4622 100644 (file)
@@ -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);
                        
index 67c598f993f5b1b5478bc492804df71d75db9ed1..18cb05dbdd01cae26255d0b7fecff7e5c1b15e24 100644 (file)
@@ -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)
index 7da84b81df31293dfa6e053cb04ac6319154e010..d93ee44a42dee19ebb6bd9148eb541517ba70ab1 100644 (file)
@@ -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);