42#define KEY_SIZE (10 * U.pixelsize)
43#define KEY_CENTER (UI_view2d_view_to_region_y(v2d, strip_y_rescale(seq, 0.0f)) + 4 + KEY_SIZE / 2)
69 return width / scale_x;
76 return height / scale_y;
102#define RETIME_KEY_MOUSEOVER_THRESHOLD (16.0f * UI_SCALE_FAC)
145 int right_x = right_frame;
153 r_frame = (left_distance < right_distance) ? left_frame : right_frame;
184 int best_distance = INT_MAX;
217 if (r_seq !=
nullptr) {
223 if (key ==
nullptr) {
236 if (timeline_ctx->
ed ==
nullptr) {
268 const float key_x =
key_x_get(scene, seq, key);
291 CLAMP(key_position, left_pos_min, right_pos_max);
326 if (prev_key_position > right_handle_position || key_position < left_handle_position) {
330 prev_key_position =
max_ff(prev_key_position, left_handle_position);
331 key_position =
min_ff(key_position, right_handle_position);
336 const float width_fac = 0.5f;
337 const float bottom = y_center -
size * width_fac;
338 const float top = y_center +
size * width_fac;
394 right_key_frame += 1;
432 constexpr int MAX_KEYS_IN_BATCH = 1024;
433 int point_counter = 0;
450 if (point_counter + 3 >= MAX_KEYS_IN_BATCH) {
474 const size_t label_str_maxncpy)
488 r_label_str, label_str_maxncpy,
"%d%%",
round_fl_to_int(speed * 100.0f));
494 const char *label_str,
495 const size_t label_len,
506 rect->
xmin = (xmin + xmax - width) / 2;
534 size_t label_len =
label_str_get(seq, key, label_str,
sizeof(label_str));
536 if (!
label_rect_get(timeline_ctx, strip_ctx, key, label_str, label_len, &label_rect)) {
540 uchar col[4] = {255, 255, 255, 255};
542 memset(
col, 0,
sizeof(
col));
547 timeline_ctx->
v2d, label_rect.
xmin, label_rect.
ymin, label_str, label_len,
col);
Scene * CTX_data_scene(const bContext *C)
float BLF_height(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
float BLF_width(int fontid, const char *str, size_t str_len, ResultBLF *r_info=nullptr) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2)
MINLINE int round_fl_to_int(float a)
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 int max_ii(int a, int b)
bool BLI_rctf_isect_x(const rctf *rect, float x)
BLI_INLINE int BLI_rcti_size_y(const struct rcti *rct)
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
bool BLI_rctf_isect_pt(const struct rctf *rect, float x, float y)
size_t BLI_snprintf_rlen(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
#define SEQ_STRIP_OFSBOTTOM
@ SEQ_TIMELINE_SHOW_STRIP_RETIMING
void GPU_matrix_push_projection()
void GPU_matrix_pop_projection()
@ GPU_SHADER_KEYFRAME_SHAPE
void GPU_program_point_size(bool enable)
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 Brightness Control the brightness and contrast of the input color Vector Map input vector components with curves Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert Invert a color
char char char char void UI_view2d_text_cache_add(View2D *v2d, float x, float y, const char *str, size_t str_len, const unsigned char col[4])
float UI_view2d_view_to_region_y(const View2D *v2d, float y)
void UI_view2d_view_ortho(const View2D *v2d)
View2D * UI_view2d_fromcontext(const bContext *C)
float UI_view2d_view_to_region_x(const View2D *v2d, float x)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
bool contains(const Key &key) const
void add_quad(float x1, float y1, float x2, float y2, const uchar color[4])
constexpr bool is_empty() const
void draw_keyframe_shape(const float x, const float y, float size, const bool sel, const eBezTriple_KeyframeType key_type, const eKeyframeShapeDrawOpts mode, const float alpha, const KeyframeShaderBindings *sh_bindings, const short handle_type, const short extreme_type)
ccl_device_inline float2 fabs(const float2 a)
float distance(float a, float b)
blender::Vector< Sequence * > sequencer_visible_strips_get(const bContext *C)
bool retiming_keys_can_be_displayed(const SpaceSeq *sseq)
SeqRetimingKey * retiming_mouseover_key_get(const bContext *C, const int mval[2], Sequence **r_seq)
static float pixels_to_view_width(const bContext *C, const float width)
void sequencer_retiming_draw_continuity(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx)
static void retime_speed_text_draw(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx, const SeqRetimingKey *key)
static rctf strip_box_get(const Scene *scene, const View2D *v2d, const Sequence *seq)
static bool fake_keys_draw(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx, const KeyframeShaderBindings &sh_bindings)
int left_fake_key_frame_get(const bContext *C, const Sequence *seq)
static bool retiming_fake_key_frame_clicked(const bContext *C, const Sequence *seq, const int mval[2], int &r_frame)
SeqRetimingKey * try_to_realize_fake_keys(const bContext *C, Sequence *seq, const int mval[2])
static float strip_start_screenspace_get(const Scene *scene, const View2D *v2d, const Sequence *seq)
void sequencer_retiming_keys_draw(const TimelineDrawContext *timeline_ctx, blender::Span< StripDrawContext > strips)
static float strip_y_rescale(const Sequence *seq, const float y_value)
static bool label_rect_get(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx, const SeqRetimingKey *key, const char *label_str, const size_t label_len, rctf *rect)
void sequencer_retiming_speed_draw(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx)
static SeqRetimingKey * mouse_over_key_get_from_strip(const bContext *C, const Sequence *seq, const int mval[2])
static SeqRetimingKey fake_retiming_key_init(const Scene *scene, const Sequence *seq, int key_x)
static float pixels_to_view_height(const bContext *C, const float height)
static bool can_draw_retiming(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx)
static void retime_key_draw(const TimelineDrawContext *timeline_ctx, const StripDrawContext &strip_ctx, const SeqRetimingKey *key, const KeyframeShaderBindings &sh_bindings)
static size_t label_str_get(const Sequence *seq, const SeqRetimingKey *key, char *r_label_str, const size_t label_str_maxncpy)
void realize_fake_keys(const Scene *scene, Sequence *seq)
int right_fake_key_frame_get(const bContext *C, const Sequence *seq)
bool retiming_keys_can_be_displayed(const SpaceSeq *sseq)
static float strip_end_screenspace_get(const Scene *scene, const View2D *v2d, const Sequence *seq)
static float key_x_get(const Scene *scene, const Sequence *seq, const SeqRetimingKey *key)
#define RETIME_KEY_MOUSEOVER_THRESHOLD
rctf seq_retiming_keys_box_get(const Scene *scene, const View2D *v2d, const Sequence *seq)
MutableSpan< SeqRetimingKey > SEQ_retiming_keys_get(const Sequence *seq)
int SEQ_retiming_keys_count(const Sequence *seq)
bool SEQ_retiming_data_is_editable(const Sequence *seq)
bool SEQ_retiming_is_active(const Sequence *seq)
bool SEQ_retiming_key_is_freeze_frame(const SeqRetimingKey *key)
bool SEQ_retiming_key_is_transition_type(const SeqRetimingKey *key)
bool SEQ_retiming_is_allowed(const Sequence *seq)
int SEQ_retiming_key_timeline_frame_get(const Scene *scene, const Sequence *seq, const SeqRetimingKey *key)
SeqRetimingKey * SEQ_retiming_key_get_by_timeline_frame(const Scene *scene, const Sequence *seq, const int timeline_frame)
float SEQ_retiming_key_speed_get(const Sequence *seq, const SeqRetimingKey *key)
void SEQ_retiming_data_ensure(Sequence *seq)
bool SEQ_retiming_is_last_key(const Sequence *seq, const SeqRetimingKey *key)
bool SEQ_retiming_key_is_transition_start(const SeqRetimingKey *key)
SeqRetimingKey * SEQ_retiming_add_key(const Scene *scene, Sequence *seq, const int timeline_frame)
int SEQ_time_get_rounded_sound_offset(const Scene *scene, const Sequence *seq)
int SEQ_time_left_handle_frame_get(const Scene *, const Sequence *seq)
float SEQ_time_content_end_frame_get(const Scene *scene, const Sequence *seq)
float SEQ_time_start_frame_get(const Sequence *seq)
float SEQ_time_media_playback_rate_factor_get(const Scene *scene, const Sequence *seq)
int SEQ_time_right_handle_frame_get(const Scene *scene, const Sequence *seq)
struct SequencerTimelineOverlay timeline_overlay
bool can_draw_retiming_overlay
blender::Map< SeqRetimingKey *, Sequence * > retiming_selection
void wmOrtho2_region_pixelspace(const ARegion *region)