77 const Bone *bone_src_act,
78 Bone **r_bone_dst_act,
109 const int lib_id_flag)
114 if (bcoll_dst->
prop) {
136 std::optional<Library *> ,
144 Bone *bone_src, *bone_dst;
145 Bone *bone_dst_act =
nullptr;
157 bone_src = bone_src->
next)
159 bone_dst->
parent =
nullptr;
161 bone_dst = bone_dst->
next;
164 armature_dst->
act_bone = bone_dst_act;
170 bone_dst = bone_dst->
next)
175 armature_dst->
edbo =
nullptr;
221 if (armature->
edbo) {
224 armature->
edbo =
nullptr;
232 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
244 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
252 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
263 if (arm->
edbo !=
nullptr) {
284 bone->
runtime = runtime_backup;
401 int min_child_index = 0;
405 if (bcoll->child_index > 0) {
406 min_child_index =
min_ii(min_child_index, bcoll->child_index);
414 if (min_child_index == 0) {
437 if (reset_bcoll_override_flag) {
440 bcoll->flags &= ~BONE_COLLECTION_OVERRIDE_LIBRARY_LOCAL;
556 if (edit_bone->prop) {
565 const Bone *bone_src,
566 const Bone *bone_src_act,
567 Bone **r_bone_dst_act,
570 Bone *bone_src_child, *bone_dst_child;
572 if (bone_src == bone_src_act) {
573 *r_bone_dst_act = bone_dst;
576 if (bone_src->
prop) {
592 bone_src_child = bone_src_child->
next, bone_dst_child = bone_dst_child->
next)
594 bone_dst_child->
parent = bone_dst;
601 Bone *bone_dst_child;
611 bone_dst_child = bone_dst_child->
next)
644 while (bone_dst !=
nullptr) {
647 bone_dst = bone_dst->
next;
648 bone_src = bone_src->
next;
662 const float mat[4][4],
665 const float mat3[3][3],
668 const Bone *bone_parent,
669 const float arm_mat_parent_inv[4][4])
678 float roll_mat3_pre[3][3];
683 if (bone->parent ==
nullptr) {
708 float roll_mat3_post[3][3], delta_mat3[3][3];
713 mul_m3_m3m3(delta_mat3, roll_mat3_post, roll_mat3_pre);
714 bone->roll =
atan2f(delta_mat3[2][0], delta_mat3[2][2]);
720 float arm_mat3[3][3];
726 bone->rad_head *= scale;
727 bone->rad_tail *= scale;
731 bone->xwidth *= scale;
732 bone->zwidth *= scale;
736 float arm_mat_inv[4][4];
766 if (
STREQ(curBone->name, name)) {
853 char name[
MAXBONENAME],
int ,
short axis,
float head,
float tail)
857 const char *extension =
nullptr;
892 else if (axis == 1) {
941 if (
len > 2 && basename[
len - 2] ==
'.') {
942 if (
ELEM(basename[
len - 1],
'L',
'R')) {
943 basename[
len - 2] =
'\0';
948 else if (
len > 3 && basename[
len - 3] ==
'.') {
949 if ((basename[
len - 2] ==
'F' && basename[
len - 1] ==
'r') ||
950 (basename[
len - 2] ==
'B' && basename[
len - 1] ==
'k'))
952 basename[
len - 3] =
'\0';
957 else if (
len > 4 && basename[
len - 4] ==
'.') {
958 if ((basename[
len - 3] ==
'T' && basename[
len - 2] ==
'o' &&
959 basename[
len - 1] ==
'p') ||
960 (basename[
len - 3] ==
'B' && basename[
len - 2] ==
'o' &&
961 basename[
len - 1] ==
't'))
963 basename[
len - 4] =
'\0';
971 const int basename_maxncpy = (
MAXBONENAME - 1) - (1 + strlen(extension));
989 const float *segment_scales,
993 float *pdist =
static_cast<float *
>(
BLI_array_alloca(pdist, temp_segments + 1));
996 for (
int i = 0; i < 3; i++) {
1009 for (
int i = 0; i < temp_segments; i++) {
1010 pdist[i + 1] = pdist[i] +
len_v3v3(coords[i], coords[i + 1]);
1014 float dist_step = pdist[temp_segments];
1015 float dist = 0,
sum = 0;
1017 for (
int i = 0; i < final_segments; i++) {
1018 sum += segment_scales[i];
1023 r_t_points[0] = 0.0f;
1025 for (
int i = 1, nr = 1; i <= final_segments; i++) {
1026 dist += segment_scales[i - 1] * dist_step;
1029 while ((nr < temp_segments) && (dist >= pdist[nr])) {
1033 float fac = (pdist[nr] - dist) / (pdist[nr] - pdist[nr - 1]);
1035 r_t_points[i] = (nr - fac) / temp_segments;
1038 r_t_points[final_segments] = 1.0f;
1079 *r_next = pchan->
child;
1093 float imat[4][4], posemat[4][4], tmpmat[4][4];
1096 memset(param, 0,
sizeof(*param));
1107 if (
fabsf(scale[0] - scale[1]) > 1e-6f ||
fabsf(scale[1] - scale[2]) > 1e-6f) {
1130 float prev_scale[3], next_scale[3];
1151 sub_v3_v3v3(delta, prev->pose_head, prev->bone->arm_head);
1158 sub_v3_v3v3(delta, prev->bone->arm_tail, prev->bone->arm_head);
1162 sub_v3_v3v3(delta, prev->pose_tail, prev->pose_head);
1168 param->
prev_bbone = (prev->bone->segments > 1);
1171 copy_v3_v3(h1, rest ? prev->bone->arm_head : prev->pose_head);
1267 param->
roll1 += prev->bone->roll2;
1271 param->
roll1 += prev->roll2;
1303 param->
scale_in[0] *= prev_scale[0];
1306 param->
scale_in[1] *= prev_scale[1];
1309 param->
scale_in[2] *= prev_scale[2];
1312 param->
ease1 *= prev_scale[1];
1327 param->
ease2 *= next_scale[1];
1336 const bool for_deform,
1355 float length = param->
length;
1356 float epsilon = 1
e-5 *
length;
1359 length *= param->
scale[1];
1362 *r_roll1 = *r_roll2 = 0.0f;
1418 const float hlength1 = param->
ease1 * circle_factor;
1419 const float hlength2 = param->
ease2 * circle_factor;
1442 *r_roll1 += param->
roll1;
1443 *r_roll2 += param->
roll2;
1451 const float xscale_correction = (param->
do_scale) ? param->
scale[0] : 1.0f;
1452 const float zscale_correction = (param->
do_scale) ? param->
scale[2] : 1.0f;
1454 h1[0] += param->
curve_in_x * xscale_correction;
1455 h1[2] += param->
curve_in_z * zscale_correction;
1463 const float scalemats[2][4][4],
1465 const float axis[3],
1491 const float gap = 0.1f;
1500 const float ratio = len1 / len2;
1501 if (ratio < gap * gap) {
1507 const bool for_deform,
1510 float scalemats[2][4][4];
1511 float bezt_controls[4][3];
1512 float h1[3], roll1, h2[3], roll2, prev[3], cur[3], axis[3];
1513 float length = param->
length;
1519 length *= param->
scale[1];
1527 copy_v3_fl3(bezt_controls[3], 0.0f, length, 0.0f);
1528 add_v3_v3v3(bezt_controls[2], bezt_controls[3], h2);
1538 const float log_scale_in_len =
logf(param->
scale_in[1]);
1541 for (
int i = 0; i < param->
segments; i++) {
1543 segment_scales[i] =
expf(
interpf(log_scale_out_len, log_scale_in_len, fac));
1555 float bezt_deriv1[3][3], bezt_deriv2[2][3];
1557 for (
int i = 0; i < 3; i++) {
1558 sub_v3_v3v3(bezt_deriv1[i], bezt_controls[i + 1], bezt_controls[i]);
1560 for (
int i = 0; i < 2; i++) {
1561 sub_v3_v3v3(bezt_deriv2[i], bezt_deriv1[i + 1], bezt_deriv1[i]);
1573 result_array[0].
mat);
1575 for (
int a = 1; a < param->
segments; a++) {
1579 float roll =
interpf(roll2, roll1, fac);
1584 param, scalemats, cur, axis, roll, scalex, scalez, result_array[a].mat);
1602 for (
int a = 0; a < param->
segments; a++) {
1607 float fac = (a + 0.5f) / param->
segments;
1608 float roll =
interpf(roll2, roll1, fac);
1613 param, scalemats, prev, axis, roll, scalex, scalez, result_array[a].mat);
1623 const bool use_boundaries)
1632 1 +
uint(segments),
sizeof(
Mat4),
"bPoseChannel_Runtime::bbone_rest_mats"));
1634 1 +
uint(segments),
sizeof(
Mat4),
"bPoseChannel_Runtime::bbone_pose_mats"));
1636 2 +
uint(segments),
sizeof(
Mat4),
"bPoseChannel_Runtime::bbone_deform_mats"));
1638 1 +
uint(segments),
sizeof(
DualQuat),
"bPoseChannel_Runtime::bbone_dual_quats"));
1646 "bPoseChannel_Runtime::bbone_segment_boundaries"));
1648 else if (!use_boundaries) {
1662 for (
int i = 0; i <= bone->
segments; i++) {
1669 for (
int i = 0; i <= bone->
segments; i++) {
1670 boundaries[i].plane_offset =
dot_v3v3(boundaries[i].point, boundaries[i].plane_normal);
1676 for (
int i = 0; i < bone->
segments; i++) {
1690 const float tuning_factor = 0.222f;
1691 const float straight_length =
len_v3v3(boundaries[0].point, boundaries[bone->
segments].point);
1692 const float max_depth_scale = bone->
segments * (straight_length /
arc_length) * tuning_factor;
1696 const float scale_factor =
powf(
max_ff(max_depth_scale, 1.0f), 1.0f / (bsp_depth - 1));
1698 boundaries[0].depth_scale = bone->
segments / max_depth_scale;
1700 for (
int i = 1; i < bsp_depth; i++) {
1701 boundaries[i].depth_scale = boundaries[i - 1].depth_scale * scale_factor;
1745 for (a = 0; a <= bone->
segments; a++) {
1754 b_bone_mats[0].
mat);
1760 mat4_to_dquat(&b_bone_dual_quats[a], tmat, b_bone_mats[a + 1].mat);
1770 if (segments <= 1) {
1782 sizeof(
Mat4) * (2 + segments));
1785 sizeof(
DualQuat) * (1 + segments));
1787 if (use_curved_mapping) {
1803 float *r_blend_next)
1807 CLAMP(head_tail, 0.0f, 1.0f);
1813 float pre_blend = head_tail *
float(segments);
1816 CLAMP(index, 0, segments - 1);
1818 float blend = pre_blend - index;
1822 *r_blend_next =
blend;
1829 float *r_blend_next)
1832 const float(*mat)[4] = mats[0].
mat;
1835 const float y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1];
1839 pchan, y / pchan->
bone->
length, r_index, r_blend_next);
1846 return dot_v3v3(co, boundary.plane_normal) - boundary.plane_offset;
1853 float *r_blend_next)
1867 int start = -1, end = segments + 1, bias = 0;
1869 while (end - start > 1) {
1870 const int mid = (start + end + bias) / 2;
1876 boundary_idx_stack[++stack_top] = mid;
1877 boundary_dist[mid] = dist;
1892 const float segment_size = 1.0f / segments;
1898 else if (start >= segments) {
1903 const float d1 =
fabsf(boundary_dist[start]);
1904 const float d2 =
fabsf(boundary_dist[end]);
1905 const float t = d1 / (d1 + d2);
1907 head_tail = segment_size * (start + t);
1919 for (
int i = stack_top; i >= 0; --i) {
1920 const int boundary_idx = boundary_idx_stack[i];
1923 const float boundary_pos = boundary_idx * segment_size;
1927 const float point_dist = boundary_dist[boundary_idx] * segment_scale;
1928 const float point_dist_abs =
fabsf(point_dist);
1931 const float mapped_dist =
fabsf(head_tail - boundary_pos);
1935 const float slope_gap = mapped_dist - point_dist_abs;
1937 if (slope_gap <= 0) {
1943 const float dist_coeff = 1.0f - point_dist_abs * boundaries[i].depth_scale;
1945 if (dist_coeff <= 0) {
1951 const float slope_tune_coeff = 3.0f;
1952 const float scaled_gap = slope_gap * slope_tune_coeff;
1953 const float slope_coeff = scaled_gap / (scaled_gap + point_dist_abs);
1956 const float dist_tune_coeff = 7.0f;
1957 const float dist_coeff_smooth = dist_coeff * dist_coeff * (dist_tune_coeff + 1.0f) /
1958 (dist_tune_coeff * dist_coeff + 1.0f);
1961 const float target_pos = boundary_pos + point_dist;
1963 head_tail =
interpf(target_pos, head_tail, slope_coeff * dist_coeff_smooth);
1973 float *r_blend_next)
1994 if (ob ==
nullptr) {
2007 float xLocMat[4][4];
2008 float nLocMat[4][4];
2042 const Bone *bone, *parbone;
2051 float offs_bone[4][4];
2069 int inherit_scale_mode,
2070 const float offs_bone[4][4],
2071 const float parent_arm_mat[4][4],
2072 const float parent_pose_mat[4][4],
2077 if (parent_pose_mat) {
2078 const bool use_rotation = (bone_flag &
BONE_HINGE) == 0;
2082 if (full_transform) {
2087 float tmat[4][4], tscale[3];
2094 switch (inherit_scale_mode) {
2126 switch (inherit_scale_mode) {
2173 float bone_loc[4][4], bone_rotscale[3][3], tmat4[4][4], tmat3[3][3];
2178 mul_v3_m4v3(bone_loc[3], parent_pose_mat, offs_bone[3]);
2188 else if (!full_transform) {
2237 const float inmat[4][4],
2250 const float inmat[4][4],
2261 const float inmat[4][4],
2272 float xLocMat[4][4];
2273 float nLocMat[4][4];
2295 const float inmat[4][4],
2298 bPoseChannel work_pchan = blender::dna::shallow_copy(*pchan);
2366 float pose_mat[4][4],
2367 float arm_mat[4][4])
2384 float quat[4],
float eul[3],
float axis[3],
float *angle,
short oldMode,
short newMode)
2404 else if (oldMode > 0) {
2423 if (
IS_EQF(axis[0], axis[1]) &&
IS_EQF(axis[1], axis[2])) {
2469 float vecmat[3][3], vecmatinv[3][3], rollmat[3][3], q[4];
2557 const float SAFE_THRESHOLD = 6.1e-3f;
2558 const float CRITICAL_THRESHOLD = 2.5e-4f;
2559 const float THRESHOLD_SQUARED = CRITICAL_THRESHOLD * CRITICAL_THRESHOLD;
2561 const float x =
nor[0];
2562 const float y =
nor[1];
2563 const float z =
nor[2];
2565 float theta = 1.0f +
y;
2566 const float theta_alt = x * x +
z *
z;
2567 float rMatrix[3][3], bMatrix[3][3];
2579 if (theta > SAFE_THRESHOLD || theta_alt > THRESHOLD_SQUARED) {
2588 if (theta <= SAFE_THRESHOLD) {
2591 theta = theta_alt * 0.5f + theta_alt * theta_alt * 0.125f;
2594 bMatrix[0][0] = 1 - x * x / theta;
2595 bMatrix[2][2] = 1 -
z *
z / theta;
2596 bMatrix[2][0] = bMatrix[0][2] = -x *
z / theta;
2601 bMatrix[0][0] = bMatrix[1][1] = -1.0;
2635 if (bone->
xwidth == 0.0f) {
2642 float offs_bone[4][4];
2655 if (use_recursion) {
2704 const Bone *last_visited_bone = *r_last_visited_bone_p;
2705 if ((pchan_prev ==
nullptr && last_visited_bone !=
nullptr) ||
2706 (pchan_prev !=
nullptr && pchan_prev->
bone != last_visited_bone))
2708 pchan_prev = last_visited_bone !=
nullptr ?
2715 *r_last_visited_bone_p = pchan->
bone;
2732 pchan->bone =
nullptr;
2733 pchan->child =
nullptr;
2759 if (pchan->bone ==
nullptr) {
2773 if (ob->
pose ==
nullptr) {
2786 Bone *prev_bone =
nullptr;
2804 pchan->custom_tx =
nullptr;
2812 pose->
flag &= ~POSE_RECALC;
2817 if (bmain !=
nullptr) {
2953 if (
ELEM(
nullptr, arm, scene)) {
3013 mul_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat);
3026 std::optional<blender::Bounds<blender::float3>> bounds_world =
BKE_pose_minmax(ob,
false);
3028 if (!bounds_world) {
3029 return std::nullopt;
3042 const bool use_empty_drawtype,
3051 std::optional<Bounds<float3>> bb_custom;
3054 if (use_empty_drawtype && (ob_custom->
type ==
OB_EMPTY) &&
3065 float mat[4][4], smat[4][4], rmat[4][4], tmp[4][4];
3074 mul_m4_series(mat, ob->object_to_world().ptr(), tmp, rmat, smat);
3089 const bool use_select)
3092 return std::nullopt;
3101 bool found_pchan =
false;
3120 return std::nullopt;
3137 rootchan = rootchan->
parent;
3139 if (rootchan !=
nullptr) {
3141 while (rootchan->
parent) {
3144 if (segcount == data->rootbone) {
3147 rootchan = rootchan->
parent;
3159 while (rootchan->
parent) {
3162 if (segcount == data->chainlen) {
3165 rootchan = rootchan->
parent;
3206bool BoneCollection::is_visible()
const
3210bool BoneCollection::is_visible_ancestors()
const
3214bool BoneCollection::is_visible_with_ancestors()
const
3216 return this->is_visible() && this->is_visible_ancestors();
3218bool BoneCollection::is_solo()
const
3222bool BoneCollection::is_expanded()
const
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
void ANIM_armature_runtime_free(bArmature *armature)
void ANIM_armature_runtime_refresh(bArmature *armature)
void ANIM_bonecoll_free(BoneCollection *bcoll, bool do_id_user_count=true)
void ANIM_armature_bonecoll_active_index_set(bArmature *armature, int bone_collection_index)
void BIK_init_tree(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float ctime)
void BIK_release_tree(struct Scene *scene, struct Object *ob, float ctime)
void BIK_execute_tree(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime)
Blender kernel action and pose functionality.
void BKE_pose_channels_hash_free(bPose *pose) ATTR_NONNULL(1)
void BKE_pose_update_constraint_flags(bPose *pose) ATTR_NONNULL(1)
void BKE_pose_channels_hash_ensure(bPose *pose) ATTR_NONNULL(1)
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
bPoseChannel * BKE_pose_channel_ensure(bPose *pose, const char *name) ATTR_NONNULL(2)
void BKE_pose_channel_free_ex(bPoseChannel *pchan, bool do_id_user) ATTR_NONNULL(1)
void BKE_pose_channel_free_bbone_cache(bPoseChannel_Runtime *runtime) ATTR_NONNULL(1)
void animviz_settings_init(struct bAnimVizSettings *avs)
void BKE_splineik_execute_tree(Depsgraph *depsgraph, Scene *scene, Object *ob, bPoseChannel *pchan_root, float ctime)
void BKE_pose_splineik_init_tree(Scene *scene, Object *ob, float ctime)
#define PBONE_VISIBLE(arm, bone)
void BKE_constraints_solve(struct Depsgraph *depsgraph, struct ListBase *conlist, struct bConstraintOb *cob, float ctime)
void BKE_constraints_clear_evalob(struct bConstraintOb *cob)
struct bConstraintOb * BKE_constraints_make_evalob(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, void *subdata, short datatype)
void BKE_curve_forward_diff_bezier(float q0, float q1, float q2, float q3, float *p, int it, int stride)
void IDP_foreach_property(IDProperty *id_property_root, int type_filter, blender::FunctionRef< void(IDProperty *id_property)> callback)
#define IDP_BlendDataRead(reader, prop)
IDProperty * IDP_CopyProperty_ex(const IDProperty *prop, int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_BlendWrite(BlendWriter *writer, const IDProperty *prop)
void IDP_FreeProperty_ex(IDProperty *prop, bool do_id_user)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
@ LIB_ID_CREATE_NO_USER_REFCOUNT
void * BKE_id_new(Main *bmain, short type, const char *name)
void BKE_id_blend_write(BlendWriter *writer, ID *id)
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(data_, func_call_)
General operations, lookup, etc. for blender objects.
bool BKE_object_minmax_empty_drawtype(const Object *ob, float r_min[3], float r_max[3])
void BKE_boundbox_init_from_minmax(BoundBox *bb, const float min[3], const float max[3])
void BKE_boundbox_minmax(const BoundBox *bb, const float obmat[4][4], float r_min[3], float r_max[3])
std::optional< blender::Bounds< blender::float3 > > BKE_object_boundbox_get(const Object *ob)
float BKE_scene_ctime_get(const Scene *scene)
#define BLI_array_alloca(arr, realsize)
#define BLI_assert_unreachable()
GHash * BLI_ghash_str_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
void BLI_ghash_insert(GHash *gh, void *key, void *val)
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
void BLI_freelinkN(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void void void void void BLI_duplicatelist(struct ListBase *dst, const struct ListBase *src) ATTR_NONNULL(1
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
void BLI_insertlinkafter(struct ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
bool BLI_remlink_safe(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_remlink(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
#define BLI_ASSERT_UNIT_M3(m)
MINLINE float interpf(float target, float origin, float t)
#define BLI_ASSERT_UNIT_V3(v)
float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3])
float mat4_to_volume_scale(const float mat[4][4])
float mat4_to_scale(const float mat[4][4])
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
void mul_mat3_m4_fl(float R[4][4], float f)
void size_to_mat3(float R[3][3], const float size[3])
void copy_m3_m3(float m1[3][3], const float m2[3][3])
void unit_m3(float m[3][3])
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 unit_m4(float m[4][4])
void copy_m4_m3(float m1[4][4], const float m2[3][3])
void mat4_to_size_fix_shear(float size[3], const float M[4][4])
void mat4_to_loc_rot_size(float loc[3], float rot[3][3], float size[3], const float wmat[4][4])
void translate_m4(float mat[4][4], float Tx, float Ty, float Tz)
void normalize_m3(float R[3][3]) ATTR_NONNULL()
void rescale_m4(float mat[4][4], const float scale[3])
void size_to_mat4(float R[4][4], const float size[3])
void mul_m4_v3(const float M[4][4], float r[3])
void orthogonalize_m4_stable(float R[4][4], int axis, bool normalize)
#define mul_m4_series(...)
void scale_m4_fl(float R[4][4], float scale)
void normalize_m4_ex(float R[4][4], float r_scale[3]) ATTR_NONNULL()
void copy_m4_m4(float m1[4][4], const float m2[4][4])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
bool invert_m4(float mat[4][4])
void mat4_to_size(float size[3], const float M[4][4])
void mul_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3])
void mul_v3_mat3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m3(float mat[3][3])
void mul_mat3_m4_v3(const float mat[4][4], float r[3])
void normalize_m4(float R[4][4]) ATTR_NONNULL()
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void quat_to_mat3(float m[3][3], const float q[4])
void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle)
void mat3_to_quat(float q[4], const float mat[3][3])
void quat_to_eulO(float e[3], short order, const float q[4])
float normalize_qt(float q[4])
void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], short order)
void eulO_to_quat(float q[4], const float e[3], short order)
void eulO_to_mat4(float mat[4][4], const float e[3], short order)
float normalize_qt_qt(float r[4], const float q[4])
float quat_split_swing_and_twist(const float q_in[4], int axis, float r_swing[4], float r_twist[4])
void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
void mat4_to_dquat(DualQuat *dq, const float basemat[4][4], const float mat[4][4])
void axis_angle_to_eulO(float eul[3], short order, const float axis[3], float angle)
void eulO_to_mat3(float M[3][3], const float e[3], short order)
void mat3_normalized_to_eulO(float eul[3], short order, const float m[3][3])
void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle)
void mat3_normalized_to_compatible_eulO(float eul[3], const float oldrot[3], short order, const float mat[3][3])
void mat3_normalized_to_quat(float q[4], const float mat[3][3])
void mat3_normalized_to_axis_angle(float axis[3], float *angle, const float mat[3][3])
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
MINLINE void invert_v3_safe(float r[3])
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t)
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void negate_v3(float r[3])
MINLINE void mul_v3_v3v3(float r[3], const float v1[3], const float v2[3])
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE void zero_v3(float r[3])
MINLINE void add_v3_v3(float r[3], const float a[3])
MINLINE float normalize_v3(float n[3])
MINLINE float len_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
#define STRNCPY(dst, src)
size_t BLI_snprintf(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_read_struct_list(reader, struct_name, list)
#define BLO_write_struct_list(writer, struct_name, list_ptr)
#define BLO_read_struct(reader, struct_name, ptr_p)
#define BLT_I18NCONTEXT_ID_ARMATURE
void DEG_relations_tag_update(Main *bmain)
#define ID_IS_LINKED(_id)
#define PCHAN_CUSTOM_BONE_LENGTH(pchan)
@ BONE_COLLECTION_VISIBLE
@ BONE_COLLECTION_ANCESTORS_VISIBLE
@ BONE_COLLECTION_EXPANDED
@ BONE_DRAW_LOCKED_WEIGHT
struct bArmature bArmature
@ BBONE_ADD_PARENT_END_ROLL
@ BBONE_HANDLE_SCALE_EASE
@ BONE_INHERIT_SCALE_FULL
@ BONE_INHERIT_SCALE_NONE
@ BONE_INHERIT_SCALE_FIX_SHEAR
@ BONE_INHERIT_SCALE_NONE_LEGACY
@ BONE_INHERIT_SCALE_ALIGNED
@ BONE_INHERIT_SCALE_AVERAGE
#define DNA_struct_default_get(struct_name)
These structs are the foundation for all linked lists in the library system.
Object is a sort of wrapper for general info.
Read Guarded memory(de)allocation.
void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float r_mat[3][3])
void BKE_armature_bone_hash_make(bArmature *arm)
static GHash * armature_bone_from_name_map(bArmature *arm)
static void copy_bone_transform(Bone *bone_dst, const Bone *bone_src)
void vec_roll_to_mat3(const float vec[3], const float roll, float r_mat[3][3])
static void write_bone_collection(BlendWriter *writer, BoneCollection *bcoll)
static void compute_bbone_segment_boundaries(bPoseChannel *pchan)
bArmature * BKE_armature_from_object(Object *ob)
bPoseChannel * BKE_armature_ik_solver_find_root(bPoseChannel *pchan, bKinematicConstraint *data)
void BKE_bone_parent_transform_clear(BoneParentTransform *bpt)
static void ease_handle_axis(const float deriv1[3], const float deriv2[3], float r_axis[3])
void BKE_pchan_bbone_deform_segment_index(const bPoseChannel *pchan, const float *co, int *r_index, float *r_blend_next)
void BKE_bone_parent_transform_combine(const BoneParentTransform *in1, const BoneParentTransform *in2, BoneParentTransform *result)
void BKE_pose_where_is_bone(Depsgraph *depsgraph, Scene *scene, Object *ob, bPoseChannel *pchan, float ctime, bool do_extra)
int BKE_armature_bonelist_count(const ListBase *lb)
void BKE_armature_loc_pose_to_bone(bPoseChannel *pchan, const float inloc[3], float outloc[3])
void BKE_armature_bonelist_free(ListBase *lb, const bool do_id_user)
void BKE_pose_channels_clear_with_null_bone(bPose *pose, const bool do_id_user)
void BKE_pose_ensure(Main *bmain, Object *ob, bArmature *arm, const bool do_id_user)
static void armature_foreach_id_bone_collection(BoneCollection *bcoll, LibraryForeachIDData *data)
static void copy_bone_collection(bArmature *armature_dst, BoneCollection *&bcoll_dst, const BoneCollection *bcoll_src, const int lib_id_flag)
void BKE_bone_parent_transform_invert(BoneParentTransform *bpt)
void BKE_armature_where_is_bone(Bone *bone, const Bone *bone_parent, const bool use_recursion)
void BKE_pose_rebuild(Main *bmain, Object *ob, bArmature *arm, const bool do_id_user)
void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll)
static void read_bone_collections(BlendDataReader *reader, bArmature *arm)
static void write_bone(BlendWriter *writer, Bone *bone)
static void direct_link_bone_collection(BlendDataReader *reader, BoneCollection *bcoll)
static void armature_transform_recurse(ListBase *bonebase, const float mat[4][4], const bool do_props, const float mat3[3][3], const float scale, const Bone *bone_parent, const float arm_mat_parent_inv[4][4])
void BKE_armature_mat_bone_to_pose(bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
void BKE_pchan_calc_mat(bPoseChannel *pchan)
void BKE_pose_where_is_bone_tail(bPoseChannel *pchan)
void BKE_pchan_apply_mat4(bPoseChannel *pchan, const float mat[4][4], bool use_compat)
void BKE_pchan_minmax(const Object *ob, const bPoseChannel *pchan, const bool use_empty_drawtype, float r_min[3], float r_max[3])
void BKE_armature_mat_pose_to_bone(bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
static void armature_foreach_id_bone(Bone *bone, LibraryForeachIDData *data)
static void equalize_cubic_bezier(const float control[4][3], int temp_segments, int final_segments, const float *segment_scales, float *r_t_points)
static void allocate_bbone_cache(bPoseChannel *pchan, const int segments, const bool use_boundaries)
float bbone_segment_bsp_signed_distance(const bPoseChannel_BBoneSegmentBoundary &boundary, const float *co)
void BKE_pchan_rebuild_bbone_handles(bPose *pose, bPoseChannel *pchan)
static bPoseChannel * pose_channel_find_bone(bPose *pose, Bone *bone)
void BKE_pose_clear_pointers(bPose *pose)
bool BKE_armature_bone_flag_test_recursive(const Bone *bone, int flag)
void BKE_pchan_to_mat4(const bPoseChannel *pchan, float r_chanmat[4][4])
static void armature_undo_preserve(BlendLibReader *, ID *id_new, ID *id_old)
static void armature_copy_data(Main *, std::optional< Library * >, ID *id_dst, const ID *id_src, const int flag)
static void copy_bonechildren(Bone *bone_dst, const Bone *bone_src, const Bone *bone_src_act, Bone **r_bone_dst_act, const int flag)
void BKE_armature_copy_bone_transforms(bArmature *armature_dst, const bArmature *armature_src)
static void make_bbone_spline_matrix(BBoneSplineParameters *param, const float scalemats[2][4][4], const float pos[3], const float axis[3], float roll, float scalex, float scalez, float result[4][4])
static void armature_blend_write(BlendWriter *writer, ID *id, const void *id_address)
static void armature_foreach_id_editbone(EditBone *edit_bone, LibraryForeachIDData *data)
static int rebuild_pose_bone(bPose *pose, Bone *bone, bPoseChannel *parchan, int counter, Bone **r_last_visited_bone_p)
void BKE_rotMode_change_values(float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
static void copy_bonechildren_custom_handles(Bone *bone_dst, bArmature *arm_dst)
void BKE_bone_parent_transform_apply(const BoneParentTransform *bpt, const float inmat[4][4], float outmat[4][4])
void BKE_pchan_bbone_segments_cache_copy(bPoseChannel *pchan, bPoseChannel *pchan_from)
void BKE_armature_mat_pose_to_delta(float delta_mat[4][4], float pose_mat[4][4], float arm_mat[4][4])
void BKE_pose_where_is(Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_armature_mat_pose_to_bone_ex(Depsgraph *depsgraph, Object *ob, bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
void BKE_pchan_bbone_spline_params_get(bPoseChannel *pchan, const bool rest, BBoneSplineParameters *param)
void BKE_bone_parent_transform_calc_from_pchan(const bPoseChannel *pchan, BoneParentTransform *r_bpt)
std::optional< blender::Bounds< blender::float3 > > BKE_pose_minmax(const Object *ob, const bool use_select)
static void armature_free_data(ID *id)
int BKE_pchan_bbone_spline_compute(BBoneSplineParameters *param, const bool for_deform, Mat4 *result_array)
void BKE_pchan_mat3_to_rot(bPoseChannel *pchan, const float mat[3][3], bool use_compat)
void mat3_to_vec_roll(const float mat[3][3], float r_vec[3], float *r_roll)
static void armature_bone_from_name_insert_recursive(GHash *bone_hash, ListBase *lb)
void BKE_armature_transform(bArmature *arm, const float mat[4][4], const bool do_props)
void BKE_pchan_bbone_segments_cache_compute(bPoseChannel *pchan)
void BKE_armature_editbonelist_free(ListBase *lb, const bool do_id_user)
void BKE_bone_parent_transform_calc_from_matrices(int bone_flag, int inherit_scale_mode, const float offs_bone[4][4], const float parent_arm_mat[4][4], const float parent_pose_mat[4][4], BoneParentTransform *r_bpt)
void BKE_pchan_bbone_handles_get(bPoseChannel *pchan, bPoseChannel **r_prev, bPoseChannel **r_next)
static void armature_foreach_id(ID *id, LibraryForeachIDData *data)
void BKE_bone_offset_matrix_get(const Bone *bone, float offs_bone[4][4])
static void armature_init_data(ID *id)
std::optional< blender::Bounds< blender::float3 > > BKE_armature_min_max(const Object *ob)
Bone * BKE_armature_find_bone_name(bArmature *arm, const char *name)
static Bone * get_named_bone_bonechildren(ListBase *lb, const char *name)
void BKE_armature_bone_hash_free(bArmature *arm)
void BKE_armature_where_is(bArmature *arm)
static void direct_link_bones(BlendDataReader *reader, Bone *bone)
void BKE_pchan_bbone_deform_clamp_segment_index(const bPoseChannel *pchan, float head_tail, int *r_index, float *r_blend_next)
void BKE_armature_mat_world_to_pose(Object *ob, const float inmat[4][4], float outmat[4][4])
void BKE_pchan_bbone_spline_setup(bPoseChannel *pchan, const bool rest, const bool for_deform, Mat4 *result_array)
bool bone_autoside_name(char name[MAXBONENAME], int, short axis, float head, float tail)
static void armature_blend_read_data(BlendDataReader *reader, ID *id)
bPoseChannel * BKE_armature_splineik_solver_find_root(bPoseChannel *pchan, bSplineIKConstraint *data)
static void evaluate_cubic_bezier(const float control[4][3], float t, float r_pos[3], float r_tangent[3])
void BKE_pose_remap_bone_pointers(bArmature *armature, bPose *pose)
void BKE_armature_loc_world_to_pose(Object *ob, const float inloc[3], float outloc[3])
static void find_bbone_segment_index_curved(const bPoseChannel *pchan, const float *co, int *r_index, float *r_blend_next)
void BKE_pchan_bbone_handles_compute(const BBoneSplineParameters *param, float h1[3], float *r_roll1, float h2[3], float *r_roll2, bool ease, bool offsets)
void vec_roll_to_mat3_normalized(const float nor[3], const float roll, float r_mat[3][3])
static void find_bbone_segment_index_straight(const bPoseChannel *pchan, const float *co, int *r_index, float *r_blend_next)
bArmature * BKE_armature_add(Main *bmain, const char *name)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ccl_device_inline float arc_length(float e2, float gamma)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
static T sum(const btAlignedObjectArray< T > &items)
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
const Depsgraph * depsgraph
draw_view in_light_buf[] float
draw_view push_constant(Type::INT, "radiance_src") .push_constant(Type capture_info_buf storage_buf(1, Qualifier::READ, "ObjectBounds", "bounds_buf[]") .push_constant(Type draw_view int
void *(* MEM_malloc_arrayN)(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
void *(* MEM_dupallocN)(const void *vmemh)
void bonecolls_copy_expanded_flag(Span< BoneCollection * > bcolls_dest, Span< const BoneCollection * > bcolls_source)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
Frequency::GEOMETRY nor[]
struct BoneCollection * next
struct BoneCollection * prev
ObjectRuntimeHandle * runtime
int active_collection_index
int collection_root_count
struct BoneCollection ** collection_array
struct EditBone * act_edbone
ListBase collections_legacy
struct bArmature_Runtime runtime
struct Mat4 * bbone_deform_mats
struct bPoseChannel_BBoneSegmentBoundary * bbone_segment_boundaries
struct DualQuat * bbone_dual_quats
struct Mat4 * bbone_pose_mats
float bbone_arc_length_reciprocal
struct Mat4 * bbone_rest_mats
float custom_scale_xyz[3]
float custom_rotation_euler[3]
struct bPoseChannel * parent
struct bPoseChannel * custom_tx
struct bPoseChannel * bbone_next
struct bPoseChannel * prev
float custom_translation[3]
struct bPoseChannel_Runtime runtime
struct bPoseChannel * bbone_prev
struct bPoseChannel * child