55#include "RNA_prototypes.hh"
170 "All properties, including transforms, bendy bone shape, and custom properties"},
171 {
PS_TFM_LOC,
"LOC", 0,
"Location",
"Location only"},
172 {
PS_TFM_ROT,
"ROT", 0,
"Rotation",
"Rotation only"},
176 {
PS_TFM_PROPS,
"CUSTOM", 0,
"Custom Properties",
"Custom properties"},
177 {0,
nullptr, 0,
nullptr,
nullptr},
182 {0,
"FREE", 0,
"Free",
"All axes are affected"},
183 {
PS_LOCK_X,
"X", 0,
"X",
"Only X-axis transforms are affected"},
184 {
PS_LOCK_Y,
"Y", 0,
"Y",
"Only Y-axis transforms are affected"},
185 {
PS_LOCK_Z,
"Z", 0,
"Z",
"Only Z-axis transforms are affected"},
186 {0,
nullptr, 0,
nullptr,
nullptr},
222 params.no_dup_data =
false;
232 if (ob_iter ==
nullptr) {
236 ob_data->
ob = ob_iter;
237 ob_data->
valid =
true;
331 *prev_frame = *next_frame = 0.0f;
340 float prev_frame, next_frame;
341 float prev_weight, next_weight;
350 next_weight = factor;
351 prev_weight = 1.0f - next_weight;
359 next_weight = current_frame - float(pso->
prev_frame);
360 prev_weight = float(pso->
next_frame) - current_frame;
362 const float total_weight = next_weight + prev_weight;
363 next_weight = (next_weight / total_weight);
364 prev_weight = (prev_weight / total_weight);
377 (*val) -= ((prev_frame_y * prev_weight) + (next_frame_y * next_weight) - (*val)) * factor;
383 (*val) += ((prev_frame_y * prev_weight) + (next_frame_y * next_weight) - (*val)) * factor;
389 (*val) =
interpf(next_frame_y, prev_frame_y, factor);
396 const float blend_factor =
fabs((factor - 0.5f) * 2);
400 (*val) =
interpf(prev_frame_y, current_frame_y, blend_factor);
404 (*val) =
interpf(next_frame_y, current_frame_y, blend_factor);
422 const char propName[])
425 char *path =
nullptr;
456 const char prop_prefix[])
470 const char *bPtr, *pPtr;
481 pPtr = strstr(bPtr, prop_prefix);
584 const FCurve *fcu_w =
nullptr, *fcu_x =
nullptr, *fcu_y =
nullptr, *fcu_z =
nullptr;
587 char *path =
nullptr;
588 float prev_frame, next_frame;
624 if (fcu_w && fcu_x && fcu_y && fcu_z) {
629 float quat_prev[4], quat_next[4];
650 float quat_curr[4], quat_breakdown[4];
655 const float interp_factor = (current_frame - pso->
prev_frame) /
658 interp_qt_qtqt(quat_breakdown, quat_prev, quat_next, interp_factor);
661 interp_qt_qtqt(quat_final, quat_breakdown, quat_curr, 1.0f + factor);
691 const float blend_factor =
fabs((factor - 0.5f) * 2);
709 for (
int idx = 0; idx < 3; idx++) {
713 float diff_val = default_value - vec[idx];
714 vec[idx] += factor * diff_val;
722 float default_values[] = {1.0f, 0.0f, 0.0f, 0.0f};
725 default_values[0] = 0.0f;
726 default_values[2] = 1.0f;
729 for (
int idx = 0; idx < 4; idx++) {
730 float diff_val = default_values[idx] - vec[idx];
731 vec[idx] += factor * diff_val;
804 if (!ob_data.
valid) {
896 mode_st =
IFACE_(
"Push Pose");
899 mode_st =
IFACE_(
"Relax Pose");
902 mode_st =
IFACE_(
"Breakdown");
905 mode_st =
IFACE_(
"Blend to Neighbor");
909 mode_st =
IFACE_(
"Sliding-Tool");
917 status.
item(
IFACE_(
"Confirm"), ICON_MOUSE_LMB);
918 status.
item(
IFACE_(
"Cancel"), ICON_EVENT_ESC);
919 status.
item(
IFACE_(
"Adjust"), ICON_MOUSE_MOVE);
929 status.
item(
"Location Only", ICON_NONE);
932 status.
item(
"Rotation Only", ICON_NONE);
935 status.
item(
"Scale Only", ICON_NONE);
938 status.
item(
"Bendy Bones Only", ICON_NONE);
941 status.
item(
"Custom Properties Only", ICON_NONE);
944 status.
item(
"Transform limits", ICON_NONE);
961 status.
item(str_offs, ICON_NONE);
1005 if (ak ==
nullptr) {
1030 if (ob_data.
valid) {
1121 bool do_pose_update =
false;
1127 switch (event->
type) {
1175 if (has_numinput ==
false) {
1177 do_pose_update =
true;
1191 float factor = value / 100;
1196 do_pose_update =
true;
1200 switch (event->
type) {
1206 do_pose_update =
true;
1212 do_pose_update =
true;
1218 do_pose_update =
true;
1224 do_pose_update =
true;
1230 do_pose_update =
true;
1238 do_pose_update =
true;
1244 do_pose_update =
true;
1250 do_pose_update =
true;
1279 if (do_pose_update) {
1345 "Weighting factor for which keyframe is favored more",
1355 "Previous Keyframe",
1356 "Frame number of keyframe immediately before the current frame",
1367 "Frame number of keyframe immediately after the current frame",
1377 "Set of properties that are affected");
1384 "Transform axis to restrict effects to");
1427 ot->name =
"Push Pose from Breakdown";
1428 ot->idname =
"POSE_OT_push";
1429 ot->description =
"Exaggerate the current pose in regards to the breakdown pose";
1484 ot->name =
"Relax Pose to Breakdown";
1485 ot->idname =
"POSE_OT_relax";
1486 ot->description =
"Make the current pose more similar to its breakdown pose";
1546 ot->name =
"Blend Pose with Rest Pose";
1547 ot->idname =
"POSE_OT_blend_with_rest";
1548 ot->description =
"Make the current pose more similar to, or further away from, the rest pose";
1605 ot->name =
"Pose Breakdowner";
1606 ot->idname =
"POSE_OT_breakdown";
1607 ot->description =
"Create a suitable breakdown pose on the current frame";
1657 ot->name =
"Blend to Neighbor";
1658 ot->idname =
"POSE_OT_blend_to_neighbor";
1659 ot->description =
"Blend from current position to previous or next keyframe";
1703 const float source_frame,
1736 current_frame_index += 1;
1738 const int bezt_index =
min_ii(current_frame_index, fcu->
totvert - 1);
1739 target_frame =
min_ff(target_frame, fcu->
bezt[bezt_index].
vec[1][0]);
1743 return target_frame;
1748 float target_frame = FLT_MIN;
1751 const FCurve *fcu =
static_cast<const FCurve *
>(ld->data);
1759 return target_frame;
1764 ListBase selected_markers = {
nullptr,
nullptr};
1768 link->
frame = marker->cfra;
1775 const float start_frame,
1776 const float end_frame,
1787 if (column->cfra <= start_frame) {
1790 if (column->cfra > end_frame) {
1794 link->
frame = column->cfra;
1814 link->
frame = column->cfra;
1828 ListBase pflinks = {
nullptr,
nullptr};
1846 ListBase target_frames = {
nullptr,
nullptr};
1850 float target_frame =
find_next_key(&pflinks, current_frame);
1852 link->
frame = target_frame;
1861 link->
frame = target_frame;
1913 "Propagate pose to first keyframe following the current frame only"},
1918 "Propagate pose to the last keyframe only (i.e. making action cyclic)"},
1923 "Propagate pose to all keyframes between current frame and 'Frame' property"},
1927 "Before Last Keyframe",
1928 "Propagate pose to all keyframes from current frame until no more are found"},
1932 "On Selected Keyframes",
1933 "Propagate pose to all selected keyframes"},
1937 "On Selected Markers",
1938 "Propagate pose to all keyframes occurring on frames with Scene Markers after the current "
1940 {0,
nullptr, 0,
nullptr,
nullptr},
1944 ot->name =
"Propagate Pose";
1945 ot->idname =
"POSE_OT_propagate";
1947 "Copy selected aspects of the current pose to subsequent poses already keyframed";
1963 "Method used to determine when to stop propagating pose to keyframes");
1970 "Frame to stop propagating frames to (for 'Before Frame' mode)",
Functions to modify FCurves.
ScrArea * CTX_wm_area(const bContext *C)
wmWindow * CTX_wm_window(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
ARegion * CTX_wm_region(const bContext *C)
View3D * CTX_wm_view3d(const bContext *C)
ViewLayer * CTX_data_view_layer(const bContext *C)
int BKE_fcurve_bezt_binarysearch_index(const BezTriple array[], float frame, int arraylen, bool *r_replace)
float evaluate_fcurve(const FCurve *fcu, float evaltime)
blender::Vector< Object * > BKE_view_layer_array_from_objects_in_mode_params(const Scene *scene, ViewLayer *view_layer, const View3D *v3d, const ObjectsInModeParams *params)
#define FOREACH_OBJECT_IN_MODE_END
#define FOREACH_OBJECT_IN_MODE_BEGIN(_scene, _view_layer, _v3d, _object_type, _object_mode, _instance)
float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, eNlaTime_ConvertModes mode)
void BKE_report(ReportList *reports, eReportType type, const char *message)
float BKE_scene_frame_get(const Scene *scene)
#define BLI_assert_msg(a, msg)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
void void BLI_freelistN(ListBase *listbase) ATTR_NONNULL(1)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
MINLINE float max_ff(float a, float b)
MINLINE int min_ii(int a, int b)
MINLINE float min_ff(float a, float b)
MINLINE float interpf(float target, float origin, float t)
void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t)
float normalize_qt(float q[4])
float normalize_qt_qt(float r[4], const float q[4])
void copy_qt_qt(float q[4], const float a[4])
void quat_to_compatible_quat(float q[4], const float a[4], const float old[4])
char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
Object is a sort of wrapper for general info.
bool ED_operator_posemode(bContext *C)
void ED_workspace_status_text(bContext *C, const char *str)
void ED_region_tag_redraw(ARegion *region)
void ED_slider_init(tSlider *slider, const wmEvent *event)
void ED_slider_property_label_set(tSlider *slider, const char *property_label)
void ED_slider_destroy(bContext *C, tSlider *slider)
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.
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, const bool only_selected)
void poseAnim_mapping_autoKeyframe(bContext *C, Scene *scene, ListBase *pfLinks, float cframe)
void poseAnim_mapping_free(ListBase *pfLinks)
void poseAnim_mapping_reset(ListBase *pfLinks)
void poseAnim_mapping_get(bContext *C, ListBase *pfLinks)
Object * poseAnim_object_get(Object *ob_)
void poseAnim_mapping_refresh(bContext *C, Scene *scene, Object *ob)
LinkData * poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, const char *path)
void reinitialize(const int64_t new_size)
void item_bool(std::string text, bool inverted, int icon1, int icon2=0)
void item(std::string text, int icon1, int icon2=0)
IndexRange index_range() const
const ActKeyColumn * ED_keylist_find_prev(const AnimKeylist *keylist, const float cfra)
void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const int saction_flag, blender::float2 range, const bool use_nla_remapping)
void ED_keylist_prepare_for_direct_access(AnimKeylist *keylist)
AnimKeylist * ED_keylist_create()
void ED_keylist_free(AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_next(const AnimKeylist *keylist, const float cfra)
const ListBase * ED_keylist_listbase(const AnimKeylist *keylist)
bool ED_keylist_is_empty(const AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_exact(const AnimKeylist *keylist, const float cfra)
void * MEM_callocN(size_t len, const char *str)
void MEM_freeN(void *vmemh)
ccl_device_inline float2 fabs(const float2 a)
KeyframeSettings get_keyframe_settings(bool from_userprefs)
SingleKeyingResult insert_vert_fcurve(FCurve *fcu, const float2 position, const KeyframeSettings &settings, eInsertKeyFlags flag)
Main Key-framing API call.
static void pose_slide_toggle_channels_mode(wmOperator *op, tPoseSlideOp *pso, ePoseSlide_Channels channel)
static wmOperatorStatus pose_slide_blend_rest_exec(bContext *C, wmOperator *op)
static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
void POSE_OT_breakdown(wmOperatorType *ot)
static wmOperatorStatus pose_slide_push_exec(bContext *C, wmOperator *op)
static wmOperatorStatus pose_slide_blend_to_neighbors_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static const EnumPropertyItem prop_channels_types[]
static wmOperatorStatus pose_slide_blend_to_neighbors_exec(bContext *C, wmOperator *op)
static void pose_slide_apply_val(tPoseSlideOp *pso, const FCurve *fcu, Object *ob, float *val)
static void pose_slide_reset(tPoseSlideOp *pso)
static void pose_slide_cancel(bContext *C, wmOperator *op)
static wmOperatorStatus pose_slide_breakdown_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus pose_slide_relax_exec(bContext *C, wmOperator *op)
static void get_keyed_frames_in_range(ListBase *pflinks, const float start_frame, const float end_frame, ListBase *target_frames)
static const EnumPropertyItem prop_axis_lock_types[]
static bool pose_slide_toggle_axis_locks(wmOperator *op, tPoseSlideOp *pso, ePoseSlide_AxisLock axis)
static wmOperatorStatus pose_slide_relax_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void pose_slide_rest_pose_apply_other_rot(tPoseSlideOp *pso, float vec[4], bool quat)
static void pose_slide_opdef_properties(wmOperatorType *ot)
static void pose_slide_refresh(bContext *C, tPoseSlideOp *pso)
static float find_next_key(ListBase *pflinks, const float start_frame)
static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
void POSE_OT_blend_with_rest(wmOperatorType *ot)
static wmOperatorStatus pose_slide_invoke_common(bContext *C, wmOperator *op, const wmEvent *event)
void POSE_OT_propagate(wmOperatorType *ot)
static void pose_slide_rest_pose_apply(bContext *C, tPoseSlideOp *pso)
static wmOperatorStatus pose_slide_breakdown_exec(bContext *C, wmOperator *op)
static void pose_slide_autoKeyframe(bContext *C, tPoseSlideOp *pso)
static float find_last_key(ListBase *pflinks)
static wmOperatorStatus pose_slide_push_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void propagate_curve_values(ListBase *pflinks, const float source_frame, ListBase *target_frames)
static wmOperatorStatus pose_propagate_exec(bContext *C, wmOperator *op)
static bool pose_frame_range_from_object_get(tPoseSlideOp *pso, Object *ob, float *prev_frame, float *next_frame)
void POSE_OT_relax(wmOperatorType *ot)
static void pose_slide_apply_vec3(tPoseSlideOp *pso, tPChanFCurveLink *pfl, float vec[3], const char propName[])
static wmOperatorStatus pose_slide_blend_rest_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static wmOperatorStatus pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
void POSE_OT_push(wmOperatorType *ot)
static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode)
static void pose_slide_rest_pose_apply_vec3(tPoseSlideOp *pso, float vec[3], float default_value)
static void get_selected_frames(ListBase *pflinks, ListBase *target_frames)
static void pose_slide_draw_status(bContext *C, tPoseSlideOp *pso)
ePosePropagate_Termination
@ POSE_PROPAGATE_LAST_KEY
@ POSE_PROPAGATE_BEFORE_FRAME
@ POSE_PROPAGATE_SELECTED_MARKERS
@ POSE_PROPAGATE_BEFORE_END
@ POSE_PROPAGATE_NEXT_KEY
@ POSE_PROPAGATE_SELECTED_KEYS
static void get_selected_marker_positions(Scene *scene, ListBase *target_frames)
static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl, const char prop_prefix[])
static void pose_slide_exit(bContext *C, wmOperator *op)
static wmOperatorStatus pose_slide_exec_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
void POSE_OT_blend_to_neighbors(wmOperatorType *ot)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
bool RNA_property_array_check(PropertyRNA *prop)
int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
PropertyType RNA_property_type(PropertyRNA *prop)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
int RNA_int_get(PointerRNA *ptr, const char *name)
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
float RNA_float_get(PointerRNA *ptr, const char *name)
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
int RNA_enum_get(PointerRNA *ptr, const char *name)
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_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)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, const int default_value, const char *ui_name, const char *ui_description)
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)
ePoseSlide_Channels channels
ePoseSlide_AxisLock axislock
blender::Array< tPoseSlideObject > ob_data_array
struct ReportList * reports
void WM_cursor_modal_set(wmWindow *win, int val)
void WM_cursor_modal_restore(wmWindow *win)
wmEventHandler_Op * WM_event_add_modal_handler(bContext *C, wmOperator *op)