57 float frame_index_max = strip->
len - 1;
61 frame_index_max = end - sta;
73 frame_index = end - timeline_frame;
76 frame_index = timeline_frame - sta;
79 frame_index =
max_ff(frame_index, 0);
81 const float scene_fps = float(scene->
r.frs_sec) / float(scene->
r.frs_sec_base);
86 frame_index = retiming_factor * frame_index_max;
89 frame_index =
clamp_f(frame_index, 0, frame_index_max);
91 if (strip->
strobe > 1.0f) {
92 frame_index -=
fmodf(
double(frame_index),
double(strip->
strobe));
123 if (strip->scene_sound) {
124 int startofs = strip->startofs;
125 int endofs = strip->endofs;
126 if (strip->startofs + strip->start < start) {
127 startofs = start - strip->start;
130 if (strip->start + strip->len - strip->endofs > end) {
131 endofs = strip->start + strip->len - end;
134 double offset_time = 0.0f;
135 if (strip->sound !=
nullptr) {
136 offset_time = strip->sound->offset_time + strip->sound_offset;
141 strip->start + startofs,
142 strip->start + strip->len - endofs,
143 startofs + strip->anim_startofs,
158 if (strip_meta ==
nullptr) {
186 strip_meta->
enddisp = strip_end;
196 if (strip->
input1 ==
nullptr && strip->
input2 ==
nullptr) {
229 for (
Strip *strip : effects) {
235 for (
Strip *strip : effects) {
244 const bool do_skip_mute,
245 const bool do_center,
246 const bool do_unselected)
251 int dist, best_dist, best_frame = timeline_frame;
252 int strip_frames[2], strip_frames_tot;
260 return timeline_frame;
270 if (do_unselected && (strip->flag &
SELECT)) {
278 strip_frames_tot = 1;
284 strip_frames_tot = 2;
287 for (
i = 0;
i < strip_frames_tot;
i++) {
288 const int strip_frame = strip_frames[
i];
294 if (strip_frame < timeline_frame) {
295 dist = timeline_frame - strip_frame;
299 if (strip_frame > timeline_frame) {
300 dist = strip_frame - timeline_frame;
304 dist =
abs(strip_frame - timeline_frame);
308 if (dist < best_dist) {
309 best_frame = strip_frame;
320 switch (strip->
type) {
327 if (strip_anim->
anim ==
nullptr) {
333 if (strip->
clip !=
nullptr) {
338 if (strip->
scene !=
nullptr) {
339 return float(strip->
scene->
r.frs_sec) / strip->
scene->
r.frs_sec_base;
348 r_rect->
xmin = scene->
r.sfra;
349 r_rect->
xmax = scene->
r.efra + 1;
356 if (seqbase ==
nullptr) {
364 rect->
ymax = std::max(rect->
ymax, strip->channel + 1.0f);
376 const int timeline_frame)
378 for (
Strip *strip : strips) {
388 const int initial_frame,
394 const int sfra = int(rectf.
xmin);
395 const int efra = int(rectf.
xmax);
396 int timeline_frame = initial_frame;
403 for (; timeline_frame >= sfra; timeline_frame--) {
409 timeline_frame = initial_frame;
413 for (; timeline_frame <= efra; timeline_frame++) {
421 for (; timeline_frame <= efra; timeline_frame++) {
423 const int gap_end_frame = timeline_frame;
454 const float scene_fps = float(scene->
r.frs_sec) / float(scene->
r.frs_sec_base);
473 strip->
start = timeline_frame;
506 if (timeline_frame >= right_handle_orig_frame) {
507 timeline_frame = right_handle_orig_frame - 1;
533 if (timeline_frame <= left_handle_orig_frame) {
534 timeline_frame = left_handle_orig_frame + 1;
538 strip->
enddisp = timeline_frame;
560 float subframe_delta,
568 if (delta == 0 && (!slip_keyframes || subframe_delta == 0.0f)) {
574 if (strip->
input1 !=
nullptr || strip->
input2 !=
nullptr) {
599 if (slip_keyframes) {
600 float anim_offset = delta;
602 anim_offset += subframe_delta;
621 const Scene *scene,
Strip *strip,
int frame_delta,
float subframe_delta,
bool slip_keyframes)
float BKE_movieclip_get_fps(struct MovieClip *clip)
void BKE_sound_move_scene_sound(const struct Scene *scene, void *handle, int startframe, int endframe, int frameskip, double audio_offset)
#define LISTBASE_FOREACH(type, var, list)
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
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 clamp_f(float value, float min, float max)
MINLINE int max_ii(int a, int b)
float MOV_get_fps(const MovieReader *anim)
bool render_is_muted(const ListBase *channels, const Strip *strip)
Strip * lookup_meta_by_strip(Editing *ed, const Strip *key)
int time_right_handle_frame_get(const Scene *scene, const Strip *strip)
VectorSet< Strip * > query_all_strips(ListBase *seqbase)
ListBase * channels_displayed_get(const Editing *ed)
float time_content_end_frame_get(const Scene *scene, const Strip *strip)
bool time_has_right_still_frames(const Scene *scene, const Strip *strip)
float time_media_playback_rate_factor_get(const Strip *strip, const float scene_fps)
void timeline_boundbox(const Scene *scene, const ListBase *seqbase, rctf *r_rect)
bool time_has_left_still_frames(const Scene *scene, const Strip *strip)
static int metastrip_end_get(Strip *strip_meta)
int retiming_key_timeline_frame_get(const Scene *scene, const Strip *strip, const SeqRetimingKey *key)
float give_frame_index(const Scene *scene, const Strip *strip, float timeline_frame)
Editing * editing_get(const Scene *scene)
static bool strip_exists_at_frame(const Scene *scene, blender::Span< Strip * > strips, const int timeline_frame)
blender::Span< Strip * > SEQ_lookup_effects_by_strip(Editing *ed, const Strip *key)
float time_strip_fps_get(Scene *scene, Strip *strip)
int time_left_handle_frame_get(const Scene *, const Strip *strip)
void offset_animdata(const Scene *scene, Strip *strip, float ofs)
void seq_time_gap_info_get(const Scene *scene, ListBase *seqbase, const int initial_frame, GapInfo *r_gap_info)
void strip_open_anim_file(Scene *scene, Strip *strip, bool openfile)
int time_get_rounded_sound_offset(const Strip *strip, const float frames_per_second)
float time_start_frame_get(const Strip *strip)
void strip_time_update_effects_strip_range(const Scene *scene, const blender::Span< Strip * > effects)
bool transform_single_image_check(const Strip *strip)
int time_strip_length_get(const Scene *scene, const Strip *strip)
bool retiming_is_active(const Strip *strip)
void timeline_expand_boundbox(const Scene *scene, const ListBase *seqbase, rctf *rect)
void time_update_meta_strip_range(const Scene *scene, Strip *strip_meta)
bool time_strip_intersects_frame(const Scene *scene, const Strip *strip, const int timeline_frame)
void time_slip_strip(const Scene *scene, Strip *strip, int frame_delta, float subframe_delta, bool slip_keyframes)
void strip_time_translate_handles(const Scene *scene, Strip *strip, const int offset)
void time_start_frame_set(const Scene *scene, Strip *strip, int timeline_frame)
void strip_update_sound_bounds_recursive(const Scene *scene, Strip *strip_meta)
static void strip_time_slip_strip_ex(const Scene *scene, Strip *strip, int delta, float subframe_delta, bool slip_keyframes, bool recursed)
void timeline_init_boundbox(const Scene *scene, rctf *r_rect)
bool time_has_still_frames(const Scene *scene, const Strip *strip)
static void strip_update_sound_bounds_recursive_impl(const Scene *scene, Strip *strip_meta, int start, int end)
void time_left_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame)
static int metastrip_start_get(Strip *strip_meta)
void time_right_handle_frame_set(const Scene *scene, Strip *strip, int timeline_frame)
SeqRetimingKey * retiming_last_key_get(const Strip *strip)
float strip_retiming_evaluate(const Strip *strip, const float frame_index)
int time_find_next_prev_edit(Scene *scene, int timeline_frame, const short side, const bool do_skip_mute, const bool do_center, const bool do_unselected)
void strip_time_effect_range_set(const Scene *scene, Strip *strip)
struct MovieReader * anim
float media_playback_rate