38 #include "RNA_prototypes.h"
90 const float pose_mat[4][4],
91 const float new_tail[3],
92 float r_new_arm_mat[4][4])
103 float premat[3][3], pmat[3][3];
158 pchan->
size[0] = pchan->
size[1] = pchan->
size[2] = 1.0f;
164 const float delta_mat[4][4],
165 float r_new_arm_mat[4][4])
168 float delta[3], new_tail[3], premat[3][3], new_pose[4][4];
203 if (!pchan || !pchan_eval) {
223 float offs_bone[4][4];
260 pstate = &new_pstate;
273 float offs_bone[4][4], delta[4][4], old_chan_loc[3];
299 float inv_parent_arm[4][4];
316 pstate = &new_pstate;
330 switch (constraint->
type) {
357 if (use_selected && (pchan->bone->flag &
BONE_SELECTED) == 0) {
394 "Actions on this armature will be destroyed by this new rest pose as the "
395 "transforms stored are relative to the old rest pose");
402 if (!selected_bones.
first) {
417 arm, pose, ob_eval->
pose, bone, &selected_bones,
NULL);
466 ot->
name =
"Apply Pose as Rest Pose";
467 ot->
idname =
"POSE_OT_armature_apply";
468 ot->
description =
"Apply the current pose as the new rest pose";
482 "Only apply the selected bones (with propagation to children)");
510 } *pchan_xform_array =
MEM_mallocN(
sizeof(*pchan_xform_array) * chanbase_len, __func__);
511 bool changed =
false;
516 pchan_xform_array[i].is_set =
false;
530 pchan_xform_array[i].is_set =
true;
537 if (!pchan_xform_array[i].is_set) {
559 ot->
name =
"Apply Visual Transform to Pose";
560 ot->
idname =
"POSE_OT_visual_transform_apply";
561 ot->
description =
"Apply final constrained position of pose bones to their transform";
781 ob_copy.
data = &arm_copy;
809 ot->
description =
"Copies the current pose of the selected bones to copy/paste buffer";
861 if (pose_from ==
NULL) {
913 ot->
description =
"Paste the stored pose on to the current pose";
927 "Paste the stored pose flipped on to current pose");
934 "Only paste the stored pose on to selected bones in the current pose");
947 pchan->
size[0] = 1.0f;
950 pchan->
size[1] = 1.0f;
953 pchan->
size[2] = 1.0f;
968 if (pchan_mirror !=
NULL) {
979 pchan->
loc[0] = 0.0f;
982 pchan->
loc[1] = 0.0f;
985 pchan->
loc[2] = 0.0f;
994 if (pchan_mirror !=
NULL) {
1031 pchan->
quat[0] = 1.0f;
1034 pchan->
quat[1] = 0.0f;
1037 pchan->
quat[2] = 0.0f;
1040 pchan->
quat[3] = 0.0f;
1046 pchan->
eul[0] = 0.0f;
1049 pchan->
eul[1] = 0.0f;
1052 pchan->
eul[2] = 0.0f;
1058 float eul[3], oldeul[3], quat1[4] = {0};
1072 eul[0] = eul[1] = eul[2] = 0.0f;
1091 if ((quat1[0] < 0.0f && pchan->
quat[0] > 0.0f) ||
1092 (quat1[0] > 0.0f && pchan->
quat[0] < 0.0f)) {
1119 pchan->
roll1 = 0.0f;
1120 pchan->
roll2 = 0.0f;
1133 if (pchan_mirror !=
NULL) {
1154 const char default_ksName[])
1158 bool changed_multi =
false;
1161 if (
ELEM(
NULL, clear_func, default_ksName)) {
1164 "Programming error: missing clear transform function or keying set name");
1175 bool changed =
false;
1179 clear_func(ob_iter->pose, pchan);
1189 clear_func(ob_iter->pose, pchan_eval);
1196 changed_multi =
true;
1240 ot->
name =
"Clear Pose Scale";
1241 ot->
idname =
"POSE_OT_scale_clear";
1242 ot->
description =
"Reset scaling of selected bones to their default values";
1267 ot->
name =
"Clear Pose Rotation";
1269 ot->
description =
"Reset rotations of selected bones to their default values";
1294 ot->
name =
"Clear Pose Location";
1296 ot->
description =
"Reset locations of selected bones to their default values";
1321 ot->
name =
"Clear Pose Transforms";
1322 ot->
idname =
"POSE_OT_transforms_clear";
1324 "Reset location, rotation, and scaling of selected bones to their default values";
1351 if ((ob->adt) && (ob->adt->action)) {
1364 workob.
data = ob->data;
1365 workob.
adt = ob->adt;
1366 workob.
pose = dummyPose;
1404 ot->
name =
"Clear User Transforms";
1405 ot->
idname =
"POSE_OT_user_transforms_clear";
1406 ot->
description =
"Reset pose bone transforms to keyframed state";
typedef float(TangentPoint)[2]
Blender kernel action and pose functionality.
void BKE_pose_copy_data(struct bPose **dst, const struct bPose *src, bool copy_constraints)
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_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, bool flush_to_original)
const char * BKE_tempdir_base(void)
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 vec_roll_to_mat3(const float vec[3], float roll, float r_mat[3][3])
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_copy_end(struct Main *bmain_src, const char *filename, struct ReportList *reports)
bool BKE_copybuffer_read(struct Main *bmain_dst, const char *libname, struct ReportList *reports, uint64_t id_types_mask)
void BKE_copybuffer_copy_begin(struct Main *bmain_src)
void BKE_copybuffer_copy_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_apply_mat4(struct Object *ob, const float mat[4][4], bool use_compat, bool use_parent)
void BKE_object_workob_calc_parent(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct Object *workob)
void BKE_report(ReportList *reports, eReportType 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, 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, 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 axis_angle_to_quat(float r[4], const float axis[3], float angle)
float normalize_qt(float q[4])
void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], short order)
void mul_qt_fl(float q[4], float f)
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_eulO(float eul[3], short order, const float quat[4])
void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
void eulO_to_quat(float quat[4], const float eul[3], short order)
void axis_angle_to_eulO(float eul[3], short order, const float axis[3], float angle)
void unit_axis_angle(float axis[3], float *angle)
void copy_qt_qt(float q[4], const float a[4])
MINLINE void mul_v3_v3(float r[3], const float a[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void 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 copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
void BLI_join_dirfile(char *__restrict dst, 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, size_t maxncpy) ATTR_NONNULL()
size_t BLI_string_flip_side_name(char *r_name, const char *from_name, bool strip_number, 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)