Jonathan Thambidurai's patch for fixing the baking of NLA.

I added to this patch some code for keying size too ... please test.

This probably fixes bug #602, but I can't say for sure: Guignot's
poor ol' example blend no longer opens in blender (not since 2.26).

Release notes remark: Bug causing inconsistent baking of actions fixed.
This commit is contained in:
Chris Want 2004-02-20 04:57:07 +00:00
parent 32fb5478a8
commit 05bff7f938

@ -196,19 +196,21 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
clear_object_constraint_status(armob);
where_is_armature_time(armob, curframe);
/* For each channel: set avail keys with current values */
for (pchan=armob->pose->chanbase.first; pchan; pchan=pchan->next){
/* Copy the constraints from the armature (if any) */
/* For each channel: set quats and locs if channel is a bone */
for (pchan=armob->pose->chanbase.first; pchan; pchan=pchan->next){
bone = get_named_bone(arm, pchan->name);
if (bone){
float tmp_quat[4], tmp_loc[3], tmp_size[3];
QUATCOPY(tmp_quat, pchan->quat);
VECCOPY(tmp_loc, pchan->loc);
VECCOPY(tmp_size, pchan->size);
Mat4ToQuat(pchan->obmat, pchan->quat);
Mat4ToSize(pchan->obmat, pchan->size);
VECCOPY(pchan->loc, pchan->obmat[3]);
/* Apply to keys */
/* Apply to keys */
set_action_key_time (result, pchan, AC_QUAT_X, 1, curframe);
set_action_key_time (result, pchan, AC_QUAT_Y, 1, curframe);
set_action_key_time (result, pchan, AC_QUAT_Z, 1, curframe);
@ -216,10 +218,18 @@ bAction* bake_action_with_client (bAction *act, Object *armob, float tolerance)
set_action_key_time (result, pchan, AC_LOC_X, 1, curframe);
set_action_key_time (result, pchan, AC_LOC_Y, 1, curframe);
set_action_key_time (result, pchan, AC_LOC_Z, 1, curframe);
set_action_key_time (result, pchan, AC_SIZE_X, 1, curframe);
set_action_key_time (result, pchan, AC_SIZE_Y, 1, curframe);
set_action_key_time (result, pchan, AC_SIZE_Z, 1, curframe);
QUATCOPY(pchan->quat, tmp_quat);
VECCOPY(pchan->loc, tmp_loc);
VECCOPY(pchan->size, tmp_size);
}
}
}
/* Make another pass to ensure all keyframes are set to linear interpolation mode */
for (achan = result->chanbase.first; achan; achan=achan->next){
IpoCurve* icu;