33#include "RNA_prototypes.hh"
128 if (adt !=
nullptr && adt->
action !=
nullptr &&
145 auto autokey_pose_bones = [&](
FCurve * ,
const char *bone_name) {
158 if (keyed_pose_bones.
contains(pchan)) {
166 rna_paths.
append({
"location"});
169 rna_paths.
append({rotation_mode_path});
170 rna_paths.
append({
"scale"});
172 keyed_pose_bones.
add(pchan);
275 switch (event->
type) {
313 if (!
object || !object->
pose) {
316 selected_pose_objects.
append(
object);
322 if (active_object && active_object->
pose && !selected_pose_objects.
contains(active_object)) {
323 selected_pose_objects.
append(active_object);
325 return selected_pose_objects;
370 if (selected_pose_objects.
is_empty()) {
377 op->
customdata = pbd = MEM_new<PoseBlendData>(
"PoseLib Preview Data");
380 if (pbd->
act ==
nullptr) {
383 if (pbd->
act->wrap().slots().size() == 0) {
392 const bool is_interactive = (
event !=
nullptr);
398 pbd->
objects = selected_pose_objects;
410 if (is_interactive) {
414 op->
ptr, release_confirm_prop);
438 for (
Object *ob : selected_pose_objects) {
465 switch (pbd->
state) {
480 BLI_assert_msg(0,
"poselib_blend_cleanup: unexpected pose blend state");
499 if (pbd ==
nullptr) {
555 status.
item(
IFACE_(
"Show Original Pose"), ICON_EVENT_TAB);
558 status.
item(
IFACE_(
"Show Blended Pose"), ICON_EVENT_TAB);
568 return operator_result;
615 if (selected_pose_objects.
is_empty()) {
628 ot->name =
"Apply Pose Asset";
629 ot->idname =
"POSELIB_OT_apply_pose_asset";
630 ot->description =
"Apply the given Pose Action to the rig";
646 "Amount that the pose is applied on top of the existing poses. A negative "
647 "value will subtract the pose instead of adding it",
654 "When enabled, applies the pose flipped over the X-axis");
663 ot->name =
"Blend Pose Asset";
664 ot->idname =
"POSELIB_OT_blend_pose_asset";
665 ot->description =
"Blend the given Pose Action to the rig";
684 "Amount that the pose is applied on top of the existing poses. A "
685 "negative value will subtract the pose instead of adding it",
697 "When enabled, applies the pose flipped over the X-axis");
703 "Confirm on Release",
704 "Always confirm operation when releasing button");
Functions and classes to work with Actions.
Functions for backward compatibility with the legacy Action API.
Functions to deal with Armatures.
Functions to insert, delete or modify keyframes.
Functionality to interact with keying sets.
Functions to work with animation poses.
Helper functions for animation to interact with the RNA system.
Main runtime representation of an asset.
Blender kernel action and pose functionality.
void void void void void BKE_action_flip_with_pose(bAction *act, blender::Span< Object * > objects) ATTR_NONNULL(1)
bPoseChannel * BKE_pose_channel_find_name(const bPose *pose, const char *name)
AnimData * BKE_animdata_from_id(const ID *id)
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
#define PBONE_SELECTED(arm, bone)
bool CTX_wm_interface_locked(const bContext *C)
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Object * CTX_data_active_object(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
class blender::asset_system::AssetRepresentation * CTX_wm_asset(const bContext *C)
bool CTX_data_selected_objects(const bContext *C, blender::Vector< PointerRNA > *list)
Main * CTX_data_main(const bContext *C)
wmWindowManager * CTX_wm_manager(const bContext *C)
bool BKE_id_is_editable(const Main *bmain, const ID *id)
void BKE_id_free(Main *bmain, void *idv)
ID * BKE_id_copy_ex(Main *bmain, const ID *id, ID **new_id_p, int flag)
General operations, lookup, etc. for blender objects.
struct PoseBackup * BKE_pose_backup_create_selected_bones(blender::Span< Object * > objects, const struct bAction *action) ATTR_WARN_UNUSED_RESULT
void BKE_pose_backup_restore(const struct PoseBackup *pbd)
bool BKE_pose_backup_is_selection_relevant(const struct PoseBackup *pose_backup)
void BKE_pose_backup_free(struct PoseBackup *pbd)
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_msg(a, msg)
void DEG_id_tag_update(ID *id, unsigned int flags)
struct AssetRepresentationHandle AssetRepresentationHandle
void ED_area_status_text(ScrArea *area, const char *str)
void ED_workspace_status_text(bContext *C, const char *str)
void ED_slider_init(tSlider *slider, const wmEvent *event)
void ED_slider_allow_overshoot_set(tSlider *slider, bool lower, bool upper)
void ED_slider_destroy(bContext *C, tSlider *slider)
void ED_slider_allow_increments_set(tSlider *slider, bool value)
tSlider * ED_slider_create(bContext *C)
bool ED_slider_modal(tSlider *slider, const wmEvent *event)
void ED_slider_status_get(const tSlider *slider, WorkspaceStatus &status)
void ED_slider_factor_bounds_set(tSlider *slider, float factor_bound_lower, float factor_bound_upper)
float ED_slider_factor_get(const tSlider *slider)
void ED_slider_factor_set(tSlider *slider, float factor)
Read Guarded memory(de)allocation.
BPy_StructRNA * depsgraph
void item_bool(std::string text, bool inverted, int icon1, int icon2=0)
void item(std::string text, int icon1, int icon2=0)
bool contains(const Key &key) const
constexpr bool is_empty() const
bool contains(const T &value) const
void append(const T &value)
bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
Vector< RNAPath > get_keyable_id_property_paths(const PointerRNA &ptr)
void pose_apply_action(blender::Span< Object * > objects, Action &pose_action, const AnimationEvalContext *anim_eval_context, float blend_factor)
StringRef get_rotation_mode_path(eRotationModes rotation_mode)
Slot & get_best_pose_slot_for_id(const ID &id, Action &pose_data)
void autokeyframe_pose_channel(bContext *C, Scene *scene, Object *ob, bPoseChannel *pose_channel, Span< RNAPath > rna_paths, short targetless_ik)
void BKE_action_find_fcurves_with_bones(bAction *action, blender::animrig::slot_handle_t slot_handle, FoundFCurveCallback callback)
AssetTempIDConsumer * temp_id_consumer_create(const blender::asset_system::AssetRepresentation *asset)
ID * temp_id_consumer_ensure_local_id(AssetTempIDConsumer *consumer, ID_Type id_type, Main *bmain, ReportList *reports)
void temp_id_consumer_free(AssetTempIDConsumer **consumer)
static bool poselib_asset_in_context(bContext *C)
static wmOperatorStatus poselib_blend_exit(bContext *C, wmOperator *op)
static wmOperatorStatus poselib_blend_modal(bContext *C, wmOperator *op, const wmEvent *event)
static bAction * poselib_action_to_blend(PoseBlendData *pbd)
static wmOperatorStatus poselib_blend_handle_event(bContext *, wmOperator *op, const wmEvent *event)
static void poselib_blend_cleanup(bContext *C, wmOperator *op)
static bool poselib_blend_poll(bContext *C)
static void poselib_blend_cancel(bContext *C, wmOperator *op)
static void poselib_blend_apply(bContext *C, wmOperator *op)
void POSELIB_OT_apply_pose_asset(wmOperatorType *ot)
static wmOperatorStatus poselib_blend_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static bAction * poselib_blend_init_get_action(bContext *C, wmOperator *op)
static void poselib_tempload_exit(PoseBlendData *pbd)
static void poselib_backup_posecopy(PoseBlendData *pbd)
static void poselib_keytag_pose(bContext *C, Scene *scene, PoseBlendData *pbd)
static void poselib_blend_free(wmOperator *op)
void POSELIB_OT_blend_pose_asset(wmOperatorType *ot)
static wmOperatorStatus poselib_blend_exec(bContext *C, wmOperator *op)
static void poselib_blend_set_factor(PoseBlendData *pbd, const float new_factor)
static blender::Vector< Object * > get_poselib_objects(bContext &C)
static bool poselib_blend_init_data(bContext *C, wmOperator *op, const wmEvent *event)
static bAction * flip_pose(bContext *C, blender::Span< Object * > objects, bAction *action)
static void poselib_toggle_flipped(PoseBlendData *pbd)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, const float default_value, const float hardmin, const float hardmax, const char *ui_name, const char *ui_description, const float softmin, const float softmax)
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)
AssetTempIDConsumer * temp_id_consumer
char headerstr[UI_MAX_DRAW_STR]
blender::Vector< Object * > objects
struct PoseBlendData::@216165076114036054345200111212170037100004121231 release_confirm_info
struct ReportList * reports
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
int WM_userdef_event_type_from_keymap_type(int kmitype)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
void WM_set_locked_interface(wmWindowManager *wm, bool lock)
void WM_event_add_mousemove(wmWindow *win)