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:
Diffstat (limited to 'source/blender/editors/transform/transform_convert_armature.c')
-rw-r--r--source/blender/editors/transform/transform_convert_armature.c60
1 files changed, 37 insertions, 23 deletions
diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c
index 9885c8fc3a6..a7301161570 100644
--- a/source/blender/editors/transform/transform_convert_armature.c
+++ b/source/blender/editors/transform/transform_convert_armature.c
@@ -99,7 +99,7 @@ static void autokeyframe_pose(
bPoseChannel *pchan;
FCurve *fcu;
- // TODO: this should probably be done per channel instead...
+ /* TODO: this should probably be done per channel instead. */
if (!autokeyframe_cfra_can_key(scene, id)) {
/* tag channels that should have unkeyed data */
for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) {
@@ -337,7 +337,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
if (data->rootbone == 0) {
for (bPoseChannel *pchan_iter = pchan; pchan_iter; pchan_iter = pchan_iter->parent) {
/* here, we set ik-settings for bone from pchan->protectflag */
- // XXX: careful with quats/axis-angle rotations where we're locking 4d components
+ /* XXX: careful with quats/axis-angle rotations where we're locking 4d components. */
if (pchan_iter->protectflag & OB_LOCK_ROTX) {
pchan_iter->ikflag |= BONE_IK_NO_XDOF_TEMP;
}
@@ -349,6 +349,10 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
}
}
}
+
+ /* Return early (as in: don't actually create a temporary constraint here), since adding
+ * will take place later in add_pose_transdata() for targetless constraints. */
+ return 0;
}
}
@@ -369,7 +373,7 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
/* we only include bones that are part of a continual connected chain */
do {
/* here, we set ik-settings for bone from pchan->protectflag */
- // XXX: careful with quats/axis-angle rotations where we're locking 4d components
+ /* XXX: careful with quats/axis-angle rotations where we're locking 4d components. */
if (pchan->protectflag & OB_LOCK_ROTX) {
pchan->ikflag |= BONE_IK_NO_XDOF_TEMP;
}
@@ -679,7 +683,7 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
td->ival = bone->dist;
}
else if (t->mode == TFM_BONESIZE) {
- // abusive storage of scale in the loc pointer :)
+ /* Abusive storage of scale in the loc pointer :) */
td->loc = &bone->xwidth;
copy_v3_v3(td->iloc, td->loc);
td->val = NULL;
@@ -702,10 +706,14 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr
/* Add a temporary auto IK constraint here, as we will only temporarily active this
* targetless bone during transform. (Targetless IK constraints are treated as if they are
- * disabled unless they are transformed). */
- add_temporary_ik_constraint(pchan, data);
- Main *bmain = CTX_data_main(t->context);
- update_deg_with_temporary_ik(bmain, ob);
+ * disabled unless they are transformed).
+ * Only do this for targetless IK though, AutoIK already added a constraint in
+ * pose_grab_with_ik_add() beforehand. */
+ if ((data->flag & CONSTRAINT_IK_TEMP) == 0) {
+ add_temporary_ik_constraint(pchan, data);
+ Main *bmain = CTX_data_main(t->context);
+ update_deg_with_temporary_ik(bmain, ob);
+ }
/* only object matrix correction */
copy_m3_m3(td->mtx, omat);
@@ -949,8 +957,9 @@ void createTransArmatureVerts(TransInfo *t)
for (ebo = edbo->first; ebo; ebo = ebo->next) {
td_old = td;
- ebo->oldlength =
- ebo->length; // length==0.0 on extrude, used for scaling radius of bone points
+
+ /* (length == 0.0) on extrude, used for scaling radius of bone points. */
+ ebo->oldlength = ebo->length;
if (EBONE_VISIBLE(arm, ebo) && !(ebo->flag & BONE_EDITMODE_LOCKED)) {
if (t->mode == TFM_BONE_ENVELOPE) {
@@ -994,7 +1003,7 @@ void createTransArmatureVerts(TransInfo *t)
td->ival = ebo->dist;
}
else {
- // abusive storage of scale in the loc pointer :)
+ /* Abusive storage of scale in the loc pointer :). */
td->loc = &ebo->xwidth;
copy_v3_v3(td->iloc, td->loc);
td->val = NULL;
@@ -1256,7 +1265,7 @@ void recalcData_edit_armature(TransInfo *t)
rotation_between_vecs_to_quat(qrot, td->axismtx[1], vec);
mul_qt_v3(qrot, up_axis);
- /* roll has a tendency to flip in certain orientations - [#34283], [#33974] */
+ /* roll has a tendency to flip in certain orientations - T34283, T33974. */
roll = ED_armature_ebone_roll_to_vector(ebo, up_axis, false);
ebo->roll = angle_compat_rad(roll, td->ival);
}
@@ -1322,8 +1331,8 @@ static void pose_transform_mirror_update(TransInfo *t, TransDataContainer *tc, O
/* We assume X-axis flipping for now. */
pchan->curve_in_x = pchan_orig->curve_in_x * -1;
pchan->curve_out_x = pchan_orig->curve_out_x * -1;
- pchan->roll1 = pchan_orig->roll1 * -1; // XXX?
- pchan->roll2 = pchan_orig->roll2 * -1; // XXX?
+ pchan->roll1 = pchan_orig->roll1 * -1; /* XXX? */
+ pchan->roll2 = pchan_orig->roll2 * -1; /* XXX? */
float pchan_mtx_final[4][4];
BKE_pchan_to_mat4(pchan_orig, pchan_mtx_final);
@@ -1350,10 +1359,14 @@ static void pose_transform_mirror_update(TransInfo *t, TransDataContainer *tc, O
data->flag |= CONSTRAINT_IK_AUTO;
/* Add a temporary auto IK constraint here, as we will only temporarily active this
* target-less bone during transform. (Target-less IK constraints are treated as if they are
- * disabled unless they are transformed) */
- add_temporary_ik_constraint(pchan, data);
- Main *bmain = CTX_data_main(t->context);
- update_deg_with_temporary_ik(bmain, ob);
+ * disabled unless they are transformed).
+ * Only do this for targetless IK though, AutoIK already added a constraint in
+ * pose_grab_with_ik_add() beforehand. */
+ if ((data->flag & CONSTRAINT_IK_TEMP) == 0) {
+ add_temporary_ik_constraint(pchan, data);
+ Main *bmain = CTX_data_main(t->context);
+ update_deg_with_temporary_ik(bmain, ob);
+ }
}
if (pid) {
@@ -1453,7 +1466,8 @@ void recalcData_pose(TransInfo *t)
* (FPoints) instead of keyframes? */
if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) {
int targetless_ik =
- (t->flag & T_AUTOIK); // XXX this currently doesn't work, since flags aren't set yet!
+ (t->flag &
+ T_AUTOIK); /* XXX this currently doesn't work, since flags aren't set yet! */
animrecord_check_state(t, ob);
autokeyframe_pose(t->context, t->scene, ob, t->mode, targetless_ik);
@@ -1490,7 +1504,7 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb)
if ((bone->flag & BONE_HINGE) && (bone->flag & BONE_CONNECTED)) {
bone->flag |= BONE_HINGE_CHILD_TRANSFORM;
}
- else if ((bone->flag & BONE_TRANSFORM) && (mode == TFM_ROTATION || mode == TFM_TRACKBALL) &&
+ else if ((bone->flag & BONE_TRANSFORM) && (ELEM(mode, TFM_ROTATION, TFM_TRACKBALL)) &&
(around == V3D_AROUND_LOCAL_ORIGINS)) {
bone->flag |= BONE_TRANSFORM_CHILD;
}
@@ -1605,7 +1619,7 @@ static short apply_targetless_ik(Object *ob)
segcount++;
if (segcount == data->rootbone || segcount > 255) {
- break; // 255 is weak
+ break; /* 255 is weak */
}
}
for (; segcount; segcount--) {
@@ -1631,7 +1645,7 @@ static short apply_targetless_ik(Object *ob)
normalize_m3(rmat3);
/* rotation */
- /* [#22409] is partially caused by this, as slight numeric error introduced during
+ /* T22409 is partially caused by this, as slight numeric error introduced during
* the solving process leads to locked-axis values changing. However, we cannot modify
* the values here, or else there are huge discrepancies between IK-solver (interactive)
* and applied poses. */
@@ -1731,7 +1745,7 @@ void special_aftertrans_update__pose(bContext *C, TransInfo *t)
if ((t->flag & T_AUTOIK) && (t->options & CTX_AUTOCONFIRM)) {
/* when running transform non-interactively (operator exec),
* we need to update the pose otherwise no updates get called during
- * transform and the auto-ik is not applied. see [#26164] */
+ * transform and the auto-ik is not applied. see T26164. */
struct Object *pose_ob = tc->poseobj;
BKE_pose_where_is(t->depsgraph, t->scene, pose_ob);
}