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.
This commit is contained in:
2005-10-29 10:15:36 +00:00
parent 8162961d31
commit 3635bde6f4
11 changed files with 105 additions and 158 deletions

View File

@@ -111,9 +111,7 @@ struct bAction *copy_action(struct bAction *src);
/** /**
* Some kind of bounding box operation on the action. * Some kind of bounding box operation on the action.
*/ */
float calc_action_start(const struct bAction *act); void calc_action_range(const struct bAction *act, float *start, float *end);
float calc_action_end(const struct bAction *act);
/** /**
* Set the pose channels from the given action. * Set the pose channels from the given action.

View 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 bActionChannel *chan;
const bConstraintChannel *conchan;
const IpoCurve *icu; const IpoCurve *icu;
float size=999999999.0f; float min=999999999.0f, max=-999999999.0;
int i; int i;
int foundvert=0; int foundvert=0;
const bConstraintChannel *conchan;
if(act) {
if (!act) for (chan=act->chanbase.first; chan; chan=chan->next) {
return 0; if(chan->ipo) {
for (icu=chan->ipo->curve.first; icu; icu=icu->next) {
for (chan=act->chanbase.first; chan; chan=chan->next) { for (i=0; i<icu->totvert; i++) {
if(chan->ipo) { min = MIN2 (min, icu->bezt[i].vec[1][0]);
for (icu=chan->ipo->curve.first; icu; icu=icu->next) { max = MAX2 (max, icu->bezt[i].vec[1][0]);
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++){
size = MIN2 (size, icu->bezt[i].vec[1][0]);
foundvert=1; foundvert=1;
} }
} }
} }
} for (conchan=chan->constraintChannels.first; conchan; conchan=conchan->next) {
} if(conchan->ipo) {
for (icu=conchan->ipo->curve.first; icu; icu=icu->next) {
if (!foundvert) for (i=0; i<icu->totvert; i++){
return 0; min = MIN2 (min, icu->bezt[i].vec[1][0]);
else max = MAX2 (max, icu->bezt[i].vec[1][0]);
return size; foundvert=1;
} }
}
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]);
} }
} }
}
if (foundvert) {
if(min==max) max+= 1.0f;
*start= min;
*end= max;
}
else {
*start= 0.0f;
*end= 1.0f;
} }
return size;
} }
/* Copy the data from the action-pose (src) into the pose */ /* 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 */ /* Handle repeat, we add 1 frame extra to make sure the last frame is included */
else if (striptime < 1.0) { else if (striptime < 1.0f + 1.0f/length) {
/* Mod to repeat */ /* Mod to repeat */
striptime*=strip->repeat; striptime*= strip->repeat;
striptime = (float)fmod (striptime, 1.0); striptime = (float)fmod (striptime, 1.0f + 1.0f/length);
frametime = (striptime * actlength) + strip->actstart; frametime = (striptime * actlength) + strip->actstart;
frametime= nla_time(frametime, (float)strip->repeat); frametime= nla_time(frametime, (float)strip->repeat);

View File

@@ -1055,12 +1055,14 @@ void evaluate_constraint (bConstraint *constraint, Object *ob, short ownertype,
Mat3Ortho(tmat); Mat3Ortho(tmat);
if(data->flag != (ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z)) { if(data->flag != (ROTLIKE_X|ROTLIKE_Y|ROTLIKE_Z)) {
float eul[3]; float obeul[3], eul[3], obmat[3][3];
Mat3ToEul(tmat, eul); Mat3ToEul(tmat, eul);
if(!(data->flag & ROTLIKE_X)) eul[0]= 0.0f; Mat3CpyMat4(obmat, ob->obmat);
if(!(data->flag & ROTLIKE_Y)) eul[1]= 0.0f; Mat3ToEul(obmat, obeul);
if(!(data->flag & ROTLIKE_Z)) eul[2]= 0.0f; 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); EulToMat3(eul, tmat);
} }

View File

@@ -86,13 +86,13 @@ void extrude_armature(int forked);
void subdivide_armature(void); void subdivide_armature(void);
void free_editArmature(void); void free_editArmature(void);
struct Bone *get_indexed_bone (struct Object *ob, int index);
void join_armature(void); void join_armature(void);
void load_editArmature(void); void load_editArmature(void);
void make_bone_parent(void); void make_bone_parent(void);
void clear_bone_parent(void); void clear_bone_parent(void);
struct Bone *get_indexed_bone (struct Object *ob, int index);
void make_editArmature(void); void make_editArmature(void);
void make_trans_bones (char mode); void make_trans_bones (char mode);
@@ -105,25 +105,25 @@ void selectconnected_armature(void);
void selectconnected_posearmature(void); void selectconnected_posearmature(void);
void unique_editbone_name (char* name); void unique_editbone_name (char* name);
void auto_align_armature(void); void auto_align_armature(void);
void create_vgroups_from_armature(Object *ob, Object *par); void create_vgroups_from_armature(Object *ob, Object *par);
void hide_selected_pose_bones(void); void hide_selected_pose_bones(void);
void hide_unselected_pose_bones(void); void hide_unselected_pose_bones(void);
void show_all_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 *)); int (*bone_func)(Object *, struct Bone *, void *));
void undo_push_armature(char *name); void undo_push_armature(char *name);
void armature_bone_rename(struct bArmature *arm, char *oldname, char *newname); void armature_bone_rename(struct bArmature *arm, char *oldname, char *newname);
void armature_flip_names(void); void armature_flip_names(void);
EditBone *armature_bone_get_mirrored(EditBone *ebo); 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_selected_armature_bones(void);
void hide_unselected_armature_bones(void); void hide_unselected_armature_bones(void);
void show_all_armature_bones(void); void show_all_armature_bones(void);
#define BONESEL_ROOT 0x10000000 #define BONESEL_ROOT 0x10000000
#define BONESEL_TIP 0x20000000 #define BONESEL_TIP 0x20000000

View File

@@ -359,7 +359,7 @@ static void draw_channel_strips(SpaceAction *saction)
bAction *act; bAction *act;
bActionChannel *chan; bActionChannel *chan;
bConstraintChannel *conchan; bConstraintChannel *conchan;
float y; float y, sta, end;
int act_start, act_end, dummy; int act_start, act_end, dummy;
char col1[3], col2[3]; char col1[3], col2[3];
@@ -381,8 +381,9 @@ static void draw_channel_strips(SpaceAction *saction)
map_active_strip(di, OBACT, 0); map_active_strip(di, OBACT, 0);
/* start and end of action itself */ /* start and end of action itself */
gla2DDrawTranslatePt(di, calc_action_start(act), 0, &act_start, &dummy); calc_action_range(act, &sta, &end);
gla2DDrawTranslatePt(di, calc_action_end(act), 0, &act_end, &dummy); gla2DDrawTranslatePt(di, sta, 0.0f, &act_start, &dummy);
gla2DDrawTranslatePt(di, end, 0.0f, &act_end, &dummy);
if (G.saction->pin==0 && OBACT) if (G.saction->pin==0 && OBACT)
map_active_strip(di, OBACT, 1); map_active_strip(di, OBACT, 1);

View File

@@ -146,7 +146,7 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
bAction *temp; bAction *temp;
bPoseChannel *pchan; bPoseChannel *pchan;
ID *id; ID *id;
float actlen; float actstart, actend;
int oldframe; int oldframe;
int curframe; int curframe;
char newname[64]; 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); sprintf (newname, "%s.BAKED", act->id.name+2);
rename_id(&result->id, newname); rename_id(&result->id, newname);
actlen = calc_action_end(act); calc_action_range(act, &actstart, &actend);
oldframe = G.scene->r.cfra; oldframe = G.scene->r.cfra;
temp = armob->action; temp = armob->action;
armob->action = result; armob->action = result;
for (curframe=1; curframe<ceil(actlen+1); curframe++){ for (curframe=1; curframe<ceil(actend+1.0f); curframe++){
/* Apply the old action */ /* Apply the old action */
@@ -1606,6 +1606,7 @@ static void delete_actionchannels (void)
void sethandles_meshchannel_keys(int code, Key *key) void sethandles_meshchannel_keys(int code, Key *key)
{ {
sethandles_ipo_keys(key->ipo, code); sethandles_ipo_keys(key->ipo, code);
BIF_undo_push("Set handles Action keys"); BIF_undo_push("Set handles Action keys");
@@ -2121,20 +2122,20 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break; break;
case HKEY: case HKEY:
if (key) { if(G.qual & LR_SHIFTKEY) {
if(G.qual & LR_SHIFTKEY) { if(okee("Set Keys to Auto Handle")) {
sethandles_meshchannel_keys(HD_AUTO, key); if (key)
} sethandles_meshchannel_keys(HD_AUTO, key);
else { else
sethandles_meshchannel_keys(HD_ALIGN, key); sethandles_actionchannel_keys(HD_AUTO);
} }
} }
else { else {
if(G.qual & LR_SHIFTKEY) { if(okee("Toggle Keys Aligned Handle")) {
sethandles_actionchannel_keys(HD_AUTO); if (key)
} sethandles_meshchannel_keys(HD_ALIGN, key);
else { else
sethandles_actionchannel_keys(HD_ALIGN); sethandles_actionchannel_keys(HD_ALIGN);
} }
} }
break; break;
@@ -2171,12 +2172,11 @@ void winqreadactionspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break; break;
case VKEY: case VKEY:
if (key) { if(okee("Set Keys to Vector Handle")) {
sethandles_meshchannel_keys(HD_VECT, key); if (key)
/* to do */ sethandles_meshchannel_keys(HD_VECT, key);
} else
else { sethandles_actionchannel_keys(HD_VECT);
sethandles_actionchannel_keys(HD_VECT);
} }
break; break;

View 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); nearBone= get_bone_from_selectbuffer(base, buffer, hits, 1);
if (nearBone) { 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); deselectall_posearmature(ob, 0);
nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE); nearBone->flag |= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
select_actionchannel_by_name(ob->action, nearBone->name, 1); select_actionchannel_by_name(ob->action, nearBone->name, 1);

View File

@@ -184,8 +184,9 @@ void synchronize_action_strips(void)
for (base=G.scene->base.first; base; base=base->next) { for (base=G.scene->base.first; base; base=base->next) {
for (strip = base->object->nlastrips.last; strip; strip=strip->prev) { for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
if (strip->flag & ACTSTRIP_LOCK_ACTION) { if (strip->flag & ACTSTRIP_LOCK_ACTION) {
float actstart = calc_action_start(strip->act); float actstart, actend;
float actend = calc_action_end(strip->act);
calc_action_range(strip->act, &actstart, &actend);
if(strip->actstart!=actstart || strip->actend!=actend) { if(strip->actstart!=actstart || strip->actend!=actend) {
float mapping= (strip->end - strip->start)/(strip->actend - strip->actstart); 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) { for (strip = base->object->nlastrips.last; strip; strip=strip->prev) {
if (strip->flag & ACTSTRIP_SELECT) { if (strip->flag & ACTSTRIP_SELECT) {
if(val==2) { if(val==2) {
strip->actstart = calc_action_start(strip->act); calc_action_range(strip->act, &strip->actstart, &strip->actend);
strip->actend = calc_action_end(strip->act);
} }
else if(val==1) { else if(val==1) {
float mapping= (strip->actend - strip->actstart)/(strip->end - strip->start); 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 */ /* Link the action to the nstrip */
nstrip->act = base->object->action; nstrip->act = base->object->action;
nstrip->actstart = calc_action_start(base->object->action); /* MAKE THIS THE FIRST FRAME OF THE ACTION */ nstrip->act->id.us++;
nstrip->actend = calc_action_end(base->object->action); calc_action_range(nstrip->act, &nstrip->actstart, &nstrip->actend);
nstrip->start = nstrip->actstart; nstrip->start = nstrip->actstart;
nstrip->end = nstrip->actend; nstrip->end = nstrip->actend;
nstrip->flag = ACTSTRIP_SELECT|ACTSTRIP_LOCK_ACTION; nstrip->flag = ACTSTRIP_SELECT|ACTSTRIP_LOCK_ACTION;
@@ -546,8 +546,7 @@ static void add_nla_block(short event)
/* Link the action to the strip */ /* Link the action to the strip */
strip->act = act; strip->act = act;
strip->actstart = calc_action_start(act); calc_action_range(strip->act, &strip->actstart, &strip->actend);
strip->actend = calc_action_end(act);
strip->start = G.scene->r.cfra; /* could be mval[0] another time... */ strip->start = G.scene->r.cfra; /* could be mval[0] another time... */
strip->end = strip->start + (strip->actend-strip->actstart); strip->end = strip->start + (strip->actend-strip->actstart);
/* simple prevention of zero strips */ /* simple prevention of zero strips */

View 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) void make_parent(void)
{ {
Base *base; Base *base;
Object *par; Object *par;
Bone *bone=NULL; bPoseChannel *pchan= NULL;
short qual, mode=0; short qual, mode=0;
if(G.scene->id.lib) return; if(G.scene->id.lib) return;
@@ -1267,19 +1244,23 @@ void make_parent(void)
} }
} }
else if(par->type == OB_ARMATURE){ else if(par->type == OB_ARMATURE){
int bonenr;
char *bonestr=NULL;
base= FIRSTBASE; base= FIRSTBASE;
while(base) { while(base) {
if TESTBASELIB(base) { if TESTBASELIB(base) {
if(base!=BASACT) { if(base!=BASACT) {
if(base->object->type==OB_MESH) { 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; break;
} }
else { 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; break;
} }
} }
@@ -1290,21 +1271,10 @@ void make_parent(void)
switch (mode){ switch (mode){
case 1: case 1:
mode=PARBONE; mode=PARBONE;
/* Make bone popup menu */ pchan= get_active_posechannel(par);
bonestr = make_bone_menu(par); if(pchan==NULL) {
error("No active Bone");
bonenr= pupmenu_col(bonestr, 20);
if (bonestr)
MEM_freeN (bonestr);
if (bonenr==-1){
allqueue(REDRAWVIEW3D, 0);
return;
}
bone= get_indexed_bone(par, bonenr<<16); // function uses selection codes
if (!bone){
allqueue(REDRAWVIEW3D, 0); allqueue(REDRAWVIEW3D, 0);
return; return;
} }
@@ -1362,8 +1332,8 @@ void make_parent(void)
if (par->type==OB_ARMATURE) { if (par->type==OB_ARMATURE) {
base->object->partype= mode; base->object->partype= mode;
if (bone) if (pchan)
strcpy (base->object->parsubstr, bone->name); strcpy (base->object->parsubstr, pchan->name);
else else
base->object->parsubstr[0]=0; base->object->parsubstr[0]=0;
} }

View File

@@ -137,8 +137,8 @@ void do_action_buttons(unsigned short event)
} }
else { else {
float extra; 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); extra= 0.05*(G.v2d->cur.xmax - G.v2d->cur.xmin);
G.v2d->cur.xmin-= extra; G.v2d->cur.xmin-= extra;
G.v2d->cur.xmax+= extra; G.v2d->cur.xmax+= extra;

View File

@@ -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 */ /* this signal does one recalc on pose, then unlocks, so ESC or edit will work */
ob->pose->flag |= POSE_DO_UNLOCK; ob->pose->flag |= POSE_DO_UNLOCK;
if(G.flags & G_RECORDKEYS) { if((G.flags & G_RECORDKEYS) && (!cancelled)) {
act= ob->action; act= ob->action;
pose= ob->pose; pose= ob->pose;