Commit Graph

16 Commits

Author SHA1 Message Date
Mahmoud Badri
cc1bf95dc2 QmlDesigner: Ensure material lib node exists on project launch
In this commit material library node is created on model attach.
A timer keeps monitoring until it is suitable to create the node.

This will properly move materials into material library for
projects created with previous QDS versions.

Also removed unnecessary handling on new material dragging, as
rewriter now works properly with material library creation.

Fixes: QDS-7178
Change-Id: Idf6f41906e02bc064961d8de9841ba1644bd3552
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-06-22 14:16:23 +00:00
Miikka Heikkinen
2cb45cbb6b QmlDesigner: Reduce number of preview requests from material editor
Removed preview request call from setValue, as it is called in long
loops during initial project load and added the calls outside those
loops where they already weren't there.

Fixes: QDS-7175
Change-Id: Ia83814a0de6fe801d954373dc8ce0e4920e8a6a6
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-06-22 12:44:28 +00:00
Mahmoud Badri
d080e6331f QmlDesigner: Parse material library on model attach
Parsing has to happen so material in an old project are correctly
appearing in the material views. Using a timer to wait until it is ok
to create the material editor node. Otherwise errors happen.

Change-Id: I54b532211f8a865c5183fab0fd8c12e5f15b983a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-06-17 08:47:04 +00:00
Mahmoud Badri
568004e121 QmlDesigner: Detect asset drag'n'drop support based on property type
Handle property support for asset drag based on property type rather
than name in order to support properties with any name
(like lightProbe).

Change-Id: I20fd422119db96aebd505b47888c97f0d94bf7f9
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-06-16 14:05:10 +00:00
Miikka Heikkinen
7269aafbd8 QmlDesigner: Ensure material library is created when needed
Added material library accessor to AbstractView, which creates the
material library and moves existing materials under it in case it
doesn't yet exist. Also added material assignment function to
AbstractView. The reason these were added to AbstractView instead of
being handled e.g. via custom notification in material editor is that
they need to be called from multiple different views in the same
transaction that triggers the need of material library.

Fixes: QDS-7081
Change-Id: If2bb884f87d04c9f3599c2342df66ef51ec238ee
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-06-07 14:14:56 +00:00
Miikka Heikkinen
92a3ebd3ef QmlDesigner: Fix crash on project load
Creating material library node in response to model change
notifications is problematic, so don't do that.

Fixes: QDS-7075
Change-Id: Ib688d71223a851b8a98e1c8fcfe598f6decdaf16
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2022-06-03 13:29:24 +00:00
Mahmoud Badri
8d11ec2656 QmlDesigner: Fix adding the first material to the material library
Fixed that material editor node was not being created when no materials
exist.

Fixes: QDS-7069
Change-Id: I358c497325e8865fc5f012531783dcbe46c32490
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2022-06-03 10:00:49 +00:00
Thomas Hartmann
a734e1b4e8 QmlDesigner: Move reparenting of materials into transaction
Without a transaction we will reparse the document for each reparent.
This will make the process very slow if there are e.g. 20 materials
in the document.

The new parent has to be created first. This cannot be part of the same
transaction, because of limiations in the rewriter.

Change-Id: Ie2c587d0f072b8163846c660dc2dd66bee7146c1
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
2022-06-02 13:21:20 +00:00
Mahmoud Badri
d47ad10728 QmlDesigner: Fix small typo
Change-Id: Ic3fb65b8f8ecf80dcf65c21f5f3e5a35c42d0735
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2022-06-02 09:51:51 +00:00
Mahmoud Badri
e1bb5d058d QmlDesigner: Mark unused params in material editor and browser
Change-Id: I5d1e2dcd340e766f829fe78edb63dfa8beacfa78
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2022-06-02 08:50:26 +00:00
Mahmoud Badri
c9b140eb7e QmlDesigner: Correct asset to material editor dnd behavior
Only check the first asset when dnd multiple assets to be in sync with
the dnd handling in the QML side after drop.

Change-Id: I32ecf6be87284dc8e32f51f674ba082fab7cad7a
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2022-05-31 13:06:01 +00:00
Mahmoud Badri
175343e24a QmlDesigner: Highlight material editor properties upon asset drag
When starting an asset drag in the assets view, highlight all
supported properties in the material editor.

Change-Id: I60935756e4c1384edcc284068163d08ebe529a05
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2022-05-31 08:57:43 +00:00
Mahmoud Badri
0b51afe21d QmlDesigner: Implement "duplicate material" feature
Fixes: QDS-7013
Change-Id: I28a11dbd9d6586631c0edcf8003e551917eaac98
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-05-27 11:20:48 +00:00
Mahmoud Badri
917ae81ce6 QmlDesigner: focus material browser upon open
When clicking the open material browser button in the material editor,
focus the material browser window if it is already open. Also do the
same when opening the material editor by double clicking a material
in the material browser.

Fixes: QDS-7006
Change-Id: If64d1ff6595dea5e33771485622322df708405d9
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
2022-05-24 13:10:42 +00:00
Mahmoud Badri
71e553f497 QmlDesigner: Disable apply material to selected when no selection exist
When there is no valid model selected, disable the "apply to selected"
actions in the material editor and browser.

Change-Id: Id8e771c64e69c0ba2f42dff01d19ffbf4afafb77
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-05-24 13:01:20 +00:00
Mahmoud Badri
f09d4538e7 QmlDesigner: Implement Material Editor
Task-number: QDS-6438
Task-number: QDS-6439
Change-Id: I04e899a68aea665f0df8b65e21523632174ec76b
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Samuel Ghinet <samuel.ghinet@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2022-05-23 16:44:02 +00:00