[Bf-blender-cvs] [82ae7b990ac] master: Fix T90633: Frame all doesn't use meta range

Andrea Beconcini noreply at git.blender.org
Mon Oct 25 06:51:39 CEST 2021


Commit: 82ae7b990acfa2c522895322eb052b90f0c3b83a
Author: Andrea Beconcini
Date:   Mon Oct 25 06:47:51 2021 +0200
Branches: master
https://developer.blender.org/rB82ae7b990acfa2c522895322eb052b90f0c3b83a

Fix T90633: Frame all doesn't use meta range

This commit fixes T90633, it changes the behavior of the `Frame All`
operation when the user is tabbed into a metastrip: instead of using
the scene timeline's range, `Frame All` uses the current metastrip's
range.

Reviewed By: ISS

Differential Revision: https://developer.blender.org/D12974

===================================================================

M	source/blender/editors/space_sequencer/sequencer_view.c
M	source/blender/sequencer/SEQ_time.h
M	source/blender/sequencer/intern/strip_time.c

===================================================================

diff --git a/source/blender/editors/space_sequencer/sequencer_view.c b/source/blender/editors/space_sequencer/sequencer_view.c
index 79593b0bbb0..2d2e7de7135 100644
--- a/source/blender/editors/space_sequencer/sequencer_view.c
+++ b/source/blender/editors/space_sequencer/sequencer_view.c
@@ -92,7 +92,14 @@ static int sequencer_view_all_exec(bContext *C, wmOperator *op)
   Scene *scene = CTX_data_scene(C);
   const Editing *ed = SEQ_editing_get(scene);
 
-  SEQ_timeline_boundbox(scene, SEQ_active_seqbase_get(ed), &box);
+  SEQ_timeline_init_boundbox(scene, &box);
+  MetaStack *ms = SEQ_meta_stack_active_get(ed);
+  /* Use meta strip range instead of scene. */
+  if (ms != NULL) {
+    box.xmin = ms->disp_range[0] - 1;
+    box.xmax = ms->disp_range[1] + 1;
+  }
+  SEQ_timeline_expand_boundbox(SEQ_active_seqbase_get(ed), &box);
   UI_view2d_smooth_view(C, region, &box, smooth_viewtx);
   return OPERATOR_FINISHED;
 }
diff --git a/source/blender/sequencer/SEQ_time.h b/source/blender/sequencer/SEQ_time.h
index c9024614dfd..df3c9a40409 100644
--- a/source/blender/sequencer/SEQ_time.h
+++ b/source/blender/sequencer/SEQ_time.h
@@ -32,6 +32,8 @@ struct Scene;
 struct Sequence;
 struct rctf;
 
+void SEQ_timeline_init_boundbox(const struct Scene *scene, struct rctf *rect);
+void SEQ_timeline_expand_boundbox(const struct ListBase *seqbase, struct rctf *rect);
 void SEQ_timeline_boundbox(const struct Scene *scene,
                            const struct ListBase *seqbase,
                            struct rctf *rect);
diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c
index 1c5f4c3ab76..92ac580f3b1 100644
--- a/source/blender/sequencer/intern/strip_time.c
+++ b/source/blender/sequencer/intern/strip_time.c
@@ -376,19 +376,27 @@ float SEQ_time_sequence_get_fps(Scene *scene, Sequence *seq)
 }
 
 /**
- * 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 seqbase: ListBase in which strips are located
- * \param rect: data structure describing rectangle, that will be filled in by this function
+ * \param scene: the Scene instance whose timeline boundaries are extracted from
+ * \param rect: output parameter to be filled with timeline boundaries
  */
-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->xmax = scene->r.efra + 1;
   rect->ymin = 0.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) {
     return;
   }
@@ -406,6 +414,19 @@ void SEQ_timeline_boundbox(const Scene *scene, const ListBase *seqbase, rctf *re
   }
 }
 
+/**
+ * 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)
 {
   Sequence *seq;



More information about the Bf-blender-cvs mailing list