118 if (ebone->bbone_next == bone) {
119 ebone->bbone_next =
nullptr;
121 if (ebone->bbone_prev == bone) {
122 ebone->bbone_prev =
nullptr;
134 if (curBone->parent == exBone) {
135 curBone->parent = exBone->
parent;
136 if (clear_connected) {
152 for (ebone_child = ebone_child->
parent; ebone_child; ebone_child = ebone_child->
parent) {
153 if (ebone_child == ebone_parent) {
162#define EBONE_TEMP_UINT(ebone) (*((uint *)(&((ebone)->temp))))
165 for (
uint i = 0;
i < ebone_child_tot;
i++) {
166 for (
EditBone *ebone_iter = ebone_child[
i]; ebone_iter; ebone_iter = ebone_iter->
parent) {
172 for (
uint i = 0;
i < ebone_child_tot;
i++) {
173 for (
EditBone *ebone_iter = ebone_child[
i]->parent; ebone_iter;
174 ebone_iter = ebone_iter->
parent)
181 for (
EditBone *ebone_iter = ebone_child[0]->parent; ebone_iter; ebone_iter = ebone_iter->
parent)
188#undef EBONE_TEMP_UINT
195 float delta[3], roll;
206 roll = ebone_parent->
roll;
263 if (ebo ==
nullptr) {
285 if (curBone->flag &
flag) {
288 ebone_mirr->
flag |= (curBone->flag &
flag);
463 eBone->
flag = curBone->flag;
465 eBone->
drawtype = curBone->drawtype;
489 eBone->
roll = curBone->arm_roll;
492 eBone->
length = curBone->length;
493 eBone->
dist = curBone->dist;
494 eBone->
weight = curBone->weight;
495 eBone->
xwidth = curBone->xwidth;
496 eBone->
zwidth = curBone->zwidth;
497 eBone->
rad_head = curBone->rad_head;
498 eBone->
rad_tail = curBone->rad_tail;
499 eBone->
segments = curBone->segments;
500 eBone->
layer = curBone->layer;
503 eBone->
roll1 = curBone->roll1;
504 eBone->
roll2 = curBone->roll2;
509 eBone->
ease1 = curBone->ease1;
510 eBone->
ease2 = curBone->ease2;
523 eBone->
color = curBone->color;
529 if (curBone->system_properties) {
536 if (curBone->childbase.first) {
539 eBoneAct = eBoneTest;
543 if (curBone == actBone) {
553 if (link !=
nullptr) {
555 if (ebone->temp.bone == link) {
571 Bone *bone = ebone->temp.bone;
599 if (curBone->parent) {
600 float parmat_inv[4][4];
605 sub_v3_v3v3(curBone->head, curBone->arm_head, curBone->parent->arm_tail);
606 sub_v3_v3v3(curBone->tail, curBone->arm_tail, curBone->parent->arm_tail);
622 if (ebone->temp.bone == curBone) {
638 printf(
"Bone %s\n", curBone->name);
645 curBone->roll = -
atan2f(difmat[2][0], difmat[2][2]);
671 constexpr float bone_length_threshold = 0.000001f;
672 constexpr float bone_length_threshold_sq = bone_length_threshold * bone_length_threshold;
673 constexpr float adjusted_bone_length = 2 * bone_length_threshold;
683 if (len_sq > bone_length_threshold_sq) {
694 if (len_sq == 0.0f) {
698 offset[2] = adjusted_bone_length;
715 printf(
"Warning: elongated (almost) zero sized bone: %s\n", eBone->name);
730 eBone->temp.bone = newBone;
737 newBone->
flag = eBone->flag;
739 newBone->
drawtype = eBone->drawtype;
749 newBone->
roll = 0.0f;
751 newBone->
weight = eBone->weight;
752 newBone->
dist = eBone->dist;
754 newBone->
xwidth = eBone->xwidth;
755 newBone->
zwidth = eBone->zwidth;
756 newBone->
rad_head = eBone->rad_head;
757 newBone->
rad_tail = eBone->rad_tail;
758 newBone->
segments = eBone->segments;
759 newBone->
layer = eBone->layer;
762 newBone->
roll1 = eBone->roll1;
763 newBone->
roll2 = eBone->roll2;
768 newBone->
ease1 = eBone->ease1;
769 newBone->
ease2 = eBone->ease2;
781 newBone->
color = eBone->color;
785 "ED_armature_from_edit", *ref);
792 if (eBone->system_properties) {
802 newBone = eBone->temp.bone;
813 if (eBone->bbone_prev) {
816 if (eBone->bbone_next) {
831 if (obt->
data == arm) {
848 if (eBone->system_properties) {
879 for (ebone =
static_cast<EditBone *
>(lb->
first); ebone; ebone = ebone_next) {
880 ebone_next = ebone->
next;
903 if (ebone_dst->
prop) {
917 if (ebone_dst->parent) {
918 ebone_dst->parent = ebone_dst->parent->temp.ebone;
920 if (ebone_dst->bbone_next) {
921 ebone_dst->bbone_next = ebone_dst->bbone_next->temp.ebone;
923 if (ebone_dst->bbone_prev) {
924 ebone_dst->bbone_prev = ebone_dst->bbone_prev->temp.ebone;
935 ebone->temp.p =
nullptr;
Functions to deal with Armatures.
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
void ANIM_armature_bonecoll_reconstruct(bArmature *armature)
void BKE_armature_bone_hash_make(bArmature *arm)
void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
void BKE_armature_bonelist_free(ListBase *lb, bool do_id_user)
void BKE_armature_where_is_bone(Bone *bone, const Bone *bone_parent, bool use_recursion)
void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll)
void BKE_armature_bone_hash_free(bArmature *arm)
void vec_roll_to_mat3_normalized(const float nor[3], float roll, float r_mat[3][3])
void IDP_FreeProperty(IDProperty *prop)
IDProperty * IDP_CopyProperty_ex(const IDProperty *prop, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_FreeProperty_ex(IDProperty *prop, bool do_id_user)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
#define BLI_ASSERT_UNIT_M3(m)
void copy_m3_m4(float m1[3][3], const float m2[4][4])
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
void copy_m4_m3(float m1[4][4], const float m2[3][3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
void print_m4(const char *str, const float m[4][4])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void sub_v3_v3(float r[3], const float a[3])
MINLINE float len_squared_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 void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3_length(float n[3], float unit_length)
MINLINE float normalize_v3(float n[3])
#define STRNCPY_UTF8(dst, src)
size_t BLI_string_flip_side_name(char *name_dst, const char *name_src, bool strip_number, size_t name_dst_maxncpy) ATTR_NONNULL(1
void DEG_id_tag_update(ID *id, unsigned int flags)
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child)
void ED_armature_ebone_selectflag_disable(EditBone *ebone, int flag)
void ED_armature_edit_transform_mirror_update(Object *obedit)
void ED_armature_ebone_transform_mirror_update(bArmature *arm, EditBone *ebo, bool check_select)
static EditBone * make_boneList_recursive(ListBase *edbo, ListBase *bones, EditBone *parent, Bone *actBone)
EditBone * ED_armature_ebone_find_name(const ListBase *edbo, const char *name)
void armature_tag_select_mirrored(bArmature *arm)
int bone_looper(Object *ob, Bone *bone, void *data, int(*bone_func)(Object *, Bone *, void *))
void ED_armature_ebone_listbase_temp_clear(ListBase *lb)
void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3])
void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4])
void ED_armature_ebone_remove_ex(bArmature *arm, EditBone *exBone, bool clear_connected)
void ED_armature_edit_sync_selection(ListBase *edbo)
int ED_armature_ebone_selectflag_get(const EditBone *ebone)
void ED_armature_ebone_selectflag_set(EditBone *ebone, int flag)
void armature_select_mirrored_ex(bArmature *arm, const int flag)
void ED_armature_ebone_select_set(EditBone *ebone, bool select)
void ED_armature_edit_free(bArmature *arm)
static void copy_bonecollection_membership(EditBone *eBone, const Bone *bone)
void ED_armature_ebone_listbase_free(ListBase *lb, const bool do_id_user)
static void armature_finalize_restpose(ListBase *bonelist, ListBase *editbonelist)
void armature_select_mirrored(bArmature *arm)
EditBone * ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const uint ebone_child_tot)
void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3])
void ED_armature_ebone_listbase_copy(ListBase *lb_dst, ListBase *lb_src, const bool do_id_user)
void ED_armature_from_edit(Main *bmain, bArmature *arm)
void ED_armature_ebone_selectflag_enable(EditBone *ebone, int flag)
void armature_tag_unselect(bArmature *arm)
void ED_armature_ebone_remove(bArmature *arm, EditBone *exBone)
void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4])
#define EBONE_TEMP_UINT(ebone)
EditBone * make_boneList(ListBase *edbo, ListBase *bones, Bone *actBone)
void bone_free(bArmature *arm, EditBone *bone)
void ED_armature_to_edit(bArmature *arm)
static EditBone * find_ebone_link(ListBase *edbo, Bone *link)
EditBone * ED_armature_ebone_get_mirrored(const ListBase *edbo, EditBone *ebo)
BMesh const char void * data
const Value * lookup_ptr(const Key &key) const
Value & lookup_or_add_default(const Key &key)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
ccl_device_inline float3 atan2(const float3 y, const float3 x)
bool bone_is_visible(const bArmature *armature, const Bone *bone)
IDProperty * system_properties
union EditBone::@275371335250266324235150226366250166246037204077 temp
ListBase bone_collections
IDProperty * system_properties
eBone_BBoneMappingMode bbone_mapping_mode
struct EditBone * act_edbone