Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / blender / editors / armature / poselib.c
index 46d08af..021bec0 100644 (file)
@@ -278,7 +278,8 @@ void poselib_validate_act (bAction *act)
 /* ************************************************************* */
 
 /* Pointers to the builtin KeyingSets that we want to use */
-static KeyingSet *poselib_ks_locrotscale = NULL;               /* the only keyingset we'll need*/
+static KeyingSet *poselib_ks_locrotscale = NULL;               /* quaternion rotations */
+static KeyingSet *poselib_ks_locrotscale2 = NULL;              /* euler rotations */           // XXX FIXME...
 static short poselib_ks_need_init= 1;                                  /* have the above been obtained yet? */
 
 /* Make sure the builtin KeyingSets are initialised properly 
@@ -289,9 +290,13 @@ static void poselib_get_builtin_keyingsets (void)
        /* only if we haven't got these yet */
        // FIXME: this assumes that we will always get the builtin sets... 
        if (poselib_ks_need_init) {
-               /* LocRotScale (quaternions or eulers depending on context) */
+               /* LocRotScale (quaternions) */
                poselib_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
                
+               /* LocRotScale (euler) */
+               //ks_locrotscale2= ANIM_builtin_keyingset_get_named(ks_locrotscale, "LocRotScale");
+               poselib_ks_locrotscale2= poselib_ks_locrotscale; // FIXME: for now, just use the same one...
+               
                /* clear flag requesting init */
                poselib_ks_need_init= 0;
        }
@@ -405,8 +410,11 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
                                /* init cks for this PoseChannel, then use the relative KeyingSets to keyframe it */
                                cks.pchan= pchan;
                                
-                               /* KeyingSet to use depends on rotation mode (but that's handled by the templates code)  */
-                               modify_keyframes(C, &dsources, act, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)frame);
+                               /* KeyingSet to use depends on rotation mode  */
+                               if (pchan->rotmode)
+                                       modify_keyframes(C, &dsources, act, poselib_ks_locrotscale2, MODIFYKEY_MODE_INSERT, (float)frame);
+                               else
+                                       modify_keyframes(C, &dsources, act, poselib_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)frame);
                        }
                }
        }
@@ -835,7 +843,7 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
                 */
                // FIXME: shouldn't this use the builtin stuff?
                if ((pld->arm->flag & ARM_DELAYDEFORM)==0)
-                       DAG_id_flush_update(&pld->ob->id, OB_RECALC_DATA);  /* sets recalc flags */
+                       DAG_object_flush_update(pld->scene, pld->ob, OB_RECALC_DATA);  /* sets recalc flags */
                else
                        where_is_pose(pld->scene, pld->ob);
        }
@@ -1338,7 +1346,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op)
                 *      - note: code copied from transform_generics.c -> recalcData()
                 */
                if ((arm->flag & ARM_DELAYDEFORM)==0)
-                       DAG_id_flush_update(&ob->id, OB_RECALC_DATA);  /* sets recalc flags */
+                       DAG_object_flush_update(scene, ob, OB_RECALC_DATA);  /* sets recalc flags */
                else
                        where_is_pose(scene, ob);
                
@@ -1352,7 +1360,7 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op)
                action_set_activemarker(act, marker, 0);
                
                /* Update event for pose and deformation children */
-               DAG_id_flush_update(&ob->id, OB_RECALC_DATA);
+               DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
                
                /* updates */
                if (IS_AUTOKEY_MODE(scene, NORMAL)) {