Commit Graph

530 Commits

Author SHA1 Message Date
Thomas Hartmann
c8d7d44bfb QmlDesigner: Fix changePreviewImageSize
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>
2020-05-26 18:14:14 +02:00
Tim Jenssen
cbd0649e3b qmlpuppet: enable the use of multilanguage database
Change-Id: I2277348ac1e6b5025e75c640da83da30294c9d10
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-05-26 18:12:38 +02:00
Tim Jenssen
03a1282bdd Merge remote-tracking branch 'origin/qds-1.50' into qds-1.59
Change-Id: Ic0edcce1268b9cc47c91364eeb84e3b3f7dfe134
2020-05-12 10:04:10 +02:00
Marco Bubke
0e7a1e6650 QmlDesigner: Preview size is now changeable
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>
2020-05-12 07:11:15 +00:00
Thomas Hartmann
33c88a0ced QmlDesigner: Expose component url
Change-Id: I2b1708e6f87b00ad0b56c04f591ba24720a886ba
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-05-06 20:17:01 +00:00
Marco Bubke
dacea667ed QmlDesigner: Add ChangeLanguage command
Change-Id: If79de7d04717ad81af05411e61c262b9ff70129b
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-04-29 06:17:34 +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
Thomas Hartmann
3caafb2b81 QmlDesigner: Inspect components for existing states
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>
2020-04-21 10:57:26 +00:00
Thomas Hartmann
74ffff63eb QmlDesigner: Allow setting state property
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>
2020-04-21 09:43:11 +00:00
Thomas Hartmann
970f075e33 QmlDesigner: Show proper error message for component
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>
2020-04-21 09:41:12 +00:00
Unseon Ryu
fee8848297 fix incorrect GaussianBlur shader code generation
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>
2020-04-06 07:48:37 +00:00
Miikka Heikkinen
09f34a697f QmlDesigner: Fix crash in puppet when component has errors
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>
2020-04-02 12:20:35 +00:00
Miikka Heikkinen
ee81b5d895 QmlDesigner: Exit puppet asynchronously in case of failed icon render
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>
2020-03-31 11:43:11 +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
9a2eedf196 QmlDesigner: Show selection and gizmo for scene root light/camera
Change-Id: Ib650a5e331cf2936ef20a47abec5086bb08f06d2
Fixes: QDS-1857
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2020-03-30 12:30:33 +00:00
Miikka Heikkinen
cbb7099902 QmlDesigner: Fix scene root finding logic
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>
2020-03-30 11:24:49 +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
Unseon Ryu
38a7bfe4eb Fix for Pane not being visible in the form editor
Task-number: QDS-797
Change-Id: I4b06aa0e09f78fdd3bb9531cf21441bdae3ee2a5
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-03-27 10:53:08 +00:00
Thomas Hartmann
fccdc91e51 QmlDesigner: Do not allow keyboard focus on macOS for puppet
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>
2020-03-26 08:27:07 +00:00
Miikka Heikkinen
0496318e9d QmlDesigner: Update selection box when target mesh changes
Change-Id: I45d54baa78e9f8547da65358d93c6d376f24ce3b
Fixes: QDS-1840
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-03-23 08:05:37 +00:00
Miikka Heikkinen
7c09d34feb QmlDesigner: Fix icon gizmo position update after edit camera change
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>
2020-03-20 08:24:09 +00:00
Miikka Heikkinen
ff6dd4dc2e QmlDesigner: Fix selection issues in navigator and 3d edit view
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>
2020-03-19 08:12:55 +00:00
Miikka Heikkinen
bcfaa8cd37 QmlDesigner: Fix missing selection box when scene changes
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>
2020-03-19 08:12:37 +00:00
Miikka Heikkinen
2c3f31bc93 QmlDesigner: Add a simple wireframe cone model for edit 3d spotlight
Change-Id: I013e4fc2d77b49694d887e8cadc05584a904ed62
Fixes: QDS-1819
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-03-16 13:37:49 +00:00
Miikka Heikkinen
010bbb8ae0 QmlDesigner: Show selection box for component scene roots in edit 3D
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>
2020-03-16 09:01:54 +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
644493fa59 QmlDesigner: Delay camera frustum geometry update in edit 3D view
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>
2020-03-12 13:37:53 +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
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
0fa7581b18 QmlDesigner: Fix 3D edit view refresh issues
Change-Id: Iddcd54b29376a6a31a0290b234ade63ed2bb898b
Fixes: QDS-1746
Fixes: QDS-1738
Fixes: QDS-1742
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-03-06 13:30:23 +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
Mahmoud Badri
fb843d3442 QmlDesigner: Remove the standalone view3D window implementation
Task-number: QDS-1692
Change-Id: I6c04aaee9ab6a119cfcc22ee2e19b808bb95ae0a
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2020-03-05 11:00:11 +00:00
Miikka Heikkinen
eadbce7b80 QmlDesigner: Fix 5.15 build
QtQuick3D Type API changes broke build.

Change-Id: Ibbd7fc3f699875b24f6345dfca66c5f442915544
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2020-03-05 09:51:41 +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
Christian Stenger
5d3e56b3b4 QmlDesigner: Fix compile with Qt5.11 and building tests
Change-Id: I96dea7de0d185c67ea3a26a42de0805bd60dc1d1
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2020-02-24 13:40:07 +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
Andre Hartmann
da42176da8 QmlPuppet: Fix unused parameter warnings
Change-Id: I3bd5f921a3ca1f6067fac6e232f383f0b1be5463
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2020-02-17 13:50:50 +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
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
7c992f5450 QmlDesigner: Insert a node dragged to 3d edit view into correct scene
Added scene instance id to the drop command.

Change-Id: I42df07fec823083454ad5a70ccafa318d05ab224
Fixes: QDS-1594
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-02-07 10:17:47 +00:00
Miikka Heikkinen
ec4e60e691 QmlDesigner: Fix build with Qt 5.14.1
A quick3d private API used was introduced in 5.14.2

Change-Id: I03e48fb79068e16a24b2c2a1e128d59efb6c8fad
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2020-02-06 12:51:58 +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
fd40bdd606 QmlDesigner: Use double precision to calculate ray-plane intersections
Float precision becomes issue when calculating ray-plane intersections
for gizmo hit detection when camera is very zoomed (in or out).
Do the critical calculations in double precision to mitigate the issue.

Change-Id: I8c33e17bf19d092e24ab19f8f8f2a54cd83304cc
Fixes: QDS-1526
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-01-24 08:42:31 +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