56#include "RNA_prototypes.hh"
91 if (obpose !=
nullptr) {
193 "All properties, including transforms, bendy bone shape, and custom properties"},
194 {
PS_TFM_LOC,
"LOC", 0,
"Location",
"Location only"},
195 {
PS_TFM_ROT,
"ROT", 0,
"Rotation",
"Rotation only"},
199 {
PS_TFM_PROPS,
"CUSTOM", 0,
"Custom Properties",
"Custom properties"},
200 {0,
nullptr, 0,
nullptr,
nullptr},
209 {0,
nullptr, 0,
nullptr,
nullptr},
221 for (
FCurve *fcurve : input_fcurves) {
222 if (fcurve->rna_path() != path) {
264 for (
ID *
id : unique_ids) {
268 range_data->
object = id_cast<Object *>(
id);
344 if (&object_range.
object->
id ==
id) {
350 *prev_frame = *next_frame = 0.0f;
368 float prev_frame, next_frame;
370 for (
const FCurve *fcurve : fcurves) {
371 prev_values[fcurve->array_index] =
evaluate_fcurve(fcurve, prev_frame);
372 next_values[fcurve->array_index] =
evaluate_fcurve(fcurve, next_frame);
385 prev_values, next_values, current_frame_factor);
393 transformable->
blend_property_to(prop_type, current_frame_breakdown, -factor, axis_flag);
398 transformable->
blend_property_to(prop_type, current_frame_breakdown, factor, axis_flag);
405 transformable->
set_property(prop_type, breakdown, axis_flag);
411 const float blend_factor =
fabs((factor - 0.5f) * 2);
415 transformable->
blend_property_to(prop_type, prev_values, blend_factor, axis_flag);
419 transformable->
blend_property_to(prop_type, next_values, blend_factor, axis_flag);
447 float prev_frame, next_frame;
449 &pso, slide_subject.
ptr.
owner_id, &prev_frame, &next_frame);
455 if (fcurves.
size() == 0) {
459 for (
const FCurve *fcurve : fcurves) {
460 prev_frame_values[fcurve->array_index] =
evaluate_fcurve(fcurve, prev_frame);
461 next_frame_values[fcurve->array_index] =
evaluate_fcurve(fcurve, next_frame);
474 prev_frame_values, next_frame_values, current_frame_factor);
477 base_values, current_frame_breakdown, factor * factor_sign);
486 const float blend_factor =
fabsf((factor - 0.5f) * 2);
498 values = base_values;
511 float prev_frame, next_frame;
530 for (
const FCurve *fcurve : quaternion_fcurves) {
541 const float interp_factor = (current_frame - pso->
prev_frame) /
544 rot_prev_frame, rot_next_frame, interp_factor);
562 const float blend_factor =
fabs((factor - 0.5f) * 2);
734 mode_st =
IFACE_(
"Push Pose");
737 mode_st =
IFACE_(
"Relax Pose");
740 mode_st =
IFACE_(
"Breakdown");
743 mode_st =
IFACE_(
"Blend to Neighbor");
747 mode_st =
IFACE_(
"Sliding-Tool");
755 status.
item(
IFACE_(
"Confirm"), ICON_MOUSE_LMB);
756 status.
item(
IFACE_(
"Cancel"), ICON_EVENT_ESC);
757 status.
item(
IFACE_(
"Adjust"), ICON_MOUSE_MOVE);
767 status.
item(
"Location Only", ICON_NONE);
770 status.
item(
"Rotation Only", ICON_NONE);
773 status.
item(
"Scale Only", ICON_NONE);
776 status.
item(
"Bendy Bones Only", ICON_NONE);
779 status.
item(
"Custom Properties Only", ICON_NONE);
782 status.
item(
"Transform limits", ICON_NONE);
801 status.
item(str_offs, ICON_NONE);
959 switch (event->
type) {
1021 float factor = value / 100;
1026 do_pose_update =
true;
1030 switch (event->
type) {
1036 do_pose_update =
true;
1042 do_pose_update =
true;
1048 do_pose_update =
true;
1054 do_pose_update =
true;
1060 do_pose_update =
true;
1068 do_pose_update =
true;
1074 do_pose_update =
true;
1080 do_pose_update =
true;
1109 if (do_pose_update) {
1175 "Weighting factor for which keyframe is favored more",
1185 "Previous Keyframe",
1186 "Frame number of keyframe immediately before the current frame",
1197 "Frame number of keyframe immediately after the current frame",
1207 "Set of properties that are affected");
1214 "Transform axis to restrict effects to");
1257 ot->
name =
"Push Pose from Breakdown";
1258 ot->
idname =
"POSE_OT_push";
1259 ot->
description =
"Exaggerate the current pose in regards to the breakdown pose";
1314 ot->
name =
"Relax Pose to Breakdown";
1315 ot->
idname =
"POSE_OT_relax";
1316 ot->
description =
"Make the current pose more similar to its breakdown pose";
1376 ot->
name =
"Blend Pose with Rest Pose";
1377 ot->
idname =
"POSE_OT_blend_with_rest";
1378 ot->
description =
"Make the current pose more similar to, or further away from, the rest pose";
1435 ot->
name =
"Pose Breakdowner";
1436 ot->
idname =
"POSE_OT_breakdown";
1437 ot->
description =
"Create a suitable breakdown pose on the current frame";
1487 ot->
name =
"Blend to Neighbor";
1488 ot->
idname =
"POSE_OT_blend_to_neighbor";
1489 ot->
description =
"Blend from current position to previous or next keyframe";
1533 const float source_frame,
1534 ListBaseT<FrameLink> *target_frames)
1539 for (
FCurve *fcu : slide_subject.fcurves) {
1544 for (
FrameLink &target_frame : *target_frames) {
1552static float find_next_key(
const ListBaseT<SlideSubject> *slide_subjects,
const float start_frame)
1555 for (
const SlideSubject &slide_subject : *slide_subjects) {
1556 for (
const FCurve *fcu : slide_subject.fcurves) {
1564 current_frame_index += 1;
1566 const int bezt_index =
min_ii(current_frame_index, fcu->
totvert - 1);
1567 target_frame =
min_ff(target_frame, fcu->
bezt[bezt_index].
vec[1][0]);
1571 return target_frame;
1577 for (
const SlideSubject &slide_subject : *slide_subjects) {
1578 for (
const FCurve *fcu : slide_subject.fcurves) {
1586 return target_frame;
1591 ListBaseT<CfraElem> selected_markers = {
nullptr,
nullptr};
1593 for (
const CfraElem &marker : selected_markers) {
1595 link->
frame = marker.cfra;
1598 selected_markers.free_no_destruct();
1602 const float start_frame,
1603 const float end_frame,
1604 ListBaseT<FrameLink> *target_frames)
1607 for (
const SlideSubject &slide_subject : *slide_subjects) {
1608 for (
FCurve *fcu : slide_subject.fcurves) {
1613 if (column.cfra <= start_frame) {
1616 if (column.cfra > end_frame) {
1620 link->
frame = column.cfra;
1627 ListBaseT<FrameLink> *target_frames)
1630 for (
const SlideSubject &slide_subject : *slide_subjects) {
1631 for (
FCurve *fcu : slide_subject.fcurves) {
1640 link->
frame = column.cfra;
1651 ListBaseT<SlideSubject> slide_subjects = {
nullptr,
nullptr};
1658 if (slide_subjects.is_empty()) {
1669 ListBaseT<FrameLink> target_frames = {
nullptr,
nullptr};
1673 float target_frame =
find_next_key(&slide_subjects, current_frame);
1675 link->
frame = target_frame;
1684 link->
frame = target_frame;
1713 target_frames.free_no_destruct();
1734 "Propagate pose to first keyframe following the current frame only"},
1739 "Propagate pose to the last keyframe only (i.e. making action cyclic)"},
1744 "Propagate pose to all keyframes between current frame and 'Frame' property"},
1748 "Before Last Keyframe",
1749 "Propagate pose to all keyframes from current frame until no more are found"},
1753 "On Selected Keyframes",
1754 "Propagate pose to all selected keyframes"},
1758 "On Selected Markers",
1759 "Propagate pose to all keyframes occurring on frames with Scene Markers after the current "
1761 {0,
nullptr, 0,
nullptr,
nullptr},
1765 ot->
name =
"Propagate Pose";
1766 ot->
idname =
"POSE_OT_propagate";
1768 "Copy selected aspects of the current pose to subsequent poses already keyframed";
1784 "Method used to determine when to stop propagating pose to keyframes");
1791 "Frame to stop propagating frames to (for 'Before Frame' mode)",
Functions to modify FCurves.
Helper functions for animation to interact with the RNA system.
General operations, lookup, etc. for blender objects.
#define OB_MODE_ALL_WEIGHT_PAINT
Object is a sort of wrapper for general info.
Read Blender memory allocation and freeing.
#define BLI_assert_unreachable()
#define UNUSED_VARS_NDEBUG(...)
#define BLI_assert_msg(a, msg)
void append(const T &value)
void item(std::string text, int icon1, int icon2=0)
void item_bool(std::string text, bool inverted, int icon1, int icon2=0)
ccl_device_inline dual3 fabs(const ccl_private dual3 &a)
KeyframeSettings get_keyframe_settings(bool from_userprefs)
void rna_property_set_as_float(PointerRNA &ptr, PropertyRNA &prop, Span< float > values)
SingleKeyingResult insert_vert_fcurve(FCurve *fcu, const float2 position, const KeyframeSettings &settings, eInsertKeyFlags flag)
Main Key-framing API call.
Rotation identity_rotation(const eRotationModes mode)
Rotation rotation_interpolated(const Rotation &a, const Rotation &b, const float factor)
Array< float > property_interpolated(const Span< float > a, const Span< float > b, const float factor)
MINLINE float min_ff(float a, float b)
static void pose_slide_refresh(bContext *C, tPoseSlideOp *pso)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
bool ED_slider_modal(tSlider *slider, const wmEvent *event)
ScrArea * CTX_wm_area(const bContext *C)
int RNA_enum_get(PointerRNA *ptr, const char *name)
static void pose_slide_autoKeyframe(bContext *C, tPoseSlideOp *pso)
static bool pose_slide_poll(bContext *C)
float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, eNlaTime_ConvertModes mode)
static wmOperatorStatus pose_slide_breakdown_exec(bContext *C, wmOperator *op)
void ED_markers_make_cfra_list(ListBaseT< TimeMarker > *markers, ListBaseT< CfraElem > *lb, const bool only_selected)
bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
void ED_slider_init(tSlider *slider, const wmEvent *event)
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
static wmOperatorStatus pose_slide_push_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void slide_subjects_free(ListBaseT< SlideSubject > *slide_subjects)
static void get_keyed_frames_in_range(const ListBaseT< SlideSubject > *slide_subjects, const float start_frame, const float end_frame, ListBaseT< FrameLink > *target_frames)
void POSE_OT_relax(wmOperatorType *ot)
void ED_slider_factor_set(tSlider *slider, float factor)
void POSE_OT_blend_with_rest(wmOperatorType *ot)
float normalize_qt(float q[4])
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
float ED_slider_factor_get(const tSlider *slider)
void WM_cursor_modal_set(wmWindow *win, int val)
bool ED_operator_posemode(bContext *C)
const ActKeyColumn * ED_keylist_find_prev(const AnimKeylist *keylist, const float cfra)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
int RNA_int_get(PointerRNA *ptr, const char *name)
bool hasNumInput(const NumInput *n)
wmWindow * CTX_wm_window(const bContext *C)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
enum eContextObjectMode CTX_data_mode_enum(const bContext *C)
bool ED_keylist_is_empty(const AnimKeylist *keylist)
static void get_selected_marker_positions(Scene *scene, ListBaseT< FrameLink > *target_frames)
static wmOperatorStatus pose_slide_exec_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
void ED_region_tag_redraw(ARegion *region)
static void pose_slide_apply_property_snapshots(tPoseSlideOp &pso, SlideSubject &slide_subject, const Span< PropertySnapshot > snapshots)
const ActKeyColumn * ED_keylist_find_exact(const AnimKeylist *keylist, const float cfra)
const ActKeyColumn * ED_keylist_find_next(const AnimKeylist *keylist, const float cfra)
static void pose_slide_reset(tPoseSlideOp *pso)
static wmOperatorStatus pose_slide_blend_rest_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void slide_subjects_reset(ListBaseT< SlideSubject > *slide_subjects)
void POSE_OT_breakdown(wmOperatorType *ot)
tSlider * ED_slider_create(bContext *C)
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)
static wmOperatorStatus pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
AnimData * BKE_animdata_from_id(const ID *id)
static void pose_slide_rest_pose_apply(bContext *C, tPoseSlideOp *pso)
void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const int saction_flag, float2 range, const bool use_nla_remapping)
static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
void * MEM_new_zeroed(size_t len, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1) ATTR_NONNULL(2)
static wmOperatorStatus pose_slide_blend_rest_exec(bContext *C, wmOperator *op)
void slide_subjects_get(bContext *C, ListBaseT< SlideSubject > *r_transformable_list)
float BKE_scene_frame_get(const Scene *scene)
static wmOperatorStatus pose_slide_breakdown_invoke(bContext *C, wmOperator *op, const wmEvent *event)
void BKE_report(ReportList *reports, eReportType type, const char *message)
static wmOperatorStatus pose_slide_relax_invoke(bContext *C, wmOperator *op, const wmEvent *event)
Object * BKE_object_pose_armature_get(Object *ob)
void slide_subjects_autokey(bContext *C, Scene *scene, const ListBaseT< SlideSubject > *slide_subjects)
void initNumInput(NumInput *n)
void POSE_OT_blend_to_neighbors(wmOperatorType *ot)
ePosePropagate_Termination
@ POSE_PROPAGATE_NEXT_KEY
@ POSE_PROPAGATE_BEFORE_END
@ POSE_PROPAGATE_SELECTED_KEYS
@ POSE_PROPAGATE_BEFORE_FRAME
@ POSE_PROPAGATE_LAST_KEY
@ POSE_PROPAGATE_SELECTED_MARKERS
static const EnumPropertyItem prop_channels_types[]
void WM_cursor_modal_restore(wmWindow *win)
void ED_keylist_prepare_for_direct_access(AnimKeylist *keylist)
AnimKeylist * ED_keylist_create()
static bool pose_frame_range_from_id_get(const tPoseSlideOp *pso, const ID *id, float *prev_frame, float *next_frame)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
bool applyNumInput(NumInput *n, float *vec)
void slide_subjects_refresh(bContext *C, const SlideSubject &slide_subject)
static void pose_slide_exit(bContext *C, wmOperator *op)
static wmOperatorStatus pose_slide_blend_to_neighbors_exec(bContext *C, wmOperator *op)
static void get_selected_frames(const ListBaseT< SlideSubject > *slide_subjects, ListBaseT< FrameLink > *target_frames)
static void pose_slide_apply_linear(tPoseSlideOp &pso, SlideSubject &slide_subject, const ed::AnimTransformable::PropertyType prop_type)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, const int default_value, const int hardmin, const int hardmax, const char *ui_name, const char *ui_description, const int softmin, const int softmax)
static bool pose_slide_toggle_axis_mutability(wmOperator *op, tPoseSlideOp *pso, const ed::AxisMutable axis)
void ED_slider_factor_bounds_set(tSlider *slider, float factor_bound_lower, float factor_bound_upper)
static wmOperatorStatus pose_slide_invoke_common(bContext *C, wmOperator *op, const wmEvent *event)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
static float find_next_key(const ListBaseT< SlideSubject > *slide_subjects, const float start_frame)
static void pose_slide_apply_quat(tPoseSlideOp *pso, SlideSubject *slide_subject)
MINLINE float max_ff(float a, float b)
static wmOperatorStatus pose_slide_relax_exec(bContext *C, wmOperator *op)
void outputNumInput(NumInput *n, char *str, const UnitSettings &unit_settings)
static wmOperatorStatus pose_slide_blend_to_neighbors_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ID_Type GS(const char *name)
void ED_slider_status_get(const tSlider *slider, WorkspaceStatus &status)
static void pose_slide_draw_status(bContext *C, tPoseSlideOp *pso)
void ED_keylist_free(AnimKeylist *keylist)
Scene * CTX_data_scene(const bContext *C)
static wmOperatorStatus pose_propagate_exec(bContext *C, wmOperator *op)
int BKE_fcurve_bezt_binarysearch_index(const BezTriple array[], float frame, int arraylen, bool *r_replace)
static Vector< FCurve * > fcurves_filtered_by_path(const Span< FCurve * > input_fcurves, const StringRef path)
static void pose_slide_cancel(bContext *C, wmOperator *op)
const ListBaseT< ActKeyColumn > * ED_keylist_listbase(const AnimKeylist *keylist)
void POSE_OT_push(wmOperatorType *ot)
static void pose_slide_opdef_properties(wmOperatorType *ot)
static float find_last_key(const ListBaseT< SlideSubject > *slide_subjects)
void ED_slider_property_label_set(tSlider *slider, const char *property_label)
MINLINE int min_ii(int a, int b)
PropertyRNA * RNA_def_float(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)
Object * CTX_data_active_object(const bContext *C)
void POSE_OT_propagate(wmOperatorType *ot)
ARegion * CTX_wm_region(const bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
static const EnumPropertyItem prop_axis_lock_types[]
float RNA_float_get(PointerRNA *ptr, const char *name)
static wmOperatorStatus pose_slide_push_exec(bContext *C, wmOperator *op)
void ED_slider_destroy(bContext *C, tSlider *slider)
static void propagate_curve_values(ListBaseT< SlideSubject > *slide_subjects, const float source_frame, ListBaseT< FrameLink > *target_frames)
float evaluate_fcurve(const FCurve *fcu, float evaltime)
static void pose_slide_toggle_channels_mode(wmOperator *op, tPoseSlideOp *pso, ePoseSlide_Channels channel)
static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode)
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
ListBaseT< TimeMarker > markers
ListBaseT< SpaceLink > spacedata
eAction_TransformFlags transform_flag
Vector< PropertySnapshot > additional_properties
Vector< PropertySnapshot > system_properties
Vector< PropertySnapshot > properties
ed::AnimTransformable * transformable
Vector< FCurve * > fcurves
ListBaseT< SlideSubject > slide_subjects
ePoseSlide_Channels channels
ed::AxisMutable axis_mutability
Array< ObjectFrameRange > ob_data_array
eView3DOverlay_Flag overlay_flag
wmOperatorStatus(*) exec(bContext *C, wmOperator *op) ATTR_WARN_UNUSED_RESULT
void(*) cancel(bContext *C, wmOperator *op)
bool(*) poll(bContext *C) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) invoke(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
wmOperatorStatus(*) modal(bContext *C, wmOperator *op, const wmEvent *event) ATTR_WARN_UNUSED_RESULT
struct ReportList * reports