105 const float pose_mat[4][4],
106 const float new_tail[3],
107 float r_new_arm_mat[4][4])
118 float premat[3][3], pmat[3][3];
174 pchan->
size[0] = pchan->
size[1] = pchan->
size[2] = 1.0f;
180 const float delta_mat[4][4],
181 float r_new_arm_mat[4][4])
184 float delta[3], new_tail[3], premat[3][3], new_pose[4][4];
219 if (!pchan || !pchan_eval) {
239 float offs_bone[4][4];
276 pstate = &new_pstate;
289 float offs_bone[4][4], delta[4][4], old_chan_loc[3];
315 float inv_parent_arm[4][4];
332 pstate = &new_pstate;
346 switch (constraint->
type) {
373 if (use_selected && (pchan->bone->flag &
BONE_SELECTED) == 0) {
410 "Actions on this armature will be destroyed by this new rest pose as the "
411 "transforms stored are relative to the old rest pose");
418 if (!selected_bones.
first) {
433 arm, pose, ob_eval->
pose, bone, &selected_bones,
NULL);
482 ot->
name =
"Apply Pose as Rest Pose";
483 ot->
idname =
"POSE_OT_armature_apply";
484 ot->
description =
"Apply the current pose as the new rest pose";
498 "Only apply the selected bones (with propagation to children)");
526 } *pchan_xform_array =
MEM_mallocN(
sizeof(*pchan_xform_array) * chanbase_len, __func__);
527 bool changed =
false;
532 pchan_xform_array[i].is_set =
false;
546 pchan_xform_array[i].is_set =
true;
553 if (!pchan_xform_array[i].is_set) {
575 ot->
name =
"Apply Visual Transform to Pose";
576 ot->
idname =
"POSE_OT_visual_transform_apply";
577 ot->
description =
"Apply final constrained position of pose bones to their transform";
798 ob_copy.
data = &arm_copy;
826 ot->
description =
"Copies the current pose of the selected bones to copy/paste buffer";
878 if (pose_from ==
NULL) {
930 ot->
description =
"Paste the stored pose on to the current pose";
944 "Paste the stored pose flipped on to current pose");
951 "Only paste the stored pose on to selected bones in the current pose");
964 pchan->
size[0] = 1.0f;
967 pchan->
size[1] = 1.0f;
970 pchan->
size[2] = 1.0f;
984 if (pchan_mirror !=
NULL) {
995 pchan->
loc[0] = 0.0f;
998 pchan->
loc[1] = 0.0f;
1001 pchan->
loc[2] = 0.0f;
1010 if (pchan_mirror !=
NULL) {
1047 pchan->
quat[0] = 1.0f;
1050 pchan->
quat[1] = 0.0f;
1053 pchan->
quat[2] = 0.0f;
1056 pchan->
quat[3] = 0.0f;
1062 pchan->
eul[0] = 0.0f;
1065 pchan->
eul[1] = 0.0f;
1068 pchan->
eul[2] = 0.0f;
1074 float eul[3], oldeul[3], quat1[4] = {0};
1088 eul[0] = eul[1] = eul[2] = 0.0f;
1107 if ((quat1[0] < 0.0f && pchan->
quat[0] > 0.0f) ||
1108 (quat1[0] > 0.0f && pchan->
quat[0] < 0.0f)) {
1135 pchan->
roll1 = 0.0f;
1136 pchan->
roll2 = 0.0f;
1149 if (pchan_mirror !=
NULL) {
1170 const char default_ksName[])
1174 bool changed_multi =
false;
1177 if (
ELEM(
NULL, clear_func, default_ksName)) {
1180 "Programming error: missing clear transform function or keying set name");
1191 bool changed =
false;
1195 clear_func(ob_iter->pose, pchan);
1205 clear_func(ob_iter->pose, pchan_eval);
1212 changed_multi =
true;
1256 ot->
name =
"Clear Pose Scale";
1257 ot->
idname =
"POSE_OT_scale_clear";
1258 ot->
description =
"Reset scaling of selected bones to their default values";
1283 ot->
name =
"Clear Pose Rotation";
1285 ot->
description =
"Reset rotations of selected bones to their default values";
1310 ot->
name =
"Clear Pose Location";
1312 ot->
description =
"Reset locations of selected bones to their default values";
1337 ot->
name =
"Clear Pose Transforms";
1338 ot->
idname =
"POSE_OT_transforms_clear";
1340 "Reset location, rotation, and scaling of selected bones to their default values";
1367 if ((ob->adt) && (ob->adt->action)) {
1380 workob.
data = ob->data;
1381 workob.
adt = ob->adt;
1382 workob.
pose = dummyPose;
1420 ot->
name =
"Clear User Transforms";
1421 ot->
idname =
"POSE_OT_user_transforms_clear";
1422 ot->
description =
"Reset pose bone transforms to keyframed state";
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
struct bPoseChannel * BKE_pose_channel_find_name(const struct bPose *pose, const char *name)
struct bPoseChannel * BKE_pose_channel_get_mirrored(const struct bPose *pose, const char *name)
void BKE_pose_copy_data(struct bPose **dst, const struct bPose *src, const bool copy_constraints)
void BKE_pose_rest(struct bPose *pose, bool selected_bones_only)
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time)
void BKE_animsys_evaluate_animdata(struct ID *id, struct AnimData *adt, const struct AnimationEvalContext *anim_eval_context, eAnimData_Recalc recalc, const bool flush_to_original)
const char * BKE_tempdir_base(void)
void vec_roll_to_mat3(const float vec[3], const float roll, float r_mat[3][3])
struct bArmature * BKE_armature_from_object(struct Object *ob)
void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll)
void BKE_pchan_apply_mat4(struct bPoseChannel *pchan, const float mat[4][4], bool use_compat)
void BKE_bone_parent_transform_combine(const struct BoneParentTransform *in1, const struct BoneParentTransform *in2, struct BoneParentTransform *result)
void BKE_armature_mat_pose_to_bone(struct bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END
void BKE_bone_parent_transform_invert(struct BoneParentTransform *bpt)
void BKE_bone_offset_matrix_get(const struct Bone *bone, float offs_bone[4][4])
#define PBONE_VISIBLE(arm, bone)
void BKE_bone_parent_transform_clear(struct BoneParentTransform *bpt)
void BKE_pose_where_is(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob)
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)
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan)
void BKE_bone_parent_transform_apply(const struct BoneParentTransform *bpt, const float inmat[4][4], float outmat[4][4])
bool BKE_copybuffer_read(struct Main *bmain_dst, const char *libname, struct ReportList *reports, const uint64_t id_types_mask)
bool BKE_copybuffer_save(struct Main *bmain_src, const char *filename, struct ReportList *reports)
void BKE_copybuffer_begin(struct Main *bmain_src)
void BKE_copybuffer_tag_ID(struct ID *id)
struct Scene * CTX_data_scene(const bContext *C)
struct wmWindowManager * CTX_wm_manager(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
struct Object * CTX_data_active_object(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
#define CTX_DATA_COUNT(C, member)
int CTX_data_selected_pose_bones(const bContext *C, ListBase *list)
struct Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
struct Main * CTX_data_main(const bContext *C)
void IDP_FreeProperty(struct IDProperty *prop)
void IDP_SyncGroupValues(struct IDProperty *dest, const struct IDProperty *src) ATTR_NONNULL()
struct IDProperty * IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define FOREACH_OBJECT_IN_MODE_END
#define FOREACH_OBJECT_IN_MODE_BEGIN(_view_layer, _v3d, _object_type, _object_mode, _instance)
struct Main * BKE_main_new(void)
void BKE_main_free(struct Main *mainvar)
const char * BKE_main_blendfile_path_from_global(void)
General operations, lookup, etc. for blender objects.
bool BKE_object_obdata_is_libdata(const struct Object *ob)
struct Object * BKE_object_pose_armature_get(struct Object *ob)
void BKE_object_workob_calc_parent(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct Object *workob)
void BKE_object_apply_mat4(struct Object *ob, const float mat[4][4], const bool use_compat, const bool use_parent)
void BKE_report(ReportList *reports, ReportType type, const char *message)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE void BLI_listbase_clear(struct ListBase *lb)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
int BLI_listbase_count_at_most(const struct ListBase *listbase, const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(struct ListBase *listbase, void *vlink) ATTR_NONNULL(1)
int BLI_listbase_count(const struct ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void * BLI_findptr(const struct ListBase *listbase, const void *ptr, const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
bool invert_m4(float R[4][4])
void copy_m3_m4(float m1[3][3], const float m2[4][4])
void mul_m4_m4m3(float R[4][4], const float A[4][4], const float B[3][3])
void unit_m4(float m[4][4])
void copy_m4_m3(float m1[4][4], const float m2[3][3])
bool invert_m4_m4(float R[4][4], const float A[4][4])
void mul_m4_v3(const float M[4][4], float r[3])
void mul_v3_m4v3(float r[3], const float M[4][4], const float v[3])
void mul_v3_mat3_m4v3(float r[3], const float M[4][4], const float v[3])
void quat_to_eulO(float eul[3], const short order, const float quat[4])
void eulO_to_quat(float quat[4], const float eul[3], const short order)
void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const short order)
void mul_qt_fl(float q[4], const float f)
void axis_angle_to_quat(float r[4], const float axis[3], const float angle)
float normalize_qt(float q[4])
void eul_to_quat(float quat[4], const float eul[3])
void quat_to_eul(float eul[3], const float quat[4])
float normalize_qt_qt(float r[4], const float q[4])
void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle)
void unit_axis_angle(float axis[3], float *angle)
void copy_qt_qt(float q[4], const float a[4])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl3(float v[3], float x, float y, float z)
MINLINE void zero_v3(float r[3])
void BLI_join_dirfile(char *__restrict dst, const size_t maxlen, const char *__restrict dir, const char *__restrict file) ATTR_NONNULL()
#define STRNCPY(dst, src)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
void BLI_string_flip_side_name(char *r_name, const char *from_name, const bool strip_number, const size_t name_len)
struct Depsgraph Depsgraph
void DEG_id_tag_update(struct ID *id, int flag)
struct Object * DEG_get_evaluated_object(const struct Depsgraph *depsgraph, struct Object *object)
@ ID_RECALC_COPY_ON_WRITE
@ MOTIONPATH_BAKE_HAS_PATHS
@ CONSTRAINT_TYPE_STRETCHTO
Object is a sort of wrapper for general info.
@ POSE_PATH_CALC_RANGE_FULL
#define ANIM_KS_LOC_ROT_SCALE_ID
#define ANIM_KS_LOCATION_ID
#define ANIM_KS_WHOLE_CHARACTER_ID
#define ANIM_KS_SCALING_ID
#define ANIM_KS_ROTATION_ID
bool ED_operator_posemode(struct bContext *C)
Read Guarded memory(de)allocation.
void uiItemR(uiLayout *layout, struct PointerRNA *ptr, const char *propname, int flag, const char *name, int icon)
void ED_armature_edit_free(struct bArmature *arm)
void ED_armature_from_edit(Main *bmain, bArmature *arm)
EditBone * ED_armature_ebone_find_name(const ListBase *edbo, const char *name)
void ED_armature_to_edit(bArmature *arm)
const Depsgraph * depsgraph
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
bool ED_autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
int ANIM_apply_keyingset(bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
KeyingSet * ANIM_get_keyingset_for_autokeying(const Scene *scene, const char *transformKSName)
void ANIM_relative_keyingset_add_source(ListBase *dsources, ID *id, StructRNA *srna, void *data)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_mallocN)(size_t len, const char *str)
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathCalcRange range)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct bPoseChannel * parent
struct bPoseChannel * next
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* ui)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports
struct wmOperatorType * type
void WM_event_add_notifier(const bContext *C, uint type, void *reference)