Blender V4.3
pose_slide.cc File Reference
#include "MEM_guardedalloc.h"
#include "BLI_array.hh"
#include "BLI_blenlib.h"
#include "BLI_math_rotation.h"
#include "BLT_translation.hh"
#include "DNA_anim_types.h"
#include "DNA_armature_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_vec_types.h"
#include "BKE_fcurve.hh"
#include "BKE_nla.hh"
#include "BKE_context.hh"
#include "BKE_layer.hh"
#include "BKE_report.hh"
#include "BKE_scene.hh"
#include "BKE_unit.hh"
#include "RNA_access.hh"
#include "RNA_define.hh"
#include "RNA_prototypes.hh"
#include "WM_api.hh"
#include "WM_types.hh"
#include "UI_interface.hh"
#include "UI_resources.hh"
#include "ED_keyframes_edit.hh"
#include "ED_keyframes_keylist.hh"
#include "ED_markers.hh"
#include "ED_numinput.hh"
#include "ED_screen.hh"
#include "ED_util.hh"
#include "ANIM_fcurve.hh"
#include "armature_intern.hh"

Go to the source code of this file.

Classes

struct  tPoseSlideObject
 
struct  tPoseSlideOp
 
struct  FrameLink
 

Macros

#define SLIDE_PIXEL_DISTANCE   (300 * U.pixelsize)
 
#define OVERSHOOT_RANGE_DELTA   0.2f
 

Enumerations

enum  ePoseSlide_AxisLock { PS_LOCK_X = (1 << 0) , PS_LOCK_Y = (1 << 1) , PS_LOCK_Z = (1 << 2) }
 
enum  ePoseSlide_Modes {
  POSESLIDE_PUSH = 0 , POSESLIDE_RELAX , POSESLIDE_BREAKDOWN , POSESLIDE_BLEND_REST ,
  POSESLIDE_BLEND
}
 
enum  ePoseSlide_Channels {
  PS_TFM_ALL = 0 , PS_TFM_LOC , PS_TFM_ROT , PS_TFM_SIZE ,
  PS_TFM_BBONE_SHAPE , PS_TFM_PROPS
}
 
enum  ePosePropagate_Termination {
  POSE_PROPAGATE_LAST_KEY = 0 , POSE_PROPAGATE_NEXT_KEY , POSE_PROPAGATE_BEFORE_FRAME , POSE_PROPAGATE_BEFORE_END ,
  POSE_PROPAGATE_SELECTED_KEYS , POSE_PROPAGATE_SELECTED_MARKERS
}
 

Functions

static int pose_slide_init (bContext *C, wmOperator *op, ePoseSlide_Modes mode)
 
static void pose_slide_exit (bContext *C, wmOperator *op)
 
static void pose_slide_refresh (bContext *C, tPoseSlideOp *pso)
 
static bool pose_frame_range_from_object_get (tPoseSlideOp *pso, Object *ob, float *prev_frame, float *next_frame)
 
static void pose_slide_apply_val (tPoseSlideOp *pso, const FCurve *fcu, Object *ob, float *val)
 
static void pose_slide_apply_vec3 (tPoseSlideOp *pso, tPChanFCurveLink *pfl, float vec[3], const char propName[])
 
static void pose_slide_apply_props (tPoseSlideOp *pso, tPChanFCurveLink *pfl, const char prop_prefix[])
 
static void pose_slide_apply_quat (tPoseSlideOp *pso, tPChanFCurveLink *pfl)
 
static void pose_slide_rest_pose_apply_vec3 (tPoseSlideOp *pso, float vec[3], float default_value)
 
static void pose_slide_rest_pose_apply_other_rot (tPoseSlideOp *pso, float vec[4], bool quat)
 
static void pose_slide_rest_pose_apply (bContext *C, tPoseSlideOp *pso)
 
static void pose_slide_apply (bContext *C, tPoseSlideOp *pso)
 
static void pose_slide_autoKeyframe (bContext *C, tPoseSlideOp *pso)
 
static void pose_slide_reset (tPoseSlideOp *pso)
 
static void pose_slide_draw_status (bContext *C, tPoseSlideOp *pso)
 
static int pose_slide_invoke_common (bContext *C, wmOperator *op, const wmEvent *event)
 
static void pose_slide_toggle_channels_mode (wmOperator *op, tPoseSlideOp *pso, ePoseSlide_Channels channel)
 
static bool pose_slide_toggle_axis_locks (wmOperator *op, tPoseSlideOp *pso, ePoseSlide_AxisLock axis)
 
static int pose_slide_modal (bContext *C, wmOperator *op, const wmEvent *event)
 
static void pose_slide_cancel (bContext *C, wmOperator *op)
 
static int pose_slide_exec_common (bContext *C, wmOperator *op, tPoseSlideOp *pso)
 
static void pose_slide_opdef_properties (wmOperatorType *ot)
 
static int pose_slide_push_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int pose_slide_push_exec (bContext *C, wmOperator *op)
 
void POSE_OT_push (wmOperatorType *ot)
 
static int pose_slide_relax_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int pose_slide_relax_exec (bContext *C, wmOperator *op)
 
void POSE_OT_relax (wmOperatorType *ot)
 
static int pose_slide_blend_rest_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int pose_slide_blend_rest_exec (bContext *C, wmOperator *op)
 
void POSE_OT_blend_with_rest (wmOperatorType *ot)
 
static int pose_slide_breakdown_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int pose_slide_breakdown_exec (bContext *C, wmOperator *op)
 
void POSE_OT_breakdown (wmOperatorType *ot)
 
static int pose_slide_blend_to_neighbors_invoke (bContext *C, wmOperator *op, const wmEvent *event)
 
static int pose_slide_blend_to_neighbors_exec (bContext *C, wmOperator *op)
 
void POSE_OT_blend_to_neighbors (wmOperatorType *ot)
 
static void propagate_curve_values (ListBase *pflinks, const float source_frame, ListBase *target_frames)
 
static float find_next_key (ListBase *pflinks, const float start_frame)
 
static float find_last_key (ListBase *pflinks)
 
static void get_selected_marker_positions (Scene *scene, ListBase *target_frames)
 
static void get_keyed_frames_in_range (ListBase *pflinks, const float start_frame, const float end_frame, ListBase *target_frames)
 
static void get_selected_frames (ListBase *pflinks, ListBase *target_frames)
 
static int pose_propagate_exec (bContext *C, wmOperator *op)
 
void POSE_OT_propagate (wmOperatorType *ot)
 

Variables

static const EnumPropertyItem prop_channels_types []
 
static const EnumPropertyItem prop_axis_lock_types []
 

Detailed Description

Pose 'Sliding' Tools

  • Push & Relax, Breakdowner

    These tools provide the animator with various capabilities for interactively controlling the spacing of poses, but also for 'pushing' and/or 'relaxing' extremes as they see fit.

  • Propagate

    This tool copies elements of the selected pose to successive keyframes, allowing the animator to go back and modify the poses for some "static" pose controls, without having to repeatedly doing a "next paste" dance.

  • Pose Sculpting (TODO)

    This is yet to be implemented, but the idea here is to use sculpting techniques to make it easier to pose rigs by allowing rigs to be manipulated using a familiar paint-based interface.

Definition in file pose_slide.cc.

Macro Definition Documentation

◆ OVERSHOOT_RANGE_DELTA

#define OVERSHOOT_RANGE_DELTA   0.2f

Definition at line 79 of file pose_slide.cc.

◆ SLIDE_PIXEL_DISTANCE

#define SLIDE_PIXEL_DISTANCE   (300 * U.pixelsize)

Definition at line 78 of file pose_slide.cc.

Enumeration Type Documentation

◆ ePosePropagate_Termination

Enumerator
POSE_PROPAGATE_LAST_KEY 

Only do on the last keyframe.

POSE_PROPAGATE_NEXT_KEY 

Stop after the next keyframe.

POSE_PROPAGATE_BEFORE_FRAME 

Stop after the specified frame.

POSE_PROPAGATE_BEFORE_END 

Stop when we run out of keyframes.

POSE_PROPAGATE_SELECTED_KEYS 

Only do on keyframes that are selected.

POSE_PROPAGATE_SELECTED_MARKERS 

Only do on the frames where markers are selected.

Definition at line 1682 of file pose_slide.cc.

◆ ePoseSlide_AxisLock

Axis Locks.

Enumerator
PS_LOCK_X 
PS_LOCK_Y 
PS_LOCK_Z 

Definition at line 85 of file pose_slide.cc.

◆ ePoseSlide_Channels

Transforms/Channels to Affect.

Enumerator
PS_TFM_ALL 
PS_TFM_LOC 
PS_TFM_ROT 
PS_TFM_SIZE 
PS_TFM_BBONE_SHAPE 
PS_TFM_PROPS 

Definition at line 104 of file pose_slide.cc.

◆ ePoseSlide_Modes

Pose Sliding Modes.

Enumerator
POSESLIDE_PUSH 

Exaggerate the pose.

POSESLIDE_RELAX 

soften the pose.

POSESLIDE_BREAKDOWN 

Slide between the endpoint poses, finding a 'soft' spot.

POSESLIDE_BLEND_REST 
POSESLIDE_BLEND 

Definition at line 92 of file pose_slide.cc.

Function Documentation

◆ find_last_key()

static float find_last_key ( ListBase * pflinks)
static

Definition at line 1749 of file pose_slide.cc.

References FCurve::bezt, LISTBASE_FOREACH, max_ff(), FCurve::totvert, and BezTriple::vec.

Referenced by pose_propagate_exec().

◆ find_next_key()

static float find_next_key ( ListBase * pflinks,
const float start_frame )
static

◆ get_keyed_frames_in_range()

static void get_keyed_frames_in_range ( ListBase * pflinks,
const float start_frame,
const float end_frame,
ListBase * target_frames )
static

◆ get_selected_frames()

static void get_selected_frames ( ListBase * pflinks,
ListBase * target_frames )
static

◆ get_selected_marker_positions()

static void get_selected_marker_positions ( Scene * scene,
ListBase * target_frames )
static

◆ pose_frame_range_from_object_get()

static bool pose_frame_range_from_object_get ( tPoseSlideOp * pso,
Object * ob,
float * prev_frame,
float * next_frame )
static

Although this lookup is not ideal, we won't be dealing with a lot of objects at a given time. But if it comes to that we can instead store prev/next frame in the tPChanFCurveLink.

Definition at line 313 of file pose_slide.cc.

References tPoseSlideOp::ob_data_array.

Referenced by pose_slide_apply_quat(), and pose_slide_apply_val().

◆ POSE_OT_blend_to_neighbors()

◆ POSE_OT_blend_with_rest()

◆ POSE_OT_breakdown()

◆ POSE_OT_propagate()

◆ POSE_OT_push()

◆ POSE_OT_relax()

◆ pose_propagate_exec()

◆ pose_slide_apply()

◆ pose_slide_apply_props()

◆ pose_slide_apply_quat()

◆ pose_slide_apply_val()

◆ pose_slide_apply_vec3()

static void pose_slide_apply_vec3 ( tPoseSlideOp * pso,
tPChanFCurveLink * pfl,
float vec[3],
const char propName[] )
static

◆ pose_slide_autoKeyframe()

static void pose_slide_autoKeyframe ( bContext * C,
tPoseSlideOp * pso )
static

Perform auto-key-framing after changes were made + confirmed.

Definition at line 865 of file pose_slide.cc.

References tPoseSlideOp::current_frame, tPoseSlideOp::pfLinks, poseAnim_mapping_autoKeyframe(), and tPoseSlideOp::scene.

Referenced by pose_slide_exec_common(), and pose_slide_modal().

◆ pose_slide_blend_rest_exec()

static int pose_slide_blend_rest_exec ( bContext * C,
wmOperator * op )
static

◆ pose_slide_blend_rest_invoke()

static int pose_slide_blend_rest_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ pose_slide_blend_to_neighbors_exec()

static int pose_slide_blend_to_neighbors_exec ( bContext * C,
wmOperator * op )
static

◆ pose_slide_blend_to_neighbors_invoke()

static int pose_slide_blend_to_neighbors_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

◆ pose_slide_breakdown_exec()

static int pose_slide_breakdown_exec ( bContext * C,
wmOperator * op )
static

◆ pose_slide_breakdown_invoke()

static int pose_slide_breakdown_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

Operator invoke() - for 'breakdown' mode.

Definition at line 1576 of file pose_slide.cc.

References OPERATOR_CANCELLED, pose_slide_exit(), pose_slide_init(), pose_slide_invoke_common(), and POSESLIDE_BREAKDOWN.

Referenced by POSE_OT_breakdown().

◆ pose_slide_cancel()

static void pose_slide_cancel ( bContext * C,
wmOperator * op )
static

Common code for cancel()

Definition at line 1313 of file pose_slide.cc.

References pose_slide_exit().

Referenced by POSE_OT_blend_to_neighbors(), POSE_OT_blend_with_rest(), POSE_OT_breakdown(), POSE_OT_push(), and POSE_OT_relax().

◆ pose_slide_draw_status()

◆ pose_slide_exec_common()

◆ pose_slide_exit()

◆ pose_slide_init()

static int pose_slide_init ( bContext * C,
wmOperator * op,
ePoseSlide_Modes mode )
static

◆ pose_slide_invoke_common()

◆ pose_slide_modal()

◆ pose_slide_opdef_properties()

◆ pose_slide_push_exec()

static int pose_slide_push_exec ( bContext * C,
wmOperator * op )
static

Operator exec() callback - for push.

Definition at line 1417 of file pose_slide.cc.

References wmOperator::customdata, OPERATOR_CANCELLED, pose_slide_exec_common(), pose_slide_exit(), pose_slide_init(), and POSESLIDE_PUSH.

Referenced by POSE_OT_push().

◆ pose_slide_push_invoke()

static int pose_slide_push_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

Operator invoke() callback for 'push from breakdown' mode.

Definition at line 1402 of file pose_slide.cc.

References OPERATOR_CANCELLED, pose_slide_exit(), pose_slide_init(), pose_slide_invoke_common(), and POSESLIDE_PUSH.

Referenced by POSE_OT_push().

◆ pose_slide_refresh()

static void pose_slide_refresh ( bContext * C,
tPoseSlideOp * pso )
static

◆ pose_slide_relax_exec()

static int pose_slide_relax_exec ( bContext * C,
wmOperator * op )
static

◆ pose_slide_relax_invoke()

static int pose_slide_relax_invoke ( bContext * C,
wmOperator * op,
const wmEvent * event )
static

Invoke callback - for 'relax to breakdown' mode.

Definition at line 1459 of file pose_slide.cc.

References OPERATOR_CANCELLED, pose_slide_exit(), pose_slide_init(), pose_slide_invoke_common(), and POSESLIDE_RELAX.

Referenced by POSE_OT_relax().

◆ pose_slide_reset()

static void pose_slide_reset ( tPoseSlideOp * pso)
static

Reset changes made to current pose.

Definition at line 874 of file pose_slide.cc.

References tPoseSlideOp::pfLinks, and poseAnim_mapping_reset().

Referenced by pose_slide_modal().

◆ pose_slide_rest_pose_apply()

◆ pose_slide_rest_pose_apply_other_rot()

static void pose_slide_rest_pose_apply_other_rot ( tPoseSlideOp * pso,
float vec[4],
bool quat )
static

Definition at line 715 of file pose_slide.cc.

References ED_slider_factor_get(), and tPoseSlideOp::slider.

Referenced by pose_slide_rest_pose_apply().

◆ pose_slide_rest_pose_apply_vec3()

static void pose_slide_rest_pose_apply_vec3 ( tPoseSlideOp * pso,
float vec[3],
float default_value )
static

◆ pose_slide_toggle_axis_locks()

static bool pose_slide_toggle_axis_locks ( wmOperator * op,
tPoseSlideOp * pso,
ePoseSlide_AxisLock axis )
static

Handle an event to toggle axis locks - returns whether any change in state is needed.

Definition at line 1098 of file pose_slide.cc.

References tPoseSlideOp::axislock, tPoseSlideOp::channels, ELEM, PS_TFM_ALL, PS_TFM_BBONE_SHAPE, PS_TFM_PROPS, wmOperator::ptr, and RNA_enum_set().

Referenced by pose_slide_modal().

◆ pose_slide_toggle_channels_mode()

static void pose_slide_toggle_channels_mode ( wmOperator * op,
tPoseSlideOp * pso,
ePoseSlide_Channels channel )
static

Handle an event to toggle channels mode.

Definition at line 1075 of file pose_slide.cc.

References tPoseSlideOp::axislock, tPoseSlideOp::channels, PS_TFM_ALL, wmOperator::ptr, and RNA_enum_set().

Referenced by pose_slide_modal().

◆ propagate_curve_values()

static void propagate_curve_values ( ListBase * pflinks,
const float source_frame,
ListBase * target_frames )
static

Definition at line 1705 of file pose_slide.cc.

References FCurve::bezt, evaluate_fcurve(), INSERTKEY_NOFLAGS, and LISTBASE_FOREACH.

Referenced by pose_propagate_exec().

Variable Documentation

◆ prop_axis_lock_types

const EnumPropertyItem prop_axis_lock_types[]
static
Initial value:
= {
{0, "FREE", 0, "Free", "All axes are affected"},
{PS_LOCK_X, "X", 0, "X", "Only X-axis transforms are affected"},
{PS_LOCK_Y, "Y", 0, "Y", "Only Y-axis transforms are affected"},
{PS_LOCK_Z, "Z", 0, "Z", "Only Z-axis transforms are affected"},
{0, nullptr, 0, nullptr, nullptr},
}
@ PS_LOCK_Z
Definition pose_slide.cc:88
@ PS_LOCK_Y
Definition pose_slide.cc:87
@ PS_LOCK_X
Definition pose_slide.cc:86

Definition at line 186 of file pose_slide.cc.

Referenced by pose_slide_opdef_properties().

◆ prop_channels_types

const EnumPropertyItem prop_channels_types[]
static
Initial value:
= {
"ALL",
0,
"All Properties",
"All properties, including transforms, bendy bone shape, and custom properties"},
{PS_TFM_LOC, "LOC", 0, "Location", "Location only"},
{PS_TFM_ROT, "ROT", 0, "Rotation", "Rotation only"},
{PS_TFM_SIZE, "SIZE", 0, "Scale", "Scale only"},
{PS_TFM_BBONE_SHAPE, "BBONE", 0, "Bendy Bone", "Bendy Bone shape properties"},
{PS_TFM_PROPS, "CUSTOM", 0, "Custom Properties", "Custom properties"},
{0, nullptr, 0, nullptr, nullptr},
}
@ PS_TFM_SIZE
@ PS_TFM_LOC
@ PS_TFM_PROPS
@ PS_TFM_ALL
@ PS_TFM_BBONE_SHAPE
@ PS_TFM_ROT

Property enum for ePoseSlide_Channels.

Definition at line 171 of file pose_slide.cc.

Referenced by pose_slide_opdef_properties().