45#include "RNA_prototypes.hh"
96 ob =
static_cast<Object *
>(ob->id.next))
99 if ((ob->parent == armob) && (ob->partype ==
PARBONE)) {
112 const float pose_mat[4][4],
113 const float new_tail[3],
114 float r_new_arm_mat[4][4])
125 float premat[3][3], pmat[3][3];
186 const float delta_mat[4][4],
187 float r_new_arm_mat[4][4])
190 float delta[3], new_tail[3], premat[3][3], new_pose[4][4];
225 if (!pchan || !pchan_eval) {
230 new_pstate.
bone = bone;
233 return ptr.data == pchan;
234 }) != selected.
end())
249 float offs_bone[4][4];
286 pstate = &new_pstate;
299 float offs_bone[4][4], delta[4][4], old_chan_loc[3];
325 float inv_parent_arm[4][4];
342 pstate = &new_pstate;
356 switch (constraint->
type) {
419 "Actions on this armature will be destroyed by this new rest pose as the "
420 "transforms stored are relative to the old rest pose");
442 arm, pose, ob_eval->
pose, bone, selected_bones,
nullptr);
489 ot->name =
"Apply Pose as Rest Pose";
490 ot->idname =
"POSE_OT_armature_apply";
491 ot->description =
"Apply the current pose as the new rest pose";
505 "Only apply the selected bones (with propagation to children)");
536 bool changed =
false;
541 pchan_xform_array[
i].is_set =
false;
555 pchan_xform_array[
i].is_set =
true;
562 if (!pchan_xform_array[
i].is_set) {
584 ot->name =
"Apply Visual Transform to Pose";
585 ot->idname =
"POSE_OT_visual_transform_apply";
586 ot->description =
"Apply final constrained position of pose bones to their transform";
632 if (pchan ==
nullptr) {
787 BLI_assert_msg(armature,
"If an armature object has a pose, it should have armature data");
800 (PartialWriteContext::IDAddOperations::MAKE_LOCAL |
801 PartialWriteContext::IDAddOperations::SET_FAKE_USER |
802 PartialWriteContext::IDAddOperations::SET_CLIPBOARD_MARK)},
806 if (*(cb_data->id_pointer) == ob->data) {
807 return (PartialWriteContext::IDAddOperations::MAKE_LOCAL |
808 PartialWriteContext::IDAddOperations::ADD_DEPENDENCIES);
815 copybuffer.write(filepath, *op->reports);
825 ot->name =
"Copy Pose";
826 ot->idname =
"POSE_OT_copy";
827 ot->description =
"Copy the current pose of the selected bones to the internal clipboard";
879 if (pose_from ==
nullptr) {
902 if (pchan !=
nullptr) {
929 ot->name =
"Paste Pose";
930 ot->idname =
"POSE_OT_paste";
931 ot->description =
"Paste the stored pose on to the current pose";
945 "Paste the stored pose flipped on to current pose");
952 "Only paste the stored pose on to selected bones in the current pose");
965 pchan->
scale[0] = 1.0f;
968 pchan->
scale[1] = 1.0f;
971 pchan->
scale[2] = 1.0f;
986 if (pchan_mirror !=
nullptr) {
997 pchan->
loc[0] = 0.0f;
1000 pchan->
loc[1] = 0.0f;
1003 pchan->
loc[2] = 0.0f;
1012 if (pchan_mirror !=
nullptr) {
1050 pchan->
quat[0] = 1.0f;
1053 pchan->
quat[1] = 0.0f;
1056 pchan->
quat[2] = 0.0f;
1059 pchan->
quat[3] = 0.0f;
1065 pchan->
eul[0] = 0.0f;
1068 pchan->
eul[1] = 0.0f;
1071 pchan->
eul[2] = 0.0f;
1077 float eul[3], oldeul[3], quat1[4] = {0};
1091 eul[0] = eul[1] = eul[2] = 0.0f;
1110 if ((quat1[0] < 0.0f && pchan->
quat[0] > 0.0f) ||
1111 (quat1[0] > 0.0f && pchan->
quat[0] < 0.0f))
1139 pchan->
roll1 = 0.0f;
1140 pchan->
roll2 = 0.0f;
1153 if (pchan_mirror !=
nullptr) {
1173 void (*clear_func)(
const bPose *,
1175 const char default_ksName[])
1179 bool changed_multi =
false;
1182 if (
ELEM(
nullptr, clear_func, default_ksName)) {
1185 "Programming error: missing clear transform function or keying set name");
1196 bool changed =
false;
1200 clear_func(ob_iter->pose, pchan);
1207 sources, &ob_iter->id, &RNA_PoseBone, pchan);
1211 clear_func(ob_iter->pose, pchan_eval);
1218 changed_multi =
true;
1261 ot->name =
"Clear Pose Scale";
1262 ot->idname =
"POSE_OT_scale_clear";
1263 ot->description =
"Reset scaling of selected bones to their default values";
1288 ot->name =
"Clear Pose Rotation";
1289 ot->idname =
"POSE_OT_rot_clear";
1290 ot->description =
"Reset rotations of selected bones to their default values";
1315 ot->name =
"Clear Pose Location";
1316 ot->idname =
"POSE_OT_loc_clear";
1317 ot->description =
"Reset locations of selected bones to their default values";
1342 ot->name =
"Clear Pose Transforms";
1343 ot->idname =
"POSE_OT_transforms_clear";
1345 "Reset location, rotation, and scaling of selected bones to their default values";
1372 if ((ob->adt) && (ob->adt->action)) {
1376 bPose *dummyPose =
nullptr;
1384 workob.
data = ob->data;
1385 workob.
adt = ob->adt;
1386 workob.
pose = dummyPose;
1401 if (pchan->system_properties) {
1427 ot->name =
"Clear User Transforms";
1428 ot->idname =
"POSE_OT_user_transforms_clear";
1429 ot->description =
"Reset pose bone transforms to keyframed state";
1439 RNA_def_boolean(
ot->srna,
"only_selected",
true,
"Only Selected",
"Only visible/selected bones");
Functions to deal with Armatures.
C++ functions to deal with Armature collections (i.e. the successor of bone layers).
Functions to insert, delete or modify keyframes.
Functionality to interact with keying sets.
static constexpr const char * ANIM_KS_ROTATION_ID
static constexpr const char * ANIM_KS_SCALING_ID
static constexpr const char * ANIM_KS_WHOLE_CHARACTER_ID
static constexpr const char * ANIM_KS_LOC_ROT_SCALE_ID
static constexpr const char * ANIM_KS_LOCATION_ID
Blender kernel action and pose functionality.
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
bPoseChannel * BKE_pose_channel_get_mirrored(const bPose *pose, const char *name) ATTR_WARN_UNUSED_RESULT
void BKE_pose_copy_data(bPose **dst, const bPose *src, bool copy_constraints)
void BKE_pose_rest(bPose *pose, bool selected_bones_only)
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
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() ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
bArmature * BKE_armature_from_object(Object *ob)
void BKE_bone_parent_transform_clear(BoneParentTransform *bpt)
void BKE_bone_parent_transform_combine(const BoneParentTransform *in1, const BoneParentTransform *in2, BoneParentTransform *result)
void BKE_bone_parent_transform_invert(BoneParentTransform *bpt)
void mat3_vec_to_roll(const float mat[3][3], const float vec[3], float *r_roll)
void BKE_pchan_apply_mat4(bPoseChannel *pchan, const float mat[4][4], bool use_compat)
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_END
void BKE_bone_parent_transform_apply(const BoneParentTransform *bpt, const float inmat[4][4], float outmat[4][4])
void vec_roll_to_mat3(const float vec[3], float roll, float r_mat[3][3])
void BKE_pose_where_is(Depsgraph *depsgraph, Scene *scene, 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], BoneParentTransform *r_bpt)
#define FOREACH_PCHAN_SELECTED_IN_OBJECT_BEGIN(_ob, _pchan)
void BKE_armature_mat_pose_to_bone(const bPoseChannel *pchan, const float inmat[4][4], float outmat[4][4])
void BKE_bone_offset_matrix_get(const Bone *bone, float offs_bone[4][4])
bool BKE_copybuffer_read(Main *bmain_dst, const char *libname, ReportList *reports, uint64_t id_types_mask)
Depsgraph * CTX_data_ensure_evaluated_depsgraph(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
#define CTX_DATA_COUNT(C, member)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
bool CTX_data_selected_pose_bones(const bContext *C, blender::Vector< PointerRNA > *list)
wmWindowManager * CTX_wm_manager(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
void IDP_FreeProperty(IDProperty *prop)
IDProperty * IDP_CopyProperty(const IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void IDP_SyncGroupValues(IDProperty *dest, const IDProperty *src) ATTR_NONNULL()
#define FOREACH_OBJECT_IN_MODE_END
#define FOREACH_OBJECT_IN_MODE_BEGIN(_scene, _view_layer, _v3d, _object_type, _object_mode, _instance)
void BKE_main_free(Main *bmain)
const char * BKE_main_blendfile_path_from_global()
General operations, lookup, etc. for blender objects.
blender::float4x4 BKE_object_calc_parent(Depsgraph *depsgraph, Scene *scene, Object *ob)
void BKE_object_apply_mat4(Object *ob, const float mat[4][4], bool use_compat, bool use_parent)
Object * BKE_object_pose_armature_get(Object *ob)
bool BKE_object_obdata_is_libdata(const Object *ob)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_msg(a, msg)
#define LISTBASE_FOREACH(type, var, list)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
#define LISTBASE_FOREACH_INDEX(type, var, list, index_var)
int BLI_listbase_count(const ListBase *listbase) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
void void BLI_INLINE bool BLI_listbase_is_single(const ListBase *lb)
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[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 copy_m4_m3(float m1[4][4], const float m2[3][3])
void mul_m4_v3(const float M[4][4], float r[3])
void mul_v3_m4v3(float r[3], const float mat[4][4], const float vec[3])
bool invert_m4_m4(float inverse[4][4], const float mat[4][4])
bool invert_m4(float mat[4][4])
void mul_v3_mat3_m4v3(float r[3], const float mat[4][4], const float vec[3])
void unit_m4(float m[4][4])
void axis_angle_to_quat(float r[4], const float axis[3], float angle)
void quat_to_eulO(float e[3], short order, const float q[4])
float normalize_qt(float q[4])
void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], short order)
void mul_qt_fl(float q[4], float f)
void eulO_to_quat(float q[4], const float e[3], short order)
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], 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 void copy_v3_fl3(float v[3], float x, float y, float z)
MINLINE bool is_zero_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
MINLINE void zero_v3(float r[3])
#define BLI_path_join(...)
char * STRNCPY(char(&dst)[N], const char *src)
#define STRNCPY_UTF8(dst, src)
size_t BLI_string_flip_side_name(char *name_dst, const char *name_src, bool strip_number, size_t name_dst_maxncpy) ATTR_NONNULL(1
void DEG_id_tag_update(ID *id, unsigned int flags)
T * DEG_get_evaluated(const Depsgraph *depsgraph, T *id)
#define ID_IS_PACKED(_id)
@ MOTIONPATH_BAKE_HAS_PATHS
@ CONSTRAINT_TYPE_STRETCHTO
Object is a sort of wrapper for general info.
@ POSE_PATH_CALC_RANGE_FULL
bool ED_operator_posemode(bContext *C)
Read Guarded memory(de)allocation.
EditBone * ED_armature_ebone_find_name(const ListBase *edbo, const char *name)
void ED_armature_edit_free(bArmature *arm)
void ED_armature_from_edit(Main *bmain, bArmature *arm)
void ED_armature_to_edit(bArmature *arm)
BPy_StructRNA * depsgraph
constexpr const T * end() const
constexpr const T * begin() const
ID * id_add(const ID *id, IDAddOptions options, blender::FunctionRef< IDAddOperations(LibraryIDLinkCallbackData *cb_data, IDAddOptions options)> dependencies_filter_cb=nullptr)
void * MEM_malloc_arrayN(size_t len, size_t size, const char *str)
void MEM_freeN(void *vmemh)
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
void relative_keyingset_add_source(blender::Vector< PointerRNA > &sources, ID *id, StructRNA *srna, void *data)
bool bone_is_visible(const bArmature *armature, const Bone *bone)
bool bone_is_selected(const bArmature *armature, const Bone *bone)
KeyingSet * get_keyingset_for_autokeying(const Scene *scene, const char *transformKSName)
bool autokeyframe_pchan(bContext *C, Scene *scene, Object *ob, bPoseChannel *pchan, KeyingSet *ks)
int apply_keyingset(bContext *C, blender::Vector< PointerRNA > *sources, KeyingSet *keyingset, ModifyKeyMode mode, float cfra)
void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathCalcRange range)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, const bool default_value, const char *ui_name, const char *ui_description)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
struct bPoseChannel * parent
IDProperty * system_properties
void prop(PointerRNA *ptr, PropertyRNA *prop, int index, int value, eUI_Item_Flag flag, std::optional< blender::StringRef > name_opt, int icon, std::optional< blender::StringRef > placeholder=std::nullopt)
struct ReportList * reports
struct wmOperatorType * type
void WM_event_add_notifier(const bContext *C, uint type, void *reference)