Blender  V2.93
Classes | Macros | Typedefs | Functions
BKE_armature.h File Reference
#include "BLI_listbase.h"

Go to the source code of this file.

Classes

struct  EditBone
 
struct  PoseTarget
 
struct  PoseTree
 
struct  BoneParentTransform
 
struct  Mat4
 
struct  BBoneSplineParameters
 

Macros

#define MAX_BBONE_SUBDIV   32
 
#define PBONE_VISIBLE(arm, bone)
 
#define PBONE_SELECTABLE(arm, bone)    (PBONE_VISIBLE(arm, bone) && !((bone)->flag & BONE_UNSELECTABLE))
 
#define PBONE_SELECTED(arm, bone)   (((bone)->flag & BONE_SELECTED) & PBONE_VISIBLE(arm, bone))
 
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan)
 
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END
 
#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN(_ob, _pchan)
 
#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_END
 

Typedefs

typedef struct EditBone EditBone
 
typedef struct PoseTarget PoseTarget
 
typedef struct PoseTree PoseTree
 
typedef struct BoneParentTransform BoneParentTransform
 
typedef struct Mat4 Mat4
 
typedef struct BBoneSplineParameters BBoneSplineParameters
 

Functions

struct bArmatureBKE_armature_add (struct Main *bmain, const char *name)
 
struct bArmatureBKE_armature_from_object (struct Object *ob)
 
int BKE_armature_bonelist_count (struct ListBase *lb)
 
void BKE_armature_bonelist_free (struct ListBase *lb, const bool do_id_user)
 
void BKE_armature_editbonelist_free (struct ListBase *lb, const bool do_id_user)
 
void BKE_armature_copy_bone_transforms (struct bArmature *armature_dst, const struct bArmature *armature_src)
 
void BKE_armature_transform (struct bArmature *arm, const float mat[4][4], const bool do_props)
 
struct BoundBoxBKE_armature_boundbox_get (struct Object *ob)
 
bool BKE_pose_minmax (struct Object *ob, float r_min[3], float r_max[3], bool use_hidden, bool use_select)
 
bool bone_autoside_name (char name[64], int strip_number, short axis, float head, float tail)
 
struct BoneBKE_armature_find_bone_name (struct bArmature *arm, const char *name)
 
void BKE_armature_bone_hash_make (struct bArmature *arm)
 
void BKE_armature_bone_hash_free (struct bArmature *arm)
 
bool BKE_armature_bone_flag_test_recursive (const struct Bone *bone, int flag)
 
void BKE_armature_refresh_layer_used (struct Depsgraph *depsgraph, struct bArmature *arm)
 
float distfactor_to_bone (const float vec[3], const float b1[3], const float b2[3], float rad1, float rad2, float rdist)
 
void BKE_armature_where_is (struct bArmature *arm)
 
void BKE_armature_where_is_bone (struct Bone *bone, const struct Bone *bone_parent, const bool use_recursion)
 
void BKE_pose_clear_pointers (struct bPose *pose)
 
void BKE_pose_remap_bone_pointers (struct bArmature *armature, struct bPose *pose)
 
void BKE_pchan_rebuild_bbone_handles (struct bPose *pose, struct bPoseChannel *pchan)
 
void BKE_pose_channels_clear_with_null_bone (struct bPose *pose, const bool do_id_user)
 
void BKE_pose_rebuild (struct Main *bmain, struct Object *ob, struct bArmature *arm, const bool do_id_user)
 
void BKE_pose_ensure (struct Main *bmain, struct Object *ob, struct bArmature *arm, const bool do_id_user)
 
void BKE_pose_where_is (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
 
void BKE_pose_where_is_bone (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan, float ctime, bool do_extra)
 
void BKE_pose_where_is_bone_tail (struct bPoseChannel *pchan)
 
void BKE_pose_apply_action (struct Object *ob, struct bAction *action, struct AnimationEvalContext *anim_eval_context)
 
void vec_roll_to_mat3 (const float vec[3], const float roll, float r_mat[3][3])
 
void vec_roll_to_mat3_normalized (const float nor[3], const float roll, float r_mat[3][3])
 
void mat3_to_vec_roll (const float mat[3][3], float r_vec[3], float *r_roll)
 
void mat3_vec_to_roll (const float mat[3][3], const float vec[3], float *r_roll)
 
void BKE_armature_mat_world_to_pose (struct Object *ob, const float inmat[4][4], float outmat[4][4])
 
void BKE_armature_loc_world_to_pose (struct Object *ob, const float inloc[3], float outloc[3])
 
void BKE_armature_mat_pose_to_bone (struct bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
 
void BKE_armature_loc_pose_to_bone (struct bPoseChannel *pchan, const float inloc[3], float outloc[3])
 
void BKE_armature_mat_bone_to_pose (struct bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
 
void BKE_armature_mat_pose_to_delta (float delta_mat[4][4], float pose_mat[4][4], float arm_mat[4][4])
 
void BKE_armature_mat_pose_to_bone_ex (struct Depsgraph *depsgraph, struct Object *ob, struct bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
 
void BKE_pchan_mat3_to_rot (struct bPoseChannel *pchan, const float mat[3][3], bool use_compat)
 
void BKE_pchan_rot_to_mat3 (const struct bPoseChannel *pchan, float r_mat[3][3])
 
void BKE_pchan_apply_mat4 (struct bPoseChannel *pchan, const float mat[4][4], bool use_compat)
 
void BKE_pchan_to_mat4 (const struct bPoseChannel *pchan, float r_chanmat[4][4])
 
void BKE_pchan_calc_mat (struct bPoseChannel *pchan)
 
void BKE_bone_offset_matrix_get (const struct Bone *bone, float offs_bone[4][4])
 
void BKE_bone_parent_transform_clear (struct BoneParentTransform *bpt)
 
void BKE_bone_parent_transform_invert (struct BoneParentTransform *bpt)
 
void BKE_bone_parent_transform_combine (const struct BoneParentTransform *in1, const struct BoneParentTransform *in2, struct BoneParentTransform *result)
 
void BKE_bone_parent_transform_apply (const struct BoneParentTransform *bpt, const float inmat[4][4], float outmat[4][4])
 
void BKE_bone_parent_transform_calc_from_pchan (const struct bPoseChannel *pchan, struct BoneParentTransform *r_bpt)
 
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], struct BoneParentTransform *r_bpt)
 
void BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode)
 
void BKE_pchan_bbone_handles_get (struct bPoseChannel *pchan, struct bPoseChannel **r_prev, struct bPoseChannel **r_next)
 
void BKE_pchan_bbone_spline_params_get (struct bPoseChannel *pchan, const bool rest, struct BBoneSplineParameters *r_param)
 
void BKE_pchan_bbone_spline_setup (struct bPoseChannel *pchan, const bool rest, const bool for_deform, Mat4 *result_array)
 
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)
 
int BKE_pchan_bbone_spline_compute (struct BBoneSplineParameters *param, const bool for_deform, Mat4 *result_array)
 
void BKE_pchan_bbone_segments_cache_compute (struct bPoseChannel *pchan)
 
void BKE_pchan_bbone_segments_cache_copy (struct bPoseChannel *pchan, struct bPoseChannel *pchan_from)
 
void BKE_pchan_bbone_deform_segment_index (const struct bPoseChannel *pchan, float pos, int *r_index, float *r_blend_next)
 
struct bPoseChannelBKE_armature_ik_solver_find_root (struct bPoseChannel *pchan, struct bKinematicConstraint *data)
 
struct bPoseChannelBKE_armature_splineik_solver_find_root (struct bPoseChannel *pchan, struct bSplineIKConstraint *data)
 
void BKE_pose_splineik_init_tree (struct Scene *scene, struct Object *ob, float ctime)
 
void BKE_splineik_execute_tree (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bPoseChannel *pchan_root, float ctime)
 
void BKE_pose_pchan_index_rebuild (struct bPose *pose)
 
void BKE_pose_eval_init (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object)
 
void BKE_pose_eval_init_ik (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object)
 
void BKE_pose_eval_bone (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object, int pchan_index)
 
void BKE_pose_constraints_evaluate (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object, int pchan_index)
 
void BKE_pose_bone_done (struct Depsgraph *depsgraph, struct Object *object, int pchan_index)
 
void BKE_pose_eval_bbone_segments (struct Depsgraph *depsgraph, struct Object *object, int pchan_index)
 
void BKE_pose_iktree_evaluate (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object, int rootchan_index)
 
void BKE_pose_splineik_evaluate (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object, int rootchan_index)
 
void BKE_pose_eval_done (struct Depsgraph *depsgraph, struct Object *object)
 
void BKE_pose_eval_cleanup (struct Depsgraph *depsgraph, struct Scene *scene, struct Object *object)
 
void BKE_pose_eval_proxy_init (struct Depsgraph *depsgraph, struct Object *object)
 
void BKE_pose_eval_proxy_done (struct Depsgraph *depsgraph, struct Object *object)
 
void BKE_pose_eval_proxy_cleanup (struct Depsgraph *depsgraph, struct Object *object)
 
void BKE_pose_eval_proxy_copy_bone (struct Depsgraph *depsgraph, struct Object *object, int pchan_index)
 
Deform 3D Coordinates by Armature (armature_deform.c)
void BKE_armature_deform_coords_with_gpencil_stroke (const struct Object *ob_arm, const struct Object *ob_target, float(*vert_coords)[3], float(*vert_deform_mats)[3][3], int vert_coords_len, int deformflag, float(*vert_coords_prev)[3], const char *defgrp_name, struct bGPDstroke *gps_target)
 
void BKE_armature_deform_coords_with_mesh (const struct Object *ob_arm, const struct Object *ob_target, float(*vert_coords)[3], float(*vert_deform_mats)[3][3], int vert_coords_len, int deformflag, float(*vert_coords_prev)[3], const char *defgrp_name, const struct Mesh *me_target)
 
void BKE_armature_deform_coords_with_editmesh (const struct Object *ob_arm, const struct Object *ob_target, float(*vert_coords)[3], float(*vert_deform_mats)[3][3], int vert_coords_len, int deformflag, float(*vert_coords_prev)[3], const char *defgrp_name, struct BMEditMesh *em_target)
 

Macro Definition Documentation

◆ FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN

#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN (   _ob,
  _pchan 
)
Value:
for (bPoseChannel *_pchan = (_ob)->pose->chanbase.first; _pchan; _pchan = _pchan->next) { \
if (PBONE_VISIBLE(((bArmature *)(_ob)->data), (_pchan)->bone) && \
((_pchan)->bone->flag & BONE_SELECTED)) {
#define PBONE_VISIBLE(arm, bone)
Definition: BKE_armature.h:338
@ BONE_SELECTED
struct bPoseChannel * next

Definition at line 349 of file BKE_armature.h.

◆ FOREACH_PCHAN_SELECTED_IN_OBJECT_END

#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END
Value:
} \
} \
((void)0)

Definition at line 353 of file BKE_armature.h.

◆ FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN

#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_BEGIN (   _ob,
  _pchan 
)
Value:
for (bPoseChannel *_pchan = (_ob)->pose->chanbase.first; _pchan; _pchan = _pchan->next) { \
if (PBONE_VISIBLE(((bArmature *)(_ob)->data), (_pchan)->bone)) {

Definition at line 358 of file BKE_armature.h.

◆ FOREACH_PCHAN_VISIBLE_IN_OBJECT_END

#define FOREACH_PCHAN_VISIBLE_IN_OBJECT_END
Value:
} \
} \
((void)0)

Definition at line 361 of file BKE_armature.h.

◆ MAX_BBONE_SUBDIV

#define MAX_BBONE_SUBDIV   32

Definition at line 277 of file BKE_armature.h.

◆ PBONE_SELECTABLE

#define PBONE_SELECTABLE (   arm,
  bone 
)     (PBONE_VISIBLE(arm, bone) && !((bone)->flag & BONE_UNSELECTABLE))

Definition at line 343 of file BKE_armature.h.

◆ PBONE_SELECTED

#define PBONE_SELECTED (   arm,
  bone 
)    (((bone)->flag & BONE_SELECTED) & PBONE_VISIBLE(arm, bone))

Definition at line 346 of file BKE_armature.h.

◆ PBONE_VISIBLE

#define PBONE_VISIBLE (   arm,
  bone 
)
Value:
CHECK_TYPE_INLINE(bone, Bone *), \
(((bone)->layer & (arm)->layer) && !((bone)->flag & BONE_HIDDEN_P)))
#define CHECK_TYPE_INLINE(val, type)
@ BONE_HIDDEN_P

Definition at line 338 of file BKE_armature.h.

Typedef Documentation

◆ BBoneSplineParameters

◆ BoneParentTransform

◆ EditBone

typedef struct EditBone EditBone

◆ Mat4

typedef struct Mat4 Mat4

◆ PoseTarget

typedef struct PoseTarget PoseTarget

◆ PoseTree

typedef struct PoseTree PoseTree

Function Documentation

◆ BKE_armature_add()

struct bArmature* BKE_armature_add ( struct Main bmain,
const char *  name 
)

Definition at line 345 of file armature.c.

References BKE_id_new(), and ID_AR.

Referenced by BKE_object_obdata_add_from_type().

◆ BKE_armature_bone_flag_test_recursive()

bool BKE_armature_bone_flag_test_recursive ( const struct Bone bone,
int  flag 
)

◆ BKE_armature_bone_hash_free()

void BKE_armature_bone_hash_free ( struct bArmature arm)

Definition at line 651 of file armature.c.

References BLI_ghash_free(), bArmature::bonehash, and NULL.

Referenced by armature_free_data(), and ED_armature_from_edit().

◆ BKE_armature_bone_hash_make()

void BKE_armature_bone_hash_make ( struct bArmature arm)

◆ BKE_armature_bonelist_count()

int BKE_armature_bonelist_count ( struct ListBase lb)

◆ BKE_armature_bonelist_free()

void BKE_armature_bonelist_free ( struct ListBase lb,
const bool  do_id_user 
)

◆ BKE_armature_boundbox_get()

struct BoundBox* BKE_armature_boundbox_get ( struct Object ob)

Definition at line 2858 of file armature.c.

References Object_Runtime::bb, boundbox_armature(), and Object::runtime.

Referenced by BKE_object_boundbox_get(), and snapArmature().

◆ BKE_armature_copy_bone_transforms()

void BKE_armature_copy_bone_transforms ( struct bArmature armature_dst,
const struct bArmature armature_src 
)

◆ BKE_armature_deform_coords_with_editmesh()

void BKE_armature_deform_coords_with_editmesh ( const struct Object ob_arm,
const struct Object ob_target,
float(*)  vert_coords[3],
float(*)  vert_deform_mats[3][3],
int  vert_coords_len,
int  deformflag,
float(*)  vert_coords_prev[3],
const char *  defgrp_name,
struct BMEditMesh em_target 
)

Referenced by deformMatricesEM(), and deformVertsEM().

◆ BKE_armature_deform_coords_with_gpencil_stroke()

void BKE_armature_deform_coords_with_gpencil_stroke ( const struct Object ob_arm,
const struct Object ob_target,
float(*)  vert_coords[3],
float(*)  vert_deform_mats[3][3],
int  vert_coords_len,
int  deformflag,
float(*)  vert_coords_prev[3],
const char *  defgrp_name,
struct bGPDstroke gps_target 
)

Referenced by gpencil_deform_verts().

◆ BKE_armature_deform_coords_with_mesh()

void BKE_armature_deform_coords_with_mesh ( const struct Object ob_arm,
const struct Object ob_target,
float(*)  vert_coords[3],
float(*)  vert_deform_mats[3][3],
int  vert_coords_len,
int  deformflag,
float(*)  vert_coords_prev[3],
const char *  defgrp_name,
const struct Mesh me_target 
)

Referenced by deformMatrices(), and deformVerts().

◆ BKE_armature_editbonelist_free()

void BKE_armature_editbonelist_free ( struct ListBase lb,
const bool  do_id_user 
)

Definition at line 385 of file armature.c.

References BLI_remlink_safe(), IDP_FreeProperty_ex(), LISTBASE_FOREACH_MUTABLE, and MEM_freeN.

Referenced by armature_free_data().

◆ BKE_armature_find_bone_name()

struct Bone* BKE_armature_find_bone_name ( bArmature arm,
const char *  name 
)

◆ BKE_armature_from_object()

struct bArmature* BKE_armature_from_object ( struct Object ob)

◆ BKE_armature_ik_solver_find_root()

struct bPoseChannel* BKE_armature_ik_solver_find_root ( struct bPoseChannel pchan,
struct bKinematicConstraint data 
)

◆ BKE_armature_loc_pose_to_bone()

void BKE_armature_loc_pose_to_bone ( struct bPoseChannel pchan,
const float  inloc[3],
float  outloc[3] 
)

◆ BKE_armature_loc_world_to_pose()

void BKE_armature_loc_world_to_pose ( struct Object ob,
const float  inloc[3],
float  outloc[3] 
)

Definition at line 1555 of file armature.c.

References BKE_armature_mat_world_to_pose(), copy_v3_v3(), and unit_m4().

◆ BKE_armature_mat_bone_to_pose()

void BKE_armature_mat_bone_to_pose ( struct bPoseChannel pchan,
const float  inmat[4][4],
float  outmat[4][4] 
)

◆ BKE_armature_mat_pose_to_bone()

void BKE_armature_mat_pose_to_bone ( struct bPoseChannel pchan,
const float  inmat[4][4],
float  outmat[4][4] 
)

◆ BKE_armature_mat_pose_to_bone_ex()

void BKE_armature_mat_pose_to_bone_ex ( struct Depsgraph depsgraph,
struct Object ob,
struct bPoseChannel pchan,
const float  inmat[4][4],
float  outmat[4][4] 
)

◆ BKE_armature_mat_pose_to_delta()

void BKE_armature_mat_pose_to_delta ( float  delta_mat[4][4],
float  pose_mat[4][4],
float  arm_mat[4][4] 
)

Remove rest-position effects from pose-transform for obtaining 'visual' transformation of pose-channel. (used by the Visual-Keyframing stuff).

Definition at line 1963 of file armature.c.

References invert_m4_m4(), and mul_m4_m4m4().

◆ BKE_armature_mat_world_to_pose()

void BKE_armature_mat_world_to_pose ( struct Object ob,
const float  inmat[4][4],
float  outmat[4][4] 
)

Definition at line 1536 of file armature.c.

References invert_m4_m4(), mul_m4_m4m4(), NULL, and Object::obmat.

Referenced by BKE_armature_loc_world_to_pose().

◆ BKE_armature_refresh_layer_used()

void BKE_armature_refresh_layer_used ( struct Depsgraph depsgraph,
struct bArmature arm 
)

◆ BKE_armature_splineik_solver_find_root()

struct bPoseChannel* BKE_armature_splineik_solver_find_root ( struct bPoseChannel pchan,
struct bSplineIKConstraint data 
)

◆ BKE_armature_transform()

void BKE_armature_transform ( struct bArmature arm,
const float  mat[4][4],
const bool  do_props 
)

◆ BKE_armature_where_is()

void BKE_armature_where_is ( struct bArmature arm)

◆ BKE_armature_where_is_bone()

void BKE_armature_where_is_bone ( struct Bone bone,
const struct Bone bone_parent,
const bool  use_recursion 
)

◆ BKE_bone_offset_matrix_get()

void BKE_bone_offset_matrix_get ( const struct Bone bone,
float  offs_bone[4][4] 
)

◆ BKE_bone_parent_transform_apply()

void BKE_bone_parent_transform_apply ( const struct BoneParentTransform bpt,
const float  inmat[4][4],
float  outmat[4][4] 
)

◆ BKE_bone_parent_transform_calc_from_matrices()

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],
struct BoneParentTransform r_bpt 
)

◆ BKE_bone_parent_transform_calc_from_pchan()

void BKE_bone_parent_transform_calc_from_pchan ( const struct bPoseChannel pchan,
struct BoneParentTransform r_bpt 
)

Referenced by add_pose_transdata().

◆ BKE_bone_parent_transform_clear()

void BKE_bone_parent_transform_clear ( struct BoneParentTransform bpt)

◆ BKE_bone_parent_transform_combine()

void BKE_bone_parent_transform_combine ( const struct BoneParentTransform in1,
const struct BoneParentTransform in2,
struct BoneParentTransform result 
)

◆ BKE_bone_parent_transform_invert()

void BKE_bone_parent_transform_invert ( struct BoneParentTransform bpt)

◆ BKE_pchan_apply_mat4()

void BKE_pchan_apply_mat4 ( bPoseChannel pchan,
const float  mat[4][4],
bool  use_compat 
)

◆ BKE_pchan_bbone_deform_segment_index()

void BKE_pchan_bbone_deform_segment_index ( const struct bPoseChannel pchan,
float  pos,
int *  r_index,
float r_blend_next 
)

◆ BKE_pchan_bbone_handles_compute()

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 
)

◆ BKE_pchan_bbone_handles_get()

void BKE_pchan_bbone_handles_get ( struct bPoseChannel pchan,
struct bPoseChannel **  r_prev,
struct bPoseChannel **  r_next 
)

◆ BKE_pchan_bbone_segments_cache_compute()

void BKE_pchan_bbone_segments_cache_compute ( bPoseChannel pchan)

◆ BKE_pchan_bbone_segments_cache_copy()

void BKE_pchan_bbone_segments_cache_copy ( bPoseChannel pchan,
bPoseChannel pchan_from 
)

◆ BKE_pchan_bbone_spline_compute()

int BKE_pchan_bbone_spline_compute ( struct BBoneSplineParameters param,
const bool  for_deform,
Mat4 result_array 
)

◆ BKE_pchan_bbone_spline_params_get()

void BKE_pchan_bbone_spline_params_get ( struct bPoseChannel pchan,
const bool  rest,
struct BBoneSplineParameters r_param 
)

Definition at line 948 of file armature.c.

References add_v3_v3v3(), Bone::arm_head, Bone::arm_mat, Bone::arm_tail, BBONE_HANDLE_RELATIVE, BBONE_HANDLE_TANGENT, Bone::bbone_next_type, Bone::bbone_prev_type, BKE_pchan_bbone_handles_get(), bPoseChannel::bone, BONE_ADD_PARENT_END_ROLL, copy_m4_m4(), copy_v3_fl3(), copy_v3_v3(), BBoneSplineParameters::curve_in_x, bPoseChannel::curve_in_x, Bone::curve_in_x, BBoneSplineParameters::curve_in_y, bPoseChannel::curve_in_y, Bone::curve_in_y, BBoneSplineParameters::curve_out_x, bPoseChannel::curve_out_x, Bone::curve_out_x, BBoneSplineParameters::curve_out_y, bPoseChannel::curve_out_y, Bone::curve_out_y, BBoneSplineParameters::do_scale, BBoneSplineParameters::ease1, bPoseChannel::ease1, Bone::ease1, BBoneSplineParameters::ease2, bPoseChannel::ease2, Bone::ease2, fabsf, Bone::flag, invert_m4_m4(), BBoneSplineParameters::length, Bone::length, mat4_to_size(), mul_m4_m4m4(), mul_v3_m4v3(), next, BBoneSplineParameters::next_bbone, BBoneSplineParameters::next_h, BBoneSplineParameters::next_mat, normalize_m4(), bPoseChannel::pose_head, bPoseChannel::pose_mat, bPoseChannel::pose_tail, BBoneSplineParameters::prev_bbone, BBoneSplineParameters::prev_h, BBoneSplineParameters::prev_mat, BBoneSplineParameters::roll1, bPoseChannel::roll1, Bone::roll1, BBoneSplineParameters::roll2, bPoseChannel::roll2, Bone::roll2, BBoneSplineParameters::scale, BBoneSplineParameters::scale_in_x, bPoseChannel::scale_in_x, Bone::scale_in_x, BBoneSplineParameters::scale_in_y, bPoseChannel::scale_in_y, Bone::scale_in_y, BBoneSplineParameters::scale_out_x, bPoseChannel::scale_out_x, Bone::scale_out_x, BBoneSplineParameters::scale_out_y, bPoseChannel::scale_out_y, Bone::scale_out_y, BBoneSplineParameters::segments, Bone::segments, sub_v3_v3v3(), BBoneSplineParameters::use_next, BBoneSplineParameters::use_prev, and zero_v3().

Referenced by BKE_pchan_bbone_spline_setup().

◆ BKE_pchan_bbone_spline_setup()

void BKE_pchan_bbone_spline_setup ( struct bPoseChannel pchan,
const bool  rest,
const bool  for_deform,
Mat4 result_array 
)

◆ BKE_pchan_calc_mat()

void BKE_pchan_calc_mat ( struct bPoseChannel pchan)

Definition at line 2651 of file armature.c.

References BKE_pchan_to_mat4(), and bPoseChannel::chan_mat.

Referenced by actcon_get_tarmat(), and BKE_pose_where_is_bone().

◆ BKE_pchan_mat3_to_rot()

void BKE_pchan_mat3_to_rot ( bPoseChannel pchan,
const float  mat[3][3],
bool  use_compat 
)

◆ BKE_pchan_rebuild_bbone_handles()

void BKE_pchan_rebuild_bbone_handles ( bPose pose,
bPoseChannel pchan 
)

Update the links for the B-Bone handles from Bone data.

Definition at line 2512 of file armature.c.

References bPoseChannel::bbone_next, Bone::bbone_next, bPoseChannel::bbone_prev, Bone::bbone_prev, bPoseChannel::bone, and pose_channel_find_bone().

Referenced by BKE_pose_rebuild().

◆ BKE_pchan_rot_to_mat3()

void BKE_pchan_rot_to_mat3 ( const struct bPoseChannel pchan,
float  r_mat[3][3] 
)

Referenced by apply_targetless_ik().

◆ BKE_pchan_to_mat4()

void BKE_pchan_to_mat4 ( const struct bPoseChannel pchan,
float  r_chanmat[4][4] 
)

◆ BKE_pose_apply_action()

void BKE_pose_apply_action ( struct Object ob,
struct bAction action,
struct AnimationEvalContext anim_eval_context 
)

◆ BKE_pose_bone_done()

void BKE_pose_bone_done ( struct Depsgraph depsgraph,
struct Object object,
int  pchan_index 
)

◆ BKE_pose_channels_clear_with_null_bone()

void BKE_pose_channels_clear_with_null_bone ( struct bPose pose,
const bool  do_id_user 
)

◆ BKE_pose_clear_pointers()

void BKE_pose_clear_pointers ( bPose pose)

Clear pointers of object's pose (needed in remap case, since we cannot always wait for a complete pose rebuild).

Definition at line 2490 of file armature.c.

References bPose::chanbase, LISTBASE_FOREACH, and NULL.

Referenced by BKE_lib_override_library_update(), BKE_pose_rebuild(), and libblock_remap_data_preprocess().

◆ BKE_pose_constraints_evaluate()

void BKE_pose_constraints_evaluate ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object object,
int  pchan_index 
)

◆ BKE_pose_ensure()

void BKE_pose_ensure ( Main bmain,
Object ob,
bArmature arm,
const bool  do_id_user 
)

◆ BKE_pose_eval_bbone_segments()

void BKE_pose_eval_bbone_segments ( struct Depsgraph depsgraph,
struct Object object,
int  pchan_index 
)

◆ BKE_pose_eval_bone()

void BKE_pose_eval_bone ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object object,
int  pchan_index 
)

◆ BKE_pose_eval_cleanup()

void BKE_pose_eval_cleanup ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object object 
)

◆ BKE_pose_eval_done()

void BKE_pose_eval_done ( struct Depsgraph depsgraph,
struct Object object 
)

◆ BKE_pose_eval_init()

void BKE_pose_eval_init ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object object 
)

◆ BKE_pose_eval_init_ik()

void BKE_pose_eval_init_ik ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object object 
)

◆ BKE_pose_eval_proxy_cleanup()

void BKE_pose_eval_proxy_cleanup ( struct Depsgraph depsgraph,
struct Object object 
)

◆ BKE_pose_eval_proxy_copy_bone()

void BKE_pose_eval_proxy_copy_bone ( struct Depsgraph depsgraph,
struct Object object,
int  pchan_index 
)

◆ BKE_pose_eval_proxy_done()

void BKE_pose_eval_proxy_done ( struct Depsgraph depsgraph,
struct Object object 
)

◆ BKE_pose_eval_proxy_init()

void BKE_pose_eval_proxy_init ( struct Depsgraph depsgraph,
struct Object object 
)

◆ BKE_pose_iktree_evaluate()

void BKE_pose_iktree_evaluate ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object object,
int  rootchan_index 
)

◆ BKE_pose_minmax()

bool BKE_pose_minmax ( struct Object ob,
float  r_min[3],
float  r_max[3],
bool  use_hidden,
bool  use_select 
)

◆ BKE_pose_pchan_index_rebuild()

void BKE_pose_pchan_index_rebuild ( struct bPose pose)

◆ BKE_pose_rebuild()

void BKE_pose_rebuild ( Main bmain,
Object ob,
bArmature arm,
const bool  do_id_user 
)

◆ BKE_pose_remap_bone_pointers()

void BKE_pose_remap_bone_pointers ( struct bArmature armature,
struct bPose pose 
)

Definition at line 2498 of file armature.c.

References BKE_armature_find_bone_name(), bPose::chanbase, and LISTBASE_FOREACH.

◆ BKE_pose_splineik_evaluate()

void BKE_pose_splineik_evaluate ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object object,
int  rootchan_index 
)

◆ BKE_pose_splineik_init_tree()

void BKE_pose_splineik_init_tree ( struct Scene scene,
struct Object ob,
float  ctime 
)

Definition at line 792 of file armature_update.c.

References scene, and splineik_init_tree().

Referenced by BKE_pose_eval_init_ik(), and BKE_pose_where_is().

◆ BKE_pose_where_is()

void BKE_pose_where_is ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob 
)

◆ BKE_pose_where_is_bone()

void BKE_pose_where_is_bone ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob,
struct bPoseChannel pchan,
float  ctime,
bool  do_extra 
)

◆ BKE_pose_where_is_bone_tail()

void BKE_pose_where_is_bone_tail ( struct bPoseChannel pchan)

◆ BKE_rotMode_change_values()

void BKE_rotMode_change_values ( float  quat[4],
float  eul[3],
float  axis[3],
float angle,
short  oldMode,
short  newMode 
)

◆ BKE_splineik_execute_tree()

void BKE_splineik_execute_tree ( struct Depsgraph depsgraph,
struct Scene scene,
struct Object ob,
struct bPoseChannel pchan_root,
float  ctime 
)

Definition at line 797 of file armature_update.c.

References depsgraph, scene, and splineik_execute_tree().

Referenced by BKE_pose_splineik_evaluate(), and BKE_pose_where_is().

◆ bone_autoside_name()

bool bone_autoside_name ( char  name[64],
int  strip_number,
short  axis,
float  head,
float  tail 
)

◆ distfactor_to_bone()

float distfactor_to_bone ( const float  vec[3],
const float  b1[3],
const float  b2[3],
float  rad1,
float  rad2,
float  rdist 
)

◆ mat3_to_vec_roll()

void mat3_to_vec_roll ( const float  mat[3][3],
float  r_vec[3],
float r_roll 
)

◆ mat3_vec_to_roll()

void mat3_vec_to_roll ( const float  mat[3][3],
const float  vec[3],
float r_roll 
)

◆ vec_roll_to_mat3()

void vec_roll_to_mat3 ( const float  vec[3],
const float  roll,
float  r_mat[3][3] 
)

◆ vec_roll_to_mat3_normalized()

void vec_roll_to_mat3_normalized ( const float  nor[3],
const float  roll,
float  r_mat[3][3] 
)

Given v = (v.x, v.y, v.z) our (normalized) bone vector, we want the rotation matrix M from the Y axis (so that M * (0, 1, 0) = v).

  • The rotation axis a lays on XZ plane, and it is orthonormal to v, hence to the projection of v onto XZ plane.
  • a = (v.z, 0, -v.x)

We know a is eigenvector of M (so M * a = a). Finally, we have w, such that M * w = (0, 1, 0) (i.e. the vector that will be aligned with Y axis once transformed). We know w is symmetric to v by the Y axis.

  • w = (-v.x, v.y, -v.z)

Solving this, we get (x, y and z being the components of v):

    ┌ (x^2 * y + z^2) / (x^2 + z^2),   x,   x * z * (y - 1) / (x^2 + z^2) ┐
M = │  x * (y^2 - 1)  / (x^2 + z^2),   y,    z * (y^2 - 1)  / (x^2 + z^2) │
    └ x * z * (y - 1) / (x^2 + z^2),   z,   (x^2 + z^2 * y) / (x^2 + z^2) ┘

This is stable as long as v (the bone) is not too much aligned with +/-Y (i.e. x and z components are not too close to 0).

Since v is normalized, we have x^2 + y^2 + z^2 = 1, hence x^2 + z^2 = 1 - y^2 = (1 - y)(1 + y).

This allows to simplifies M like this:

    ┌ 1 - x^2 / (1 + y),   x,     -x * z / (1 + y) ┐
M = │                -x,   y,                   -z │
    └  -x * z / (1 + y),   z,    1 - z^2 / (1 + y) ┘

Written this way, we see the case v = +Y is no more a singularity. The only one remaining is the bone being aligned with -Y.

Let's handle the asymptotic behavior when bone vector is reaching the limit of y = -1. Each of the four corner elements can vary from -1 to 1, depending on the axis a chosen for doing the rotation. And the "rotation" here is in fact established by mirroring XZ plane by that given axis, then inversing the Y-axis. For sufficiently small x and z, and with y approaching -1, all elements but the four corner ones of M will degenerate. So let's now focus on these corner elements.

We rewrite M so that it only contains its four corner elements, and combine the 1 / (1 + y) factor:

                   ┌ 1 + y - x^2,        -x * z ┐
M* = 1 / (1 + y) * │                            │
                   └      -x * z,   1 + y - z^2 ┘

When y is close to -1, computing 1 / (1 + y) will cause severe numerical instability, so we ignore it and normalize M instead. We know y^2 = 1 - (x^2 + z^2), and y < 0, hence y = -sqrt(1 - (x^2 + z^2)).

Since x and z are both close to 0, we apply the binomial expansion to the first order: y = -sqrt(1 - (x^2 + z^2)) = -1 + (x^2 + z^2) / 2. Which gives:

                       ┌  z^2 - x^2,  -2 * x * z ┐
M* = 1 / (x^2 + z^2) * │                         │
                       └ -2 * x * z,   x^2 - z^2 ┘

Definition at line 2155 of file armature.c.

References axis_angle_normalized_to_mat3(), BLI_ASSERT_UNIT_V3, mul_m3_m3m3(), nor, unit_m3(), x, y, and z.

Referenced by ED_armature_ebone_roll_to_vector(), ED_armature_ebone_to_mat3(), blender::bke::tests::TEST(), and vec_roll_to_mat3().