Orange's buglist!
authorTon Roosendaal <ton@blender.org>
Sat, 29 Oct 2005 10:15:36 +0000 (10:15 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 29 Oct 2005 10:15:36 +0000 (10:15 +0000)
- Action Editor: hotkeys V and H for handles were invisible, added menus
- NLA strips: when current frame is exactly on the strip end, it didn't
  include that action... needs a rounding correction for it.
- Action/NLA: deleting keys in Action, which results in only 1 key left,
  resulted in zero sized strip length. Now the strips are defaulted to be
  1 frame in size minimal.
- NLA editor: ALT+C "Convert to strip" didn't increment Action user count
- 3D Window: CTRL+P make parent to Bone still gave the insane menu with all
  bone names. With unified PoseMode select it can just parent to the
  active Bone. Note; this now requires the Armature to be in PoseMode to
  work.
- Rotation Constraint; the new options to only map to X,Y,Z rotation, did
  set the not mapped rotation axes to zero. These should remain unchanged.
- AutoKey optionn for Actions; should not insert action keys on ESC

And added a fix myself:

- When SHIFT+selecting a Bone in PoseMode, and the Armature was not selected
  or active yet, it doesn't extend-select/deselect the Bone anymore.
  This case is only useful when you try to add IK or Constraint, so the
  shift+selection should only activate the clicked Bone.

source/blender/blenkernel/BKE_action.h
source/blender/blenkernel/intern/action.c
source/blender/blenkernel/intern/constraint.c
source/blender/include/BIF_editarmature.h
source/blender/src/drawaction.c
source/blender/src/editaction.c
source/blender/src/editarmature.c
source/blender/src/editnla.c
source/blender/src/editobject.c
source/blender/src/header_action.c
source/blender/src/transform_conversions.c

index 21e7b2f7fc062df47db686a125cf4ba1eed15296..29b492e51e6489501be2c84fce3010940d1cc05d 100644 (file)
@@ -111,9 +111,7 @@ struct bAction *copy_action(struct bAction *src);
 /**
  * Some kind of bounding box operation on the action.
  */
-float calc_action_start(const struct bAction *act);
-
-float calc_action_end(const struct bAction *act);
+void calc_action_range(const struct bAction *act, float *start, float *end);
 
 /**
  * Set the pose channels from the given action.
index 3e49472162161e0bbc1397a11d2a6dcb5be781bf..3dc3e7b5cf055643fdfcbaa5717aae198f148d52 100644 (file)
@@ -406,73 +406,48 @@ void blend_poses(bPose *dst, const bPose *src, float srcweight, short mode)
 }
 
 
-float calc_action_start(const bAction *act)
+void calc_action_range(const bAction *act, float *start, float *end)
 {
        const bActionChannel *chan;
+       const bConstraintChannel *conchan;
        const IpoCurve  *icu;
-       float size=999999999.0f;
+       float min=999999999.0f, max=-999999999.0;
        int     i;
        int     foundvert=0;
-       const bConstraintChannel *conchan;
 
-
-       if (!act)
-               return 0;
-
-       for (chan=act->chanbase.first; chan; chan=chan->next) {
-               if(chan->ipo) {
-                       for (icu=chan->ipo->curve.first; icu; icu=icu->next) {
-                               for (i=0; i<icu->totvert; i++){
-                                       size = MIN2 (size, icu->bezt[i].vec[1][0]);
-                                       foundvert=1;
+       if(act) {
+               for (chan=act->chanbase.first; chan; chan=chan->next) {
+                       if(chan->ipo) {
+                               for (icu=chan->ipo->curve.first; icu; icu=icu->next) {
+                                       for (i=0; i<icu->totvert; i++) {
+                                               min = MIN2 (min, icu->bezt[i].vec[1][0]);
+                                               max = MAX2 (max, icu->bezt[i].vec[1][0]);
+                                               foundvert=1;
+                                       }
                                }
                        }
-               }
-               for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
-                       if(conchan->ipo) {
-                               for (icu=conchan->ipo->curve.first; icu; icu=icu->next) {
-                                       for (i=0; i<icu->totvert; i++){
-                                               size = MIN2 (size, icu->bezt[i].vec[1][0]);
-                                               foundvert=1;
+                       for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
+                               if(conchan->ipo) {
+                                       for (icu=conchan->ipo->curve.first; icu; icu=icu->next) {
+                                               for (i=0; i<icu->totvert; i++){
+                                                       min = MIN2 (min, icu->bezt[i].vec[1][0]);
+                                                       max = MAX2 (max, icu->bezt[i].vec[1][0]);
+                                                       foundvert=1;
+                                               }
                                        }
                                }
                        }
                }
+       }       
+       if (foundvert) {
+               if(min==max) max+= 1.0f;
+               *start= min;
+               *end= max;
        }
-       
-       if (!foundvert)
-               return 0;
-       else
-               return size;
-}
-
-float calc_action_end(const bAction *act)
-{
-       const bActionChannel    *chan;
-       const bConstraintChannel *conchan;
-       const IpoCurve          *icu;
-       float size=0;
-       int     i;
-
-       if (!act)
-               return 0;
-
-       for (chan=act->chanbase.first; chan; chan=chan->next) {
-               if(chan->ipo) {
-                       for (icu=chan->ipo->curve.first; icu; icu=icu->next)
-                               for (i=0; i<icu->totvert; i++)
-                                       size = MAX2 (size, icu->bezt[i].vec[1][0]);
-               }
-               
-               for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next){
-                       if(conchan->ipo) {
-                               for (icu=conchan->ipo->curve.first; icu; icu=icu->next)
-                                       for (i=0; i<icu->totvert; i++)
-                                               size = MAX2 (size, icu->bezt[i].vec[1][0]);
-                       }
-               }
+       else {
+               *start= 0.0f;
+               *end= 1.0f;
        }
-       return size;
 }
 
 /* Copy the data from the action-pose (src) into the pose */
@@ -798,11 +773,12 @@ static void do_nla(Object *ob, int blocktype)
                                                }
                                        }
                                }
-                               /* Handle repeat */
-                               else if (striptime < 1.0) {     
+                               /* Handle repeat, we add 1 frame extra to make sure the last frame is included */
+                               else if (striptime < 1.0f + 1.0f/length) {
+                                       
                                        /* Mod to repeat */
-                                       striptime*=strip->repeat;
-                                       striptime = (float)fmod (striptime, 1.0);
+                                       striptime*= strip->repeat;
+                                       striptime = (float)fmod (striptime, 1.0f + 1.0f/length);
                                        
                                        frametime = (striptime * actlength) + strip->actstart;
                                        frametime= nla_time(frametime, (float)strip->repeat);
index 0e682b3a58c42092950e498096fdc79492da0c07..12126c04462205af4b40efbf1ac75f2916af6d35 100644 (file)
@@ -1055,12 +1055,14 @@ void evaluate_constraint (bConstraint *constraint, Object *ob, short ownertype,
                        Mat3Ortho(tmat);
                        
                        if(data->flag != (ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z)) {
-                               float eul[3];
+                               float obeul[3], eul[3], obmat[3][3];
                                
                                Mat3ToEul(tmat, eul);
-                               if(!(data->flag & ROTLIKE_X)) eul[0]= 0.0f;
-                               if(!(data->flag & ROTLIKE_Y)) eul[1]= 0.0f;
-                               if(!(data->flag & ROTLIKE_Z)) eul[2]= 0.0f;
+                               Mat3CpyMat4(obmat, ob->obmat);
+                               Mat3ToEul(obmat, obeul);
+                               if(!(data->flag & ROTLIKE_X)) eul[0]= obeul[0];
+                               if(!(data->flag & ROTLIKE_Y)) eul[1]= obeul[1];
+                               if(!(data->flag & ROTLIKE_Z)) eul[2]= obeul[2];
                                EulToMat3(eul, tmat);
                        }
 
index a9cff6ce7ae8f219f08493775c134268e431a54f..a079dd0ec2b46316cf7eff8e6ae78b3ca78523d8 100644 (file)
@@ -86,13 +86,13 @@ void        extrude_armature(int forked);
 void   subdivide_armature(void);
 
 void   free_editArmature(void);
-struct Bone *get_indexed_bone (struct Object *ob, int index);
 
 void   join_armature(void);
 void   load_editArmature(void);
 
 void   make_bone_parent(void);
 void    clear_bone_parent(void);
+struct Bone    *get_indexed_bone (struct Object *ob, int index);
 
 void   make_editArmature(void);
 void   make_trans_bones (char mode);
@@ -105,25 +105,25 @@ void      selectconnected_armature(void);
 void   selectconnected_posearmature(void);
 void    unique_editbone_name (char* name);
 
-void auto_align_armature(void);
-void create_vgroups_from_armature(Object *ob, Object *par);
+void   auto_align_armature(void);
+void   create_vgroups_from_armature(Object *ob, Object *par);
 
-void hide_selected_pose_bones(void);
-void hide_unselected_pose_bones(void);
-void show_all_pose_bones(void);
+void   hide_selected_pose_bones(void);
+void   hide_unselected_pose_bones(void);
+void   show_all_pose_bones(void);
 
-int bone_looper(Object *ob, struct Bone *bone, void *data,
+int            bone_looper(Object *ob, struct Bone *bone, void *data,
                                int (*bone_func)(Object *, struct Bone *, void *));
 
-void undo_push_armature(char *name);
-void armature_bone_rename(struct bArmature *arm, char *oldname, char *newname);
-void armature_flip_names(void);
+void   undo_push_armature(char *name);
+void   armature_bone_rename(struct bArmature *arm, char *oldname, char *newname);
+void   armature_flip_names(void);
 EditBone *armature_bone_get_mirrored(EditBone *ebo);
-void transform_armature_mirror_update(void);
+void   transform_armature_mirror_update(void);
 
-void hide_selected_armature_bones(void);
-void hide_unselected_armature_bones(void);
-void show_all_armature_bones(void);
+void   hide_selected_armature_bones(void);
+void   hide_unselected_armature_bones(void);
+void   show_all_armature_bones(void);
 
 #define        BONESEL_ROOT    0x10000000
 #define        BONESEL_TIP             0x20000000
index c6955955c0909fd4c16b5ac15189156b8706b473..1c6c28929e32320d697d803a8c0c80912f698b75 100644 (file)
@@ -359,7 +359,7 @@ static void draw_channel_strips(SpaceAction *saction)
        bAction *act;
        bActionChannel *chan;
        bConstraintChannel *conchan;
-       float   y;
+       float y, sta, end;
        int act_start, act_end, dummy;
        char col1[3], col2[3];
        
@@ -381,8 +381,9 @@ static void draw_channel_strips(SpaceAction *saction)
                map_active_strip(di, OBACT, 0);
        
        /* start and end of action itself */
-       gla2DDrawTranslatePt(di, calc_action_start(act), 0, &act_start, &dummy);
-       gla2DDrawTranslatePt(di, calc_action_end(act), 0, &act_end, &dummy);
+       calc_action_range(act, &sta, &end);
+       gla2DDrawTranslatePt(di, sta, 0.0f, &act_start, &dummy);
+       gla2DDrawTranslatePt(di, end, 0.0f, &act_end, &dummy);
        
        if (G.saction->pin==0 && OBACT)
                map_active_strip(di, OBACT, 1);
index 981d92fe5ffd15fbe975f8406346d300efb2f84a..0ba59b073377d400e0c9111c1a94d997e1db45e6 100644 (file)
@@ -146,7 +146,7 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
        bAction                 *temp;
        bPoseChannel    *pchan;
        ID                              *id;
-       float                   actlen;
+       float                   actstart, actend;
        int                             oldframe;
        int                             curframe;
        char                    newname[64];
@@ -174,14 +174,14 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
        sprintf (newname, "%s.BAKED", act->id.name+2);
        rename_id(&result->id, newname);
 
-       actlen = calc_action_end(act);
+       calc_action_range(act, &actstart, &actend);
 
        oldframe = G.scene->r.cfra;
 
        temp = armob->action;
        armob->action = result;
        
-       for (curframe=1; curframe<ceil(actlen+1); curframe++){
+       for (curframe=1; curframe<ceil(actend+1.0f); curframe++){
 
                /* Apply the old action */
                
@@ -1606,6 +1606,7 @@ static void delete_actionchannels (void)
 
 void sethandles_meshchannel_keys(int code, Key *key)
 {
+       
     sethandles_ipo_keys(key->ipo, code);
 
        BIF_undo_push("Set handles Action keys");
@@ -2121,20 +2122,20 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        break;
 
                case HKEY:
-                       if (key) {
-                               if(G.qual & LR_SHIFTKEY) {
-                                       sethandles_meshchannel_keys(HD_AUTO, key);
-                               }
-                               else { 
-                                       sethandles_meshchannel_keys(HD_ALIGN, key);
+                       if(G.qual & LR_SHIFTKEY) {
+                               if(okee("Set Keys to Auto Handle")) {
+                                       if (key)
+                                               sethandles_meshchannel_keys(HD_AUTO, key);
+                                       else
+                                               sethandles_actionchannel_keys(HD_AUTO);
                                }
                        }
                        else {
-                               if(G.qual & LR_SHIFTKEY) {
-                                       sethandles_actionchannel_keys(HD_AUTO);
-                               }
-                               else { 
-                                       sethandles_actionchannel_keys(HD_ALIGN);
+                               if(okee("Toggle Keys Aligned Handle")) {
+                                       if (key)
+                                               sethandles_meshchannel_keys(HD_ALIGN, key);
+                                       else
+                                               sethandles_actionchannel_keys(HD_ALIGN);
                                }
                        }
                        break;
@@ -2171,12 +2172,11 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                        break;
 
                case VKEY:
-                       if (key) {
-                               sethandles_meshchannel_keys(HD_VECT, key);
-                               /* to do */
-                       }
-                       else {
-                               sethandles_actionchannel_keys(HD_VECT);
+                       if(okee("Set Keys to Vector Handle")) {
+                               if (key)
+                                       sethandles_meshchannel_keys(HD_VECT, key);
+                               else
+                                       sethandles_actionchannel_keys(HD_VECT);
                        }
                        break;
 
index 68883e3ed3b4510da5f6ed471e46fd9b58f52094..11b3851ff9359988975176a0589123fa84e93576 100644 (file)
@@ -1813,7 +1813,8 @@ int do_pose_selectbuffer(Base *base, unsigned int *buffer, short hits)
        nearBone= get_bone_from_selectbuffer(base, buffer, hits, 1);
 
        if (nearBone) {
-               if (!(G.qual & LR_SHIFTKEY)){
+               /* since we do unified select, we don't shift+select a bone if the armature object was not active yet */
+               if (!(G.qual & LR_SHIFTKEY) || base!=BASACT){
                        deselectall_posearmature(ob, 0);
                        nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
                        select_actionchannel_by_name(ob->action, nearBone->name, 1);
index 9f1807718762b17adb4479571da44af7734ec1a0..790494d9d4493fad59038a581264692310764b3c 100644 (file)
@@ -184,8 +184,9 @@ void synchronize_action_strips(void)
        for (base=G.scene->base.first; base; base=base->next) {
                for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
                        if (strip->flag & ACTSTRIP_LOCK_ACTION) {
-                               float actstart = calc_action_start(strip->act);
-                               float actend = calc_action_end(strip->act);
+                               float actstart, actend;
+                               
+                               calc_action_range(strip->act, &actstart, &actend);
                                
                                if(strip->actstart!=actstart || strip->actend!=actend) {
                                        float mapping= (strip->end - strip->start)/(strip->actend - strip->actstart);
@@ -211,8 +212,7 @@ void reset_action_strips(int val)
                for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
                        if (strip->flag & ACTSTRIP_SELECT) {
                                if(val==2) {
-                                       strip->actstart = calc_action_start(strip->act);
-                                       strip->actend = calc_action_end(strip->act);
+                                       calc_action_range(strip->act, &strip->actstart, &strip->actend);
                                }
                                else if(val==1) {
                                        float mapping= (strip->actend - strip->actstart)/(strip->end - strip->start);
@@ -495,8 +495,8 @@ static void convert_nla(short mval[2])
                        
                        /* Link the action to the nstrip */
                        nstrip->act = base->object->action;
-                       nstrip->actstart = calc_action_start(base->object->action);     /* MAKE THIS THE FIRST FRAME OF THE ACTION */
-                       nstrip->actend = calc_action_end(base->object->action);
+                       nstrip->act->id.us++;
+                       calc_action_range(nstrip->act, &nstrip->actstart, &nstrip->actend);
                        nstrip->start = nstrip->actstart;
                        nstrip->end = nstrip->actend;
                        nstrip->flag = ACTSTRIP_SELECT|ACTSTRIP_LOCK_ACTION;
@@ -546,8 +546,7 @@ static void add_nla_block(short event)
        
        /* Link the action to the strip */
        strip->act = act;
-       strip->actstart = calc_action_start(act);
-       strip->actend = calc_action_end(act);
+       calc_action_range(strip->act, &strip->actstart, &strip->actend);
        strip->start = G.scene->r.cfra;         /* could be mval[0] another time... */
        strip->end = strip->start + (strip->actend-strip->actstart);
                /* simple prevention of zero strips */
index fe30b012aabd24b70e69ebbd33ff07fe1177ccaf..90865fefd047517d34e8651f9e45aac32c6ae57b 100644 (file)
@@ -1156,34 +1156,11 @@ int test_parent_loop(Object *par, Object *ob)
 
 }
 
-static char *make_bone_menu (Object *ob)
-{
-       char *menustr=NULL;
-       bPoseChannel *pchan;
-       int             size;
-       int             index=0;
-       
-       //      Count the bones
-       for(size=0, pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, size++);
-       
-       size = size*48 + 256;
-       menustr = MEM_callocN(size, "bonemenu");
-       
-       sprintf (menustr, "Select Bone%%t");
-       
-       for(pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next, index++) {
-               sprintf (menustr, "%s|%s%%x%d", menustr, pchan->bone->name, index);
-       }
-       
-       return menustr;
-}
-
-
 void make_parent(void)
 {
        Base *base;
        Object *par;
-       Bone    *bone=NULL;
+       bPoseChannel *pchan= NULL;
        short qual, mode=0;
 
        if(G.scene->id.lib) return;
@@ -1267,19 +1244,23 @@ void make_parent(void)
                }
        }
        else if(par->type == OB_ARMATURE){
-               int     bonenr;
-               char *bonestr=NULL;
                
                base= FIRSTBASE;
                while(base) {
                        if TESTBASELIB(base) {
                                if(base!=BASACT) {
                                        if(base->object->type==OB_MESH) {
-                                               mode= pupmenu("Make Parent To%t|Bone %x1|Armature %x2|Object %x3");
+                                               if(par->flag & OB_POSEMODE)
+                                                       mode= pupmenu("Make Parent To%t|Bone %x1|Armature %x2|Object %x3");
+                                               else
+                                                       mode= pupmenu("Make Parent To%t|Armature %x2|Object %x3");
                                                break;
                                        }
                                        else {
-                                               mode= pupmenu("Make Parent To %t|Bone %x1|Object %x3");
+                                               if(par->flag & OB_POSEMODE)
+                                                       mode= pupmenu("Make Parent To %t|Bone %x1|Object %x3");
+                                               else
+                                                       mode= pupmenu("Make Parent To %t|Object %x3");
                                                break;
                                        }
                                }
@@ -1290,21 +1271,10 @@ void make_parent(void)
                switch (mode){
                case 1:
                        mode=PARBONE;
-                       /* Make bone popup menu */
-
-                       bonestr = make_bone_menu(par);
-
-                       bonenr= pupmenu_col(bonestr, 20);
-                       if (bonestr)
-                               MEM_freeN (bonestr);
-                       
-                       if (bonenr==-1){
-                               allqueue(REDRAWVIEW3D, 0);
-                               return;
-                       }
+                       pchan= get_active_posechannel(par);
 
-                       bone= get_indexed_bone(par, bonenr<<16);                // function uses selection codes
-                       if (!bone){
+                       if(pchan==NULL) {
+                               error("No active Bone");
                                allqueue(REDRAWVIEW3D, 0);
                                return;
                        }
@@ -1362,8 +1332,8 @@ void make_parent(void)
                                        
                                        if (par->type==OB_ARMATURE) {
                                                base->object->partype= mode;
-                                               if (bone)
-                                                       strcpy (base->object->parsubstr, bone->name);
+                                               if (pchan)
+                                                       strcpy (base->object->parsubstr, pchan->name);
                                                else
                                                        base->object->parsubstr[0]=0;
                                        }
index edd3ed8d16413fe763dbdc16f70db3884de92335..55617c0bed5a9c3746b4bebf65c52d05fdbd07f2 100644 (file)
@@ -137,8 +137,8 @@ void do_action_buttons(unsigned short event)
                        }
                        else {
                                float extra;
-                               G.v2d->cur.xmin= calc_action_start(G.saction->action);
-                               G.v2d->cur.xmax= calc_action_end(G.saction->action);
+                               
+                               calc_action_range(G.saction->action, &G.v2d->cur.xmin, &G.v2d->cur.xmax);
                                extra= 0.05*(G.v2d->cur.xmax - G.v2d->cur.xmin);
                                G.v2d->cur.xmin-= extra;
                                G.v2d->cur.xmax+= extra;
index 98bcb5d47ce2a42337d4bb2946c054a1ca18001b..529f2a7bc2bd95c74a8617a3225c2801502d597f 100755 (executable)
@@ -1732,7 +1732,7 @@ void special_aftertrans_update(TransInfo *t)
                /* this signal does one recalc on pose, then unlocks, so ESC or edit will work */
                ob->pose->flag |= POSE_DO_UNLOCK;
                
-               if(G.flags & G_RECORDKEYS) {
+               if((G.flags & G_RECORDKEYS) && (!cancelled)) {
                        act= ob->action;
                        pose= ob->pose;