diff options
author | Ton Roosendaal <ton@blender.org> | 2005-10-29 14:15:36 +0400 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2005-10-29 14:15:36 +0400 |
commit | 3635bde6f4980cff7dab5d48cb006100c879ac5c (patch) | |
tree | 4f4f052ad9bbdf1856afa02d415d701f97f91751 /source/blender | |
parent | 8162961d315acb6c141b071dec6dc858baff5ba7 (diff) |
Orange's buglist!
- 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.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 90 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/constraint.c | 10 | ||||
-rw-r--r-- | source/blender/include/BIF_editarmature.h | 28 | ||||
-rw-r--r-- | source/blender/src/drawaction.c | 7 | ||||
-rw-r--r-- | source/blender/src/editaction.c | 40 | ||||
-rw-r--r-- | source/blender/src/editarmature.c | 3 | ||||
-rw-r--r-- | source/blender/src/editnla.c | 15 | ||||
-rw-r--r-- | source/blender/src/editobject.c | 58 | ||||
-rw-r--r-- | source/blender/src/header_action.c | 4 | ||||
-rwxr-xr-x | source/blender/src/transform_conversions.c | 2 |
11 files changed, 104 insertions, 157 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 21e7b2f7fc0..29b492e51e6 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -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. diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 3e494721621..3dc3e7b5cf0 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -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); diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 0e682b3a58c..12126c04462 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -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); } diff --git a/source/blender/include/BIF_editarmature.h b/source/blender/include/BIF_editarmature.h index a9cff6ce7ae..a079dd0ec2b 100644 --- a/source/blender/include/BIF_editarmature.h +++ b/source/blender/include/BIF_editarmature.h @@ -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 diff --git a/source/blender/src/drawaction.c b/source/blender/src/drawaction.c index c6955955c09..1c6c28929e3 100644 --- a/source/blender/src/drawaction.c +++ b/source/blender/src/drawaction.c @@ -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); diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c index 981d92fe5ff..0ba59b07337 100644 --- a/source/blender/src/editaction.c +++ b/source/blender/src/editaction.c @@ -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; diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c index 68883e3ed3b..11b3851ff93 100644 --- a/source/blender/src/editarmature.c +++ b/source/blender/src/editarmature.c @@ -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); diff --git a/source/blender/src/editnla.c b/source/blender/src/editnla.c index 9f180771876..790494d9d44 100644 --- a/source/blender/src/editnla.c +++ b/source/blender/src/editnla.c @@ -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 */ diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c index fe30b012aab..90865fefd04 100644 --- a/source/blender/src/editobject.c +++ b/source/blender/src/editobject.c @@ -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; } diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c index edd3ed8d164..55617c0bed5 100644 --- a/source/blender/src/header_action.c +++ b/source/blender/src/header_action.c @@ -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; diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c index 98bcb5d47ce..529f2a7bc2b 100755 --- a/source/blender/src/transform_conversions.c +++ b/source/blender/src/transform_conversions.c @@ -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; |