Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-09-25 09:04:34 +0400
committerJoshua Leung <aligorith@gmail.com>2007-09-25 09:04:34 +0400
commit2d429e1d548c2049c2179574a783ea791c7132ed (patch)
treea55a0d3c12ba461deaa51ee53144e12992aad9ba /source/blender/src/transform_conversions.c
parent4ad6ac1caddcecc7e6a00f316cf60ea4d8b2aa38 (diff)
== Armature Animation Fixes ==
This commit fixes several bugs related to animating armatures. I've also tidied up the formatting in a few files along the way, and also commented the flags for this pose->flag. What's new/fixed: * Undo will no longer destroy entire un-keyframed poses. Now it behaves as expected, and only reverses the most recent change. * On some files, POSE_DO_UNLOCK somehow got set on files and never cleared. The symptom of this was a file in which you suddenly could no longer pose an armature at all without using auto-keyframing. A check to prevent this from happening again has been added (it will also fix old files too) Notes: - Now, all PoseChannels get tagged with BONE_UNKEYED after they have been transformed. This flag prevents IPO data being flushed over these new values, even after undo. - These tags only get removed on frame-changes or inserting new keyframes.
Diffstat (limited to 'source/blender/src/transform_conversions.c')
-rw-r--r--source/blender/src/transform_conversions.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/source/blender/src/transform_conversions.c b/source/blender/src/transform_conversions.c
index 31002134d55..058461806ce 100644
--- a/source/blender/src/transform_conversions.c
+++ b/source/blender/src/transform_conversions.c
@@ -2607,15 +2607,19 @@ void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
if (!act)
act= ob->action= add_empty_action("Action");
- for (pchan=pose->chanbase.first; pchan; pchan=pchan->next){
- if (pchan->bone->flag & BONE_TRANSFORM){
-
+ for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
+ if (pchan->bone->flag & BONE_TRANSFORM) {
+ /* clear any 'unkeyed' flag it may have */
+ pchan->bone->flag &= ~BONE_UNKEYED;
+
+ /* only insert into available channels? */
if(U.uiflag & USER_KEYINSERTAVAI) {
bActionChannel *achan;
-
+
for (achan = act->chanbase.first; achan; achan=achan->next){
if (achan->ipo && !strcmp (achan->name, pchan->name)){
for (icu = achan->ipo->curve.first; icu; icu=icu->next){
+ /* only insert keyframe if needed? */
if (U.uiflag & USER_KEYINSERTNEED)
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, icu->adrcode);
else
@@ -2625,6 +2629,7 @@ void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
}
}
}
+ /* only insert keyframe if needed? */
else if (U.uiflag & USER_KEYINSERTNEED) {
if ((tmode==TFM_TRANSLATION) && (targetless_ik==0)) {
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X);
@@ -2643,16 +2648,17 @@ void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
insertkey_smarter(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z);
}
}
+ /* insert keyframe in any channel that's appropriate */
else {
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_X, 0);
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Y, 0);
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_SIZE_Z, 0);
-
+
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_W, 0);
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_X, 0);
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Y, 0);
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_QUAT_Z, 0);
-
+
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_X, 0);
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Y, 0);
insertkey(&ob->id, ID_PO, pchan->name, NULL, AC_LOC_Z, 0);
@@ -2667,6 +2673,15 @@ void autokeyframe_pose_cb_func(Object *ob, int tmode, short targetless_ik)
allqueue(REDRAWNLA, 0);
allqueue(REDRAWTIME, 0);
}
+ else {
+ /* tag channels that should have unkeyed data */
+ for (pchan=pose->chanbase.first; pchan; pchan=pchan->next) {
+ if (pchan->bone->flag & BONE_TRANSFORM) {
+ /* tag this channel */
+ pchan->bone->flag |= BONE_UNKEYED;
+ }
+ }
+ }
}
/* very bad call!!! - copied from editnla.c! */
@@ -2775,8 +2790,8 @@ void special_aftertrans_update(TransInfo *t)
if(t->mode==TFM_TRANSLATION)
pose_grab_with_ik_clear(ob);
-
- /* automatic inserting of keys */
+
+ /* automatic inserting of keys and unkeyed tagging - only if transform wasn't cancelled */
if(!cancelled) {
autokeyframe_pose_cb_func(ob, t->mode, targetless_ik);
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);