|
Blender V4.3
|
#include <cctype>#include <cfloat>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>#include <limits>#include <optional>#include "MEM_guardedalloc.h"#include "BLI_alloca.h"#include "BLI_ghash.h"#include "BLI_listbase.h"#include "BLI_math_geom.h"#include "BLI_math_matrix.h"#include "BLI_math_matrix.hh"#include "BLI_math_rotation.h"#include "BLI_math_vector.h"#include "BLI_span.hh"#include "BLI_string.h"#include "BLI_string_ref.hh"#include "BLI_utildefines.h"#include "BLT_translation.hh"#include "DNA_defaults.h"#include "DNA_armature_types.h"#include "DNA_constraint_types.h"#include "DNA_listBase.h"#include "DNA_object_types.h"#include "DNA_scene_types.h"#include "BKE_action.hh"#include "BKE_anim_data.hh"#include "BKE_anim_visualization.h"#include "BKE_armature.hh"#include "BKE_constraint.h"#include "BKE_curve.hh"#include "BKE_idprop.hh"#include "BKE_idtype.hh"#include "BKE_lib_id.hh"#include "BKE_lib_query.hh"#include "BKE_main.hh"#include "BKE_object.hh"#include "BKE_object_types.hh"#include "BKE_scene.hh"#include "ANIM_bone_collections.hh"#include "DEG_depsgraph_build.hh"#include "DEG_depsgraph_query.hh"#include "BIK_api.h"#include "BLI_math_base_safe.h"#include "BLO_read_write.hh"#include "CLG_log.h"Go to the source code of this file.
Functions | |
Prototypes | |
| static void | copy_bonechildren (Bone *bone_dst, const Bone *bone_src, const Bone *bone_src_act, Bone **r_bone_dst_act, const int flag) |
| static void | copy_bonechildren_custom_handles (Bone *bone_dst, bArmature *arm_dst) |
Generic Data-Level Functions | |
| bArmature * | BKE_armature_add (Main *bmain, const char *name) |
| bArmature * | BKE_armature_from_object (Object *ob) |
| int | BKE_armature_bonelist_count (const ListBase *lb) |
| void | BKE_armature_bonelist_free (ListBase *lb, const bool do_id_user) |
| void | BKE_armature_editbonelist_free (ListBase *lb, const bool do_id_user) |
Armature Transform Copy | |
| static void | copy_bone_transform (Bone *bone_dst, const Bone *bone_src) |
| void | BKE_armature_copy_bone_transforms (bArmature *armature_dst, const bArmature *armature_src) |
Armature Transform by 4x4 Matrix | |
| |
| 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_transform (bArmature *arm, const float mat[4][4], const bool do_props) |
Armature Bone Find by Name | |
Using fast GHash lookups when available. | |
| static Bone * | get_named_bone_bonechildren (ListBase *lb, const char *name) |
| Bone * | BKE_armature_find_bone_name (bArmature *arm, const char *name) |
| static void | armature_bone_from_name_insert_recursive (GHash *bone_hash, ListBase *lb) |
| static GHash * | armature_bone_from_name_map (bArmature *arm) |
| void | BKE_armature_bone_hash_make (bArmature *arm) |
| void | BKE_armature_bone_hash_free (bArmature *arm) |
Armature Bone Flags | |
| bool | BKE_armature_bone_flag_test_recursive (const Bone *bone, int flag) |
Bone auto-side name support | |
| bool | bone_autoside_name (char name[MAXBONENAME], int, short axis, float head, float tail) |
Armature B-Bone Support | |
| 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 | evaluate_cubic_bezier (const float control[4][3], float t, float r_pos[3], float r_tangent[3]) |
| void | BKE_pchan_bbone_handles_get (bPoseChannel *pchan, bPoseChannel **r_prev, bPoseChannel **r_next) |
| void | BKE_pchan_bbone_spline_params_get (bPoseChannel *pchan, const bool rest, BBoneSplineParameters *param) |
| void | BKE_pchan_bbone_spline_setup (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) |
| 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 | ease_handle_axis (const float deriv1[3], const float deriv2[3], float r_axis[3]) |
| int | BKE_pchan_bbone_spline_compute (BBoneSplineParameters *param, const bool for_deform, Mat4 *result_array) |
| static void | allocate_bbone_cache (bPoseChannel *pchan, const int segments, const bool use_boundaries) |
| static void | compute_bbone_segment_boundaries (bPoseChannel *pchan) |
| void | BKE_pchan_bbone_segments_cache_compute (bPoseChannel *pchan) |
| void | BKE_pchan_bbone_segments_cache_copy (bPoseChannel *pchan, bPoseChannel *pchan_from) |
| void | BKE_pchan_bbone_deform_clamp_segment_index (const bPoseChannel *pchan, float head_tail, int *r_index, float *r_blend_next) |
| static void | find_bbone_segment_index_straight (const bPoseChannel *pchan, const float *co, int *r_index, float *r_blend_next) |
| float | bbone_segment_bsp_signed_distance (const bPoseChannel_BBoneSegmentBoundary &boundary, const float *co) |
| static void | find_bbone_segment_index_curved (const bPoseChannel *pchan, const float *co, int *r_index, float *r_blend_next) |
| void | BKE_pchan_bbone_deform_segment_index (const bPoseChannel *pchan, const float *co, int *r_index, float *r_blend_next) |
Bone Space to Space Conversion API | |
| void | BKE_armature_mat_world_to_pose (Object *ob, const float inmat[4][4], float outmat[4][4]) |
| void | BKE_armature_loc_world_to_pose (Object *ob, const float inloc[3], float outloc[3]) |
Bone Matrix Calculation API | |
| void | BKE_bone_offset_matrix_get (const Bone *bone, float offs_bone[4][4]) |
| void | BKE_bone_parent_transform_calc_from_pchan (const bPoseChannel *pchan, 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], BoneParentTransform *r_bpt) |
| void | BKE_bone_parent_transform_clear (BoneParentTransform *bpt) |
| void | BKE_bone_parent_transform_invert (BoneParentTransform *bpt) |
| void | BKE_bone_parent_transform_combine (const BoneParentTransform *in1, const BoneParentTransform *in2, BoneParentTransform *result) |
| void | BKE_bone_parent_transform_apply (const BoneParentTransform *bpt, const float inmat[4][4], float outmat[4][4]) |
| void | BKE_armature_mat_pose_to_bone (bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4]) |
| void | BKE_armature_mat_bone_to_pose (bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4]) |
| void | BKE_armature_loc_pose_to_bone (bPoseChannel *pchan, const float inloc[3], float outloc[3]) |
Bone Matrix Read/Write API | |
High level functions for transforming bones and reading the transform values. | |
| 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_mat3_to_rot (bPoseChannel *pchan, const float mat[3][3], bool use_compat) |
| void | BKE_pchan_rot_to_mat3 (const bPoseChannel *pchan, float r_mat[3][3]) |
| void | BKE_pchan_apply_mat4 (bPoseChannel *pchan, const float mat[4][4], bool use_compat) |
| void | BKE_armature_mat_pose_to_delta (float delta_mat[4][4], float pose_mat[4][4], float arm_mat[4][4]) |
Rotation Mode Conversions | |
Used for Objects and Pose Channels, since both can have multiple rotation representations. | |
| void | BKE_rotMode_change_values (float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode) |
Bone Vector, Roll Conversion | |
Used for Objects and Pose Channels, since both can have multiple rotation representations. How it WorksThis is the bone transformation trick; they're hierarchical so each bone(b) is in the coord system of bone(b-1): arm_mat(b)= arm_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) -> yoffs is just the y axis translation in parent's coord system -> d_root is the translation of the bone root, also in parent's coord system pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) we then - in init deform - store the deform in chan_mat, such that: pose_mat(b)= arm_mat(b) * chan_mat(b) | |
| 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 | vec_roll_to_mat3_normalized (const float nor[3], const float roll, float r_mat[3][3]) |
| void | vec_roll_to_mat3 (const float vec[3], const float roll, float r_mat[3][3]) |
Armature Bone Matrix Calculation (Recursive) | |
| void | BKE_armature_where_is_bone (Bone *bone, const Bone *bone_parent, const bool use_recursion) |
| void | BKE_armature_where_is (bArmature *arm) |
Pose Rebuild | |
| static int | rebuild_pose_bone (bPose *pose, Bone *bone, bPoseChannel *parchan, int counter, Bone **r_last_visited_bone_p) |
| void | BKE_pose_clear_pointers (bPose *pose) |
| void | BKE_pose_remap_bone_pointers (bArmature *armature, bPose *pose) |
| static bPoseChannel * | pose_channel_find_bone (bPose *pose, Bone *bone) |
| void | BKE_pchan_rebuild_bbone_handles (bPose *pose, bPoseChannel *pchan) |
| void | BKE_pose_channels_clear_with_null_bone (bPose *pose, const bool do_id_user) |
| void | BKE_pose_rebuild (Main *bmain, Object *ob, bArmature *arm, const bool do_id_user) |
| void | BKE_pose_ensure (Main *bmain, Object *ob, bArmature *arm, const bool do_id_user) |
Pose Solver | |
| void | BKE_pchan_to_mat4 (const bPoseChannel *pchan, float r_chanmat[4][4]) |
| void | BKE_pchan_calc_mat (bPoseChannel *pchan) |
| void | BKE_pose_where_is_bone_tail (bPoseChannel *pchan) |
| void | BKE_pose_where_is_bone (Depsgraph *depsgraph, Scene *scene, Object *ob, bPoseChannel *pchan, float ctime, bool do_extra) |
| void | BKE_pose_where_is (Depsgraph *depsgraph, Scene *scene, Object *ob) |
Calculate Bounding Box (Armature & Pose) | |
| std::optional< blender::Bounds< blender::float3 > > | BKE_armature_min_max (const Object *ob) |
| void | BKE_pchan_minmax (const Object *ob, const bPoseChannel *pchan, const bool use_empty_drawtype, float r_min[3], float r_max[3]) |
| std::optional< blender::Bounds< blender::float3 > > | BKE_pose_minmax (const Object *ob, const bool use_select) |
Graph Evaluation | |
| bPoseChannel * | BKE_armature_ik_solver_find_root (bPoseChannel *pchan, bKinematicConstraint *data) |
| bPoseChannel * | BKE_armature_splineik_solver_find_root (bPoseChannel *pchan, bSplineIKConstraint *data) |
|
static |
Definition at line 1621 of file armature.cc.
References bPoseChannel_Runtime::bbone_deform_mats, bPoseChannel_Runtime::bbone_dual_quats, bPoseChannel_Runtime::bbone_pose_mats, bPoseChannel_Runtime::bbone_rest_mats, bPoseChannel_Runtime::bbone_segment_boundaries, bPoseChannel_Runtime::bbone_segments, BKE_pose_channel_free_bbone_cache(), MEM_malloc_arrayN, MEM_SAFE_FREE, and bPoseChannel::runtime.
Referenced by BKE_pchan_bbone_segments_cache_compute(), and BKE_pchan_bbone_segments_cache_copy().
|
static |
Definition at line 445 of file armature.cc.
References bArmature::act_bone, bArmature::act_edbone, ANIM_armature_runtime_refresh(), BKE_armature_bone_hash_make(), BLO_read_struct, BLO_read_struct_list, bArmature::bonebase, bArmature::bonehash, direct_link_bones(), bArmature::edbo, LISTBASE_FOREACH, bArmature::needs_flush_to_id, read_bone_collections(), and bArmature::runtime.
|
static |
Definition at line 312 of file armature.cc.
References bArmature::act_edbone, BKE_id_blend_write(), BLI_listbase_clear(), BLO_write_id_struct, bArmature::bonebase, bArmature::bonehash, bArmature::collection_array, bArmature::collection_array_num, bArmature::collections_legacy, bArmature::edbo, ListBase::first, bArmature::id, ListBase::last, LISTBASE_FOREACH, bArmature::needs_flush_to_id, BoneCollection::next, BoneCollection::prev, bArmature::runtime, write_bone(), and write_bone_collection().
Definition at line 792 of file armature.cc.
References armature_bone_from_name_insert_recursive(), BLI_ghash_insert(), and LISTBASE_FOREACH.
Referenced by armature_bone_from_name_insert_recursive(), and armature_bone_from_name_map().
Create a (name -> bone) map.
Definition at line 806 of file armature.cc.
References armature_bone_from_name_insert_recursive(), BKE_armature_bonelist_count(), BLI_ghash_str_new_ex(), and bArmature::bonebase.
Referenced by BKE_armature_bone_hash_make().
|
static |
Only copy internal data of Armature ID from source to already allocated/initialized destination. You probably never want to use that directly, use BKE_id_copy or BKE_id_copy_ex for typical needs.
WARNING! This function will not handle ID user count!
| flag | Copying options (see BKE_lib_id.hh's LIB_ID_COPY_... flags for more). |
Definition at line 135 of file armature.cc.
References bArmature::act_bone, bArmature::act_edbone, bArmature_Runtime::active_collection_index, ANIM_armature_bonecoll_active_index_set(), ANIM_armature_runtime_refresh(), BKE_armature_bone_hash_make(), BLI_duplicatelist(), bArmature::bonebase, bArmature::bonehash, bArmature::collection_array, bArmature::collection_array_num, copy_bone_collection(), copy_bonechildren(), copy_bonechildren_custom_handles(), bArmature::edbo, ListBase::first, flag, LIB_ID_CREATE_NO_USER_REFCOUNT, MEM_dupallocN, Bone::next, Bone::parent, and bArmature::runtime.
|
static |
Definition at line 256 of file armature.cc.
References armature_foreach_id_bone(), armature_foreach_id_bone_collection(), armature_foreach_id_editbone(), BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL, bArmature::bonebase, bArmature::edbo, and LISTBASE_FOREACH.
|
static |
Definition at line 228 of file armature.cc.
References armature_foreach_id_bone(), BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL, Bone::childbase, IDP_foreach_property(), IDP_TYPE_FILTER_ID, LISTBASE_FOREACH, and Bone::prop.
Referenced by armature_foreach_id(), and armature_foreach_id_bone().
|
static |
Definition at line 248 of file armature.cc.
References BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL, IDP_foreach_property(), IDP_TYPE_FILTER_ID, and BoneCollection::prop.
Referenced by armature_foreach_id().
|
static |
Definition at line 240 of file armature.cc.
References BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL, IDP_foreach_property(), IDP_TYPE_FILTER_ID, and EditBone::prop.
Referenced by armature_foreach_id().
|
static |
Free (or release) any data used by this armature (does not free the armature itself).
Definition at line 201 of file armature.cc.
References ANIM_armature_runtime_free(), ANIM_bonecoll_free(), BKE_armature_bone_hash_free(), BKE_armature_bonelist_free(), BKE_armature_editbonelist_free(), BLI_freelistN(), bArmature::bonebase, bArmature::collection_array, bArmature::collection_array_num, bArmature::edbo, and MEM_freeN().
|
static |
Definition at line 89 of file armature.cc.
References BLI_assert, DNA_struct_default_get, MEMCMP_STRUCT_AFTER_IS_ZERO, and MEMCPY_STRUCT_AFTER.
|
static |
Helper for ED_armature_transform
Definition at line 661 of file armature.cc.
References Bone::arm_tail, armature_transform_recurse(), atan2f, BKE_armature_where_is_bone(), BLI_listbase_is_empty(), copy_m3_m4(), copy_v3_v3(), invert_m3(), invert_m4_m4(), LISTBASE_FOREACH, mat3_to_vec_roll(), mul_m3_m3m3(), mul_m4_v3(), mul_mat3_m4_v3(), sub_v3_v3v3(), and vec_roll_to_mat3().
Referenced by armature_transform_recurse(), and BKE_armature_transform().
|
static |
Definition at line 469 of file armature.cc.
References blender::animrig::bonecolls_copy_expanded_flag().
|
inline |
Computes signed distance to the segment boundary BSP plane.
Definition at line 1843 of file armature.cc.
References dot_v3v3().
Referenced by find_bbone_segment_index_curved().
Definition at line 514 of file armature.cc.
References BKE_id_new(), and ID_AR.
Referenced by BKE_object_obdata_add_from_type(), blender::io::usd::USDSkeletonReader::create_object(), and blender::animrig::tests::KeyframingTest::SetUp().
Definition at line 835 of file armature.cc.
References BKE_armature_bone_flag_test_recursive(), Bone::flag, flag, and Bone::parent.
Referenced by BKE_armature_bone_flag_test_recursive(), and snap_selected_to_location().
| void BKE_armature_bone_hash_free | ( | bArmature * | arm | ) |
Definition at line 821 of file armature.cc.
References BLI_ghash_free(), and bArmature::bonehash.
Referenced by armature_free_data(), and ED_armature_from_edit().
| void BKE_armature_bone_hash_make | ( | bArmature * | arm | ) |
Definition at line 814 of file armature.cc.
References armature_bone_from_name_map(), and bArmature::bonehash.
Referenced by armature_blend_read_data(), armature_copy_data(), ED_armature_from_edit(), blender::animrig::tests::ArmatureBoneCollections::SetUp(), and blender::animrig::tests::ArmatureBoneCollectionsLiboverrides::SetUp().
Definition at line 530 of file armature.cc.
References BKE_armature_bonelist_count(), and LISTBASE_FOREACH.
Referenced by armature_bone_from_name_map(), BKE_armature_bonelist_count(), and blender::ed::object::data_xform_create_ex().
| void BKE_armature_bonelist_free | ( | ListBase * | lb, |
| const bool | do_id_user ) |
Definition at line 540 of file armature.cc.
References BKE_armature_bonelist_free(), BLI_freelistN(), IDP_FreeProperty_ex(), and LISTBASE_FOREACH.
Referenced by armature_free_data(), BKE_armature_bonelist_free(), and ED_armature_from_edit().
Definition at line 640 of file armature.cc.
References BLI_assert, bArmature::bonebase, copy_bone_transform(), ListBase::first, and Bone::next.
Referenced by blender::ed::object::apply_objects_internal(), and blender::ed::object::object_origin_set_exec().
| void BKE_armature_editbonelist_free | ( | ListBase * | lb, |
| const bool | do_id_user ) |
Definition at line 553 of file armature.cc.
References BLI_remlink_safe(), IDP_FreeProperty_ex(), LISTBASE_FOREACH_MUTABLE, and MEM_freeN().
Referenced by armature_free_data().
Find the bone with the given name.
When doing multiple subsequent calls to this function, consider calling BKE_armature_bone_hash_make first to hash the bone names and speed up queries.
Definition at line 779 of file armature.cc.
References BLI_ghash_lookup(), bArmature::bonebase, bArmature::bonehash, and get_named_bone_bonechildren().
Referenced by AnimationImporter::apply_matrix_curves(), BKE_pose_blend_read_after_liblink(), BKE_pose_blend_write(), BKE_pose_remap_bone_pointers(), bone_unique_check(), copy_and_update_ownership(), copy_bone_collection(), copy_bonechildren_custom_handles(), ED_armature_bone_rename(), blender::io::usd::is_armature_modifier_bone_name(), and blender::ed::object::test_constraint().
Definition at line 522 of file armature.cc.
References Object::data, OB_ARMATURE, and Object::type.
Referenced by apply_armature_pose2bones_exec(), createTransPose(), and blender::ed::object::test_constraint().
| bPoseChannel * BKE_armature_ik_solver_find_root | ( | bPoseChannel * | pchan, |
| bKinematicConstraint * | data ) |
Definition at line 3132 of file armature.cc.
References CONSTRAINT_IK_TIP, and bPoseChannel::parent.
Referenced by blender::deg::DepsgraphNodeBuilder::build_ik_pose(), and blender::deg::DepsgraphRelationBuilder::build_ik_pose().
| void BKE_armature_loc_pose_to_bone | ( | bPoseChannel * | pchan, |
| const float | inloc[3], | ||
| float | outloc[3] ) |
Convert Pose-Space Location to Bone-Space Location
Definition at line 2270 of file armature.cc.
References BKE_armature_mat_pose_to_bone(), copy_v3_v3(), and unit_m4().
Referenced by snap_sel_to_grid_exec(), and snap_selected_to_location().
Convert World-Space Location to Pose-Space Location
Definition at line 2005 of file armature.cc.
References BKE_armature_mat_world_to_pose(), copy_v3_v3(), and unit_m4().
| void BKE_armature_mat_bone_to_pose | ( | bPoseChannel * | pchan, |
| const float | inmat[4][4], | ||
| float | outmat[4][4] ) |
Convert Bone-Space Matrix to Pose-Space Matrix.
Definition at line 2260 of file armature.cc.
References BKE_bone_parent_transform_apply(), and BKE_bone_parent_transform_calc_from_pchan().
Referenced by BKE_constraint_mat_convertspace(), and BKE_pose_where_is_bone().
| void BKE_armature_mat_pose_to_bone | ( | bPoseChannel * | pchan, |
| const float | inmat[4][4], | ||
| float | outmat[4][4] ) |
Convert Pose-Space Matrix to Bone-Space Matrix.
Definition at line 2249 of file armature.cc.
References BKE_bone_parent_transform_apply(), BKE_bone_parent_transform_calc_from_pchan(), and BKE_bone_parent_transform_invert().
Referenced by apply_targetless_ik(), BKE_armature_loc_pose_to_bone(), BKE_armature_mat_pose_to_bone_ex(), BKE_constraint_apply_for_pose(), BKE_constraint_mat_convertspace(), BKE_pchan_bbone_spline_params_get(), pose_visual_transform_apply_exec(), and blender::animrig::visualkey_get_values().
| void BKE_armature_mat_pose_to_bone_ex | ( | Depsgraph * | depsgraph, |
| Object * | ob, | ||
| bPoseChannel * | pchan, | ||
| const float | inmat[4][4], | ||
| float | outmat[4][4] ) |
Definition at line 2292 of file armature.cc.
References BKE_armature_mat_pose_to_bone(), BKE_pchan_apply_mat4(), BKE_pose_where_is_bone(), depsgraph, and unit_m4().
| 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 2365 of file armature.cc.
References invert_m4_m4(), and mul_m4_m4m4().
Convert World-Space Matrix to Pose-Space Matrix.
Definition at line 1989 of file armature.cc.
References invert_m4_m4(), and mul_m4_m4m4().
Referenced by BKE_armature_loc_world_to_pose().
| std::optional< blender::Bounds< blender::float3 > > BKE_armature_min_max | ( | const Object * | ob | ) |
Return the posed Armature bounding box in object-local coordinate space.
Definition at line 3024 of file armature.cc.
References BKE_pose_minmax(), and blender::math::transform_point().
Referenced by BKE_object_boundbox_get(), and snapArmature().
| bPoseChannel * BKE_armature_splineik_solver_find_root | ( | bPoseChannel * | pchan, |
| bSplineIKConstraint * | data ) |
Definition at line 3153 of file armature.cc.
References BLI_assert, and bPoseChannel::parent.
Referenced by blender::deg::DepsgraphNodeBuilder::build_splineik_pose(), and blender::deg::DepsgraphRelationBuilder::build_splineik_pose().
Definition at line 743 of file armature.cc.
References armature_transform_recurse(), bArmature::bonebase, copy_m3_m4(), mat4_to_scale(), and normalize_m3().
Referenced by blender::ed::object::apply_objects_internal(), blender::ed::object::armature_coords_and_quats_apply_with_mat4(), and ED_armature_transform().
| void BKE_armature_where_is | ( | bArmature * | arm | ) |
Updates vectors and matrices on rest-position level, only needed after editing armature itself, now only on reading file.
Definition at line 2663 of file armature.cc.
References BKE_armature_where_is_bone(), bArmature::bonebase, and LISTBASE_FOREACH.
Referenced by blo_do_versions_pre250().
Recursive part, calculates rest-position of entire tree of children.
Definition at line 2625 of file armature.cc.
References Bone::arm_mat, BKE_armature_where_is_bone(), BKE_bone_offset_matrix_get(), Bone::bone_mat, Bone::childbase, copy_m4_m3(), copy_v3_v3(), ListBase::first, Bone::head, len_v3(), Bone::length, mul_m4_m4m4(), Bone::next, Bone::roll, Bone::segments, sub_v3_v3v3(), Bone::tail, vec_roll_to_mat3(), Bone::xwidth, and Bone::zwidth.
Referenced by armature_finalize_restpose(), armature_transform_recurse(), BKE_armature_where_is(), and BKE_armature_where_is_bone().
Simple helper, computes the offset bone matrix: offs_bone = yoffs(b-1) + root(b) + bonemat(b).
Definition at line 2025 of file armature.cc.
References BLI_assert, Bone::bone_mat, copy_m4_m3(), copy_v3_v3(), Bone::head, Bone::length, and Bone::parent.
Referenced by applyarmature_process_selected_recursive(), BKE_armature_where_is_bone(), and BKE_bone_parent_transform_calc_from_pchan().
| void BKE_bone_parent_transform_apply | ( | const BoneParentTransform * | bpt, |
| const float | inmat[4][4], | ||
| float | outmat[4][4] ) |
Definition at line 2236 of file armature.cc.
References copy_v3_v3(), BoneParentTransform::loc_mat, mul_m4_m4m4(), mul_v3_m4v3(), BoneParentTransform::post_scale, rescale_m4(), and BoneParentTransform::rotscale_mat.
Referenced by applyarmature_process_selected_recursive(), BKE_armature_mat_bone_to_pose(), and BKE_armature_mat_pose_to_bone().
| 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 ) |
Compute the parent transform using data decoupled from specific data structures.
| bone_flag | Bone.flag containing settings. |
| offs_bone | delta from parent to current arm_mat (or just arm_mat if no parent). |
| parent_arm_mat | arm_mat of parent, or NULL. |
| parent_pose_mat | pose_mat of parent, or NULL. |
| r_bpt | OUTPUT parent transform. |
Definition at line 2068 of file armature.cc.
References BLI_assert_unreachable, BONE_HINGE, BONE_INHERIT_SCALE_ALIGNED, BONE_INHERIT_SCALE_AVERAGE, BONE_INHERIT_SCALE_FIX_SHEAR, BONE_INHERIT_SCALE_FULL, BONE_INHERIT_SCALE_NONE, BONE_INHERIT_SCALE_NONE_LEGACY, BONE_NO_LOCAL_LOCATION, copy_m3_m4(), copy_m4_m3(), copy_m4_m4(), copy_v3_fl(), copy_v3_v3(), fabsf, BoneParentTransform::loc_mat, mat4_to_size(), mat4_to_size_fix_shear(), mat4_to_volume_scale(), mul_m3_m3m3(), mul_m4_m4m4(), mul_mat3_m4_fl(), mul_v3_m4v3(), normalize_m4(), normalize_m4_ex(), orthogonalize_m4_stable(), BoneParentTransform::post_scale, rescale_m4(), BoneParentTransform::rotscale_mat, unit_m3(), and unit_m4().
Referenced by applyarmature_process_selected_recursive(), and BKE_bone_parent_transform_calc_from_pchan().
| void BKE_bone_parent_transform_calc_from_pchan | ( | const bPoseChannel * | pchan, |
| BoneParentTransform * | r_bpt ) |
Get the current parent transformation for the given pose bone.
Construct the matrices (rot/scale and loc) to apply the PoseChannels into the armature (object) space. I.e. (roughly) the pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) in the pose_mat(b)= pose_mat(b-1) * yoffs(b-1) * d_root(b) * bone_mat(b) * chan_mat(b) ...function.
This allows to get the transformations of a bone in its object space, before constraints (and IK) get applied (used by pose evaluation code). And reverse: to find pchan transformations needed to place a bone at a given loc/rot/scale in object space (used by interactive transform, and snapping code).
Note that, with the HINGE/NO_SCALE/NO_LOCAL_LOCATION options, the location matrix will differ from the rotation/scale matrix...
Definition at line 2039 of file armature.cc.
References Bone::arm_mat, BKE_bone_offset_matrix_get(), BKE_bone_parent_transform_calc_from_matrices(), bPoseChannel::bone, Bone::flag, Bone::inherit_scale_mode, Bone::parent, bPoseChannel::parent, and bPoseChannel::pose_mat.
Referenced by add_pose_transdata(), BKE_armature_mat_bone_to_pose(), and BKE_armature_mat_pose_to_bone().
| void BKE_bone_parent_transform_clear | ( | BoneParentTransform * | bpt | ) |
Definition at line 2213 of file armature.cc.
References copy_v3_fl(), BoneParentTransform::loc_mat, BoneParentTransform::post_scale, BoneParentTransform::rotscale_mat, and unit_m4().
Referenced by applyarmature_process_selected_recursive().
| void BKE_bone_parent_transform_combine | ( | const BoneParentTransform * | in1, |
| const BoneParentTransform * | in2, | ||
| BoneParentTransform * | result ) |
Definition at line 2227 of file armature.cc.
References BoneParentTransform::loc_mat, mul_m4_m4m4(), mul_v3_v3v3(), BoneParentTransform::post_scale, and BoneParentTransform::rotscale_mat.
Referenced by applyarmature_process_selected_recursive().
| void BKE_bone_parent_transform_invert | ( | BoneParentTransform * | bpt | ) |
Definition at line 2220 of file armature.cc.
References invert_m4(), invert_v3_safe(), BoneParentTransform::loc_mat, BoneParentTransform::post_scale, and BoneParentTransform::rotscale_mat.
Referenced by applyarmature_process_selected_recursive(), and BKE_armature_mat_pose_to_bone().
| void BKE_pchan_apply_mat4 | ( | bPoseChannel * | pchan, |
| const float | mat[4][4], | ||
| bool | use_compat ) |
Apply a 4x4 matrix to the pose bone, similar to BKE_object_apply_mat4().
Definition at line 2358 of file armature.cc.
References BKE_pchan_mat3_to_rot(), bPoseChannel::loc, mat4_to_loc_rot_size(), rot, and bPoseChannel::size.
Referenced by action_flip_pchan(), BKE_armature_mat_pose_to_bone_ex(), BKE_constraint_apply_for_pose(), pose_transform_mirror_update(), and pose_visual_transform_apply_exec().
| void BKE_pchan_bbone_deform_clamp_segment_index | ( | const bPoseChannel * | pchan, |
| float | head_tail, | ||
| int * | r_index, | ||
| float * | r_blend_next ) |
Calculate index and blend factor for the two B-Bone segment nodes affecting the specified point along the bone.
| pchan | Pose channel. |
| head_tail | head-tail position along the bone (auto-clamped between 0 and 1). |
| r_index | OUTPUT index of the first segment joint affecting the point. |
| r_blend_next | OUTPUT blend factor between the first and the second segment in [0..1] |
Definition at line 1800 of file armature.cc.
References blend, bPoseChannel::bone, CLAMP, float, floorf, int, and Bone::segments.
Referenced by constraint_target_to_mat4(), find_bbone_segment_index_curved(), and find_bbone_segment_index_straight().
| void BKE_pchan_bbone_deform_segment_index | ( | const bPoseChannel * | pchan, |
| const float * | co, | ||
| int * | r_index, | ||
| float * | r_blend_next ) |
Calculate index and blend factor for the two B-Bone segment nodes affecting the specified point in object (pose) space.
| pchan | Pose channel. |
| co | Pose space coordinates of the point being deformed. |
| r_index | OUTPUT index of the first segment joint affecting the point. |
| r_blend_next | OUTPUT blend factor between the first and the second segment in [0..1] |
Definition at line 1970 of file armature.cc.
References bPoseChannel_Runtime::bbone_segment_boundaries, find_bbone_segment_index_curved(), find_bbone_segment_index_straight(), and bPoseChannel::runtime.
Referenced by armdef_accumulate_bone(), and b_bone_deform().
| 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 ) |
Computes the bezier handle vectors and rolls coming from custom handles.
Definition at line 1346 of file armature.cc.
References copy_m3_m4(), copy_v3_fl3(), copy_v3_v3(), cubic_tangent_factor_circle_v3(), BBoneSplineParameters::curve_in_x, BBoneSplineParameters::curve_in_z, BBoneSplineParameters::curve_out_x, BBoneSplineParameters::curve_out_z, BBoneSplineParameters::do_scale, e, BBoneSplineParameters::ease1, BBoneSplineParameters::ease2, BBoneSplineParameters::length, length(), mat3_vec_to_roll(), mul_v3_fl(), negate_v3(), BBoneSplineParameters::next_bbone, BBoneSplineParameters::next_h, BBoneSplineParameters::next_mat, normalize_v3(), BBoneSplineParameters::prev_bbone, BBoneSplineParameters::prev_h, BBoneSplineParameters::prev_mat, BBoneSplineParameters::roll1, BBoneSplineParameters::roll2, BBoneSplineParameters::scale, BBoneSplineParameters::use_next, and BBoneSplineParameters::use_prev.
Referenced by BKE_pchan_bbone_spline_compute().
| void BKE_pchan_bbone_handles_get | ( | bPoseChannel * | pchan, |
| bPoseChannel ** | r_prev, | ||
| bPoseChannel ** | r_next ) |
Get "next" and "prev" bones - these are used for handle calculations.
Definition at line 1061 of file armature.cc.
References BBONE_HANDLE_AUTO, bPoseChannel::bbone_next, Bone::bbone_next_type, bPoseChannel::bbone_prev, Bone::bbone_prev_type, bPoseChannel::bone, BONE_CONNECTED, bPoseChannel::child, Bone::flag, and bPoseChannel::parent.
Referenced by BKE_pchan_bbone_spline_params_get(), and blender::deg::DepsgraphRelationBuilder::build_rig().
| void BKE_pchan_bbone_segments_cache_compute | ( | bPoseChannel * | pchan | ) |
Compute and cache the B-Bone shape in the channel runtime struct.
Definition at line 1705 of file armature.cc.
References allocate_bbone_cache(), Bone::arm_mat, bPoseChannel_Runtime::bbone_deform_mats, bPoseChannel_Runtime::bbone_dual_quats, BBONE_MAPPING_CURVED, Bone::bbone_mapping_mode, bPoseChannel_Runtime::bbone_pose_mats, bPoseChannel_Runtime::bbone_rest_mats, bPoseChannel_Runtime::bbone_segment_boundaries, BKE_pchan_bbone_spline_setup(), BLI_assert, bPoseChannel::bone, bPoseChannel::chan_mat, compute_bbone_segment_boundaries(), invert_m4_m4(), Mat4::mat, mat4_to_dquat(), mul_m4_m4m4(), mul_m4_series, normalize_m4(), bPoseChannel::runtime, and Bone::segments.
Referenced by BKE_pose_eval_bbone_segments().
| void BKE_pchan_bbone_segments_cache_copy | ( | bPoseChannel * | pchan, |
| bPoseChannel * | pchan_from ) |
Copy cached B-Bone segments from one channel to another.
Definition at line 1764 of file armature.cc.
References allocate_bbone_cache(), bPoseChannel_Runtime::bbone_arc_length_reciprocal, bPoseChannel_Runtime::bbone_deform_mats, bPoseChannel_Runtime::bbone_dual_quats, bPoseChannel_Runtime::bbone_pose_mats, bPoseChannel_Runtime::bbone_rest_mats, bPoseChannel_Runtime::bbone_segment_boundaries, bPoseChannel_Runtime::bbone_segments, BKE_pose_channel_free_bbone_cache(), BLI_assert, and bPoseChannel::runtime.
Referenced by BKE_pose_eval_bbone_segments().
| int BKE_pchan_bbone_spline_compute | ( | BBoneSplineParameters * | param, |
| bool | for_deform, | ||
| Mat4 * | result_array ) |
Fills the array with the desired amount of bone->segments elements. This calculation is done within unit bone space.
Definition at line 1506 of file armature.cc.
References add_v3_v3v3(), BKE_pchan_bbone_handles_compute(), CLAMP_MAX, CLAMP_MIN, copy_v3_fl3(), copy_v3_v3(), BBoneSplineParameters::do_scale, ease_handle_axis(), equalize_cubic_bezier(), evaluate_cubic_bezier(), expf, float, interpf(), invert_m4_m4(), BBoneSplineParameters::length, logf, make_bbone_spline_matrix(), Mat4::mat, MAX_BBONE_SUBDIV, negate_v3(), BBoneSplineParameters::scale, BBoneSplineParameters::scale_in, BBoneSplineParameters::scale_out, BBoneSplineParameters::segments, size_to_mat4(), sub_v3_v3v3(), and zero_v3().
Referenced by BKE_pchan_bbone_spline_setup(), and ebone_spline_preview().
| void BKE_pchan_bbone_spline_params_get | ( | bPoseChannel * | pchan, |
| bool | rest, | ||
| BBoneSplineParameters * | param ) |
Compute B-Bone spline parameters for the given channel.
Definition at line 1087 of file armature.cc.
References add_v3_v3v3(), Bone::arm_head, Bone::arm_mat, Bone::arm_tail, BBONE_ADD_PARENT_END_ROLL, Bone::bbone_flag, BBONE_HANDLE_RELATIVE, BBONE_HANDLE_SCALE_ANY, BBONE_HANDLE_SCALE_EASE, BBONE_HANDLE_SCALE_X, BBONE_HANDLE_SCALE_Y, BBONE_HANDLE_SCALE_Z, BBONE_HANDLE_TANGENT, Bone::bbone_next_flag, Bone::bbone_next_type, Bone::bbone_prev_flag, Bone::bbone_prev_type, BBONE_SCALE_EASING, BKE_armature_mat_pose_to_bone(), BKE_pchan_bbone_handles_get(), bPoseChannel::bone, copy_m4_m4(), copy_v3_fl(), copy_v3_fl3(), copy_v3_v3(), BBoneSplineParameters::curve_in_x, Bone::curve_in_x, bPoseChannel::curve_in_x, BBoneSplineParameters::curve_in_z, Bone::curve_in_z, bPoseChannel::curve_in_z, BBoneSplineParameters::curve_out_x, Bone::curve_out_x, bPoseChannel::curve_out_x, BBoneSplineParameters::curve_out_z, Bone::curve_out_z, bPoseChannel::curve_out_z, BBoneSplineParameters::do_scale, BBoneSplineParameters::ease1, Bone::ease1, bPoseChannel::ease1, BBoneSplineParameters::ease2, Bone::ease2, bPoseChannel::ease2, fabsf, invert_m4_m4(), BBoneSplineParameters::length, Bone::length, mat4_to_size(), mul_m4_m4m4(), mul_v3_m4v3(), mul_v3_v3(), 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, Bone::roll1, bPoseChannel::roll1, BBoneSplineParameters::roll2, Bone::roll2, bPoseChannel::roll2, BBoneSplineParameters::scale, BBoneSplineParameters::scale_in, Bone::scale_in, bPoseChannel::scale_in, BBoneSplineParameters::scale_out, Bone::scale_out, bPoseChannel::scale_out, BBoneSplineParameters::segments, Bone::segments, sub_v3_v3v3(), BBoneSplineParameters::use_next, BBoneSplineParameters::use_prev, and zero_v3().
Referenced by BKE_pchan_bbone_spline_setup().
| void BKE_pchan_bbone_spline_setup | ( | bPoseChannel * | pchan, |
| bool | rest, | ||
| bool | for_deform, | ||
| Mat4 * | result_array ) |
Fills the array with the desired amount of bone->segments elements. This calculation is done within unit bone space.
Definition at line 1334 of file armature.cc.
References BKE_pchan_bbone_spline_compute(), BKE_pchan_bbone_spline_params_get(), bPoseChannel::bone, and Bone::segments.
Referenced by add_verts_to_dgroups(), BKE_pchan_bbone_segments_cache_compute(), and draw_bone_update_disp_matrix_bbone().
| void BKE_pchan_calc_mat | ( | bPoseChannel * | pchan | ) |
Convert the loc/rot/size to mat4 (pchan.chan_mat), used in constraint.cc too.
Definition at line 2860 of file armature.cc.
References BKE_pchan_to_mat4(), and bPoseChannel::chan_mat.
Referenced by actcon_get_tarmat(), and BKE_pose_where_is_bone().
| void BKE_pchan_mat3_to_rot | ( | bPoseChannel * | pchan, |
| const float | mat[3][3], | ||
| bool | use_compat ) |
Same as BKE_object_mat3_to_rot().
Definition at line 2312 of file armature.cc.
References BLI_ASSERT_UNIT_M3, bPoseChannel::eul, mat3_normalized_to_axis_angle(), mat3_normalized_to_compatible_eulO(), mat3_normalized_to_eulO(), mat3_normalized_to_quat(), bPoseChannel::quat, ROT_MODE_AXISANGLE, ROT_MODE_QUAT, bPoseChannel::rotAngle, bPoseChannel::rotAxis, and bPoseChannel::rotmode.
Referenced by apply_targetless_ik(), and BKE_pchan_apply_mat4().
| void BKE_pchan_minmax | ( | const Object * | ob, |
| const bPoseChannel * | pchan, | ||
| const bool | use_empty_drawtype, | ||
| float | r_min[3], | ||
| float | r_max[3] ) |
Calculate the axis-aligned bounds of pchan in world-space, taking into account custom transform when set.
r_min and r_max are expanded to fit pchan so the caller must initialize them (typically using INIT_MINMAX).
| use_empty_drawtype | When enabled, the draw type of empty custom-objects is taken into account when calculating the bounds. |
Definition at line 3040 of file armature.cc.
References ARM_NO_CUSTOM, BKE_boundbox_init_from_minmax(), BKE_boundbox_minmax(), BKE_object_boundbox_get(), BKE_object_minmax_empty_drawtype(), copy_m4_m4(), bPoseChannel::custom, bPoseChannel::custom_rotation_euler, bPoseChannel::custom_scale_xyz, bPoseChannel::custom_translation, bPoseChannel::custom_tx, Object::data, eulO_to_mat4(), bArmature::flag, max, BoundBox::min, min, minmax_v3v3_v3(), mul_m4_series, mul_v3_m4v3(), OB_EMPTY, PCHAN_CUSTOM_BONE_LENGTH, bPoseChannel::pose_head, bPoseChannel::pose_mat, bPoseChannel::pose_tail, rescale_m4(), ROT_MODE_XYZ, scale_m4_fl(), translate_m4(), and Object::type.
Referenced by BKE_pose_minmax(), and pchan_culling_calc_bsphere().
| void BKE_pchan_rebuild_bbone_handles | ( | bPose * | pose, |
| bPoseChannel * | pchan ) |
Update the links for the B-Bone handles from Bone data.
Definition at line 2750 of file armature.cc.
References Bone::bbone_next, bPoseChannel::bbone_next, Bone::bbone_prev, bPoseChannel::bbone_prev, bPoseChannel::bone, and pose_channel_find_bone().
Referenced by BKE_pose_rebuild().
| void BKE_pchan_rot_to_mat3 | ( | const bPoseChannel * | pchan, |
| float | r_mat[3][3] ) |
Same as BKE_object_rot_to_mat3().
Definition at line 2334 of file armature.cc.
References axis_angle_to_mat3(), bPoseChannel::eul, eulO_to_mat3(), normalize_qt_qt(), bPoseChannel::quat, quat_to_mat3(), ROT_MODE_AXISANGLE, bPoseChannel::rotAngle, bPoseChannel::rotAxis, and bPoseChannel::rotmode.
Referenced by apply_targetless_ik(), and BKE_pchan_to_mat4().
| void BKE_pchan_to_mat4 | ( | const bPoseChannel * | pchan, |
| float | r_chanmat[4][4] ) |
Convert the loc/rot/size to r_chanmat (typically bPoseChannel.chan_mat).
Definition at line 2837 of file armature.cc.
References BKE_pchan_rot_to_mat3(), bPoseChannel::bone, BONE_CONNECTED, copy_m4_m3(), copy_v3_v3(), Bone::flag, bPoseChannel::loc, mul_m3_m3m3(), bPoseChannel::size, and size_to_mat3().
Referenced by action_flip_pchan(), BKE_pchan_calc_mat(), dvar_eval_transChan(), pose_mirror_info_init(), and pose_transform_mirror_update().
| void BKE_pose_channels_clear_with_null_bone | ( | bPose * | pose, |
| const bool | do_id_user ) |
Definition at line 2756 of file armature.cc.
References BKE_pose_channel_free_ex(), BKE_pose_channels_hash_free(), BLI_freelinkN(), bPose::chanbase, and LISTBASE_FOREACH_MUTABLE.
Referenced by BKE_pose_rebuild(), and blender::ed::object::editmode_load_free_ex().
| 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 2729 of file armature.cc.
References bPose::chanbase, and LISTBASE_FOREACH.
Referenced by BKE_lib_override_library_update(), BKE_pose_rebuild(), and libblock_remap_data_preprocess_ob().
Ensures object's pose is rebuilt if needed.
| bmain | May be NULL, only used to tag depsgraph as being dirty. |
Definition at line 2822 of file armature.cc.
References BKE_pose_rebuild(), BLI_assert, ELEM, bPose::flag, GS, bArmature::id, ID_AR, ID::name, OB_ARMATURE, Object::pose, POSE_RECALC, and Object::type.
Referenced by BKE_lib_override_library_main_operations_create(), BKE_lib_override_library_status_check_local(), BKE_lib_override_library_status_check_reference(), BKE_pose_where_is(), lib_override_library_operations_create(), RNA_struct_override_matches(), blender::animrig::tests::KeyframingTest::SetUp(), and version_bonegroup_migrate_color().
| std::optional< blender::Bounds< blender::float3 > > BKE_pose_minmax | ( | const Object * | ob, |
| bool | use_select ) |
Calculate the axis aligned bounds of the pose of ob in world-space.
This only considers visible bones. When they are either directly (via a flag on the bone) or indirectly (via bone collections) hidden, they are not part of the bounds calculation. When a bone has a custom bone shape, that is included in the bounding box.
| use_select | When true, only consider selected bones. When false, selection state is ignored and all bones are included in the bounds. |
Definition at line 3088 of file armature.cc.
References BKE_pchan_minmax(), BLI_assert, BONE_SELECTED, bPose::chanbase, Object::data, LISTBASE_FOREACH, max, min, OB_ARMATURE, PBONE_VISIBLE, Object::pose, and Object::type.
Referenced by BKE_armature_min_max(), and viewselected_exec().
Only after leave edit-mode, duplicating, validating older files, library syncing.
| bmain | May be NULL, only used to tag depsgraph as being dirty. |
Definition at line 2767 of file armature.cc.
References animviz_settings_init(), bPose::avs, BKE_pchan_rebuild_bbone_handles(), BKE_pose_channels_clear_with_null_bone(), BKE_pose_channels_hash_ensure(), BKE_pose_clear_pointers(), BKE_pose_update_constraint_flags(), BLI_findindex(), bArmature::bonebase, bPose::chanbase, DEG_relations_tag_update(), bPose::flag, LISTBASE_FOREACH, MEM_callocN, Object::pose, POSE_WAS_REBUILT, and rebuild_pose_bone().
Referenced by BKE_library_make_local(), BKE_object_handle_update_ex(), BKE_pose_ensure(), blender::deg::DepsgraphNodeBuilder::build_rig(), do_versions_after_linking_290(), ED_armature_from_edit(), blender::ed::object::make_links_data_exec(), object_copy_data(), and blender::ed::object::single_obdata_users().
Definition at line 2737 of file armature.cc.
References BKE_armature_find_bone_name(), bPose::chanbase, and LISTBASE_FOREACH.
Definition at line 2941 of file armature.cc.
References Bone::arm_head, Bone::arm_mat, ARM_RESTPOS, Bone::arm_tail, BIK_execute_tree(), BIK_init_tree(), BIK_release_tree(), BKE_pose_ensure(), BKE_pose_splineik_init_tree(), BKE_pose_where_is_bone(), BKE_scene_ctime_get(), BKE_splineik_execute_tree(), bPose::chanbase, copy_m4_m4(), copy_v3_v3(), Object::data, depsgraph, bArmature::edbo, ELEM, bArmature::flag, invert_m4_m4(), LISTBASE_FOREACH, mul_m4_m4m4(), OB_ARMATURE, Object::pose, POSE_CHAIN, POSE_DONE, POSE_IKSPLINE, POSE_IKTREE, Object::runtime, and Object::type.
Referenced by apply_armature_pose2bones_exec(), blender::ed::object::apply_objects_internal(), BKE_object_handle_data_update(), BKE_object_modifier_update_subframe(), blender::ed::object::object_origin_set_exec(), and special_aftertrans_update__pose().
| void BKE_pose_where_is_bone | ( | Depsgraph * | depsgraph, |
| Scene * | scene, | ||
| Object * | ob, | ||
| bPoseChannel * | pchan, | ||
| float | ctime, | ||
| bool | do_extra ) |
The main armature solver, does all constraints excluding IK.
| pchan | pose-channel - validated, as having bone and parent pointer. |
| do_extra | when zero skips loc/size/rot, constraints and strip modifiers. |
Definition at line 2877 of file armature.cc.
References add_v3_v3(), BKE_armature_mat_bone_to_pose(), BKE_constraints_clear_evalob(), BKE_constraints_make_evalob(), BKE_constraints_solve(), BKE_pchan_calc_mat(), BKE_pose_where_is_bone_tail(), bPoseChannel::bone, BONE_CONNECTED, BONE_NO_CYCLICOFFSET, bPoseChannel::chan_mat, CONSTRAINT_OBTYPE_BONE, bPoseChannel::constraints, copy_v3_v3(), bPose::cyclic_offset, depsgraph, ListBase::first, Bone::flag, bPoseChannel::parent, Object::pose, bPoseChannel::pose_head, bPoseChannel::pose_mat, and unit_m4().
Referenced by BKE_armature_mat_pose_to_bone_ex(), BKE_pose_constraints_evaluate(), BKE_pose_eval_bone(), BKE_pose_where_is(), convert_channels(), execute_scene(), iksolver_execute_tree(), and splineik_execute_tree().
| void BKE_pose_where_is_bone_tail | ( | bPoseChannel * | pchan | ) |
Calculate tail of pose-channel.
Definition at line 2868 of file armature.cc.
References add_v3_v3v3(), bPoseChannel::bone, copy_v3_v3(), Bone::length, mul_v3_fl(), bPoseChannel::pose_head, bPoseChannel::pose_mat, and bPoseChannel::pose_tail.
Referenced by BKE_pose_where_is_bone(), and splineik_evaluate_bone().
| void BKE_rotMode_change_values | ( | float | quat[4], |
| float | eul[3], | ||
| float | axis[3], | ||
| float * | angle, | ||
| short | oldMode, | ||
| short | newMode ) |
Rotation Mode Conversions - Used for Pose-Channels + Objects.
Called from RNA when rotation mode changes
Definition at line 2383 of file armature.cc.
References axis_angle_to_eulO(), axis_angle_to_quat(), eulO_to_axis_angle(), eulO_to_quat(), IS_EQF, normalize_qt(), quat_to_axis_angle(), quat_to_eulO(), ROT_MODE_AXISANGLE, and ROT_MODE_QUAT.
Referenced by pose_bone_rotmode_exec().
Definition at line 852 of file armature.cc.
References BLI_snprintf(), ELEM, IS_EQF, len, MAXBONENAME, and STRNCPY.
|
static |
Computes the B-Bone segment boundary planes for the curved mapping.
Definition at line 1654 of file armature.cc.
References arc_length(), Bone::arm_mat, bPoseChannel_Runtime::bbone_arc_length_reciprocal, bPoseChannel_Runtime::bbone_rest_mats, bPoseChannel_Runtime::bbone_segment_boundaries, BLI_assert, bPoseChannel::bone, ceilf, dot_v3v3(), int, len_v3v3(), Mat4::mat, max_ff(), mul_v3_m4v3(), mul_v3_mat3_m4v3(), normalize_v3(), powf, bPoseChannel::runtime, and Bone::segments.
Referenced by BKE_pchan_bbone_segments_cache_compute().
|
static |
Copies the bone collection in bcoll_src to bcoll_dst, re-hooking up all of the bone relationships to the bones in armature_dst.
armature_copy_data() below. You probably don't want to use this otherwise.| lib_id_flag | Copying options (see BKE_lib_id.hh's LIB_ID_COPY_... flags for more). |
Definition at line 106 of file armature.cc.
References BKE_armature_find_bone_name(), BLI_duplicatelist(), BoneCollection::bones, IDP_CopyProperty_ex(), LISTBASE_FOREACH, MEM_dupallocN, and BoneCollection::prop.
Referenced by armature_copy_data().
Definition at line 623 of file armature.cc.
References Bone::arm_head, Bone::arm_mat, Bone::arm_roll, Bone::arm_tail, Bone::bone_mat, copy_m3_m3(), copy_m4_m4(), copy_v3_v3(), Bone::head, Bone::roll, and Bone::tail.
Referenced by BKE_armature_copy_bone_transforms().
|
static |
Definition at line 564 of file armature.cc.
References BLI_duplicatelist(), BLI_listbase_clear(), Bone::childbase, Bone_Runtime::collections, copy_bonechildren(), ListBase::first, flag, IDP_CopyProperty_ex(), Bone::next, Bone::parent, Bone::prop, and Bone::runtime.
Referenced by armature_copy_data(), and copy_bonechildren().
Definition at line 599 of file armature.cc.
References Bone::bbone_next, Bone::bbone_prev, BKE_armature_find_bone_name(), Bone::childbase, copy_bonechildren_custom_handles(), ListBase::first, Bone::name, and Bone::next.
Referenced by armature_copy_data(), and copy_bonechildren_custom_handles().
|
static |
Definition at line 381 of file armature.cc.
References BLO_read_struct, BLO_read_struct_list, BoneCollection::bones, IDP_BlendDataRead, LISTBASE_FOREACH, and BoneCollection::prop.
Referenced by read_bone_collections().
|
static |
Definition at line 361 of file armature.cc.
References Bone::bbone_next, Bone::bbone_prev, BLO_read_struct, BLO_read_struct_list, BONE_DRAW_ACTIVE, BONE_DRAW_LOCKED_WEIGHT, Bone::childbase, direct_link_bones(), Bone::flag, IDP_BlendDataRead, LISTBASE_FOREACH, Bone::parent, Bone::prop, and Bone::runtime.
Referenced by armature_blend_read_data(), and direct_link_bones().
|
static |
Definition at line 1489 of file armature.cc.
References copy_v3_v3(), len_squared_v3(), madd_v3_v3fl(), sqrtf, and UNLIKELY.
Referenced by BKE_pchan_bbone_spline_compute().
|
static |
Definition at line 986 of file armature.cc.
References BKE_curve_forward_diff_bezier(), BLI_array_alloca, float, len_v3v3(), and sum().
Referenced by BKE_pchan_bbone_spline_compute().
|
static |
Definition at line 1043 of file armature.cc.
References interp_v3_v3v3(), madd_v3_v3v3fl(), and sub_v3_v3v3().
Referenced by BKE_pchan_bbone_spline_compute().
|
static |
Implementation of the Curved B-Bone segment mapping.
Definition at line 1850 of file armature.cc.
References bPoseChannel_Runtime::bbone_arc_length_reciprocal, bPoseChannel_Runtime::bbone_segment_boundaries, bbone_segment_bsp_signed_distance(), bPoseChannel_Runtime::bbone_segments, BKE_pchan_bbone_deform_clamp_segment_index(), BLI_assert, fabsf, interpf(), MAX_BBONE_SUBDIV, and bPoseChannel::runtime.
Referenced by BKE_pchan_bbone_deform_segment_index().
|
static |
Implementation of the Straight B-Bone segment mapping.
Definition at line 1826 of file armature.cc.
References bPoseChannel_Runtime::bbone_deform_mats, BKE_pchan_bbone_deform_clamp_segment_index(), bPoseChannel::bone, float, Bone::length, Mat4::mat, and bPoseChannel::runtime.
Referenced by BKE_pchan_bbone_deform_segment_index().
Definition at line 763 of file armature.cc.
References get_named_bone_bonechildren(), LISTBASE_FOREACH, and STREQ.
Referenced by BKE_armature_find_bone_name(), and get_named_bone_bonechildren().
|
static |
Definition at line 1462 of file armature.cc.
References copy_m4_m3(), copy_v3_v3(), BBoneSplineParameters::do_scale, mul_m4_series, mul_v3_fl(), pos, and vec_roll_to_mat3().
Referenced by BKE_pchan_bbone_spline_compute().
Computes vector and roll based on a rotation. "mat" must contain only a rotation, and no scaling.
Definition at line 2456 of file armature.cc.
References copy_v3_v3(), and mat3_vec_to_roll().
Referenced by armature_transform_recurse(), correct_bone_roll_value(), do_version_bone_roll_256(), ED_armature_ebone_from_mat3(), and ED_armature_edit_transform().
Computes roll around the vector that best approximates the matrix. If vec is the Y vector from purely rotational mat, result should be exact.
Definition at line 2467 of file armature.cc.
References invert_m3_m3(), mat3_to_quat(), mul_m3_m3m3(), quat_split_swing_and_twist(), and vec_roll_to_mat3().
Referenced by applyarmature_set_edit_position(), BKE_pchan_bbone_handles_compute(), mat3_to_vec_roll(), blender::bke::tests::TEST(), and blender::bke::tests::TEST().
|
static |
Find the matching pose channel using the bone name, if not nullptr.
Definition at line 2745 of file armature.cc.
References BKE_pose_channel_find_name(), and Bone::name.
Referenced by BKE_pchan_rebuild_bbone_handles().
|
static |
Definition at line 392 of file armature.cc.
References BLI_listbase_clear(), BLI_listbase_count(), BLO_read_struct_list, bArmature::collection_array, bArmature::collection_array_num, bArmature::collection_root_count, bArmature::collections_legacy, direct_link_bone_collection(), bArmature::id, ID_IS_LINKED, LISTBASE_FOREACH_INDEX, MEM_malloc_arrayN, min_ii(), BoneCollection::next, and BoneCollection::prev.
Referenced by armature_blend_read_data().
|
static |
| r_last_visited_bone_p | The last bone handled by the last call to this function. |
Definition at line 2680 of file armature.cc.
References ThemeWireColor::active, BKE_pose_channel_ensure(), BKE_pose_channel_find_name(), BLI_insertlinkafter(), BLI_remlink(), bPoseChannel::bone, BONE_CONNECTED, bPose::chanbase, bPoseChannel::child, Bone::childbase, bPoseChannel::color, BoneColor::custom, ListBase::first, Bone::flag, Bone::name, Bone::next, bPoseChannel::parent, bPoseChannel::prev, rebuild_pose_bone(), ThemeWireColor::select, and ThemeWireColor::solid.
Referenced by BKE_pose_rebuild(), and rebuild_pose_bone().
Definition at line 2611 of file armature.cc.
References nor, normalize_v3_v3(), and vec_roll_to_mat3_normalized().
Referenced by applyarmature_adjust_edit_position(), applyarmature_set_edit_position(), armature_transform_recurse(), BKE_armature_where_is_bone(), correct_bone_roll_value(), make_bbone_spline_matrix(), and mat3_vec_to_roll().
Calculates the rest matrix of a bone based on its vector and a roll around that vector.
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).
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 use a different approach based on x and z as inputs. 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 second order: y = -sqrt(1 - (x^2 + z^2)) = -1 + (x^2 + z^2) / 2 + (x^2 + z^2)^2 / 8, which allows eliminating the problematic 1 constant.
A first order expansion allows simplifying to this, but second order is more precise:
┌ z^2 - x^2, -2 * x * z ┐
M* = 1 / (x^2 + z^2) * │ │
└ -2 * x * z, x^2 - z^2 ┘
P.S. In the end, this basically is a heavily optimized version of Damped Track +Y.
Definition at line 2482 of file armature.cc.
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::find_flip_boundary(), blender::bke::tests::test_vec_roll_to_mat3_normalized(), and vec_roll_to_mat3().
|
static |
Definition at line 275 of file armature.cc.
References BLO_write_struct, Bone::childbase, IDP_BlendWrite(), LISTBASE_FOREACH, Bone::prop, Bone::runtime, Bone::size, and write_bone().
Referenced by armature_blend_write(), and write_bone().
|
static |
Definition at line 298 of file armature.cc.
References BLO_write_struct, BLO_write_struct_list, BoneCollection::bones, IDP_BlendWrite(), and BoneCollection::prop.
Referenced by armature_blend_write().
| IDTypeInfo IDType_ID_AR |
Definition at line 477 of file armature.cc.