Fix T75649: Using "Auto IK" on FK controls with Rigify will crash Blender.

Fixed a coding mistake when adding temp IK chains with Auto-IK.
We need to use the data from the new temporary constraint.
This commit is contained in:
Sebastian Parborg 2020-04-15 12:32:06 +02:00
parent c1edbe7917
commit 6547d9d3e2
Notes: blender-bot 2023-02-14 08:38:11 +01:00
Referenced by issue #75735, Armature Auto IK no longer uses the correct chain length
Referenced by issue #75649, (Crash Report) Using "Auto IK" on FK controls with Rigify will crash Blender. (MacOS)
1 changed files with 6 additions and 2 deletions

View File

@ -58,7 +58,8 @@ typedef struct BoneInitData {
float zwidth;
} BoneInitData;
static void add_temporary_ik_constraint(bPoseChannel *pchan, bKinematicConstraint *targetless_con)
static bConstraint *add_temporary_ik_constraint(bPoseChannel *pchan,
bKinematicConstraint *targetless_con)
{
bConstraint *con = BKE_constraint_add_for_pose(
NULL, pchan, "TempConstraint", CONSTRAINT_TYPE_KINEMATIC);
@ -77,6 +78,8 @@ static void add_temporary_ik_constraint(bPoseChannel *pchan, bKinematicConstrain
}
temp_con_data->flag |= CONSTRAINT_IK_TEMP | CONSTRAINT_IK_AUTO | CONSTRAINT_IK_POS;
return con;
}
static void update_deg_with_temporary_ik(Main *bmain, Object *ob)
@ -324,7 +327,8 @@ static short pose_grab_with_ik_add(bPoseChannel *pchan)
}
}
add_temporary_ik_constraint(pchan, targetless);
data = add_temporary_ik_constraint(pchan, targetless)->data;
copy_v3_v3(data->grabtarget, pchan->pose_tail);
/* watch-it! has to be 0 here, since we're still on the