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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2009-04-20 19:06:46 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2009-04-20 19:06:46 +0400
commit874c29cea8e6f9bc411fccf2d6f4cb07e94328d0 (patch)
tree5971e577cf7c02e05a1e37b5ad058c71a6744877 /source/blender/editors/armature
parent7555bfa793a2b0fc187c6211c56986f35b2d7b09 (diff)
parentc5bc4e4fb1a33eda8c31f2ea02e91f32f74c8fa5 (diff)
2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r19323:HEAD
Notes: * blenderbuttons and ICON_SNAP_PEEL_OBJECT were not merged.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r--source/blender/editors/armature/BIF_generate.h2
-rw-r--r--source/blender/editors/armature/BIF_retarget.h2
-rw-r--r--source/blender/editors/armature/editarmature_generate.c8
-rw-r--r--source/blender/editors/armature/editarmature_retarget.c13
-rw-r--r--source/blender/editors/armature/editarmature_sketch.c25
-rw-r--r--source/blender/editors/armature/poseobject.c31
6 files changed, 59 insertions, 22 deletions
diff --git a/source/blender/editors/armature/BIF_generate.h b/source/blender/editors/armature/BIF_generate.h
index bc655a4cdff..bde079c45fb 100644
--- a/source/blender/editors/armature/BIF_generate.h
+++ b/source/blender/editors/armature/BIF_generate.h
@@ -1,5 +1,5 @@
/**
- * $Id: $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/armature/BIF_retarget.h b/source/blender/editors/armature/BIF_retarget.h
index 049ddf5baa5..c39f410424a 100644
--- a/source/blender/editors/armature/BIF_retarget.h
+++ b/source/blender/editors/armature/BIF_retarget.h
@@ -1,5 +1,5 @@
/**
- * $Id: $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
diff --git a/source/blender/editors/armature/editarmature_generate.c b/source/blender/editors/armature/editarmature_generate.c
index a1990814a02..6d271375c64 100644
--- a/source/blender/editors/armature/editarmature_generate.c
+++ b/source/blender/editors/armature/editarmature_generate.c
@@ -1,5 +1,5 @@
/**
- * $Id: editarmature_generate.c $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -53,14 +53,14 @@ void setBoneRollFromNormal(EditBone *bone, float *no, float invmat[][4], float t
{
if (no != NULL && !VecIsNull(no))
{
- float tangent[3], cotangent[3], normal[3];
+ float tangent[3], vec[3], normal[3];
VECCOPY(normal, no);
Mat3MulVecfl(tmat, normal);
VecSubf(tangent, bone->tail, bone->head);
- Crossf(cotangent, tangent, normal);
- Crossf(normal, cotangent, tangent);
+ Projf(vec, tangent, normal);
+ VecSubf(normal, normal, vec);
Normalize(normal);
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c
index 4da7eaf9440..68e8b45e7d2 100644
--- a/source/blender/editors/armature/editarmature_retarget.c
+++ b/source/blender/editors/armature/editarmature_retarget.c
@@ -206,12 +206,12 @@ float rollBoneByQuatAligned(EditBone *bone, float old_up_axis[3], float qrot[4],
}
}
-float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4])
+float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float qroll[4], float up_axis[3])
{
if (previous == NULL)
{
- QuatOne(qroll);
- return rollBoneByQuat(edge->bone, edge->up_axis, qrot);
+ /* default to up_axis if no previous */
+ return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
else
{
@@ -228,9 +228,8 @@ float rollBoneByQuatJoint(RigEdge *edge, RigEdge *previous, float qrot[4], float
}
else
{
- /* SHOULDN'T BE HERE */
- QuatOne(qroll);
- return rollBoneByQuat(edge->bone, edge->up_axis, qrot);
+ /* default to up_axis if first bone in the chain is an offset */
+ return rollBoneByQuatAligned(edge->bone, edge->up_axis, qrot, qroll, up_axis);
}
VecSubf(vec_second, edge->bone->tail, edge->bone->head);
@@ -1859,7 +1858,7 @@ static void repositionBone(bContext *C, RigGraph *rigg, RigEdge *edge, float vec
}
else if (scene->toolsettings->skgen_retarget_roll == SK_RETARGET_ROLL_JOINT)
{
- bone->roll = rollBoneByQuatJoint(edge, edge->next, qrot, qroll);
+ bone->roll = rollBoneByQuatJoint(edge, edge->prev, qrot, qroll, up_axis);
}
else
{
diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c
index 5d0b954046c..45605ad472d 100644
--- a/source/blender/editors/armature/editarmature_sketch.c
+++ b/source/blender/editors/armature/editarmature_sketch.c
@@ -1,5 +1,5 @@
/**
- * $Id: $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -293,7 +293,7 @@ char *BIF_listTemplates(bContext *C)
while (!BLI_ghashIterator_isDone(&ghi))
{
Object *ob = BLI_ghashIterator_getValue(&ghi);
- int key = (int)BLI_ghashIterator_getKey(&ghi);
+ int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi));
p += sprintf(p, "|%s%%x%i", ob->id.name+2, key);
@@ -314,7 +314,7 @@ int BIF_currentTemplate(bContext *C)
while (!BLI_ghashIterator_isDone(&ghi))
{
Object *ob = BLI_ghashIterator_getValue(&ghi);
- int key = (int)BLI_ghashIterator_getKey(&ghi);
+ int key = GET_INT_FROM_POINTER(BLI_ghashIterator_getKey(&ghi));
if (ob == scene->toolsettings->skgen_template)
{
@@ -1035,7 +1035,22 @@ void sk_drawStroke(SK_Stroke *stk, int id, float color[3], int start, int end)
}
glEnd();
-
+
+#if 0
+ glColor3f(0, 0, 1);
+ glBegin(GL_LINES);
+
+ for (i = 0; i < stk->nb_points; i++)
+ {
+ float *p = stk->points[i].p;
+ float *no = stk->points[i].no;
+ glVertex3fv(p);
+ glVertex3f(p[0] + no[0], p[1] + no[1], p[2] + no[2]);
+ }
+
+ glEnd();
+#endif
+
glColor3f(0, 0, 0);
glBegin(GL_POINTS);
@@ -1998,7 +2013,7 @@ void sk_convertStroke(bContext *C, SK_Stroke *stk)
Mat4MulVecfl(invmat, bone->head);
Mat4MulVecfl(invmat, bone->tail);
- setBoneRollFromNormal(bone, pt->no, invmat, tmat);
+ setBoneRollFromNormal(bone, head->no, invmat, tmat);
}
new_parent = bone;
diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c
index 09edc5549c1..3d8d446c579 100644
--- a/source/blender/editors/armature/poseobject.c
+++ b/source/blender/editors/armature/poseobject.c
@@ -1237,7 +1237,6 @@ static short pose_select_same_layer (Object *ob)
return changed;
}
-
void pose_select_grouped (Scene *scene, short nr)
{
short changed = 0;
@@ -1669,9 +1668,7 @@ void pose_special_editmenu(Scene *scene)
pose_clear_paths(ob);
}
else if(nr==5) {
- rest_pose(ob->pose);
- DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
- BIF_undo_push("Clear User Transform Pose");
+ pose_clear_user_transforms(scene, ob);
}
else if(nr==6) {
pose_relax();
@@ -1682,3 +1679,29 @@ void pose_special_editmenu(Scene *scene)
#endif
}
+/* Restore selected pose-bones to 'action'-defined pose */
+void pose_clear_user_transforms(Scene *scene, Object *ob)
+{
+ bArmature *arm= ob->data;
+ bPoseChannel *pchan;
+
+ if (ob->pose == NULL)
+ return;
+
+ /* find selected bones */
+ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
+ if (pchan->bone && (pchan->bone->flag & BONE_SELECTED) && (pchan->bone->layer & arm->layer)) {
+ /* just clear the BONE_UNKEYED flag, allowing this bone to get overwritten by actions again */
+ pchan->bone->flag &= ~BONE_UNKEYED;
+ }
+ }
+
+ /* clear pose locking flag
+ * - this will only clear the user-defined pose in the selected bones, where BONE_UNKEYED has been cleared
+ */
+ ob->pose->flag |= POSE_DO_UNLOCK;
+
+ DAG_object_flush_update(scene, ob, OB_RECALC_DATA);
+ BIF_undo_push("Clear User Transform");
+}
+