PoseChannel Transforms - AutoIK Restored
authorJoshua Leung <aligorith@gmail.com>
Tue, 17 Feb 2009 09:34:21 +0000 (09:34 +0000)
committerJoshua Leung <aligorith@gmail.com>
Tue, 17 Feb 2009 09:34:21 +0000 (09:34 +0000)
- Auto-IK works again now.

- Quick-animate feature works with Auto-IK now.
- Also disabled the checks for existing animation data for this, making it easier to use/discover. At least we've got undo to cover for the cases where the user didn't intend to do this.

source/blender/editors/transform/transform_conversions.c
source/blender/editors/transform/transform_generics.c

index bfa2394d2923e16181796e061bb2180c5ef3177d..3df76c1e4c47ab18cd191c396997dbdf742c2408 100644 (file)
 #include "ED_image.h"
 #include "ED_keyframing.h"
 #include "ED_keyframes_edit.h"
+#include "ED_object.h"
 #include "ED_mesh.h"
 #include "ED_types.h"
 #include "ED_uvedit.h"
@@ -835,18 +836,17 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
                        if(data->tar==NULL || (data->tar->type==OB_ARMATURE && data->subtarget[0]==0)) {
                                targetless = con;
                                /* but, if this is a targetless IK, we make it auto anyway (for the children loop) */
-                               if (con->enforce!=0.0) {
+                               if (con->enforce!=0.0f) {
                                        targetless->flag |= CONSTRAINT_IK_AUTO;
                                        return 0;
                                }
                        }
-                       if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0))
+                       if ((con->flag & CONSTRAINT_DISABLE)==0 && (con->enforce!=0.0f))
                                return 0;
                }
        }
        
-       // TRANSFORM_FIX_ME
-       //con = add_new_constraint(CONSTRAINT_TYPE_KINEMATIC);
+       con = add_new_constraint(CONSTRAINT_TYPE_KINEMATIC);
        BLI_addtail(&pchan->constraints, con);
        pchan->constflag |= (PCHAN_HAS_IK|PCHAN_HAS_TARGET);    /* for draw, but also for detecting while pose solving */
        data= con->data;
@@ -965,7 +965,6 @@ static void createTransPose(bContext *C, TransInfo *t, Object *ob)
        
        if (arm->flag & ARM_RESTPOS) {
                if (ELEM(t->mode, TFM_DUMMY, TFM_BONESIZE)==0) {
-                       //notice("Pose edit not possible while Rest Position is enabled");
                        BKE_report(CTX_reports(C), RPT_ERROR, "Can't select linked when sync selection is enabled.");
                        return;
                }
@@ -1004,7 +1003,6 @@ static void createTransPose(bContext *C, TransInfo *t, Object *ob)
        }
        
        if(td != (t->data+t->total)) {
-               // printf("Bone selection count error\n");
                BKE_report(CTX_reports(C), RPT_DEBUG, "Bone selection count error.");
        }
        
index 7c865e91c404b3c1ad6608dc1d4ae18d0b674c31..16798ea2cd5adfc7f55abedc846ea25ed65be488 100644 (file)
@@ -565,10 +565,10 @@ void recalcData(TransInfo *t)
                 * check if the auto-record feature means that we should record 'samples'
                 * (i.e. uneditable animation values)
                 */
-               // XXX experimental feature
                // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
-               if ((ob->adt) && (t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
-                       short targetless_ik= 0; // XXX...
+               // TODO: maybe the ob->adt check isn't really needed? makes it too difficult to use...
+               if (/*(ob->adt) && */(t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+                       short targetless_ik= (t->flag & T_AUTOIK);
                        autokeyframe_pose_cb_func(t->scene, (View3D *)t->view, ob, t->mode, targetless_ik);
                }
                
@@ -593,9 +593,9 @@ void recalcData(TransInfo *t)
                         * check if the auto-record feature means that we should record 'samples'
                         * (i.e. uneditable animation values)
                         */
-                       // XXX experimental feature
                        // TODO: autokeyframe calls need some setting to specify to add samples (FPoints) instead of keyframes?
-                       if ((ob->adt) && (t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
+                       // TODO: maybe the ob->adt check isn't really needed? makes it too difficult to use...
+                       if (/*(ob->adt) && */(t->animtimer) && IS_AUTOKEY_ON(t->scene)) {
                                autokeyframe_ob_cb_func(t->scene, (View3D *)t->view, ob, t->mode);
                        }