82 *temp_con_data = *targetless_con;
108 for (; con; con = con->
next) {
114 if (data->tar ==
nullptr) {
117 if (data->tar->type ==
OB_ARMATURE && data->subtarget[0] == 0) {
134 if (pchan ==
nullptr) {
143 if (data->tar ==
nullptr || (data->tar->type ==
OB_ARMATURE && data->subtarget[0] ==
'\0')) {
149 if (con->enforce != 0.0f) {
154 if (data->rootbone == 0) {
218 data->max_rootbone = data->rootbone;
228 short wentdeeper = 0, added = 0;
237 if (wentdeeper == 0) {
266 for (bonec =
static_cast<Bone *
>(pchan->bone->childbase.first); bonec; bonec = bonec->
next)
272 if ((pchan->bone->flag &
BONE_CONNECTED) == 0 && (bonec ==
nullptr)) {
280 for (parent = pchan->
parent; parent; parent = parent->
parent) {
285 if (parent ==
nullptr) {
302 return (tot_ik) ? 1 : 0;
338 bool is_mirror_relative)
359 if (is_mirror_relative) {
360 float pchan_mtx[4][4];
361 float pchan_mtx_mirror[4][4];
363 float flip_mtx[4][4];
370 mul_m4_m4m4(pchan_mtx_mirror, pchan_mtx_mirror, flip_mtx);
371 mul_m4_m4m4(pchan_mtx_mirror, flip_mtx, pchan_mtx_mirror);
390 float pmat[3][3], omat[3][3];
391 float cmat[3][3], tmat[3][3];
411 td->loc = pchan->
loc;
445 copy_m3_m4(omat, ob->object_to_world().ptr());
508 td->val = &bone->
dist;
509 td->ival = bone->
dist;
528 td->loc = data->grabtarget;
560 bool has_translate_rotate_buf[2] = {
false,
false};
561 bool *has_translate_rotate = (t->
mode ==
TFM_TRANSLATION) ? has_translate_rotate_buf :
nullptr;
571 if ((arm ==
nullptr) || (pose ==
nullptr)) {
582 Bone *bone = pchan->bone;
589 if (has_translate_rotate !=
nullptr) {
590 if (has_translate_rotate[0] && has_translate_rotate[1]) {
597 has_translate_rotate[0] =
true;
602 has_translate_rotate[0] =
true;
606 has_translate_rotate[1] =
true;
610 has_translate_rotate[0] =
true;
615 if (tc->data_len == 0) {
628 int total_mirrored = 0;
631 pchan->bone->flag &= ~BONE_TRANSFORM_MIRROR;
644 pid[total_mirrored].
pchan =
nullptr;
647 tc->custom.type.use_free =
true;
652 if (tc->data_len == 0) {
664 if (pose ==
nullptr) {
675 td = tc->data =
static_cast<TransData *
>(
679 for (i = 0; i < tc->data_len; i++, td++, tdx++) {
701 has_translate_rotate[0] =
true;
714 if (td != (tc->data + tc->data_len)) {
726 if (has_translate_rotate[1]) {
743 int total_mirrored = 0;
747 const int data_len_prev = tc->data_len;
770 if (mirror && (data_len_prev < tc->data_len)) {
786 bid[total_mirrored].
bone =
nullptr;
788 tc->custom.type.data = bid;
789 tc->custom.type.use_free =
true;
805 float mtx[3][3], smtx[3][3], bonemat[3][3];
809 copy_m3_m4(mtx, tc->obedit->object_to_world().ptr());
812 td = tc->data =
static_cast<TransData *
>(
820 ebo->oldlength = ebo->length;
825 td->val = &ebo->rad_head;
841 td->val = &ebo->rad_tail;
860 td->val = &ebo->
dist;
861 td->ival = ebo->
dist;
865 td->loc = &ebo->xwidth;
889 td->val = &(ebo->roll);
890 td->ival = ebo->roll;
931 td->ival = ebo->roll;
955 td->ival = ebo->roll;
966 if (mirror && (td_old != td)) {
969 bid[i].
bone = eboflip;
986 bid[i].
bone =
nullptr;
1026 if ((ebo_child->flag &
BONE_CONNECTED) && (ebo_child->parent == ebo)) {
1028 ebo_child->rad_head = ebo->
rad_tail;
1105 for (i = 0; i < tc->data_len; i++, td++) {
1107 float vec[3], up_axis[3];
1111 ebo =
static_cast<EditBone *
>(td->extra);
1115 ebo->
roll = td->ival;
1156 float flip_mtx[4][4];
1158 flip_mtx[0][0] = -1;
1162 pchan_orig->bone->flag &= ~BONE_TRANSFORM_MIRROR;
1172 for (
int i = tc->
data_len; i--; td++) {
1177 if (pchan ==
nullptr) {
1191 float pchan_mtx_final[4][4];
1193 mul_m4_m4m4(pchan_mtx_final, pchan_mtx_final, flip_mtx);
1194 mul_m4_m4m4(pchan_mtx_final, flip_mtx, pchan_mtx_final);
1206 if (data ==
nullptr) {
1276 const bool targetless_ik,
1277 const bool is_connected,
1278 const bool transforming_more_than_one_bone)
1284 if (transforming_more_than_one_bone &&
1287 rna_paths.
append({
"location"});
1290 rna_paths.
append({
"location"});
1318 if (!is_connected) {
1321 if (targetless_ik) {
1322 rna_paths.
append({rotation_path});
1329 rna_paths.
append({rotation_path});
1335 rna_paths.
append({
"scale"});
1348 short targetless_ik,
1350 const bool transforming_more_than_one_bone)
1366 const bool is_connected = pchan->bone->parent !=
nullptr &&
1369 scene->toolsettings,
1373 transforming_more_than_one_bone);
1376 rna_paths = {{
"location"}, {rotation_path}, {
"scale"}};
1380 C, scene, ob, pchan, rna_paths.
as_span(), targetless_ik);
1391 Object *ob = tc->poseobj;
1417 Object *ob = tc->poseobj;
1456 GSET_ITER (gs_iter, motionpath_updates) {
1474 for (; bone; bone = bone->
next) {
1484 bone->
flag &= ~BONE_TRANSFORM;
1503 bone->
flag &= ~BONE_TRANSFORM;
1506 bone->
flag &= ~BONE_HINGE_CHILD_TRANSFORM;
1507 bone->
flag &= ~BONE_TRANSFORM_CHILD;
1510 bone->
flag &= ~BONE_TRANSFORM;
1530 int segcount, apply = 0;
1547 for (; parchan; parchan = parchan->
parent) {
1548 chanlist[segcount] = parchan;
1551 if (segcount == data->rootbone || segcount > 255) {
1555 for (; segcount; segcount--) {
1564 parchan = chanlist[segcount - 1];
1565 bone = parchan->
bone;
1571 float rmat3[3][3], qrmat[3][3], imat3[3][3], smat[3][3];
1600 data->flag &= ~CONSTRAINT_IK_AUTO;
1612 bool relations_changed =
false;
1621 for (con =
static_cast<bConstraint *
>(pchan->constraints.first); con; con =
next) {
1626 relations_changed =
true;
1637 if (data->tar ==
nullptr || (data->tar->type ==
OB_ARMATURE && data->subtarget[0] == 0)) {
1644 if (relations_changed) {
1669 for (
int i = 0; i < tc->data_len; i++) {
1671 objects.append(td->
ob);
1680 short targetless_ik = 0;
1688 Object *pose_ob = tc->poseobj;
1706 data->flag &= ~CONSTRAINT_IK_AUTO;
1733 GSET_ITER (gs_iter, motionpath_updates) {
Functions and classes to work with Actions.
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.
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
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_armature_mat_pose_to_bone(bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
void BKE_pchan_to_mat4(const bPoseChannel *pchan, float r_chanmat[4][4])
#define PBONE_VISIBLE(arm, bone)
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)
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)
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(struct 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 unit_m4(float m[4][4])
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])
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
@ BONE_HINGE_CHILD_TRANSFORM
@ CONSTRAINT_TYPE_KINEMATIC
@ AUTOKEY_FLAG_INSERTNEEDED
@ V3D_AROUND_LOCAL_ORIGINS
@ POSE_PATH_CALC_RANGE_CURRENT_FRAME
@ POSE_PATH_CALC_RANGE_CHANGED
#define EBONE_VISIBLE(arm, ebone)
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)
void append(const T &value)
void append_non_duplicates(const T &value)
Span< T > as_span() const
void *(* MEM_mallocN)(size_t len, const char *str)
size_t(* MEM_allocN_len)(const void *vmemh)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
bool is_autokey_on(const Scene *scene)
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
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 PoseInitData_Mirror::@566 orig
TransCustomDataContainer custom
float axismtx_gimbal[3][3]
struct bConstraint * next
struct bPoseChannel * parent