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:
authorSebastian Parborg <darkdefende@gmail.com>2021-10-08 13:09:27 +0300
committerSebastian Parborg <darkdefende@gmail.com>2021-10-08 13:14:45 +0300
commit482806c81678e351ff171c68a757386a5b2d4676 (patch)
tree7f9b1dfccb0683584af937ec77b440cb6ccaa413 /source/blender/sequencer/intern/strip_transform.c
parenta3e2cc0bb7fe47fa1122cd19c4fa8a5aa59f761c (diff)
VSE: Implement the bounding box (xform) tool in the seq preview window
Make the "xform" tool/gizmo available for strip transformations in the sequencer preview window. Because of the amount of hacks needed to make the gizmo work nicely with multiple strips at the same time, it was decided to only show the translate gizmo when multiple strips are selected. This is because the transforms with multiple strips would appear buggy because of our lack of shearing support in the transform system. There is also currently no way to properly sync the gizmo drawing with the transform when using multiple strips. Reviewed By: Richard Antalik, Campbell Barton Differential Revision: http://developer.blender.org/D12729
Diffstat (limited to 'source/blender/sequencer/intern/strip_transform.c')
-rw-r--r--source/blender/sequencer/intern/strip_transform.c54
1 files changed, 35 insertions, 19 deletions
diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c
index f014c7a312a..ec504c0c9b6 100644
--- a/source/blender/sequencer/intern/strip_transform.c
+++ b/source/blender/sequencer/intern/strip_transform.c
@@ -473,40 +473,41 @@ void SEQ_image_transform_origin_offset_pixelspace_get(const Scene *scene,
*
* \param scene: Scene in which strips are located
* \param seq: Sequence to calculate image transform origin
+ * \param apply_rotation: Apply sequence rotation transform to the quad
* \param r_origin: return value
*/
-
-void SEQ_image_transform_final_quad_get(const Scene *scene,
- const Sequence *seq,
- float r_quad[4][2])
+static void seq_image_transform_quad_get_ex(const Scene *scene,
+ const Sequence *seq,
+ bool apply_rotation,
+ float r_quad[4][2])
{
StripTransform *transform = seq->strip->transform;
StripCrop *crop = seq->strip->crop;
- int imgage_size[2] = {scene->r.xsch, scene->r.ysch};
+ int image_size[2] = {scene->r.xsch, scene->r.ysch};
if (ELEM(seq->type, SEQ_TYPE_MOVIE, SEQ_TYPE_IMAGE)) {
- imgage_size[0] = seq->strip->stripdata->orig_width;
- imgage_size[1] = seq->strip->stripdata->orig_height;
+ image_size[0] = seq->strip->stripdata->orig_width;
+ image_size[1] = seq->strip->stripdata->orig_height;
}
float transform_matrix[3][3];
loc_rot_size_to_mat3(transform_matrix,
(const float[]){transform->xofs, transform->yofs},
- transform->rotation,
+ apply_rotation ? transform->rotation : 0.0f,
(const float[]){transform->scale_x, transform->scale_y});
- const float origin[2] = {imgage_size[0] * transform->origin[0],
- imgage_size[1] * transform->origin[1]};
- const float pivot[2] = {origin[0] - (imgage_size[0] / 2), origin[1] - (imgage_size[1] / 2)};
+ const float origin[2] = {image_size[0] * transform->origin[0],
+ image_size[1] * transform->origin[1]};
+ const float pivot[2] = {origin[0] - (image_size[0] / 2), origin[1] - (image_size[1] / 2)};
transform_pivot_set_m3(transform_matrix, pivot);
- r_quad[0][0] = (imgage_size[0] / 2) - crop->right;
- r_quad[0][1] = (imgage_size[1] / 2) - crop->top;
- r_quad[1][0] = (imgage_size[0] / 2) - crop->right;
- r_quad[1][1] = (-imgage_size[1] / 2) + crop->bottom;
- r_quad[2][0] = (-imgage_size[0] / 2) + crop->left;
- r_quad[2][1] = (-imgage_size[1] / 2) + crop->bottom;
- r_quad[3][0] = (-imgage_size[0] / 2) + crop->left;
- r_quad[3][1] = (imgage_size[1] / 2) - crop->top;
+ r_quad[0][0] = (image_size[0] / 2) - crop->right;
+ r_quad[0][1] = (image_size[1] / 2) - crop->top;
+ r_quad[1][0] = (image_size[0] / 2) - crop->right;
+ r_quad[1][1] = (-image_size[1] / 2) + crop->bottom;
+ r_quad[2][0] = (-image_size[0] / 2) + crop->left;
+ r_quad[2][1] = (-image_size[1] / 2) + crop->bottom;
+ r_quad[3][0] = (-image_size[0] / 2) + crop->left;
+ r_quad[3][1] = (image_size[1] / 2) - crop->top;
mul_m3_v2(transform_matrix, r_quad[0]);
mul_m3_v2(transform_matrix, r_quad[1]);
@@ -521,6 +522,21 @@ void SEQ_image_transform_final_quad_get(const Scene *scene,
mul_v2_v2(r_quad[3], mirror);
}
+void SEQ_image_transform_quad_get(const Scene *scene,
+ const Sequence *seq,
+ bool apply_rotation,
+ float r_quad[4][2])
+{
+ seq_image_transform_quad_get_ex(scene, seq, apply_rotation, r_quad);
+}
+
+void SEQ_image_transform_final_quad_get(const Scene *scene,
+ const Sequence *seq,
+ float r_quad[4][2])
+{
+ seq_image_transform_quad_get_ex(scene, seq, true, r_quad);
+}
+
void SEQ_image_preview_unit_to_px(const Scene *scene, const float co_src[2], float co_dst[2])
{
co_dst[0] = co_src[0] * scene->r.xsch;