Commit Graph

103 Commits

Author SHA1 Message Date
Miikka Heikkinen
c865481068 QmlDesigner: Add particle attractor visualization to 3D editor
Particle attractors are visualized similarly to particle emitters,
except that they are shown as blue instead of yellow when parent system
is active.

Fixes: QDS-6426
Change-Id: I085727dac7f3b4fa968e313b78db3f476941a7da
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-03-18 08:17:37 +00:00
Robert Löhning
59a721c0ea QmlDesigner: Compile fix for Qt 5.15
error: passing ‘const QQmlContext’ as ‘this’ argument discards qualifiers

Change-Id: I4fa9ed0098f5bd63925534459d1171d7c9430897
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2022-03-15 12:36:52 +00:00
Miikka Heikkinen
72e4287ac3 QmlDesigner: Fix navigator preview of Models
Now we resolve absolute source url for our preview model, so it
will always find the custom mesh files.

Also always use the Node type preview if the instance is a component,
even if the root node is Model. This ensures the preview works properly
in case there are child nodes inside the component.

Fixes: QDS-6204
Change-Id: I48ef273e5a5dca13abe25816b5edf0be7dd217ff
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-03-15 10:45:24 +00:00
Miikka Heikkinen
be9b71af2f QmlDesigner: Fix runtime puppet compilation error
Change-Id: I6c3b1ce317305b6cbc088971beaa1700b5327682
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-10 08:43:01 +00:00
Miikka Heikkinen
ec02c157ee QmlDesigner: Simplify hidden and locked handling for gizmos
There is no need to have an event filter to listen to changes to
_edit3dLocked and _edit3dHidden properties, as they are only changed
in one place. We can simply emit the change notification there.

Fixes: QDS-6403
Change-Id: I8136f38fd8e435e3a4dbd69d70169496e1675dfa
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-08 07:38:41 +00:00
Miikka Heikkinen
98673190ad QmlDesigner: Add visualization gizmo for ParticleEmitter3D
Particle emitters are now visualized in 3D edit view either by
a small sphere for point emitters or by a proper model for
model based emitters. The visualization model is rendered
transparent. The visualization models can be displayed either
always or only when the parent particle system is active
in editor.

Trail emitters are not visualized, as any visualization would
be misleading, since these emitters follow generated particles.

Fixes: QDS-6189
Change-Id: Idb6f12cadd9cea8110e5290cc18443aeb62c38d6
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2022-03-03 09:34:57 +00:00
Miikka Heikkinen
f146b846cd QmlDesigner: Implement proper preview for pure 3D scenes
Refactored the existing 3D node preview generation to be done
synchronously, which enables their use also for creating state
and item library previews for 3D nodes with ease.

Fixes: QDS-5785
Change-Id: Ib493eccbc239f33bcad3301673a865494616a901
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-02-10 14:47:26 +00:00
Eike Ziller
1368111824 Merge remote-tracking branch 'origin/6.0' into 7.0
Change-Id: Ie2b23daa457c2aed635a784963bc1e95740bd076
2022-02-02 10:17:03 +01:00
Christian Strømme
4a0c6f1e78 Fix invalid usage of temporary data
Make sure the return value stays valid in the scope we're using it in.

Change-Id: Ifa8a7ef88c9189ba90f5adb699b284f381a59488
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-01-31 16:04:12 +00:00
Miikka Heikkinen
557489c3fc QmlDesigner: Fix camera frustum initialization for Qt5 builds
In Qt5 builds, we need additional async update at camera geometry
initialization to ensure source camera is up to date and frustum mesh
can be constructed.

Fixes: QDS-6071
Change-Id: I41371ae66fde432b0fdf4b5fee6a0604d005bf63
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-01-28 09:00:57 +00:00
Jere Tuliniemi
a03a50a262 QmlDesigner: Add camera alignment buttons
Add a button to 3D edit view that aligns the selected cameras to the
view camera. Add another button that aligns the view camera to a
selected camera.

Task-number: QDS-4482
Change-Id: Ibe6ceaf498db10f45c8c351e3a108419d8d7a59b
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-25 14:15:54 +00:00
Eike Ziller
85b60d9608 Merge remote-tracking branch 'origin/6.0'
Conflicts:
	src/plugins/coreplugin/editormanager/editormanager.cpp

Change-Id: I80fe565749ad5c06dfe99436f2dc6ab4b66a2537
2021-12-16 10:50:33 +01:00
Miikka Heikkinen
d73be23c69 QmlDesigner: Make model used for instancing unpickable in 3D editor
The base model used for instancing is hidden at render time, so it
should not be pickable in 3D editor.

Fixes: QDS-5100
Change-Id: I7c58bd8e7e5c9bfbe75dbaff67c0fd99793ad610
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
2021-12-14 15:27:01 +00:00
Miikka Heikkinen
4751e9a771 QmlDesigner: Change 3D editor selection box appearance
The selection box in 3D editor no longer includes selection boxes of
immediate children for clarity. The box itself also now only shows the
corners of the box.

Fixes: QDS-3656
Change-Id: Iae3e884276f26385d6a362809b79a74e09c093a3
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2021-12-14 13:03:32 +00:00
Miikka Heikkinen
a4c2f2fb8c QmlDesigner: Fix Qt5 compilation
QQuick3DViewport::pickAll was introduced in Qt 6.2.
Checking against version 6.2.1 because that's when the global picking
API was taken into use in QmlDesigner.

Change-Id: Id69ff9d958da89ba9e043dfb082a99f640884a4e
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-12-07 12:57:42 +00:00
Miikka Heikkinen
eba2a0520b QmlDesigner: Fix picking issues
We now check also the parent chain for pickability, because
a node is not pickable if one of the ancestors is not pickable,
as all properties picking depends on (visibility, locked state)
are implicitly inherited by descendants.

Rotate gizmo rings default to regular View3D picking when the angle
is so steep that the plane intersection is not reliable. With new
global picking enabled handling we need to check all hits instead
of just the first one.

Change-Id: Ib1aa604b06f7db1041f5d4c3019cc2badf29a20f
Fixes: QDS-5679
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2021-12-07 08:18:35 +00:00
Kaj Grönholm
4a5603b15c Adjust to model bounds calculation API change
Model bounds API changed with 25b757b7b0a286a392b3 so switch to new
API with version checks.

Task-number: QDS-5657
Change-Id: I6d880f179fc277f94ea9ac610ae682e9afbefe39
Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2021-12-03 05:19:42 +00:00
Miikka Heikkinen
cb00a8d30f QmlDesigner: Fix orthographic camera hdpi issues in edit 3D view
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>
2021-11-22 10:14:42 +00:00
Kaj Grönholm
d8a7c97fcb Use global picking API
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>
2021-10-14 04:08:33 +00:00
Kaj Grönholm
d1d5f47bda Fix building with Quick 3D dev
Adjust to camera changes b74fde27@qtquick3d

Task-number: QTBUG-95932
Change-Id: Id7408541caaebb0ee18240e7bc4208ac416fb0b9
Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Reviewed-by: Jonas Karlsson <jonas.karlsson@qt.io>
Reviewed-by: Knud Dollereder <knud.dollereder@qt.io>
2021-08-24 15:35:30 +00:00
Christian Strømme
4788f0671f Update MouseArea3D::getCameraToNodeDir() to not rely on cameraNode()
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>
2021-08-23 12:22:04 +00:00
Tim Jenssen
27d414458e qmlpuppet: fix qt 5.15 builds
Change-Id: I6d19624537a3980252d43624ecf24e110638225a
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-10 09:07:41 +00:00
Miikka Heikkinen
2c7b2ad685 QmlPuppet: Fix incorrect initial render size/scene for edit 3D
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>
2021-08-09 14:00:19 +00:00
Miikka Heikkinen
18f24ffd68 QmlPuppet: Fix multiselection fit object in 3D editor
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>
2021-07-01 14:29:35 +00:00
Miikka Heikkinen
48348b8dc4 QmlPuppet: Change custom 3D geometries to use public API
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>
2021-06-29 12:03:51 +00:00
Miikka Heikkinen
193f485be2 QmlDesigner: Fix unused variable warnings
Change-Id: I1616452753685bbd57eec8fc6e1c9934c63fef0c
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2021-06-22 08:54:41 +00:00
Miikka Heikkinen
acb4113f09 QmlPuppet: Enable negative scaling in multiselection
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>
2021-06-11 12:28:38 +00:00
Miikka Heikkinen
b73884bee5 QmlPuppet: Fix runtime warnings in 3D editor
Fixes: QDS-4491
Change-Id: I462e165ef59111f70c928b7d652ade99c5b3c0d0
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2021-06-11 12:28:26 +00:00
Miikka Heikkinen
74f65abed0 QmlPuppet: Fix multiselection 3D transformations when nodes have pivot
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>
2021-06-11 07:47:19 +00:00
Miikka Heikkinen
4e1ca8d3c5 QmlPuppet: Reset gizmo orientation after multiselection rotation
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>
2021-06-11 07:47:13 +00:00
Alessandro Portale
dcbf26490d QmlPuppet: Fix build with Qt 6.2
Fixes: QTCREATORBUG-25763
Change-Id: I05f4b44a3793c41fd1c6812f40f6603892cdac50
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2021-06-04 10:12:30 +00:00
Miikka Heikkinen
f913a65405 QmlPuppet: Support multiselection transformations in 3D edit view
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>
2021-06-01 09:38:00 +00:00
Miikka Heikkinen
125cdcc3a0 QmlDesigner: Block changing eulerRotation for 3D Node that has rotation
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>
2021-05-27 08:43:50 +00:00
Miikka Heikkinen
baf3528af5 QmlPuppet: Fix custom 3D geometries for Qt 6.1
Private API puppet uses for custom 3D geometries has changed.

Change-Id: Ie9f2052b04399db6f9643aba6319f6e95df1c15b
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2021-02-05 15:03:47 +00:00
Eike Ziller
5ca70bdcb3 Merge remote-tracking branch 'origin/4.14'
Change-Id: Iea84f23cf394de13e99a9ed777c8c113e4eff473
2020-11-19 15:38:13 +01:00
Alessandro Portale
30aec82285 Add missing "final" to unexported/unshared classes
Change-Id: I84d5fc39d7ef5588a20545854d0cfd0b993db090
Reviewed-by: hjk <hjk@qt.io>
2020-11-18 15:40:29 +00:00
Jarek Kobus
df9d1414b8 Don't cast QHoverEvent into QMouseEvent
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>
2020-11-17 08:42:57 +00:00
Henning Gruendl
f2883c19b1 QmlDesigner: Add lock feature support to 3D editor
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>
2020-11-06 09:19:05 +00:00
Miikka Heikkinen
6b8d8e414a QmlDesigner: Port 3D edit view to Qt6
Task-number: QDS-2899
Change-Id: Iedbe5e8561e5ab71ef32922e69da43cd3cc57e90
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-10-20 14:55:43 +00:00
Miikka Heikkinen
762addfbd0 QmlDesigner: Add navigator tooltip for 3D Model nodes
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>
2020-09-22 13:35:10 +00:00
Miikka Heikkinen
5cc7dae965 QmlPuppet: Improve gizmo precision
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>
2020-09-04 11:58:04 +00:00
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
29ceaade9c QmlDesigner: Restore the previously active 3D scene on scene creation
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>
2020-06-09 12:31:57 +00:00
Miikka Heikkinen
b2b590ae24 QmlDesigner: Restart overlay update timer on each request
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>
2020-06-09 12:14:35 +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
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
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
Tim Jenssen
53d161c98e Merge remote-tracking branch 'origin/qds-1.59'
Change-Id: I8a5d7d98b4d75379fe3953fe00bdb939d1722676
2020-04-28 16:18:24 +02: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
Christian Kandeler
785b184fb6 QmlDesigner: Fix warnings about unused variables and functions
Change-Id: Ib907db11dcdcef9cbbb91c8fd7af22ae420796b1
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2020-04-23 13:49:04 +00:00