85 count += bone_func(ob, bone,
data);
136 if (curBone.
parent == exBone) {
138 if (clear_connected) {
154 for (ebone_child = ebone_child->
parent; ebone_child; ebone_child = ebone_child->
parent) {
155 if (ebone_child == ebone_parent) {
164#define EBONE_TEMP_UINT(ebone) (*((uint *)(&((ebone)->temp))))
167 for (
uint i = 0; i < ebone_child_tot; i++) {
168 for (
EditBone *ebone_iter = ebone_child[i]; ebone_iter; ebone_iter = ebone_iter->
parent) {
174 for (
uint i = 0; i < ebone_child_tot; i++) {
175 for (
EditBone *ebone_iter = ebone_child[i]->parent; ebone_iter;
176 ebone_iter = ebone_iter->
parent)
183 for (
EditBone *ebone_iter = ebone_child[0]->parent; ebone_iter; ebone_iter = ebone_iter->
parent)
190#undef EBONE_TEMP_UINT
197 float delta[3], roll;
208 roll = ebone_parent->
roll;
265 if (ebo ==
nullptr) {
287 if (curBone.
flag & flag) {
290 ebone_mirr->
flag |= (curBone.
flag & flag);
448 ListBaseT<Bone> *bones,
456 for (
Bone &curBone : *bones) {
457 eBone = MEM_new<EditBone>(
"make_editbone");
458 eBone->
temp.bone = &curBone;
465 eBone->
flag = curBone.flag;
491 eBone->
roll = curBone.arm_roll;
494 eBone->
length = curBone.length;
495 eBone->
dist = curBone.dist;
496 eBone->
weight = curBone.weight;
497 eBone->
xwidth = curBone.xwidth;
498 eBone->
zwidth = curBone.zwidth;
502 eBone->
layer = curBone.layer;
505 eBone->
roll1 = curBone.roll1;
506 eBone->
roll2 = curBone.roll2;
511 eBone->
ease1 = curBone.ease1;
512 eBone->
ease2 = curBone.ease2;
525 eBone->
color = curBone.color;
531 if (curBone.system_properties) {
538 if (curBone.childbase.first_) {
541 eBoneAct = eBoneTest;
545 if (&curBone == actBone) {
555 if (link !=
nullptr) {
557 if (ebone.temp.bone == link) {
573 Bone *bone = ebone.temp.bone;
596 ListBaseT<EditBone> *editbonelist)
598 for (
Bone &curBone : *bonelist) {
602 if (curBone.parent) {
603 float parmat_inv[4][4];
608 sub_v3_v3v3(curBone.head, curBone.arm_head, curBone.parent->arm_tail);
609 sub_v3_v3v3(curBone.tail, curBone.arm_tail, curBone.parent->arm_tail);
624 for (
EditBone &ebone : *editbonelist) {
625 if (ebone.temp.bone == &curBone) {
641 printf(
"Bone %s\n", curBone->name);
648 curBone.roll = -
atan2f(difmat[2][0], difmat[2][2]);
676 constexpr float bone_length_threshold = 0.000001f;
677 constexpr float bone_length_threshold_sq = bone_length_threshold * bone_length_threshold;
678 constexpr float adjusted_bone_length = 2 * bone_length_threshold;
688 if (len_sq > bone_length_threshold_sq) {
699 if (len_sq == 0.0f) {
703 offset[2] = adjusted_bone_length;
720 printf(
"Warning: elongated (almost) zero sized bone: %s\n", eBone.
name);
734 newBone = MEM_new<Bone>(
"bone");
735 eBone.
temp.bone = newBone;
754 newBone->
roll = 0.0f;
790 "ED_armature_from_edit", ref);
807 newBone = eBone.
temp.bone;
834 if (obt->
data == id_cast<const ID *>(arm)) {
846 if (arm->
edbo->first()) {
857 arm->
edbo->free_no_destruct();
859 MEM_delete(arm->
edbo);
882 for (ebone = lb->first(); ebone; ebone = ebone_next) {
883 ebone_next = ebone->
next;
897 lb->clear_no_delete();
901 ListBaseT<EditBone> *lb_src,
902 const bool do_id_user)
906 for (
EditBone &ebone_src : *lb_src) {
907 EditBone *ebone_dst = MEM_dupalloc(&ebone_src);
908 if (ebone_dst->
prop) {
916 ebone_src.temp.ebone = ebone_dst;
921 for (
EditBone &ebone_dst : *lb_dst) {
922 if (ebone_dst.parent) {
923 ebone_dst.parent = ebone_dst.parent->temp.ebone;
925 if (ebone_dst.bbone_next) {
926 ebone_dst.bbone_next = ebone_dst.bbone_next->temp.ebone;
928 if (ebone_dst.bbone_prev) {
929 ebone_dst.bbone_prev = ebone_dst.bbone_prev->temp.ebone;
940 ebone.temp.p =
nullptr;
Functions to deal with Armatures.
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
#define BLI_ASSERT_UNIT_M3(m)
#define STRNCPY_UTF8(dst, src)
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define EBONE_TEMP_UINT(ebone)
const Value * lookup_ptr(const Key &key) const
Value & lookup_or_add_default(const Key &key)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
bool bone_is_visible(const bArmature *armature, const Bone *bone)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
MINLINE float len_squared_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void IDP_FreeProperty_ex(IDProperty *prop, bool do_id_user)
void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, bool do_id_user)
MINLINE void copy_v3_v3(float r[3], const float a[3])
void ED_armature_to_edit(bArmature *arm)
void ED_armature_from_edit(Main *bmain, bArmature *arm)
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
void ED_armature_ebone_selectflag_disable(EditBone *ebone, eBone_Flag flag)
void ED_armature_edit_transform_mirror_update(Object *obedit)
void ED_armature_ebone_selectflag_enable(EditBone *ebone, eBone_Flag flag)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) ATTR_NONNULL(1
void copy_m4_m3(float m1[4][4], const float m2[3][3])
bool ED_armature_ebone_is_child_recursive(EditBone *ebone_parent, EditBone *ebone_child)
bool invert_m3_m3(float inverse[3][3], const float mat[3][3])
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
void ED_armature_ebone_listbase_copy(ListBaseT< EditBone > *lb_dst, ListBaseT< EditBone > *lb_src, const bool do_id_user)
void * BLI_findstring(const ListBase *listbase, const char *id, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void armature_tag_unselect(bArmature *arm)
void ED_armature_ebone_remove_ex(bArmature *arm, EditBone *exBone, bool clear_connected)
void BKE_armature_bone_hash_free(bArmature *arm)
EditBone * make_boneList(ListBaseT< EditBone > *edbo, ListBaseT< Bone > *bones, Bone *actBone)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void ED_armature_ebone_transform_mirror_update(bArmature *arm, EditBone *ebo, bool check_select)
void ED_armature_ebone_listbase_temp_clear(ListBaseT< EditBone > *lb)
MINLINE void sub_v3_v3(float r[3], const float a[3])
EditBone * ED_armature_ebone_find_shared_parent(EditBone *ebone_child[], const uint ebone_child_tot)
EditBone * ED_armature_ebone_get_mirrored(const ListBaseT< EditBone > *edbo, EditBone *ebo)
void ED_armature_ebone_from_mat4(EditBone *ebone, const float mat[4][4])
void armature_tag_select_mirrored(bArmature *arm)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
void ED_armature_ebone_to_mat3(EditBone *ebone, float r_mat[3][3])
void ANIM_armature_bonecoll_reconstruct(bArmature *armature)
void ED_armature_ebone_selectflag_set(EditBone *ebone, eBone_Flag flag)
void DEG_id_tag_update(ID *id, unsigned int flags)
BMesh const char void * data
void ED_armature_edit_sync_selection(ListBaseT< EditBone > *edbo)
static EditBone * make_boneList_recursive(ListBaseT< EditBone > *edbo, ListBaseT< Bone > *bones, EditBone *parent, Bone *actBone)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void ED_armature_ebone_to_mat4(EditBone *ebone, float r_mat[4][4])
void ED_armature_edit_free(bArmature *arm)
void BKE_armature_where_is_bone(Bone *bone, const Bone *bone_parent, bool use_recursion)
void ED_armature_ebone_from_mat3(EditBone *ebone, const float mat[3][3])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
MINLINE float normalize_v3(float n[3])
void ED_armature_ebone_remove(bArmature *arm, EditBone *exBone)
MINLINE void add_v3_v3(float r[3], const float a[3])
int ED_armature_ebone_selectflag_get(const EditBone *ebone)
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void armature_select_mirrored(bArmature *arm)
void BKE_armature_bone_hash_make(bArmature *arm)
void IDP_FreeProperty(IDProperty *prop)
void armature_select_mirrored_ex(bArmature *arm, eBone_Flag flag)
MINLINE float normalize_v3_length(float n[3], float unit_length)
void bone_free(bArmature *arm, EditBone *bone)
static void copy_bonecollection_membership(EditBone *eBone, const Bone *bone)
static void armature_finalize_restpose(ListBaseT< Bone > *bonelist, ListBaseT< EditBone > *editbonelist)
void vec_roll_to_mat3_normalized(const float nor[3], float roll, float r_mat[3][3])
void print_m4(const char *str, const float m[4][4])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
static EditBone * find_ebone_link(ListBaseT< EditBone > *edbo, Bone *link)
IDProperty * IDP_CopyProperty_ex(const IDProperty *prop, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void ED_armature_ebone_listbase_free(ListBaseT< EditBone > *lb, const bool do_id_user)
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void ED_armature_ebone_select_set(EditBone *ebone, bool select)
int bone_looper(Object *ob, Bone *bone, void *data, int(*bone_func)(Object *, Bone *, void *))
void BKE_armature_bonelist_free(ListBaseT< Bone > *lb, bool do_id_user)
EditBone * ED_armature_ebone_find_name(const ListBaseT< EditBone > *edbo, const char *name)
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
ListBaseT< BoneCollectionReference > collections
eBone_BBoneFlag bbone_flag
eBone_BBoneHandleFlag bbone_next_flag
eBone_BBoneHandleType bbone_prev_type
eBone_BBoneHandleFlag bbone_prev_flag
eBone_BBoneMappingMode bbone_mapping_mode
eBone_BBoneHandleType bbone_next_type
IDProperty * system_properties
ListBaseT< Bone > childbase
eBone_InheritScaleMode inherit_scale_mode
union blender::EditBone::@252003325204232231327014100071366025164067232113 temp
ListBaseT< BoneCollectionReference > bone_collections
eBone_BBoneHandleFlag bbone_next_flag
eBone_BBoneMappingMode bbone_mapping_mode
eBone_BBoneFlag bbone_flag
IDProperty * system_properties
eBone_InheritScaleMode inherit_scale_mode
eBone_BBoneHandleType bbone_next_type
eBone_BBoneHandleFlag bbone_prev_flag
eBone_BBoneHandleType bbone_prev_type
ListBaseT< Object > objects
ListBaseT< EditBone > * edbo
struct EditBone * act_edbone
bke::bArmature_Runtime * runtime
ListBaseT< Bone > bonebase