QmlDesigner: Add BakedLightmap item to component library

Also adds relevant property specifics and navigator drop support.

Fixes: QDS-9521
Change-Id: I78539548770ae75fbe0602c2871fb5fea5515ab4
Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Miikka Heikkinen
2023-03-24 16:53:23 +02:00
parent feabda3aa7
commit 79f4066dac
6 changed files with 120 additions and 4 deletions

View File

@@ -0,0 +1,64 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
import StudioTheme 1.0 as StudioTheme
Section {
caption: qsTr("Baked Lightmap")
width: parent.width
SectionLayout {
PropertyLabel {
text: qsTr("Enabled")
tooltip: qsTr("When false, the lightmap generated for the model is not stored during lightmap baking,\neven if the key is set to a non-empty value.")
}
SecondColumnLayout {
CheckBox {
text: backendValues.enabled.valueToString
backendValue: backendValues.enabled
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
}
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Key")
tooltip: qsTr("Sets the filename base for baked lightmap files for the model.\nNo other Model in the scene can use the same key.")
}
SecondColumnLayout {
LineEdit {
backendValue: backendValues.key
showTranslateCheckBox: false
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
}
ExpandingSpacer {}
}
PropertyLabel {
text: qsTr("Load Prefix")
tooltip: qsTr("Sets the folder where baked lightmap files are generated.\nIt should be a relative path.")
}
SecondColumnLayout {
LineEdit {
backendValue: backendValues.loadPrefix
showTranslateCheckBox: false
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
}
ExpandingSpacer {}
}
}
}

View File

@@ -0,0 +1,14 @@
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
import QtQuick 2.15
import QtQuick.Layouts 1.15
import HelperWidgets 2.0
Column {
width: parent.width
BakedLightmapSection {
width: parent.width
}
}

View File

@@ -42,6 +42,8 @@ ChooseFromPropertyListFilter::ChooseFromPropertyListFilter(const NodeMetaInfo &i
// -> Model
// Effect
// -> Item
// BakedLightmap
// -> Model
if (insertInfo.isQtQuick3DTexture()) {
if (parentInfo.isQtQuick3DDefaultMaterial() || parentInfo.isQtQuick3DPrincipledMaterial()
@@ -101,6 +103,9 @@ ChooseFromPropertyListFilter::ChooseFromPropertyListFilter(const NodeMetaInfo &i
} else if (insertInfo.isEffectMaker()) {
if (parentInfo.isQtQuickItem())
propertyList.append("effect");
} else if (insertInfo.isQtQuick3DBakedLightmap()) {
if (parentInfo.isQtQuick3DModel())
propertyList.append("bakedLightmap");
}
}

View File

@@ -118,6 +118,7 @@ public:
bool isQtMultimediaSoundEffect() const;
bool isQtObject() const;
bool isQtQuick3D() const;
bool isQtQuick3DBakedLightmap() const;
bool isQtQuick3DBuffer() const;
bool isQtQuick3DCamera() const;
bool isQtQuick3DCommand() const;

View File

@@ -2245,7 +2245,17 @@ bool NodeMetaInfo::isQtQuick3DCamera() const
using namespace Storage::Info;
return isBasedOnCommonType<QtQuick3D, Camera>(m_projectStorage, m_typeId);
} else {
return isValid() && isSubclassOf("QQuick3D.Camera");
return isValid() && isSubclassOf("QtQuick3D.Camera");
}
}
bool NodeMetaInfo::isQtQuick3DBakedLightmap() const
{
if constexpr (useProjectStorage()) {
using namespace Storage::Info;
return isBasedOnCommonType<QtQuick3D, BakedLightmap>(m_projectStorage, m_typeId);
} else {
return isValid() && isSubclassOf("QtQuick3D.BakedLightmap");
}
}
@@ -2255,7 +2265,7 @@ bool NodeMetaInfo::isQtQuick3DBuffer() const
using namespace Storage::Info;
return isBasedOnCommonType<QtQuick3D, Buffer>(m_projectStorage, m_typeId);
} else {
return isValid() && isSubclassOf("QQuick3D.Buffer");
return isValid() && isSubclassOf("QtQuick3D.Buffer");
}
}
@@ -2265,7 +2275,7 @@ bool NodeMetaInfo::isQtQuick3DInstanceListEntry() const
using namespace Storage::Info;
return isBasedOnCommonType<QtQuick3D, InstanceListEntry>(m_projectStorage, m_typeId);
} else {
return isValid() && isSubclassOf("QQuick3D.InstanceListEntry");
return isValid() && isSubclassOf("QtQuick3D.InstanceListEntry");
}
}
@@ -2275,7 +2285,7 @@ bool NodeMetaInfo::isQtQuick3DInstanceList() const
using namespace Storage::Info;
return isBasedOnCommonType<QtQuick3D, InstanceList>(m_projectStorage, m_typeId);
} else {
return isValid() && isSubclassOf("QQuick3D.InstanceList");
return isValid() && isSubclassOf("QtQuick3D.InstanceList");
}
}

View File

@@ -791,4 +791,26 @@ MetaInfo {
toolTip: qsTr("A sound object in 3D space.")
}
}
Type {
name: "QtQuick3D.BakedLightmap"
icon: ":/ItemLibrary/images/item-default-icon.png"
Hints {
canBeDroppedInNavigator: true
canBeDroppedInFormEditor: false
canBeDroppedInView3D: false
}
ItemLibraryEntry {
name: "Baked Lightmap"
category: "Components"
libraryIcon: ":/ItemLibrary/images/item-default-icon.png"
version: "6.5"
requiredImport: "QtQuick3D"
toolTip: qsTr("An object to specify details about baked lightmap of a model.")
Property { name: "loadPrefix"; type: "string"; value: "lightmaps"; }
}
}
}