68 frame_index = end - timeline_frame;
71 frame_index = timeline_frame - sta;
74 frame_index =
max_ff(frame_index, 0);
76 const float scene_fps =
float(scene->
r.frs_sec) /
float(scene->
r.frs_sec_base);
83 frame_index = retiming_factor * strip->
len;
86 float frame_index_max = strip->is_effect() ? end - sta : strip->
len - 1;
87 frame_index =
clamp_f(frame_index, 0, frame_index_max);
89 if (strip->
strobe > 1.0f) {
90 frame_index -=
fmodf(
double(frame_index),
double(strip->
strobe));
121 if (strip->scene_sound) {
122 int startofs = strip->startofs;
123 int endofs = strip->endofs;
124 if (strip->startofs + strip->start < start) {
125 startofs = start - strip->start;
128 if (strip->start + strip->len - strip->endofs > end) {
129 endofs = strip->start + strip->len - end;
132 double offset_time = 0.0f;
133 if (strip->sound !=
nullptr) {
134 offset_time = strip->sound->offset_time + strip->sound_offset;
139 strip->start + startofs,
140 strip->start + strip->len - endofs,
141 startofs + strip->anim_startofs,
156 if (strip_meta ==
nullptr) {
182 strip_meta->
enddisp = strip_end;
192 if (strip->
input1 ==
nullptr && strip->
input2 ==
nullptr) {
225 for (
Strip *strip : effects) {
231 for (
Strip *strip : effects) {
240 const bool do_skip_mute,
241 const bool do_center,
242 const bool do_unselected)
247 int dist, best_dist, best_frame = timeline_frame;
248 int strip_frames[2], strip_frames_tot;
256 return timeline_frame;
266 if (do_unselected && (strip->flag &
SELECT)) {
274 strip_frames_tot = 1;
280 strip_frames_tot = 2;
283 for (
i = 0;
i < strip_frames_tot;
i++) {
284 const int strip_frame = strip_frames[
i];
290 if (strip_frame < timeline_frame) {
291 dist = timeline_frame - strip_frame;
295 if (strip_frame > timeline_frame) {
296 dist = strip_frame - timeline_frame;
300 dist =
abs(strip_frame - timeline_frame);
304 if (dist < best_dist) {
305 best_frame = strip_frame;
316 switch (strip->
type) {
323 if (strip_anim->
anim ==
nullptr) {
329 if (strip->
clip !=
nullptr) {
334 if (strip->
scene !=
nullptr) {
344 r_rect->
xmin = scene->
r.sfra;
345 r_rect->
xmax = scene->
r.efra + 1;
352 if (seqbase ==
nullptr) {
360 rect->
ymax = std::max(rect->
ymax, strip->channel + 1.0f);
372 const int timeline_frame)
374 for (
Strip *strip : strips) {
384 const int initial_frame,
390 const int sfra = int(rectf.
xmin);
391 const int efra = int(rectf.
xmax);
392 int timeline_frame = initial_frame;
399 for (; timeline_frame >= sfra; timeline_frame--) {
405 timeline_frame = initial_frame;
409 for (; timeline_frame <= efra; timeline_frame++) {
417 for (; timeline_frame <= efra; timeline_frame++) {
419 const int gap_end_frame = timeline_frame;
450 const float scene_fps =
float(scene->
r.frs_sec) /
float(scene->
r.frs_sec_base);
469 strip->
start = timeline_frame;
502 if (timeline_frame >= right_handle_orig_frame) {
503 timeline_frame = right_handle_orig_frame - 1;
529 if (timeline_frame <= left_handle_orig_frame) {
530 timeline_frame = left_handle_orig_frame + 1;
534 strip->
enddisp = timeline_frame;
543 int left_handle_timeline_frame,
544 int right_handle_timeline_frame)
565 float subframe_delta,
570 strip->
sound_offset += subframe_delta / scene->frames_per_second();
573 if (delta == 0 && (!slip_keyframes || subframe_delta == 0.0f)) {
579 if (strip->
input1 !=
nullptr || strip->
input2 !=
nullptr) {
585 if (!recursed && strip->is_effect()) {
604 if (slip_keyframes) {
605 float anim_offset = delta;
607 anim_offset += subframe_delta;
626 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_handles_frame_set(const Scene *scene, Strip *strip, int left_handle_timeline_frame, int right_handle_timeline_frame)
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