There is no need to double the viewport anymore when calculating
orthographic camera frustum visualization, Qt6 correctly accounts
for device pixel ratio in ortho projection. Even in Qt5, the old
hack only made frustum visualization correct for hdpi screens while
breaking it for regular screens.
Also fixed zoom factor handling for orthographic edit camera mode.
Task-number: QDS-5469
Change-Id: Ie53b5dfa2fbcc00f098ea64e5a6673e4b7af0963
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
When gobal picking is available (Qt 6.2+), use that instead of toggling
models pickable properties.
Task-number: QDS-4978
Change-Id: Id2a501ae97955128874447fa8a3b8afab3d1f2c7
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
The cameraNode() function has been removed from QtQuick3D and it only
existed because of the weird way we we're creating the camera node.
Now, instead of the round-trip, just request the spatial node directly.
See: b74fde27@qtquick3d
Change-Id: Icc8584aebee4952356769a134756074cba8d1b0e
Reviewed-by: Kaj Grönholm <kaj.gronholm@qt.io>
The scene id was stored as array of QChars instead of QString, which
caused issues restoring the correct scene at puppet reset.
The intitial incorrect render size was caused by not changing the
render window size in addition to root QML item size.
Fixes: QDS-4586
Change-Id: Id6b16d778a9d886e8fdc40eab1e549d13091f8f4
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Multiselection is now properly fit to the view when fit object is used.
Fixes: QDS-4608
Change-Id: Ia80133fc861bd177b9102423ebef37b592c74758
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Custom geometries often break and code becomes convoluted with
version ifdeffing, so refactor the custom geometries to use public
geometry api, which works both in Qt5 and Qt6.
Fixes: QDS-4611
Change-Id: I2d78776a14d5c8153b52806842254dbedb5de83d
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Scenerotation was queried from the node for each drag move, causing
drift in the calculations. Locking the rotation at drag start makes
negative scaling work nicely.
Also enabled negative values on all axis scaling, since it makes no
sense to block it there when single axis/planar scaling already allows
it.
Fixes: QDS-4493
Change-Id: I7a38a08556bd6d729974332d312aa4aa4e84ea30
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
We simply need to store the scene position of the pivot point of the
node instead of node itself and work with that.
Fixes: QDS-4515
Change-Id: I99155636c52897794bea21b2db7f7d2d00059d91
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Gizmo orientation in multiselection case should always be aligned to
the global axes, so we now reset multiselection on release
handlers of rotation gizmo.
Fixes: QDS-4492
Change-Id: Ic10f26f65df42869e4643f48457bcbcbf970fe9a
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Add support for moving, rotating, and scaling a multiselection of 3D
nodes in 3D edit view.
Fixes: QDS-4313
Change-Id: Icf83911ac6f87fde1cb79d6f5059ae01ed434d7f
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
QtQuick3D doesn't support both rotation and eulerRotation set on same
node, so we delete existing quaternion rotation if user sets an euler
rotation to the node. If node has quaternion rotation animation,
we block any change to eulerRotation in the node.
3D editor also disables the rotation gizmo for blocked nodes.
Task-number: QDS-4335
Change-Id: I4ce7b022c732a9547751f101548ecea948279db8
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Private API puppet uses for custom 3D geometries has changed.
Change-Id: Ie9f2052b04399db6f9643aba6319f6e95df1c15b
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Such a cast rely on the fact that some internal data
of both classes must match. Qt doesn't guarantee it.
Change-Id: I5c29af98e320b72b599c059a2827eb2e7d3843da
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Added lock feature support for 3D editor. Also refactored the hide
support, since the two use largely similar logic.
Task-number: QDS-2915
Change-Id: I627848f3a3a73881427a03aeec6793fd26a1885a
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Only the source and geometry properties of the model is taken from the
node, rest of the properties are always same for consistent style.
Change-Id: I2355ce91c3e3d6f23b9f27ecf31430e3e13d0c80
Fixes: QDS-2764
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
At high zoom levels, picking precision of the gizmos was not good,
because compounding inaccuracies from multiple floating point
operations required. Fixed by reimplementing many operations using
double precision math.
Change-Id: I013876b816379a20b552eb06d2f9cbb3f2aa2d21
Fixes: QDS-2676
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
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>
Store the last active scene in global 3D tool state and restore it
when a scene is created after puppet relaunch.
Change-Id: Ie2d69f6db6798ab383c66d38b2dea7eba13adc97
Fixes: QDS-2239
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
If timer is not restarted on each request, the update can end up
happening before the next frame has been rendered. This can happen e.g.
at puppet startup, where the delay between first request and first
frame render can easily be more than 16ms.
Change-Id: Ib9555548e8c60799c585d0ab43d0626cfa31a494
Fixes: QDS-2082
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
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>
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>
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>
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>
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>
Fixed multiple issues with showing correct selection in navigator and
3d edit view:
- Dragging items from item library selects only that item,
regardless if drag was done to 3d edit view or navigator
- Selection is shown correctly after reparenting items, including
multiselection reparenting
- Adding a new item to the active scene now shows selection box
correctly for that item
Change-Id: I5156ca4c22e606c41e1e346ea5c32c3d70d89f5e
Fixes: QDS-1577
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
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>
Calculating camera frustum geometry requires linked camera spatial
node to be up-to-date. However, we can't control the order in which
the spatial nodes of cameras and geometries are updated, so geometry
update will often happen first. Therefore we need to defer geometry
update to the next frame when we detect camera change.
Change-Id: I056eb1bf95db357a73511a6bb7ef0c55c6f4befa
Fixes: QDS-1649
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
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>
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>
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>
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>
A quick3d private API used was introduced in 5.14.2
Change-Id: I03e48fb79068e16a24b2c2a1e128d59efb6c8fad
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
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>
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>
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>