Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorok what <ok_what>2022-04-21 01:38:39 +0300
committerRichard Antalik <richardantalik@gmail.com>2022-04-21 03:01:10 +0300
commite16ff4132e35cab6a757105741b8563679bda0bd (patch)
tree4a73093fb7bed83d95f4140365605309d18b4220 /source/blender/sequencer
parent2bd9cbe40532143bcc520d2ec55e5ff4f4eceebb (diff)
VSE: Add frame selected operator for preview
This operator moves the view to show the selected visible strips. Reviewed By: ISS Differential Revision: https://developer.blender.org/D14222
Diffstat (limited to 'source/blender/sequencer')
-rw-r--r--source/blender/sequencer/SEQ_transform.h16
-rw-r--r--source/blender/sequencer/intern/strip_transform.c15
2 files changed, 31 insertions, 0 deletions
diff --git a/source/blender/sequencer/SEQ_transform.h b/source/blender/sequencer/SEQ_transform.h
index eb910a5a5d1..a342dfe10a2 100644
--- a/source/blender/sequencer/SEQ_transform.h
+++ b/source/blender/sequencer/SEQ_transform.h
@@ -119,6 +119,22 @@ void SEQ_image_preview_unit_from_px(const struct Scene *scene,
const float co_src[2],
float co_dst[2]);
+/**
+ * Get viewport axis aligned bounding box from a collection of sequences.
+ * The collection must have one or more strips
+ *
+ * \param scene: Scene in which strips are located
+ * \param strips: Collection of strips to get the bounding box from
+ * \param apply_rotation: Include sequence rotation transform in the bounding box calculation
+ * \param r_min: Minimum x and y values
+ * \param r_max: Maximum x and y values
+ */
+void SEQ_image_transform_bounding_box_from_collection(struct Scene *scene,
+ struct SeqCollection *strips,
+ bool apply_rotation,
+ float r_min[2],
+ float r_max[2]);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c
index 087e2610bd6..e614dfa9b82 100644
--- a/source/blender/sequencer/intern/strip_transform.c
+++ b/source/blender/sequencer/intern/strip_transform.c
@@ -517,3 +517,18 @@ void SEQ_image_preview_unit_from_px(const Scene *scene, const float co_src[2], f
co_dst[0] = co_src[0] / scene->r.xsch;
co_dst[1] = co_src[1] / scene->r.ysch;
}
+
+void SEQ_image_transform_bounding_box_from_collection(
+ Scene *scene, SeqCollection *strips, bool apply_rotation, float r_min[2], float r_max[2])
+{
+ Sequence *seq;
+
+ INIT_MINMAX2(r_min, r_max);
+ SEQ_ITERATOR_FOREACH (seq, strips) {
+ float quad[4][2];
+ SEQ_image_transform_quad_get(scene, seq, apply_rotation, quad);
+ for (int i = 0; i < 4; i++) {
+ minmax_v2v2_v2(r_min, r_max, quad[i]);
+ }
+ }
+}