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/editors/transform/transform_mode_resize.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/editors/transform/transform_mode_resize.c')
-rw-r--r--source/blender/editors/transform/transform_mode_resize.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform_mode_resize.c b/source/blender/editors/transform/transform_mode_resize.c
index 65f4623b3be..28323460626 100644
--- a/source/blender/editors/transform/transform_mode_resize.c
+++ b/source/blender/editors/transform/transform_mode_resize.c
@@ -201,14 +201,45 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
ED_area_status_text(t->area, str);
}
-void initResize(TransInfo *t)
+void initResize(TransInfo *t, float mouse_dir_constraint[3])
{
t->mode = TFM_RESIZE;
t->transform = applyResize;
t->tsnap.applySnap = ApplySnapResize;
t->tsnap.distance = ResizeBetween;
- initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
+ if (is_zero_v3(mouse_dir_constraint)) {
+ initMouseInputMode(t, &t->mouse, INPUT_SPRING_FLIP);
+ }
+ else {
+ int mval_start[2], mval_end[2];
+ float mval_dir[3], t_mval[2];
+ float viewmat[3][3];
+
+ copy_m3_m4(viewmat, t->viewmat);
+ mul_v3_m3v3(mval_dir, viewmat, mouse_dir_constraint);
+ normalize_v2(mval_dir);
+ if (is_zero_v2(mval_dir)) {
+ /* The screen space direction is orthogonal to the view.
+ * Fall back to constraining on the Y axis. */
+ mval_dir[0] = 0;
+ mval_dir[1] = 1;
+ }
+
+ mval_start[0] = t->center2d[0];
+ mval_start[1] = t->center2d[1];
+
+ t_mval[0] = t->mval[0] - mval_start[0];
+ t_mval[1] = t->mval[1] - mval_start[1];
+ project_v2_v2v2(mval_dir, t_mval, mval_dir);
+
+ mval_end[0] = t->center2d[0] + mval_dir[0];
+ mval_end[1] = t->center2d[1] + mval_dir[1];
+
+ setCustomPoints(t, &t->mouse, mval_end, mval_start);
+
+ initMouseInputMode(t, &t->mouse, INPUT_CUSTOM_RATIO);
+ }
t->flag |= T_NULL_ONE;
t->num.val_flag[0] |= NUM_NULL_ONE;