diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick3D/BakedLightmapSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick3D/BakedLightmapSection.qml new file mode 100644 index 00000000000..ceb41793601 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick3D/BakedLightmapSection.qml @@ -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 {} + } + } +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick3D/BakedLightmapSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick3D/BakedLightmapSpecifics.qml new file mode 100644 index 00000000000..cca06c421a0 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick3D/BakedLightmapSpecifics.qml @@ -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 + } +} diff --git a/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp b/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp index f0f88d7f445..35078859de0 100644 --- a/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp +++ b/src/plugins/qmldesigner/components/navigator/choosefrompropertylistdialog.cpp @@ -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"); } } diff --git a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h index 35f2c25f461..69ac5f2a977 100644 --- a/src/plugins/qmldesigner/designercore/include/nodemetainfo.h +++ b/src/plugins/qmldesigner/designercore/include/nodemetainfo.h @@ -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; diff --git a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp index 6f4ffd4cc0f..f4b505c4e70 100644 --- a/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp +++ b/src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp @@ -2245,7 +2245,17 @@ bool NodeMetaInfo::isQtQuick3DCamera() const using namespace Storage::Info; return isBasedOnCommonType(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(m_projectStorage, m_typeId); + } else { + return isValid() && isSubclassOf("QtQuick3D.BakedLightmap"); } } @@ -2255,7 +2265,7 @@ bool NodeMetaInfo::isQtQuick3DBuffer() const using namespace Storage::Info; return isBasedOnCommonType(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(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(m_projectStorage, m_typeId); } else { - return isValid() && isSubclassOf("QQuick3D.InstanceList"); + return isValid() && isSubclassOf("QtQuick3D.InstanceList"); } } diff --git a/src/plugins/qmldesigner/qtquickplugin/quick.metainfo b/src/plugins/qmldesigner/qtquickplugin/quick.metainfo index e9a01ef66e6..45e01621280 100644 --- a/src/plugins/qmldesigner/qtquickplugin/quick.metainfo +++ b/src/plugins/qmldesigner/qtquickplugin/quick.metainfo @@ -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"; } + } + } }