Commit Graph

100 Commits

Author SHA1 Message Date
Miikka Heikkinen
fccc02de96 QmlDesigner: Allow starting free drag on initial selection press
Changed object selection to be done on press instead of click, and
the initial press now also starts free drag of the selected object
after a short distance moved to prevent accidental drags.

Change-Id: I61656661cd734d167ef9f8db42d986f0e97402a3
Fixes: QDS-2376
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-07-03 11:35:49 +00:00
Miikka Heikkinen
38ded4ffea QmlDesigner: Turn the 3D edit light on initially for lightless scenes
Change-Id: Ib840adec751604f08b5135b3e3088b7ce663685a
Fixes: QDS-2316
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-06-29 13:30:07 +00:00
Miikka Heikkinen
85bcae2c38 QmlDesigner: Handle active scene id change properly on edit 3D view
The scene id shown on the corner of edit 3D view is updated and
toolstates are also stored under the new id.

Change-Id: Ib3ac2f2bb829a5d908e22932c313c76bd4143592
Fixes: QDS-2277
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-06-29 10:19:45 +00:00
Eike Ziller
40a14070d3 Merge remote-tracking branch 'origin/4.13'
Change-Id: Ie67085fcbb4150c60f0253312e19a82b95b4a898
2020-06-29 09:01:31 +02:00
Artur Shepilko
1522dc98c1 Qmlpuppet: Remove an explicit bool type for fitAndHideBox() function
Explicit return values in qml functions cause errors in some Qt
versions, so remove the need for it.

Change-Id: Idd3035b19b56c25e94bc846c3de8f7aa5381e1eb
Reviewed-by: Artur Shepilko <artur.shepilko@nomadbyte.com>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-06-26 13:57:15 +00:00
Miikka Heikkinen
2949504a9d QmlDesigner: Fix draggable priorities in 3D edit gizmos
Upped default priority of all directional draggables a bit to make
them preferable to free rotation ball.

Change-Id: If934cb723e8c1a8ca9a114d71b19cbfc196e2682
Fixes: QDS-2286
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-06-26 13:56:52 +00:00
Miikka Heikkinen
0a83cc4e88 QmlDesigner: Show the scene id in 3D edit view
It's sometimes hard to tell which scene is shown in 3D edit view, so
added the scene id to the upper left corner of the view.

Task-number: QDS-2239
Change-Id: I5999e41c3f92028cd9a0f79ae0c8b72263d9ce42
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:31:37 +00:00
Miikka Heikkinen
5551791077 QmlDesigner: Fix hover hightlight of 3D edit icon gizmos
MouseArea.containsMouse gets confused when the mouse input gets grabbed
by an overlapping 3D mouse area.

Change-Id: I6ee69f217d95c5e4f3f5361e14c932ce0a2feab0
Fixes: QDS-2187
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:28:03 +00:00
Miikka Heikkinen
47ca3ccd8f QmlDesigner: Fix RotateGizmo and LightGizmo label z-value
Labels went under IconGizmos, so increased the z-value to match that
of MoveGizmo label.

Change-Id: I2620db0cadfadc73808a3a9f9967aadf87c9a863
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:16:24 +00:00
Miikka Heikkinen
cfa8373ce0 QmlDesigner: Remove unused signal
Change-Id: If0adce20a27575f7b4a39a08836da250d0b7bae6
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:13:32 +00:00
Miikka Heikkinen
b441988b58 QmlDesigner: Add fade control handle to point light gizmo
Also changed the point light mesh to just a single camera plane ring
based on discussions with UX.

Change-Id: If9e847440570bbe87483194c0b417cf09c7084a2
Fixes: QDS-2041
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:13:13 +00:00
Miikka Heikkinen
327821220c QmlDesigner: Add handles to light gizmo for adjusting area light
Change-Id: Ic12bd6f5ec8800d7a42064247eecbb742ebea40c
Fixes: QDS-2040
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:12:55 +00:00
Miikka Heikkinen
e4b2e45ea6 QmlDesigner: Implement spotlight drag handles
Inner cone visualization for spotlight was added, as well as drag
handles to adjust inner and outer cone angles and fade.

Fade handle adjusts fades in order: quadratic, linear, constant.
If a specific fade value is zero, the next one in list is chosen
for adjustment.

Change-Id: I921936d9782de511558bc6c24cfa0953cce494f0
Fixes: QDS-2038
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:12:32 +00:00
Miikka Heikkinen
387657b83a QmlDesigner: Add missing camera plane ring to point light model
Task-number: QDS-2037
Change-Id: Ica5a7ec2983da251d2ab75565120423288de27a2
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:10:58 +00:00
Miikka Heikkinen
3d162524e4 QmlDesigner: Add brightness control to light gizmo
Brightness can be controlled by dragging on the brightness indicator
arrow of the light gizmo in 3D edit view.

Change-Id: I317f5ee08b59bcc0bebf3fdf59861df15ef13c84
Fixes: QDS-2039
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:09:55 +00:00
Miikka Heikkinen
a3e6e24427 QmlDesigner: Update light gizmos
Directional light model was made constant size, as it doesn't have
actual physical presence.

Spot light cone now shows the cone angle correctly and the length of
the cone is calculated so that 5% of the brightness reaches the
center of the cone bottom.

Area light rectangle matches the area of the light.

Point light mesh changed to three perpendicular circles.
Same formula for size of the circles used as for spotlight length.

All light types share a common brightness indicator arrow.

Task-number: QDS-2037
Change-Id: I534dbcda9cfa2a7768c2537868ba83818979b250
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:09:41 +00:00
Miikka Heikkinen
4d23e6300f QmlDesigner: Update light icons
Task-number: QDS-2037
Change-Id: I0b95034f9ba9f308ba6fde82749b6cbef3f35859
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-06-09 12:07:39 +00:00
Miikka Heikkinen
d1a7afa28f QmlDesigner: Add "closeup" option to focusObjectToCamera function
The closeup option is used for itemlibrary thumbnail generation, where
the regular fit produces too small images on most imports.

Change-Id: I2901a2e20d100b155111f002b22489df945e9e01
Fixes: QDS-1899
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-04-24 10:29:43 +00:00
Miikka Heikkinen
e0751d56d0 QmlDesigner: Colorize light gizmos
Light gizmo icons and models are now colored based on the light color.
Image provider is used instead of simpler ColorOverlay component,
as ColorOverlay doesn't properly handle transparency when rendered
offscreen in puppet.

Change-Id: If6af915bca9bea2cb48ac23ac6c5ba46dc150e3b
Fixes: QDS-1733
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-03-31 07:39:16 +00:00
Miikka Heikkinen
92aca4db8d QmlDesigner: Remove focus setting from EditView3D
There is no keyboard handling on puppet side anymore, so no need to
set focus, either.

Change-Id: I00ebf7de1ac0b339c1323a62a61a1c086123d848
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-03-30 11:24:58 +00:00
Mahmoud Badri
621a823a53 QmlDesigner: Enable toggling the helper grid on/off
Also remove the toolbar buttons from the puppet side and few other
clean-ups.

Task-number: QDS-1849
Change-Id: I075753552043a9f1bc649f6baf54dc7b689e4f64
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-03-30 09:57:03 +00:00
Miikka Heikkinen
6cf8d7d645 QmlDesigner: Create thumbnail for imported 3D assets
Qmlpuppet now allows creating icon from qml source code.

Invoke qmlpuppet with following arguments to create icons:
--rendericon <size> <icon file name> <icon qml source>

E.g. --rendericon 24 ~/my_icon.png ~/my_icon.qml

Two icons are created, one with size x size dimensions and
one with double the dimensions and "@2x" injected into the file name.

3D asset import utilizes this icon rendering to produce item library
icons for imported components.

Change-Id: I92c62c80d961f5f61a0ce1c09b32bbcbf80ea56c
Fixes: QDS-1052
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-03-30 07:59:03 +00:00
Miikka Heikkinen
83d590950b QmlDesigner: Edit 3D view icon update
Added icon for spot light gizmo and updated directional light icon.
Removed icons that are no longer needed on puppet side.

Change-Id: Id1e72c80e122250f7edc8a69a0e5720e755b96fc
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-03-13 10:08:14 +00:00
Miikka Heikkinen
2c842453b0 QmlDesigner: Add light meshes to edit 3d view
Change-Id: I996498fde14510fc78c729f56cb8d46b28b233bb
Fixes: QDS-1634
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-03-12 09:06:48 +00:00
Mahmoud Badri
4a11975956 QmlDesigner: Update cullingMode API to QtQuick3D 5.15 specs
Change-Id: Ic4fc6bbd4d2bb7e9968c337eb5775a04c1a6f59c
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2020-03-10 14:01:38 +00:00
Miikka Heikkinen
9abd96e38f QmlDesigner: Fix edit 3D view tool state initialization
Edit 3D view tool state is now always initialized to a stored
"no scene" state if one exists to ensure further scene changes
properly inherit the tool state in all cases.

Change-Id: Ifee5fe58255b51d9dbed57abb2020ea00d94af2c
Fixes: QDS-1750
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-03-09 11:58:42 +00:00
Miikka Heikkinen
efa11e690b QmlDesigner: Remove remaining separate edit 3D window code
Change-Id: I3d745b54ae3aa5c3c05c859239934125b9ca828d
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-03-09 08:41:55 +00:00
Miikka Heikkinen
887b137348 QmlDesigner: Fix various Edit 3D view tool state issues
Edit 3D view tool state is now inherited from the current tool state
of the 3D view for newly added scenes. If there is a stored tool state
for the scene id, then that is used instead.

Change-Id: I4360d034cf946b1951642f4c2e09344b34825dc2
Fixes: QDS-1730
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-03-06 13:28:04 +00:00
Miikka Heikkinen
a77ef4ca7f QmlDesigner: Port Edit 3D View to 5.15
Qt 5.15.0 is now the minimum version to enable Edit 3D view.

Change-Id: I15cee59e6a7665477825caa0ae412fc6ac7b570a
Fixes: QDS-1694
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-03-04 06:27:45 +00:00
Mahmoud Badri
55b3d53213 Handle the case when there is no 3D Nodes in the qml doc
When there is no 3D node in the qml doc, the view 3D will still be
enabled and manipulate-able. Also few relevant tweaks.

Task-number: QDS-1693
Change-Id: I758f783108b317a6971703bee8e3fb564400ed8b
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-02-28 13:19:44 +00:00
Miikka Heikkinen
4908055937 Integrate Edit3D view into Creator
Edit3D view is now a tab alongside Form Editor.
Buttons were moved to a Creator side task bar on Edit 3D view.

Change-Id: Ia06107e4f855ba512ffea3e628a61558894e800e
Fixes: QDS-1570
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-02-24 12:18:53 +00:00
Miikka Heikkinen
1d71e6ac17 QmlDesigner: Store tool state on per-scene basis
Tool state of the scene is linked to qml id of the scene root, so that
tool states are preserved through delete and undo, which causes
generation of new internal ids for instances.

Tool state storage doesn't currently survive changing of scene root
qml id, as tracking that isn't trivial. It's not enough to simply track
id change commands because model repurposes existing nodes when major
graph changes occur, causing unexpected id changes e.g. when
delete/undo is done.

Change-Id: I74d11ce47e86ce5d29796399c4a91b65980b1597
Fixes: QDS-1536
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-02-11 12:13:24 +00:00
Mahmoud Badri
159c82802b QmlDesigner: Maintain grid size while zooming
Task-number: QDS-1622
Change-Id: I488b78304866b40b16d17d643816aa899ccb4cd9
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2020-02-10 21:47:06 +00:00
Mahmoud Badri
76bb4e4c08 QmlDesigner: Implement grid zooming
Grid zooms in and out according to camera zoom so that grid spacing is
neither too condense nor too sparse. Also changed the grid color to be
a bit darker and few other small tweaks.
PS: if the view camera is panned, the grid will not work correctly.
This is due to issues with the camera zoom calculations and is not part
of this commit.

Task-number: QDS-1566
Change-Id: Ib08d5387b028b8d870df9ecf88a5766eae5a509e
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-02-07 10:21:06 +00:00
Miikka Heikkinen
07ada921dc QmlDesigner: Fix camera frustum visualization in 3d edit view
Now camera frustum visualization should always appear correctly in
3D edit view, as the QSSGRenderCamera node is created at frustum
geometry update time if it's missing. Active scene change
also triggers geometry update for camera gizmos.

Change-Id: If24e97490b2ff6607049b5288c6e167aa29a86b2
Fixes: QDS-1472
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-02-06 08:41:11 +00:00
Miikka Heikkinen
13c6e5df28 QmlDesigner: Support adding/removing/reparenting 3D scenes
3D edit view should now update correctly when 3D Nodes and View3D
items are added, removed, or reparented in the scene.

Deleting the active scene will change the active scene to another
existing scene.

Fixes: QDS-1591
Change-Id: Ib885453574e72f486a236264cc10d88cb872e9c7
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-02-04 13:22:53 +00:00
Miikka Heikkinen
3890bf4efb QmlDesigner: Add support for multiple views to 3D edit view
Any subtree of Nodes can be shown in 3D edit view.
Selecting any Node or their children, or View3D changes the
view in 3D edit view to the relevant scene.

Fixes: QDS-1494
Fixes: QDS-1565
Change-Id: I2d5a6f88bab2a20b74c347351235f79fb530519b
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-31 14:52:08 +00:00
Miikka Heikkinen
a35a2d6bf3 QmlDesigner: Fix far away gizmo scaling
Changed auto scaler math to use more double precision math to improve
scaling accuracy when camera is zoomed far or gizmo is far from origin.

Change-Id: Ic3020bbf159c0d5d090af9c9b8e8a4aa372d2406
Fixes: QDS-1528
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-31 11:48:14 +00:00
Miikka Heikkinen
c9f90047ac QmlDesigner: Fix qml warning in edit 3D view
Change-Id: I736723a2acc896367760cf7137250d8d7d05ca91
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-01-27 08:54:53 +00:00
Miikka Heikkinen
495ebd0d3a QmlDesigner: Restore 3D edit view geometry on restart
Change-Id: I045c34033df2a8e3f39afc46c87803127dc8e978
Fixes: QDS-1352
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-23 08:55:58 +00:00
Miikka Heikkinen
ef95674378 QmlDesigner: Initialize 3D edit view tool state at initial show
Whenever the tool state of 3D edit view changes, creator is notified
to store the state. The stored state is then restored to 3D edit view
when it is restarted. The state persists only for the lifetime of the
creator.

Change-Id: I888b3ba82693a17a2f163924fbae1cfa27593890
Fixes: QDS-1351
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-17 14:57:44 +00:00
Miikka Heikkinen
5a4b0b565a QmlDesigner: Fix scale gizmo for child objects
As global space scaling is not supported, the scaling algorithm could
be simplified a lot. Now scaling gizmos work off the relative distance
along the scaling rod/plane instead of going through global space,
removing the need for complicated and error prone transformations.

Change-Id: Iaf0d5b2f31f10ae0b26b6a59b36e9ee4498838c9
Fixes: QDS-1269
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-14 13:57:18 +00:00
Miikka Heikkinen
e92bef2b62 QmlDesigner: Hide non-dragged planes of rotate gizmo in 3D edit view
To make things clearer, non-dragged planes of rotate gizmo are hidden
for the duration of the drag. This also hides the wobbling of the
gizmo during a drag when ancestors have non-uniform scaling.

Also corrects the resulting rotation by using dragHelper mouseArea to
lock the drag plane down for the duration of the drag.

Change-Id: I2dda2a78c78d5df62626c6b6c3ed3b18bac37933
Fixes: QDS-1331
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-14 11:09:57 +00:00
Miikka Heikkinen
58e2c3271e QmlDesigner: Add pivot point visualization line to 3D edit view
A line connecting the pivot point and object center is added to
3D edit view.

Change-Id: Ic265e9a3ab2895761cc92b94c778d68509ef36f1
Fixes: QDS-1474
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-14 11:09:38 +00:00
Miikka Heikkinen
a793e96ed2 QmlDesigner: Fix single selection of multiselected light/camera
When a multiselected light/camera icon is clicked without ctrl pressed,
it now ends up as the single selection as it is supposed to instead
of clearing the entire selection.

Change-Id: Id785cc4cd4ed6100b9bde625e9ccb45646e43b7f
Fixes: QDS-1353
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-10 09:49:34 +00:00
Miikka Heikkinen
7ad96a967f QmlDesigner: Show 3D edit view gizmos at pivot point of node
Change-Id: I6eb6b2674868d9251e568249cfabc105d0c715d7
Fixes: QDS-1354
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-09 13:17:27 +00:00
Miikka Heikkinen
82f2667ab3 QmlDesigner: Fix minor edit 3D view ui issues in mac
Change-Id: Ia86b5f828d147ca0c3593da7f7dcb77696fdeead
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-12-13 14:44:23 +00:00
Mahmoud Badri
f97de35dd4 Improve edit view 3D "on top" logic
- Proxy dialog removed
- When the QDS window is minimized/maximized, the edit view 3D follows.
  The opposite is not true (edit view 3D can be minimized separately).
- Edit view 3D is always on top of QDS window. Only exception is when
  a popup is shown (so that the user can handle the popup).
- External apps go normally on top of the edit view 3D.

Known (non critical) issues:
- Activating the edit view 3D doesn't raise() the QDS window, so if an
external app is on top of the edit view 3D then the view is clicked,
the external app will be in between the view and the QDS window.
- Closing the edit view 3D from the x button doesnt work (causes a
  restart). This is not in the scope of this commit.

Task-number: QDS-1179
Change-Id: I1dd72590037be295b94735de96772307ba14c59c
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-12-13 12:40:43 +00:00
Miikka Heikkinen
eb09e814db QmlDesigner: Properly update 3D edit view cameras and lights
Now edit view will create and remove cameras and light gizmos properly
when cameras and lights are added or deleted.

Change-Id: I858752c1410f3a40ea2adaf538c281aaee94ec58
Fixes: QDS-1267
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-12-13 09:27:44 +00:00
Miikka Heikkinen
783e5d0a8d Use separate MouseArea3D to calculate drag vector
Using the MouseArea3D linked to gizmo to manage the drag leads to
slight unwanted drift on the drag plane, as it moves with the gizmo.
Fixed by using a helper MouseArea3D to calculate drag vector.
Helper area's transform is set at mouse press time and is not changed
during the drag.

Change-Id: I50d3f738277bd34005c977423d114abc8dbed520
Fixes: QDS-1312
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2019-12-11 10:59:21 +00:00