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>2009-09-13 16:34:00 +0400
committerJoshua Leung <aligorith@gmail.com>2009-09-13 16:34:00 +0400
commitca986a6874412aacbe9ec31a0cf94285f3d9ad41 (patch)
treea964ec9eb81b60ca10cba38337e88d2d560380b3 /source/blender/editors/armature/poseobject.c
parent16a7fe1314bb82850a2d410089b6665eb8154f26 (diff)
2 Animation Fixes:
* Auto-keyframing for Paste Poses and PoseLib works again. Unfortunately, it doesn't take into account whether the transforms were changed or not... * 'Stick to View' setting for Grease Pencil has now been inverted, since the old order was confusing.
Diffstat (limited to 'source/blender/editors/armature/poseobject.c')
-rw-r--r--source/blender/editors/armature/poseobject.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 7d7f54309a8..bab7111dbd7 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -961,6 +961,11 @@ void POSE_OT_copy (wmOperatorType *ot)
/* ---- */
+/* Pointers to the builtin KeyingSets that we want to use */
+static KeyingSet *posePaste_ks_locrotscale = NULL; /* the only keyingset we'll need */
+
+/* ---- */
+
static int pose_paste_exec (bContext *C, wmOperator *op)
{
Scene *scene= CTX_data_scene(C);
@@ -969,6 +974,13 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
char name[32];
int flip= RNA_boolean_get(op->ptr, "flipped");
+ bCommonKeySrc cks;
+ ListBase dsources = {&cks, &cks};
+
+ /* init common-key-source for use by KeyingSets */
+ memset(&cks, 0, sizeof(bCommonKeySrc));
+ cks.id= &ob->id;
+
/* sanity checks */
if ELEM(NULL, ob, ob->pose)
return OPERATOR_CANCELLED;
@@ -1045,6 +1057,13 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
eul[1]*= -1;
eul[2]*= -1;
EulOToAxisAngle(eul, EULER_ORDER_DEFAULT, &pchan->quat[1], &pchan->quat[0]);
+
+ // experimental method (uncomment to test):
+#if 0
+ /* experimental method: just flip the orientation of the axis on x/y axes */
+ pchan->quat[1] *= -1;
+ pchan->quat[2] *= -1;
+#endif
}
else {
float eul[3];
@@ -1056,28 +1075,16 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
}
}
-#if 0 // XXX old animation system
- if (autokeyframe_cfra_can_key(ob)) {
- ID *id= &ob->id;
+ if (autokeyframe_cfra_can_key(scene, &ob->id)) {
+ /* Set keys on pose
+ * - KeyingSet to use depends on rotation mode
+ * (but that's handled by the templates code)
+ */
+ // TODO: for getting the KeyingSet used, we should really check which channels were affected
+ if (posePaste_ks_locrotscale == NULL)
+ posePaste_ks_locrotscale= ANIM_builtin_keyingset_get_named(NULL, "LocRotScale");
- /* Set keys on pose */
- // TODO: make these use keyingsets....
- if (chan->flag & POSE_ROT) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_Z, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_QUAT_W, 0);
- }
- if (chan->flag & POSE_SIZE) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_SIZE_Z, 0);
- }
- if (chan->flag & POSE_LOC) {
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_X, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_Y, 0);
- insertkey(id, ID_PO, pchan->name, NULL, AC_LOC_Z, 0);
- }
+ modify_keyframes(C, &dsources, NULL, posePaste_ks_locrotscale, MODIFYKEY_MODE_INSERT, (float)CFRA);
/* clear any unkeyed tags */
if (chan->bone)
@@ -1088,7 +1095,6 @@ static int pose_paste_exec (bContext *C, wmOperator *op)
if (chan->bone)
chan->bone->flag |= BONE_UNKEYED;
}
-#endif // XXX old animation system
}
}
}
@@ -1975,6 +1981,7 @@ void ARMATURE_OT_bone_layers (wmOperatorType *ot)
RNA_def_boolean_array(ot->srna, "layers", 16, NULL, "Layers", "Armature layers that bone belongs to.");
}
+/* ********************************************** */
#if 0
// XXX old sys