73 const Bone *bone_src_act,
74 Bone **r_bone_dst_act,
105 const int lib_id_flag)
110 if (bcoll_dst->
prop) {
135 std::optional<Library *> ,
143 Bone *bone_src, *bone_dst;
144 Bone *bone_dst_act =
nullptr;
156 bone_src = bone_src->
next)
158 bone_dst->
parent =
nullptr;
160 bone_dst = bone_dst->
next;
163 armature_dst->
act_bone = bone_dst_act;
169 bone_dst = bone_dst->
next)
174 armature_dst->
edbo =
nullptr;
220 if (armature->
edbo) {
223 armature->
edbo =
nullptr;
231 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
236 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
248 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
254 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
262 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
267 BKE_lib_query_idpropertiesForeachIDLink_callback(prop, data);
278 if (arm->
edbo !=
nullptr) {
299 bone->
runtime = runtime_backup;
427 int min_child_index = 0;
431 if (bcoll->child_index > 0) {
432 min_child_index =
min_ii(min_child_index, bcoll->child_index);
440 if (min_child_index == 0) {
463 if (reset_bcoll_override_flag) {
573 if (bone->system_properties) {
586 if (edit_bone->prop) {
589 if (edit_bone->system_properties) {
598 const Bone *bone_src,
599 const Bone *bone_src_act,
600 Bone **r_bone_dst_act,
603 Bone *bone_src_child, *bone_dst_child;
605 if (bone_src == bone_src_act) {
606 *r_bone_dst_act = bone_dst;
609 if (bone_src->
prop) {
628 bone_src_child = bone_src_child->
next, bone_dst_child = bone_dst_child->
next)
630 bone_dst_child->
parent = bone_dst;
637 Bone *bone_dst_child;
647 bone_dst_child = bone_dst_child->
next)
680 while (bone_dst !=
nullptr) {
683 bone_dst = bone_dst->
next;
684 bone_src = bone_src->
next;
698 const float mat[4][4],
701 const float mat3[3][3],
704 const Bone *bone_parent,
705 const float arm_mat_parent_inv[4][4])
714 float roll_mat3_pre[3][3];
719 if (bone->parent ==
nullptr) {
744 float roll_mat3_post[3][3], delta_mat3[3][3];
749 mul_m3_m3m3(delta_mat3, roll_mat3_post, roll_mat3_pre);
750 bone->roll =
atan2f(delta_mat3[2][0], delta_mat3[2][2]);
756 float arm_mat3[3][3];
762 bone->rad_head *= scale;
763 bone->rad_tail *= scale;
767 bone->xwidth *= scale;
768 bone->zwidth *= scale;
772 float arm_mat_inv[4][4];
905 const char *extension =
nullptr;
925 else if (axis == 1) {
974 if (
len > 2 && basename[
len - 2] ==
'.') {
975 if (
ELEM(basename[
len - 1],
'L',
'R')) {
976 basename[
len - 2] =
'\0';
981 else if (
len > 3 && basename[
len - 3] ==
'.') {
982 if ((basename[
len - 2] ==
'F' && basename[
len - 1] ==
'r') ||
983 (basename[
len - 2] ==
'B' && basename[
len - 1] ==
'k'))
985 basename[
len - 3] =
'\0';
990 else if (
len > 4 && basename[
len - 4] ==
'.') {
991 if ((basename[
len - 3] ==
'T' && basename[
len - 2] ==
'o' &&
992 basename[
len - 1] ==
'p') ||
993 (basename[
len - 3] ==
'B' && basename[
len - 2] ==
'o' &&
994 basename[
len - 1] ==
't'))
996 basename[
len - 4] =
'\0';
1004 const int basename_maxncpy = (
MAXBONENAME - 1) - (1 + strlen(extension));
1023 const float *segment_scales,
1027 float *pdist =
static_cast<float *
>(
BLI_array_alloca(pdist, temp_segments + 1));
1030 for (
int i = 0;
i < 3;
i++) {
1043 for (
int i = 0;
i < temp_segments;
i++) {
1044 pdist[
i + 1] = pdist[
i] +
len_v3v3(coords[
i], coords[
i + 1]);
1048 float dist_step = pdist[temp_segments];
1049 float dist = 0,
sum = 0;
1051 for (
int i = 0;
i < final_segments;
i++) {
1052 sum += segment_scales[
i];
1057 r_t_points[0] = 0.0f;
1059 for (
int i = 1, nr = 1;
i <= final_segments;
i++) {
1060 dist += segment_scales[
i - 1] * dist_step;
1063 while ((nr < temp_segments) && (dist >= pdist[nr])) {
1067 float fac = (pdist[nr] - dist) / (pdist[nr] - pdist[nr - 1]);
1069 r_t_points[
i] = (nr - fac) / temp_segments;
1072 r_t_points[final_segments] = 1.0f;
1113 *r_next = pchan->
child;
1127 float imat[4][4], posemat[4][4], tmpmat[4][4];
1130 memset(param, 0,
sizeof(*param));
1141 if (
fabsf(scale[0] - scale[1]) > 1e-6f ||
fabsf(scale[1] - scale[2]) > 1e-6f) {
1164 float prev_scale[3], next_scale[3];
1185 sub_v3_v3v3(delta, prev->pose_head, prev->bone->arm_head);
1192 sub_v3_v3v3(delta, prev->bone->arm_tail, prev->bone->arm_head);
1196 sub_v3_v3v3(delta, prev->pose_tail, prev->pose_head);
1202 param->
prev_bbone = (prev->bone->segments > 1);
1205 copy_v3_v3(h1, rest ? prev->bone->arm_head : prev->pose_head);
1301 param->
roll1 += prev->bone->roll2;
1305 param->
roll1 += prev->roll2;
1337 param->
scale_in[0] *= prev_scale[0];
1340 param->
scale_in[1] *= prev_scale[1];
1343 param->
scale_in[2] *= prev_scale[2];
1346 param->
ease1 *= prev_scale[1];
1361 param->
ease2 *= next_scale[1];
1370 const bool for_deform,
1390 float epsilon = 1
e-5 *
length;
1396 *r_roll1 = *r_roll2 = 0.0f;
1452 const float hlength1 = param->
ease1 * circle_factor;
1453 const float hlength2 = param->
ease2 * circle_factor;
1476 *r_roll1 += param->
roll1;
1477 *r_roll2 += param->
roll2;
1485 const float xscale_correction = (param->
do_scale) ? param->
scale[0] : 1.0f;
1486 const float zscale_correction = (param->
do_scale) ? param->
scale[2] : 1.0f;
1488 h1[0] += param->
curve_in_x * xscale_correction;
1489 h1[2] += param->
curve_in_z * zscale_correction;
1497 const float scalemats[2][4][4],
1499 const float axis[3],
1525 const float gap = 0.1f;
1534 const float ratio = len1 / len2;
1535 if (ratio < gap * gap) {
1541 const bool for_deform,
1544 float scalemats[2][4][4];
1545 float bezt_controls[4][3];
1546 float h1[3], roll1, h2[3], roll2, prev[3], cur[3], axis[3];
1562 add_v3_v3v3(bezt_controls[2], bezt_controls[3], h2);
1572 const float log_scale_in_len =
logf(param->
scale_in[1]);
1577 segment_scales[
i] =
expf(
interpf(log_scale_out_len, log_scale_in_len, fac));
1589 float bezt_deriv1[3][3], bezt_deriv2[2][3];
1591 for (
int i = 0;
i < 3;
i++) {
1592 sub_v3_v3v3(bezt_deriv1[
i], bezt_controls[
i + 1], bezt_controls[
i]);
1594 for (
int i = 0;
i < 2;
i++) {
1607 result_array[0].
mat);
1609 for (
int a = 1; a < param->
segments; a++) {
1613 float roll =
interpf(roll2, roll1, fac);
1618 param, scalemats, cur, axis, roll, scalex, scalez, result_array[a].mat);
1636 for (
int a = 0; a < param->
segments; a++) {
1641 float fac = (a + 0.5f) / param->
segments;
1642 float roll =
interpf(roll2, roll1, fac);
1647 param, scalemats, prev, axis, roll, scalex, scalez, result_array[a].mat);
1657 const bool use_boundaries)
1666 "bPoseChannel_Runtime::bbone_rest_mats");
1668 "bPoseChannel_Runtime::bbone_pose_mats");
1670 2 +
uint(segments),
"bPoseChannel_Runtime::bbone_deform_mats");
1672 1 +
uint(segments),
"bPoseChannel_Runtime::bbone_dual_quats");
1678 1 +
uint(segments),
"bPoseChannel_Runtime::bbone_segment_boundaries");
1680 else if (!use_boundaries) {
1716 const int bsp_depth = int(
ceilf(log2f(bone->
segments + 2)));
1722 const float tuning_factor = 0.222f;
1724 const float max_depth_scale = bone->
segments * (straight_length /
arc_length) * tuning_factor;
1728 const float scale_factor =
powf(
max_ff(max_depth_scale, 1.0f), 1.0f / (bsp_depth - 1));
1732 for (
int i = 1;
i < bsp_depth;
i++) {
1777 for (a = 0; a <= bone->
segments; a++) {
1786 b_bone_mats[0].
mat);
1792 mat4_to_dquat(&b_bone_dual_quats[a], tmat, b_bone_mats[a + 1].mat);
1802 if (segments <= 1) {
1814 sizeof(
Mat4) * (2 + segments));
1817 sizeof(
DualQuat) * (1 + segments));
1819 if (use_curved_mapping) {
1835 float *r_blend_next)
1839 CLAMP(head_tail, 0.0f, 1.0f);
1845 float pre_blend = head_tail *
float(segments);
1847 int index = int(
floorf(pre_blend));
1848 CLAMP(index, 0, segments - 1);
1850 float blend = pre_blend - index;
1854 *r_blend_next =
blend;
1861 float *r_blend_next)
1864 const float (*mat)[4] = mats[0].
mat;
1867 const float y = mat[0][1] * co[0] + mat[1][1] * co[1] + mat[2][1] * co[2] + mat[3][1];
1871 pchan,
y / pchan->
bone->
length, r_index, r_blend_next);
1885 float *r_blend_next)
1899 int start = -1, end = segments + 1, bias = 0;
1901 while (end - start > 1) {
1902 const int mid = (start + end + bias) / 2;
1908 boundary_idx_stack[++stack_top] = mid;
1909 boundary_dist[mid] = dist;
1924 const float segment_size = 1.0f / segments;
1930 else if (start >= segments) {
1935 const float d1 =
fabsf(boundary_dist[start]);
1936 const float d2 =
fabsf(boundary_dist[end]);
1937 const float t = d1 / (d1 + d2);
1939 head_tail = segment_size * (start + t);
1951 for (
int i = stack_top;
i >= 0; --
i) {
1952 const int boundary_idx = boundary_idx_stack[
i];
1955 const float boundary_pos = boundary_idx * segment_size;
1959 const float point_dist = boundary_dist[boundary_idx] * segment_scale;
1960 const float point_dist_abs =
fabsf(point_dist);
1963 const float mapped_dist =
fabsf(head_tail - boundary_pos);
1967 const float slope_gap = mapped_dist - point_dist_abs;
1969 if (slope_gap <= 0) {
1975 const float dist_coeff = 1.0f - point_dist_abs * boundaries[
i].
depth_scale;
1977 if (dist_coeff <= 0) {
1983 const float slope_tune_coeff = 3.0f;
1984 const float scaled_gap = slope_gap * slope_tune_coeff;
1985 const float slope_coeff = scaled_gap / (scaled_gap + point_dist_abs);
1988 const float dist_tune_coeff = 7.0f;
1989 const float dist_coeff_smooth = dist_coeff * dist_coeff * (dist_tune_coeff + 1.0f) /
1990 (dist_tune_coeff * dist_coeff + 1.0f);
1993 const float target_pos = boundary_pos + point_dist;
1995 head_tail =
interpf(target_pos, head_tail, slope_coeff * dist_coeff_smooth);
2005 float *r_blend_next)
2026 if (ob ==
nullptr) {
2039 float xLocMat[4][4];
2040 float nLocMat[4][4];
2074 const Bone *bone, *parbone;
2083 float offs_bone[4][4];
2101 int inherit_scale_mode,
2102 const float offs_bone[4][4],
2103 const float parent_arm_mat[4][4],
2104 const float parent_pose_mat[4][4],
2109 if (parent_pose_mat) {
2110 const bool use_rotation = (bone_flag &
BONE_HINGE) == 0;
2114 if (full_transform) {
2119 float tmat[4][4], tscale[3];
2126 switch (inherit_scale_mode) {
2158 switch (inherit_scale_mode) {
2205 float bone_loc[4][4], bone_rotscale[3][3], tmat4[4][4], tmat3[3][3];
2210 mul_v3_m4v3(bone_loc[3], parent_pose_mat, offs_bone[3]);
2220 else if (!full_transform) {
2269 const float inmat[4][4],
2282 const float inmat[4][4],
2293 const float inmat[4][4],
2303 const float inloc[3],
2306 float xLocMat[4][4];
2307 float nLocMat[4][4];
2329 const float inmat[4][4],
2332 bPoseChannel work_pchan = blender::dna::shallow_copy(*pchan);
2400 float pose_mat[4][4],
2401 float arm_mat[4][4])
2418 float quat[4],
float eul[3],
float axis[3],
float *
angle,
short oldMode,
short newMode)
2438 else if (oldMode > 0) {
2457 if (
IS_EQF(axis[0], axis[1]) &&
IS_EQF(axis[1], axis[2])) {
2473 pchan->
loc[0] = location[0];
2476 pchan->
loc[1] = location[1];
2479 pchan->
loc[2] = location[2];
2486 pchan->
scale[0] = scale[0];
2489 pchan->
scale[1] = scale[1];
2492 pchan->
scale[2] = scale[2];
2499 pchan->
quat[0] = quat[0];
2502 pchan->
quat[1] = quat[1];
2505 pchan->
quat[2] = quat[2];
2508 pchan->
quat[3] = quat[3];
2515 pchan->
eul[0] = euler[0];
2518 pchan->
eul[1] = euler[1];
2521 pchan->
eul[2] = euler[2];
2526 const float axis[3],
2582 float vecmat[3][3], vecmatinv[3][3], rollmat[3][3], q[4];
2670 const float SAFE_THRESHOLD = 6.1e-3f;
2671 const float CRITICAL_THRESHOLD = 2.5e-4f;
2672 const float THRESHOLD_SQUARED = CRITICAL_THRESHOLD * CRITICAL_THRESHOLD;
2674 const float x =
nor[0];
2675 const float y =
nor[1];
2676 const float z =
nor[2];
2678 float theta = 1.0f +
y;
2679 const float theta_alt =
x *
x +
z *
z;
2680 float rMatrix[3][3], bMatrix[3][3];
2692 if (theta > SAFE_THRESHOLD || theta_alt > THRESHOLD_SQUARED) {
2701 if (theta <= SAFE_THRESHOLD) {
2704 theta = theta_alt * 0.5f + theta_alt * theta_alt * 0.125f;
2707 bMatrix[0][0] = 1 -
x *
x / theta;
2708 bMatrix[2][2] = 1 -
z *
z / theta;
2709 bMatrix[2][0] = bMatrix[0][2] = -
x *
z / theta;
2714 bMatrix[0][0] = bMatrix[1][1] = -1.0;
2748 if (bone->
xwidth == 0.0f) {
2755 float offs_bone[4][4];
2768 if (use_recursion) {
2817 const Bone *last_visited_bone = *r_last_visited_bone_p;
2818 if ((pchan_prev ==
nullptr && last_visited_bone !=
nullptr) ||
2819 (pchan_prev !=
nullptr && pchan_prev->
bone != last_visited_bone))
2821 pchan_prev = last_visited_bone !=
nullptr ?
2828 *r_last_visited_bone_p = pchan->
bone;
2845 pchan->bone =
nullptr;
2846 pchan->child =
nullptr;
2872 if (pchan->bone ==
nullptr) {
2886 if (ob->
pose ==
nullptr) {
2899 Bone *prev_bone =
nullptr;
2917 pchan->custom_tx =
nullptr;
2930 if (bmain !=
nullptr) {
3066 if (
ELEM(
nullptr, arm, scene)) {
3126 mul_m4_m4m4(pchan->chan_mat, pchan->pose_mat, imat);
3144 const bool use_empty_drawtype,
3151 Object *ob_custom =
nullptr;
3159 ob_custom = pchan->
custom;
3165 std::optional<Bounds<float3>> bb_custom;
3168 if (use_empty_drawtype && (ob_custom->
type ==
OB_EMPTY) &&
3200 const bool use_select)
3203 return std::nullopt;
3212 bool found_pchan =
false;
3233 return std::nullopt;
3250 rootchan = rootchan->
parent;
3252 if (rootchan !=
nullptr) {
3254 while (rootchan->
parent) {
3257 if (segcount ==
data->rootbone) {
3260 rootchan = rootchan->
parent;
3272 while (rootchan->
parent) {
3275 if (segcount ==
data->chainlen) {
3278 rootchan = rootchan->
parent;
3319bool BoneCollection::is_visible()
const
3323bool BoneCollection::is_visible_ancestors()
const
3327bool BoneCollection::is_visible_with_ancestors()
const
3329 return this->is_visible() && this->is_visible_ancestors();
3331bool BoneCollection::is_solo()
const
3335bool BoneCollection::is_expanded()
const
Functions to deal with Armatures.
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)
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
void * BKE_id_new(Main *bmain, short type, const char *name)
@ LIB_ID_CREATE_NO_USER_REFCOUNT
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])
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)
int BLI_findindex(const ListBase *listbase, const void *vlink) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(ListBase *lb)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void BLI_freelinkN(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_MUTABLE(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
void BLI_insertlinkafter(ListBase *listbase, void *vprevlink, void *vnewlink) ATTR_NONNULL(1)
void BLI_remlink(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
bool BLI_remlink_safe(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void void void void void BLI_duplicatelist(ListBase *dst, const ListBase *src) 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 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 unit_m4(float m[4][4])
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
size_t size_t size_t BLI_snprintf_utf8(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
size_t size_t size_t bool BLI_str_utf8_truncate_at_size(char *str, const size_t str_size)
#define STRNCPY_UTF8_RLEN(dst, src)
#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_COLLECTION_OVERRIDE_LIBRARY_LOCAL
@ BONE_DRAW_LOCKED_WEIGHT
@ 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.
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
Read Guarded memory(de)allocation.
void BKE_pchan_rot_to_mat3(const bPoseChannel *pchan, float r_mat[3][3])
void BKE_pchan_protected_rotation_axisangle_set(bPoseChannel *pchan, const float axis[3], float angle)
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_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_pchan_protected_rotation_euler_set(bPoseChannel *pchan, const float euler[3])
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_armature_mat_pose_to_bone_ex(Depsgraph *depsgraph, Object *ob, const bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
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)
void BKE_pchan_protected_location_set(bPoseChannel *pchan, const float location[3])
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_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_armature_mat_bone_to_pose(const bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
void BKE_pchan_minmax(const Object *ob, const bPoseChannel *pchan, const bool use_empty_drawtype, blender::float3 &r_min, blender::float3 &r_max)
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_armature_loc_pose_to_bone(const bPoseChannel *pchan, const float inloc[3], float outloc[3])
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_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_protected_scale_set(bPoseChannel *pchan, const float scale[3])
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_armature_mat_pose_to_bone(const bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
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_pchan_protected_rotation_quaternion_set(bPoseChannel *pchan, const float quat[4])
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)
BMesh const char void * data
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
BPy_StructRNA * depsgraph
ccl_device_inline float arc_length(const float e2, const float gamma)
SIMD_FORCE_INLINE const btScalar & z() const
Return the z value.
static T sum(const btAlignedObjectArray< T > &items)
float length(VecOp< float, D >) RET
void * MEM_callocN(size_t len, const char *str)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
bool bone_is_visible(const bArmature *armature, const Bone *bone)
void bonecolls_copy_expanded_flag(Span< BoneCollection * > bcolls_dest, Span< const BoneCollection * > bcolls_source)
bool bone_is_selected(const bArmature *armature, const Bone *bone)
Bounds< VecBase< T, 3 > > transform_bounds(const MatBase< T, D, D > &matrix, const Bounds< VecBase< T, 3 > > &bounds)
T min(const T &a, const T &b)
T max(const T &a, const T &b)
MatBase< float, 4, 4 > float4x4
VecBase< float, 3 > float3
struct IDProperty * system_properties
struct BoneCollection * next
struct BoneCollection * prev
IDProperty * system_properties
IDProperty * system_properties
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
const c_style_mat & ptr() const
static int blend(const Tex *tex, const float texvec[3], TexResult *texres)