Changeset View
Changeset View
Standalone View
Standalone View
source/blender/sequencer/intern/strip_time.c
| Show First 20 Lines • Show All 370 Lines • ▼ Show 20 Lines | case SEQ_TYPE_SCENE: | ||||
| return (float)seq->scene->r.frs_sec / seq->scene->r.frs_sec_base; | return (float)seq->scene->r.frs_sec / seq->scene->r.frs_sec_base; | ||||
| } | } | ||||
| break; | break; | ||||
| } | } | ||||
| return 0.0f; | return 0.0f; | ||||
| } | } | ||||
| /** | /** | ||||
| * Define boundary rectangle of sequencer timeline and fill in rect data | * Initialize given rectangle with the Scene's timeline boundaries. | ||||
| * | * | ||||
| * \param scene: Scene in which strips are located | * \param scene: the Scene instance whose timeline boundaries are extracted from | ||||
| * \param seqbase: ListBase in which strips are located | * \param rect: output parameter to be filled with timeline boundaries | ||||
| * \param rect: data structure describing rectangle, that will be filled in by this function | |||||
| */ | */ | ||||
| void SEQ_timeline_boundbox(const Scene *scene, const ListBase *seqbase, rctf *rect) | void SEQ_timeline_init_boundbox(const Scene *scene, rctf *rect) | ||||
| { | { | ||||
| rect->xmin = scene->r.sfra; | rect->xmin = scene->r.sfra; | ||||
| rect->xmax = scene->r.efra + 1; | rect->xmax = scene->r.efra + 1; | ||||
| rect->ymin = 0.0f; | rect->ymin = 0.0f; | ||||
| rect->ymax = 8.0f; | rect->ymax = 8.0f; | ||||
| } | |||||
| /** | |||||
| * Stretch the given rectangle to include the given strips boundaries | |||||
| * | |||||
| * \param seqbase: ListBase in which strips are located | |||||
| * \param rect: output parameter to be filled with strips' boundaries | |||||
| */ | |||||
| void SEQ_timeline_expand_boundbox(const ListBase *seqbase, rctf *rect) | |||||
| { | |||||
| if (seqbase == NULL) { | if (seqbase == NULL) { | ||||
| return; | return; | ||||
| } | } | ||||
| LISTBASE_FOREACH (Sequence *, seq, seqbase) { | LISTBASE_FOREACH (Sequence *, seq, seqbase) { | ||||
| if (rect->xmin > seq->startdisp - 1) { | if (rect->xmin > seq->startdisp - 1) { | ||||
| rect->xmin = seq->startdisp - 1; | rect->xmin = seq->startdisp - 1; | ||||
| } | } | ||||
| if (rect->xmax < seq->enddisp + 1) { | if (rect->xmax < seq->enddisp + 1) { | ||||
| rect->xmax = seq->enddisp + 1; | rect->xmax = seq->enddisp + 1; | ||||
| } | } | ||||
| if (rect->ymax < seq->machine + 2) { | if (rect->ymax < seq->machine + 2) { | ||||
| rect->ymax = seq->machine + 2; | rect->ymax = seq->machine + 2; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /** | |||||
| * Define boundary rectangle of sequencer timeline and fill in rect data | |||||
| * | |||||
| * \param scene: Scene in which strips are located | |||||
| * \param seqbase: ListBase in which strips are located | |||||
| * \param rect: data structure describing rectangle, that will be filled in by this function | |||||
| */ | |||||
| void SEQ_timeline_boundbox(const Scene *scene, const ListBase *seqbase, rctf *rect) | |||||
| { | |||||
| SEQ_timeline_init_boundbox(scene, rect); | |||||
| SEQ_timeline_expand_boundbox(seqbase, rect); | |||||
| } | |||||
| static bool strip_exists_at_frame(SeqCollection *all_strips, const int timeline_frame) | static bool strip_exists_at_frame(SeqCollection *all_strips, const int timeline_frame) | ||||
| { | { | ||||
| Sequence *seq; | Sequence *seq; | ||||
| SEQ_ITERATOR_FOREACH (seq, all_strips) { | SEQ_ITERATOR_FOREACH (seq, all_strips) { | ||||
| if (SEQ_time_strip_intersects_frame(seq, timeline_frame)) { | if (SEQ_time_strip_intersects_frame(seq, timeline_frame)) { | ||||
| return true; | return true; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 69 Lines • Show Last 20 Lines | |||||