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},
229 if (ob_iter ==
nullptr) {
233 ob_data->
ob = ob_iter;
234 ob_data->
valid =
true;
328 *prev_frame = *next_frame = 0.0f;
337 float prev_frame, next_frame;
338 float prev_weight, next_weight;
347 next_weight = factor;
348 prev_weight = 1.0f - next_weight;
359 const float total_weight = next_weight + prev_weight;
360 next_weight = (next_weight / total_weight);
361 prev_weight = (prev_weight / total_weight);
374 (*val) -= ((prev_frame_y * prev_weight) + (next_frame_y * next_weight) - (*val)) * factor;
380 (*val) += ((prev_frame_y * prev_weight) + (next_frame_y * next_weight) - (*val)) * factor;
386 (*val) =
interpf(next_frame_y, prev_frame_y, factor);
393 const float blend_factor =
fabs((factor - 0.5f) * 2);
397 (*val) =
interpf(prev_frame_y, current_frame_y, blend_factor);
401 (*val) =
interpf(next_frame_y, current_frame_y, blend_factor);
419 const char propName[])
422 char *path =
nullptr;
453 const char prop_prefix[])
467 const char *bPtr, *pPtr;
478 pPtr = strstr(bPtr, prop_prefix);
581 const FCurve *fcu_w =
nullptr, *fcu_x =
nullptr, *fcu_y =
nullptr, *fcu_z =
nullptr;
584 char *path =
nullptr;
585 float prev_frame, next_frame;
621 if (fcu_w && fcu_x && fcu_y && fcu_z) {
626 float quat_prev[4], quat_next[4];
647 float quat_curr[4], quat_breakdown[4];
652 const float interp_factor = (current_frame - pso->
prev_frame) /
655 interp_qt_qtqt(quat_breakdown, quat_prev, quat_next, interp_factor);
658 interp_qt_qtqt(quat_final, quat_breakdown, quat_curr, 1.0f + factor);
688 const float blend_factor =
fabs((factor - 0.5f) * 2);
706 for (
int idx = 0; idx < 3; idx++) {
710 float diff_val = default_value - vec[idx];
711 vec[idx] += factor * diff_val;
719 float default_values[] = {1.0f, 0.0f, 0.0f, 0.0f};
722 default_values[0] = 0.0f;
723 default_values[2] = 1.0f;
726 for (
int idx = 0; idx < 4; idx++) {
727 float diff_val = default_values[idx] - vec[idx];
728 vec[idx] += factor * diff_val;
801 if (!ob_data.
valid) {
893 mode_st =
IFACE_(
"Push Pose");
896 mode_st =
IFACE_(
"Relax Pose");
899 mode_st =
IFACE_(
"Breakdown");
902 mode_st =
IFACE_(
"Blend to Neighbor");
906 mode_st =
IFACE_(
"Sliding-Tool");
926 status.item(
"Location Only", ICON_NONE);
929 status.item(
"Rotation Only", ICON_NONE);
932 status.item(
"Scale Only", ICON_NONE);
935 status.item(
"Bendy Bones Only", ICON_NONE);
938 status.item(
"Custom Properties Only", ICON_NONE);
941 status.item(
"Transform limits", ICON_NONE);
958 status.item(str_offs, ICON_NONE);
1004 if (ak ==
nullptr) {
1029 if (ob_data.
valid) {
1120 bool do_pose_update =
false;
1126 switch (event->
type) {
1176 if (has_numinput ==
false) {
1178 do_pose_update =
true;
1192 float factor = value / 100;
1197 do_pose_update =
true;
1201 switch (event->
type) {
1207 do_pose_update =
true;
1213 do_pose_update =
true;
1219 do_pose_update =
true;
1225 do_pose_update =
true;
1231 do_pose_update =
true;
1239 do_pose_update =
true;
1245 do_pose_update =
true;
1251 do_pose_update =
true;
1280 if (do_pose_update) {
1346 "Weighting factor for which keyframe is favored more",
1356 "Previous Keyframe",
1357 "Frame number of keyframe immediately before the current frame",
1368 "Frame number of keyframe immediately after the current frame",
1378 "Set of properties that are affected");
1385 "Transform axis to restrict effects to");
1428 ot->name =
"Push Pose from Breakdown";
1429 ot->idname =
"POSE_OT_push";
1430 ot->description =
"Exaggerate the current pose in regards to the breakdown pose";
1485 ot->name =
"Relax Pose to Breakdown";
1486 ot->idname =
"POSE_OT_relax";
1487 ot->description =
"Make the current pose more similar to its breakdown pose";
1547 ot->name =
"Blend Pose with Rest Pose";
1548 ot->idname =
"POSE_OT_blend_with_rest";
1549 ot->description =
"Make the current pose more similar to, or further away from, the rest pose";
1606 ot->name =
"Pose Breakdowner";
1607 ot->idname =
"POSE_OT_breakdown";
1608 ot->description =
"Create a suitable breakdown pose on the current frame";
1658 ot->name =
"Blend to Neighbor";
1659 ot->idname =
"POSE_OT_blend_to_neighbor";
1660 ot->description =
"Blend from current position to previous or next keyframe";
1704 const float source_frame,
1737 current_frame_index += 1;
1739 const int bezt_index =
min_ii(current_frame_index, fcu->
totvert - 1);
1740 target_frame =
min_ff(target_frame, fcu->
bezt[bezt_index].
vec[1][0]);
1744 return target_frame;
1749 float target_frame = FLT_MIN;
1752 const FCurve *fcu =
static_cast<const FCurve *
>(ld->data);
1760 return target_frame;
1765 ListBase selected_markers = {
nullptr,
nullptr};
1769 link->
frame = marker->cfra;
1776 const float start_frame,
1777 const float end_frame,
1788 if (column->cfra <= start_frame) {
1791 if (column->cfra > end_frame) {
1795 link->
frame = column->cfra;
1815 link->
frame = column->cfra;
1829 ListBase pflinks = {
nullptr,
nullptr};
1847 ListBase target_frames = {
nullptr,
nullptr};
1851 float target_frame =
find_next_key(&pflinks, current_frame);
1853 link->
frame = target_frame;
1862 link->
frame = target_frame;
1914 "Propagate pose to first keyframe following the current frame only"},
1919 "Propagate pose to the last keyframe only (i.e. making action cyclic)"},
1924 "Propagate pose to all keyframes between current frame and 'Frame' property"},
1928 "Before Last Keyframe",
1929 "Propagate pose to all keyframes from current frame until no more are found"},
1933 "On Selected Keyframes",
1934 "Propagate pose to all selected keyframes"},
1938 "On Selected Markers",
1939 "Propagate pose to all keyframes occurring on frames with Scene Markers after the current "
1941 {0,
nullptr, 0,
nullptr,
nullptr},
1945 ot->name =
"Propagate Pose";
1946 ot->idname =
"POSE_OT_propagate";
1948 "Copy selected aspects of the current pose to subsequent poses already keyframed";
1964 "Method used to determine when to stop propagating pose to keyframes");
1971 "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)
#define FOREACH_OBJECT_IN_MODE_END
blender::Vector< Object * > BKE_view_layer_array_from_objects_in_mode_unique_data(const Scene *scene, ViewLayer *view_layer, const View3D *v3d, eObjectMode mode)
#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.
void ED_area_status_text(ScrArea *area, const char *str)
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)
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)