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>
When drag-adjusting e.g. brightness or position of the object in 3D
edit view, the value ending up in property editor and qml doc didn't
always match what was displayed on 3D edit view. This happened because
ValuesModifiedCommand was compressed to 100ms intervals, but any
property changes also sent ValuesChangedCommand at 16ms interval,
which changed the instance value at backend, but not the model value.
Fixed by comparing modified value to model value instead of instance
value.
Also made the 100ms compression timer singleshot, so the backend
wouldn't be unnecessarily bombarded with ValuesModifiedCommand when
holding the mouse still while dragging.
Change-Id: If86dcd61bcf0c04735d65648e4c34d9d214c5313
Fixes: QDS-2081
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>
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>
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>
If the size is invalid set the default size.
Invalid size most likely means the setting was removed.
Change-Id: I3f1dad5bdac799673d37036099d954caab9aca19
Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
You can now change the preview size with
rootModelNode.setAuxiliaryData("previewSize@Internal", size);
If size is null it will use the bounding box size.
Change-Id: Icbe747ccc5a2e26e79783825d2ed94ecc640012b
Reviewed-by: Michael Winkelmann <michael.winkelmann@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
You can not use a variable in a lambda without capturing it.
Change-Id: Iada3e40c70c0584c82a5c95a40f64164ca533aed
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>
For each created items we retrieve a list of the names
of all existing states.
Task-number: QDS-1978
Change-Id: I8e85e439fce3c6204cb8bcf69f6be847cc8dae5c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This has to be blocked only for the root item.
Task-number: QDS-1979
Change-Id: Ia05255468623fe715e3f7172e2f058a70629b783
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
If a component cannot be created we have to show a proper
error message.
Task-number: QDS-1980
Change-Id: I48a6ff0fd89c9666328c501abb00dc0997171d96
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
m_quickView in Qt5NodeInstanceServer::initializeView()
is instantiated with setProfile(QSurfaceFormat::CoreProfile)
However QGfxShaderBuilder::QGfxShaderBuilder() initiates and
generate the gaussian blur shader code with referring default format.
that doesn't set the profile to QSurfaceFormat::CoreProfile.
The correct resolution is to get profile with accessing current window.
But QGfxShaderBuilder is not QQuickItem so it doesn't have any way to
access current window.
As qmlscene does, it could be a nice solution to keep the current
surface format as default when instantiating QQuickView.
Fixes: QDS-1864
Change-Id: I0fcf80effccebf7cfe8e58c071cf121b6af5bdbd
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Check component creation errors earlier to avoid crash.
This allows puppet to notify creator about the problem, so invalid
components can be properly highlighted in navigator.
Change-Id: I059a5be04c4e509a38f6d47daa97e0da36c333ae
Fixes: QDS-1887
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
The application event loop is not yet active at setup time, so just
calling qGuiApp->quit() directly doesn't actually exit the application.
Change-Id: Iccae4dd59d92b593205c2057b189774f827ffcda
Fixes: QDS-1875
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>
If there's a single node child on View3D, detect that as scene root
when another non-node direct child of View3D is selected.
Change-Id: Ib538b0ae368e7b460700a99e4c450a15586c2f62
Fixes: QDS-1865
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
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>
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>
Since we integrated the 3D view no keyboard focus is required anymore.
Change-Id: Ia523e1a6b0c1d0ef9912775a91022f28de47b54a
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Changing edit camera could take a couple of frames to propagate the
the correct position to icon gizmos. It's unclear why exactly this
happens, but a trivial fix is to just render a couple of extra frames
whenever the camera changes.
Change-Id: I8c4fc33bff9cb7a4c4ac3b5105327cc5eb0a45d5
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@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>
Explicitly change the selection back to previous selection after
a scene change in puppet. Also reduced the existing timeout for
executing the pending selection command after calling
ensureSelectionBoxes, as we now explicitly render the next frame after
selection change and don't have to wait for rendering to trigger
otherwise.
Change-Id: Ibe8004890910ae15e7ac3172165bc72463c1e5cc
Fixes: QDS-1792
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Components typically have Node as their root item, so having a
component as a scene root detects as having a plain Node as scene
root, which normally doesn't get a selection box.
Change-Id: I66ae1dc3ade4b6f822d768cf71e8feceb0ffa06d
Fixes: QDS-1636
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>
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>
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>
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>
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>