57 #include "RNA_prototypes.h"
83 #define SLIDE_PIXEL_DISTANCE (300 * U.pixelsize)
84 #define OVERSHOOT_RANGE_DELTA 0.2f
183 "All properties, including transforms, bendy bone shape, and custom properties"},
184 {
PS_TFM_LOC,
"LOC", 0,
"Location",
"Location only"},
185 {
PS_TFM_ROT,
"ROT", 0,
"Rotation",
"Rotation only"},
188 {
PS_TFM_PROPS,
"CUSTOM", 0,
"Custom Properties",
"Custom properties"},
194 {0,
"FREE", 0,
"Free",
"All axes are affected"},
195 {
PS_LOCK_X,
"X", 0,
"X",
"Only X-axis transforms are affected"},
196 {
PS_LOCK_Y,
"Y", 0,
"Y",
"Only Y-axis transforms are affected"},
197 {
PS_LOCK_Z,
"Z", 0,
"Z",
"Only Z-axis transforms are affected"},
238 "pose slide objects data");
245 if (ob_iter ==
NULL) {
249 ob_data->
ob = ob_iter;
250 ob_data->
valid =
true;
321 if (ob_data->
valid) {
346 *prevFrameF = *nextFrameF = 0.0f;
355 float prevFrameF, nextFrameF;
412 (*val) = ((sVal * w2) + (eVal * w1));
421 const float blend_factor =
fabs((factor - 0.5f) * 2);
425 (*val) = (cVal * (1 - blend_factor)) + (sVal * blend_factor);
429 (*val) = (cVal * (1 - blend_factor)) + (eVal * blend_factor);
448 const char propName[])
481 const char prop_prefix[])
497 const char *bPtr, *pPtr;
508 pPtr = strstr(bPtr, prop_prefix);
536 &
ptr, prop, (
int)tval);
565 float prevFrameF, nextFrameF;
600 if (fcu_w && fcu_x && fcu_y && fcu_z) {
605 float quat_prev[4], quat_next[4];
626 float quat_curr[4], quat_breakdown[4];
684 for (
int idx = 0; idx < 3; idx++) {
687 float diff_val = default_value - vec[idx];
702 float default_values[] = {1.0f, 0.0f, 0.0f, 0.0f};
705 default_values[0] = 0.0f;
706 default_values[2] = 1.0f;
708 for (
int idx = 0; idx < 4; idx++) {
709 float diff_val = default_values[idx] - vec[idx];
795 if (!ob_data->
valid) {
889 char bone_vis_str[50];
893 strcpy(mode_str,
TIP_(
"Push Pose"));
896 strcpy(mode_str,
TIP_(
"Relax Pose"));
899 strcpy(mode_str,
TIP_(
"Breakdown"));
902 strcpy(mode_str,
TIP_(
"Blend to Neighbor"));
907 strcpy(mode_str,
TIP_(
"Sliding-Tool"));
913 STRNCPY(axis_str,
TIP_(
"[X]/Y/Z axis only (X to clear)"));
916 STRNCPY(axis_str,
TIP_(
"X/[Y]/Z axis only (Y to clear)"));
919 STRNCPY(axis_str,
TIP_(
"X/Y/[Z] axis only (Z to clear)"));
924 STRNCPY(axis_str,
TIP_(
"X/Y/Z = Axis Constraint"));
936 TIP_(
"[G]/R/S/B/C - Location only (G to clear) | %s"),
942 TIP_(
"G/[R]/S/B/C - Rotation only (R to clear) | %s"),
948 TIP_(
"G/R/[S]/B/C - Scale only (S to clear) | %s"),
952 STRNCPY(limits_str,
TIP_(
"G/R/S/[B]/C - Bendy Bone properties only (B to clear) | %s"));
955 STRNCPY(limits_str,
TIP_(
"G/R/S/B/[C] - Custom Properties only (C to clear) | %s"));
958 STRNCPY(limits_str,
TIP_(
"G/R/S/B/C - Limit to Transform/Property Set"));
962 STRNCPY(bone_vis_str,
TIP_(
"[H] - Toggle bone visibility"));
972 BLI_snprintf(status_str,
sizeof(status_str),
"%s: %s | %s", mode_str, str_offs, limits_str);
1050 if (ob_data->
valid) {
1145 bool do_pose_update =
false;
1151 switch (event->
type) {
1201 if (has_numinput ==
false) {
1203 do_pose_update =
true;
1217 float factor = value / 100;
1218 CLAMP(factor, 0.0f, 1.0f);
1223 do_pose_update =
true;
1227 switch (event->
type) {
1233 do_pose_update =
true;
1239 do_pose_update =
true;
1245 do_pose_update =
true;
1251 do_pose_update =
true;
1257 do_pose_update =
true;
1265 do_pose_update =
true;
1271 do_pose_update =
true;
1277 do_pose_update =
true;
1303 if (do_pose_update) {
1369 "Weighting factor for which keyframe is favored more",
1379 "Previous Keyframe",
1380 "Frame number of keyframe immediately before the current frame",
1391 "Frame number of keyframe immediately after the current frame",
1401 "Set of properties that are affected");
1408 "Transform axis to restrict effects to");
1451 ot->
name =
"Push Pose from Breakdown";
1453 ot->
description =
"Exaggerate the current pose in regards to the breakdown pose";
1508 ot->
name =
"Relax Pose to Breakdown";
1510 ot->
description =
"Make the current pose more similar to its breakdown pose";
1564 ot->
name =
"Push Pose from Rest Pose";
1566 ot->
description =
"Push the current pose further away from the rest pose";
1621 ot->
name =
"Relax Pose to Rest Pose";
1623 ot->
description =
"Make the current pose more similar to the rest pose";
1678 ot->
name =
"Pose Breakdowner";
1680 ot->
description =
"Create a suitable breakdown pose on the current frame";
1728 ot->
name =
"Blend to Neighbor";
1729 ot->
idname =
"POSE_OT_blend_to_neighbor";
1730 ot->
description =
"Blend from current position to previous or next keyframe";
1795 float endFrame = startFrame;
1931 float refVal = 0.0f;
1959 if (fcu->
bezt[match].
vec[1][0] < startFrame) {
1971 for (bezt = &fcu->
bezt[i]; i < fcu->totvert; i++, bezt++) {
1981 if (first ==
false) {
1987 if (i != (fcu->
totvert - 1)) {
2016 bezt->
vec[0][1] = bezt->
vec[1][1] = bezt->
vec[2][1] = refVal;
2060 for (pfl = pflinks.
first; pfl; pfl = pfl->
next) {
2101 "Propagate pose to all keyframes after current frame that don't change (Default behavior)"},
2106 "Propagate pose to first keyframe following the current frame only"},
2111 "Propagate pose to the last keyframe only (i.e. making action cyclic)"},
2116 "Propagate pose to all keyframes between current frame and 'Frame' property"},
2120 "Before Last Keyframe",
2121 "Propagate pose to all keyframes from current frame until no more are found"},
2125 "On Selected Keyframes",
2126 "Propagate pose to all selected keyframes"},
2130 "On Selected Markers",
2131 "Propagate pose to all keyframes occurring on frames with Scene Markers after the current "
2137 ot->
name =
"Propagate Pose";
2140 "Copy selected aspects of the current pose to subsequent poses already keyframed";
2156 "Method used to determine when to stop propagating pose to keyframes");
2163 "Frame to stop propagating frames to (for 'Before Frame' mode)",
typedef float(TangentPoint)[2]
struct ScrArea * CTX_wm_area(const bContext *C)
struct Scene * CTX_data_scene(const bContext *C)
struct ViewLayer * CTX_data_view_layer(const bContext *C)
struct View3D * CTX_wm_view3d(const bContext *C)
struct ARegion * CTX_wm_region(const bContext *C)
struct wmWindow * CTX_wm_window(const bContext *C)
float evaluate_fcurve(struct FCurve *fcu, float evaltime)
int BKE_fcurve_bezt_binarysearch_index(const struct BezTriple array[], float frame, int arraylen, bool *r_replace)
#define BKE_view_layer_array_from_objects_in_mode_unique_data(view_layer, v3d, r_len, mode)
#define FOREACH_OBJECT_IN_MODE_END
#define FOREACH_OBJECT_IN_MODE_BEGIN(_view_layer, _v3d, _object_type, _object_mode, _instance)
float BKE_nla_tweakedit_remap(struct AnimData *adt, float cframe, short mode)
General operations, lookup, etc. for blender objects.
void BKE_report(ReportList *reports, eReportType type, const char *message)
#define BLI_assert_msg(a, msg)
BLI_INLINE bool BLI_listbase_is_empty(const struct ListBase *lb)
void void BLI_freelistN(struct ListBase *listbase) ATTR_NONNULL(1)
MINLINE int round_fl_to_int(float a)
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])
size_t size_t char * BLI_sprintfN(const char *__restrict format,...) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC ATTR_PRINTF_FORMAT(1
#define STRNCPY(dst, src)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define BEZT_ISSEL_ANY(bezt)
Object is a sort of wrapper for general info.
@ ACTKEYBLOCK_FLAG_STATIC_HOLD
bool ED_operator_posemode(struct bContext *C)
void ED_area_status_text(ScrArea *area, const char *str)
void ED_region_tag_redraw(struct ARegion *region)
void ED_workspace_status_text(struct bContext *C, const char *str)
void ED_slider_init(struct tSlider *slider, const struct wmEvent *event)
void ED_slider_status_string_get(const struct tSlider *slider, char *status_string, size_t size_of_status_string)
float ED_slider_factor_get(struct tSlider *slider)
bool ED_slider_modal(struct tSlider *slider, const struct wmEvent *event)
void ED_slider_factor_set(struct tSlider *slider, float factor)
void ED_slider_destroy(struct bContext *C, struct tSlider *slider)
struct tSlider * ED_slider_create(struct bContext *C)
Read Guarded memory(de)allocation.
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position CLAMP
void ED_markers_make_cfra_list(ListBase *markers, ListBase *lb, short only_sel)
void poseAnim_mapping_free(ListBase *pfLinks)
void poseAnim_mapping_reset(ListBase *pfLinks)
LinkData * poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, const char *path)
void poseAnim_mapping_autoKeyframe(struct bContext *C, struct Scene *scene, ListBase *pfLinks, float cframe)
void poseAnim_mapping_get(struct bContext *C, ListBase *pfLinks)
void poseAnim_mapping_refresh(struct bContext *C, struct Scene *scene, struct Object *ob)
struct Object * poseAnim_object_get(struct Object *ob_)
void fcurve_to_keylist(AnimData *adt, FCurve *fcu, AnimKeylist *keylist, const int saction_flag)
AnimKeylist * ED_keylist_create()
bool ED_keylist_is_empty(const struct AnimKeylist *keylist)
void ED_keylist_prepare_for_direct_access(AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_next(const AnimKeylist *keylist, const float cfra)
int actkeyblock_get_valid_hold(const ActKeyColumn *ac)
void ED_keylist_free(AnimKeylist *keylist)
const ActKeyColumn * ED_keylist_find_prev(const AnimKeylist *keylist, const float cfra)
const ActKeyColumn * ED_keylist_find_exact(const AnimKeylist *keylist, const float cfra)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
ccl_device_inline float2 fabs(const float2 &a)
static void pose_slide_toggle_channels_mode(wmOperator *op, tPoseSlideOp *pso, ePoseSlide_Channels channel)
void POSE_OT_relax_rest(wmOperatorType *ot)
static int pose_slide_invoke_common(bContext *C, wmOperator *op, const wmEvent *event)
static void pose_slide_apply(bContext *C, tPoseSlideOp *pso)
void POSE_OT_breakdown(wmOperatorType *ot)
static int pose_slide_push_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int pose_slide_relax_rest_exec(bContext *C, wmOperator *op)
static int pose_slide_relax_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int pose_slide_relax_rest_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static const EnumPropertyItem prop_channels_types[]
union tPosePropagate_ModeData tPosePropagate_ModeData
static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event)
static void pose_slide_reset(tPoseSlideOp *pso)
static bool pose_propagate_get_refVal(Object *ob, FCurve *fcu, float *value)
struct tPoseSlideOp tPoseSlideOp
static void pose_slide_cancel(bContext *C, wmOperator *op)
static int pose_slide_blend_to_neighbors_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int pose_slide_push_rest_exec(bContext *C, wmOperator *op)
static const EnumPropertyItem prop_axis_lock_types[]
static bool pose_slide_toggle_axis_locks(wmOperator *op, tPoseSlideOp *pso, ePoseSlide_AxisLock axis)
static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, Object *ob, float *val)
static int pose_slide_exec_common(bContext *C, wmOperator *op, tPoseSlideOp *pso)
void POSE_OT_push_rest(wmOperatorType *ot)
static void pose_slide_rest_pose_apply_other_rot(tPoseSlideOp *pso, float vec[4], bool quat)
struct tPoseSlideObject tPoseSlideObject
static void pose_slide_opdef_properties(wmOperatorType *ot)
static void pose_slide_refresh(bContext *C, tPoseSlideOp *pso)
static void pose_slide_apply_quat(tPoseSlideOp *pso, tPChanFCurveLink *pfl)
static float pose_propagate_get_boneHoldEndFrame(tPChanFCurveLink *pfl, float startFrame)
static int pose_slide_blend_to_neighbors_exec(bContext *C, wmOperator *op)
void POSE_OT_propagate(wmOperatorType *ot)
static void pose_slide_rest_pose_apply(bContext *C, tPoseSlideOp *pso)
static bool pose_frame_range_from_object_get(tPoseSlideOp *pso, Object *ob, float *prevFrameF, float *nextFrameF)
static void pose_slide_autoKeyframe(bContext *C, tPoseSlideOp *pso)
static int pose_slide_breakdown_exec(bContext *C, wmOperator *op)
static int pose_slide_push_rest_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static int pose_slide_push_exec(bContext *C, wmOperator *op)
static void pose_propagate_fcurve(wmOperator *op, Object *ob, FCurve *fcu, float startFrame, tPosePropagate_ModeData modeData)
static int pose_propagate_exec(bContext *C, wmOperator *op)
void POSE_OT_relax(wmOperatorType *ot)
static void pose_slide_apply_vec3(tPoseSlideOp *pso, tPChanFCurveLink *pfl, float vec[3], const char propName[])
static int pose_slide_relax_exec(bContext *C, wmOperator *op)
void POSE_OT_push(wmOperatorType *ot)
static int pose_slide_init(bContext *C, wmOperator *op, ePoseSlide_Modes mode)
static int pose_slide_breakdown_invoke(bContext *C, wmOperator *op, const wmEvent *event)
static void pose_slide_rest_pose_apply_vec3(tPoseSlideOp *pso, float vec[3], float default_value)
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_SMART_HOLDS
@ POSE_PROPAGATE_NEXT_KEY
@ POSE_PROPAGATE_SELECTED_KEYS
static void pose_slide_apply_props(tPoseSlideOp *pso, tPChanFCurveLink *pfl, const char prop_prefix[])
static void pose_slide_exit(bContext *C, wmOperator *op)
void POSE_OT_blend_to_neighbors(wmOperatorType *ot)
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
bool RNA_property_array_check(PropertyRNA *prop)
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
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)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
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)
int RNA_property_enum_get(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)
int RNA_enum_get(PointerRNA *ptr, const char *name)
PropertyRNA * RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
PropertyRNA * RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value, float hardmin, float hardmax, const char *ui_name, const char *ui_description, float softmin, float softmax)
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
PropertyRNA * RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value, int hardmin, int hardmax, const char *ui_name, const char *ui_description, int softmin, int softmax)
PropertyRNA * RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items, int default_value, const char *ui_name, const char *ui_description)
bool RNA_path_resolve_property(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
struct ActKeyColumn * next
struct bPoseChannel * pchan
struct IDProperty * oldprops
struct tPChanFCurveLink * next
ePoseSlide_Channels channels
ePoseSlide_AxisLock axislock
struct AnimKeylist * keylist
struct tPoseSlideObject * ob_data_array
int(* invoke)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
int(* modal)(struct bContext *, struct wmOperator *, const struct wmEvent *) ATTR_WARN_UNUSED_RESULT
bool(* poll)(struct bContext *) ATTR_WARN_UNUSED_RESULT
void(* cancel)(struct bContext *, struct wmOperator *)
int(* exec)(struct bContext *, struct wmOperator *) ATTR_WARN_UNUSED_RESULT
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)