87 *temp_con_data = *targetless_con;
113 for (; con; con = con->
next) {
119 if (
data->tar ==
nullptr) {
139 if (pchan ==
nullptr) {
154 if (con->enforce != 0.0f) {
159 if (
data->rootbone == 0) {
223 data->max_rootbone =
data->rootbone;
233 short wentdeeper = 0, added = 0;
242 if (wentdeeper == 0) {
271 for (bonec =
static_cast<Bone *
>(pchan->bone->childbase.first); bonec; bonec = bonec->
next)
277 if ((pchan->bone->flag &
BONE_CONNECTED) == 0 && (bonec ==
nullptr)) {
285 for (parent = pchan->
parent; parent; parent = parent->
parent) {
290 if (parent ==
nullptr) {
307 return (tot_ik) ? 1 : 0;
343 bool is_mirror_relative)
364 if (is_mirror_relative) {
365 float pchan_mtx[4][4];
366 float pchan_mtx_mirror[4][4];
368 float flip_mtx[4][4];
375 mul_m4_m4m4(pchan_mtx_mirror, pchan_mtx_mirror, flip_mtx);
376 mul_m4_m4m4(pchan_mtx_mirror, flip_mtx, pchan_mtx_mirror);
396 float pmat[3][3], omat[3][3];
397 float cmat[3][3], tmat[3][3];
431 td_ext->
quat =
nullptr;
436 td_ext->
rot =
nullptr;
439 td_ext->
quat =
nullptr;
445 td_ext->
rot =
nullptr;
455 copy_m3_m4(omat, ob->object_to_world().ptr());
571 bool has_translate_rotate_buf[2] = {
false,
false};
572 bool *has_translate_rotate = (t->
mode ==
TFM_TRANSLATION) ? has_translate_rotate_buf :
nullptr;
582 if ((arm ==
nullptr) || (pose ==
nullptr)) {
593 Bone *bone = pchan->bone;
600 if (has_translate_rotate !=
nullptr) {
601 if (has_translate_rotate[0] && has_translate_rotate[1]) {
608 has_translate_rotate[0] =
true;
613 has_translate_rotate[0] =
true;
617 has_translate_rotate[1] =
true;
621 has_translate_rotate[0] =
true;
626 if (tc->data_len == 0) {
639 int total_mirrored = 0;
652 "PoseInitData_Mirror");
655 pid[total_mirrored].
pchan =
nullptr;
658 tc->custom.type.use_free =
true;
663 if (tc->data_len == 0) {
674 if (pose ==
nullptr) {
705 has_translate_rotate[0] =
true;
721 if (td != (tc->data + tc->data_len)) {
734 if (has_translate_rotate[1]) {
751 int total_mirrored = 0;
755 const int data_len_prev = tc->data_len;
778 if (mirror && (data_len_prev < tc->data_len)) {
793 bid[total_mirrored].
bone =
nullptr;
795 tc->custom.type.data = bid;
796 tc->custom.type.use_free =
true;
812 float mtx[3][3], smtx[3][3], bonemat[3][3];
816 copy_m3_m4(mtx, tc->obedit->object_to_world().ptr());
826 ebo->oldlength = ebo->length;
831 td->
val = &ebo->rad_head;
845 td->
val = &ebo->rad_tail;
862 td->
val = &ebo->dist;
863 td->
ival = ebo->dist;
867 td->
loc = &ebo->xwidth;
888 td->
val = &(ebo->roll);
889 td->
ival = ebo->roll;
927 td->
ival = ebo->roll;
949 td->
ival = ebo->roll;
958 if (mirror && (td_old != td)) {
961 bid[
i].
bone = eboflip;
978 bid[
i].
bone =
nullptr;
1018 if ((ebo_child->flag &
BONE_CONNECTED) && (ebo_child->parent == ebo)) {
1020 ebo_child->rad_head = ebo->
rad_tail;
1096 for (
i = 0;
i < tc->data_len;
i++, td++) {
1098 float vec[3], up_axis[3];
1147 float flip_mtx[4][4];
1149 flip_mtx[0][0] = -1;
1168 if (pchan ==
nullptr) {
1182 float pchan_mtx_final[4][4];
1184 mul_m4_m4m4(pchan_mtx_final, pchan_mtx_final, flip_mtx);
1185 mul_m4_m4m4(pchan_mtx_final, flip_mtx, pchan_mtx_final);
1197 if (
data ==
nullptr) {
1267 const bool targetless_ik,
1268 const bool is_connected,
1269 const bool transforming_more_than_one_bone)
1275 if (transforming_more_than_one_bone &&
1278 rna_paths.
append({
"location"});
1281 rna_paths.
append({
"location"});
1309 if (!is_connected) {
1312 if (targetless_ik) {
1313 rna_paths.
append({rotation_path});
1320 rna_paths.
append({rotation_path});
1326 rna_paths.
append({
"scale"});
1339 short targetless_ik,
1341 const bool transforming_more_than_one_bone)
1357 const bool is_connected = pchan->bone->parent !=
nullptr &&
1364 transforming_more_than_one_bone);
1367 rna_paths = {{
"location"}, {rotation_path}, {
"scale"}};
1381 Object *ob = tc->poseobj;
1407 Object *ob = tc->poseobj;
1446 GSET_ITER (gs_iter, motionpath_updates) {
1466 if (&pose_bone == &child) {
1519 int segcount, apply = 0;
1536 for (; parchan; parchan = parchan->
parent) {
1537 chanlist[segcount] = parchan;
1540 if (segcount ==
data->rootbone || segcount > 255) {
1544 for (; segcount; segcount--) {
1552 parchan = chanlist[segcount - 1];
1559 float rmat3[3][3], qrmat[3][3], imat3[3][3], smat[3][3];
1600 bool relations_changed =
false;
1609 for (con =
static_cast<bConstraint *
>(pchan->constraints.first); con; con =
next) {
1614 relations_changed =
true;
1632 if (relations_changed) {
1661 short targetless_ik = 0;
1669 Object *pose_ob = tc->poseobj;
1714 GSET_ITER (gs_iter, motionpath_updates) {
Functions and classes to work with Actions.
Functions to deal with Armatures.
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
Functions to insert, delete or modify keyframes.
Helper functions for animation to interact with the RNA system.
void BIK_clear_data(struct bPose *pose)
Blender kernel action and pose functionality.
void BKE_pose_channel_transform_orientation(const bArmature *arm, const bPoseChannel *pose_bone, float r_pose_orientation[3][3])
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
bPoseChannel * BKE_pose_channel_get_mirrored(const bPose *pose, const char *name) ATTR_WARN_UNUSED_RESULT
void BKE_pose_channel_transform_location(const bArmature *arm, const bPoseChannel *pose_bone, float r_pose_space_pivot[3])
bool BKE_pose_is_bonecoll_visible(const bArmature *arm, const bPoseChannel *pchan) ATTR_WARN_UNUSED_RESULT
void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float r_mat[3][3])
bArmature * BKE_armature_from_object(Object *ob)
void BKE_pchan_apply_mat4(bPoseChannel *pchan, const float mat[4][4], bool use_compat)
void BKE_pchan_to_mat4(const bPoseChannel *pchan, float r_chanmat[4][4])
void BKE_pose_where_is(Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_bone_parent_transform_calc_from_pchan(const bPoseChannel *pchan, BoneParentTransform *r_bpt)
void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, const float mat[3][3], bool use_compat)
void BKE_armature_mat_pose_to_bone(const bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
struct bConstraint * BKE_constraint_add_for_pose(struct Object *ob, struct bPoseChannel *pchan, const char *name, short type)
Main * CTX_data_main(const bContext *C)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_unreachable()
GSet * BLI_gset_ptr_new(const char *info)
void BLI_gset_insert(GSet *gs, void *key)
BLI_INLINE void * BLI_gsetIterator_getKey(GSetIterator *gsi)
#define GSET_ITER(gs_iter_, gset_)
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp)
#define LISTBASE_FOREACH(type, var, list)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void pseudoinverse_m3_m3(float inverse[3][3], const float mat[3][3], float epsilon)
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
#define PSEUDOINVERSE_EPSILON
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void normalize_m3(float R[3][3]) ATTR_NONNULL()
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4(float mat[4][4])
#define mul_m3_series(...)
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
void mat3_to_size(float size[3], const float M[3][3])
void unit_m4(float m[4][4])
float angle_compat_rad(float angle, float angle_compat)
void rotation_between_vecs_to_quat(float q[4], const float v1[3], const float v2[3])
void mul_qt_v3(const float q[4], float r[3])
void copy_qt_qt(float q[4], const float a[4])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ MOTIONPATH_BAKE_HAS_PATHS
@ POSE_RUNTIME_HINGE_CHILD_TRANSFORM
@ POSE_RUNTIME_TRANSFORM_CHILD
@ POSE_TRANSFORM_AROUND_CUSTOM_TX
@ CONSTRAINT_TYPE_KINEMATIC
@ AUTOKEY_FLAG_INSERTNEEDED
@ V3D_AROUND_LOCAL_ORIGINS
@ POSE_PATH_CALC_RANGE_CURRENT_FRAME
@ POSE_PATH_CALC_RANGE_CHANGED
Read Guarded memory(de)allocation.
void ANIM_deselect_keys_in_animation_editors(bContext *C)
float ED_armature_ebone_roll_to_vector(const EditBone *bone, const float align_axis[3], const bool axis_only)
void ED_armature_edit_transform_mirror_update(Object *obedit)
void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3])
EditBone * ED_armature_ebone_get_mirrored(const ListBase *edbo, EditBone *ebo)
BMesh const char void * data
void append(const T &value)
void append_non_duplicates(const T &value)
Span< T > as_span() const
void * MEM_calloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
size_t(* MEM_allocN_len)(const void *vmemh)
void MEM_freeN(void *vmemh)
void pose_bone_descendent_iterator(bPose &pose, bPoseChannel &pose_bone, FunctionRef< void(bPoseChannel &child_bone)> callback)
bool is_autokey_on(const Scene *scene)
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
bool bone_is_visible(const bArmature *armature, const Bone *bone)
StringRef get_rotation_mode_path(eRotationModes rotation_mode)
bool is_keying_flag(const Scene *scene, eKeying_Flag flag)
void autokeyframe_pose_channel(bContext *C, Scene *scene, Object *ob, bPoseChannel *pose_channel, Span< RNAPath > rna_paths, short targetless_ik)
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathCalcRange range)
struct ToolSettings * toolsettings
struct bConstraint * next
struct bPoseChannel * parent
struct bPoseChannel_Runtime runtime