From 8e8cb6aa3dee6e40ab63a5e69bf11c4e12d4fbdb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Tue, 28 Feb 2023 17:49:18 +0200 Subject: [PATCH] QmlDesigner: Fix shader asset icon in assets view Fixes: QDS-9297 Change-Id: Ib81e1e12476b436dbb04984bf6f6567a88a44f63 Reviewed-by: Mahmoud Badri --- src/plugins/qmldesigner/utils/asset.cpp | 17 ++++++++++++++--- src/plugins/qmldesigner/utils/asset.h | 6 ++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/plugins/qmldesigner/utils/asset.cpp b/src/plugins/qmldesigner/utils/asset.cpp index 738d49f3340..1264630061b 100644 --- a/src/plugins/qmldesigner/utils/asset.cpp +++ b/src/plugins/qmldesigner/utils/asset.cpp @@ -35,6 +35,12 @@ const QStringList &Asset::supportedFragmentShaderSuffixes() return retList; } +const QStringList &Asset::supportedVertexShaderSuffixes() +{ + static const QStringList retList {"*.vert", "*.glsl", "*.glslv", "*.vsh"}; + return retList; +} + const QStringList &Asset::supportedShaderSuffixes() { static const QStringList retList {"*.frag", "*.vert", @@ -114,9 +120,14 @@ bool Asset::isFragmentShader() const return m_type == Asset::Type::FragmentShader; } +bool Asset::isVertexShader() const +{ + return m_type == Asset::Type::VertexShader; +} + bool Asset::isShader() const { - return m_type == Asset::Type::Shader; + return isFragmentShader() || isVertexShader(); } bool Asset::isFont() const @@ -178,8 +189,8 @@ void Asset::resolveType() m_type = Asset::Type::Image; else if (supportedFragmentShaderSuffixes().contains(m_suffix)) m_type = Asset::Type::FragmentShader; - else if (supportedShaderSuffixes().contains(m_suffix)) - m_type = Asset::Type::Shader; + else if (supportedVertexShaderSuffixes().contains(m_suffix)) + m_type = Asset::Type::VertexShader; else if (supportedFontSuffixes().contains(m_suffix)) m_type = Asset::Type::Font; else if (supportedAudioSuffixes().contains(m_suffix)) diff --git a/src/plugins/qmldesigner/utils/asset.h b/src/plugins/qmldesigner/utils/asset.h index a9d6d0a135a..dce8c47e8ac 100644 --- a/src/plugins/qmldesigner/utils/asset.h +++ b/src/plugins/qmldesigner/utils/asset.h @@ -14,17 +14,18 @@ public: Image, MissingImage, FragmentShader, + VertexShader, Font, Audio, Video, Texture3D, - Effect, - Shader }; + Effect }; Asset(const QString &filePath); static const QStringList &supportedImageSuffixes(); static const QStringList &supportedFragmentShaderSuffixes(); + static const QStringList &supportedVertexShaderSuffixes(); static const QStringList &supportedShaderSuffixes(); static const QStringList &supportedFontSuffixes(); static const QStringList &supportedAudioSuffixes(); @@ -41,6 +42,7 @@ public: Type type() const; bool isImage() const; bool isFragmentShader() const; + bool isVertexShader() const; bool isShader() const; bool isFont() const; bool isAudio() const;