Explorar o código

Scene settings row dividers (#11413)

* Scene settings icon update:
-Icons now support SVGs
-Icons are retrieved from the edit context in some cases (useful for Gems)
-Added two SVG icons

Remaining icons are waiting on UX

Signed-off-by: AMZN-stankowi <[email protected]>

* Removed unused mesh.png icon

Signed-off-by: AMZN-stankowi <[email protected]>

* Top level dividers in scene settings

Signed-off-by: AMZN-stankowi <[email protected]>

* Fixed casing issue for Linux

Signed-off-by: AMZN-stankowi <[email protected]>

Signed-off-by: AMZN-stankowi <[email protected]>
AMZN-stankowi %!s(int64=2) %!d(string=hai) anos
pai
achega
e70c87a36e

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3 - 0
Assets/Editor/Icons/AssetImporter/Mesh.svg


+ 0 - 3
Assets/Editor/Icons/AssetImporter/mesh.png

@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:92dd31098a955586ecce1af46593616696eecfb5901244764d3809d816d37fde
-size 664

+ 1 - 0
Code/Tools/SceneAPI/SceneData/Groups/AnimationGroup.cpp

@@ -158,6 +158,7 @@ namespace AZ
                         ->ClassElement(Edit::ClassElements::EditorData, "")
                             ->Attribute("AutoExpand", true)
                             ->Attribute(Edit::Attributes::NameLabelOverride, "")
+                            ->Attribute(AZ::Edit::Attributes::CategoryStyle, "display divider")
                         ->DataElement(AZ_CRC("ManifestName", 0x5215b349), &AnimationGroup::m_name, "Group name",
                             "Name for the group. This name will also be used as the name for the generated file.")
                             ->Attribute("FilterType", DataTypes::IAnimationGroup::TYPEINFO_Uuid())

+ 1 - 0
Code/Tools/SceneAPI/SceneData/Groups/MeshGroup.cpp

@@ -93,6 +93,7 @@ namespace AZ
                         ->ClassElement(Edit::ClassElements::EditorData, "")
                             ->Attribute("AutoExpand", true)
                             ->Attribute(Edit::Attributes::NameLabelOverride, "")
+                            ->Attribute(AZ::Edit::Attributes::CategoryStyle, "display divider")
                         ->DataElement(AZ_CRC("ManifestName", 0x5215b349), &MeshGroup::m_name, "Name mesh",
                             "Name the mesh as you want it to appear in the Open 3D Engine Asset Browser.")
                             ->Attribute("FilterType", DataTypes::IMeshGroup::TYPEINFO_Uuid())

+ 4 - 1
Code/Tools/SceneAPI/SceneUI/ManifestMetaInfoHandler.cpp

@@ -6,6 +6,7 @@
  *
  */
 
+#include <AzCore/Component/ComponentApplicationBus.h>
 #include <AzCore/Memory/SystemAllocator.h>
 #include <SceneAPI/SceneUI/ManifestMetaInfoHandler.h>
 #include <SceneAPI/SceneCore/DataTypes/Groups/IMeshGroup.h>
@@ -13,6 +14,7 @@
 #include <SceneAPI/SceneCore/DataTypes/Groups/ISkinGroup.h>
 #include <SceneAPI/SceneCore/DataTypes/Groups/IAnimationGroup.h>
 
+
 namespace AZ
 {
     namespace SceneAPI
@@ -33,9 +35,10 @@ namespace AZ
 
             void ManifestMetaInfoHandler::GetIconPath(AZStd::string& iconPath, const DataTypes::IManifestObject& target)
             {
+                // Icons for classes that don't have edit serialize contexts
                 if (target.RTTI_IsTypeOf(DataTypes::IMeshGroup::TYPEINFO_Uuid()))
                 {
-                    iconPath = ":/SceneUI/Manifest/MeshGroupIcon.png";
+                    iconPath = ":/SceneUI/Manifest/MeshGroupIcon.svg";
                 }
                 else if (target.RTTI_IsTypeOf(DataTypes::ISkeletonGroup::TYPEINFO_Uuid()))
                 {

+ 84 - 3
Code/Tools/SceneAPI/SceneUI/RowWidgets/HeaderWidget.cpp

@@ -11,16 +11,21 @@
 #include <AzCore/EBus/EBus.h>
 #include <AzCore/Component/ComponentApplicationBus.h>
 #include <AzCore/Serialization/SerializeContext.h>
+#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
 #include <AzToolsFramework/UI/PropertyEditor/PropertyEditorAPI.h>
 #include <AzToolsFramework/Debug/TraceContext.h>
 #include <SceneAPI/SceneCore/Containers/Scene.h>
 #include <SceneAPI/SceneCore/Containers/SceneManifest.h>
+#include <SceneAPI/SceneCore/DataTypes/Groups/ISceneNodeGroup.h>
 #include <SceneAPI/SceneCore/Utilities/Reporting.h>
 #include <SceneAPI/SceneCore/Events/ManifestMetaInfoBus.h>
 #include <SceneAPI/SceneUI/RowWidgets/HeaderWidget.h>
 #include <SceneAPI/SceneUI/RowWidgets/ManifestVectorWidget.h>
 #include <SceneAPI/SceneUI/SceneWidgets/ManifestWidget.h>
 
+
+#include <QFile>
+
 static void InitSceneUIHeaderWidgetResources()
 {
     Q_INIT_RESOURCE(Icons);
@@ -46,6 +51,8 @@ namespace AZ
                 ui->setupUi(this);
 
                 ui->m_icon->hide();
+                ui->m_headerLine->hide();
+                ui->m_headerLineSpacer->hide();
                 
                 ui->m_deleteButton->setIcon(QIcon(":/PropertyEditor/Resources/cross-small.png"));
                 connect(ui->m_deleteButton, &QToolButton::clicked, this, &HeaderWidget::DeleteObject);
@@ -67,7 +74,7 @@ namespace AZ
                 ui->m_nameLabel->setText(GetSerializedName(target));
                 
                 UpdateDeletable();
-                SetIcon(target);
+                UpdateUIForManifestObject(target);
             }
 
             const DataTypes::IManifestObject* HeaderWidget::GetManifestObject() const
@@ -175,22 +182,96 @@ namespace AZ
                 return "<type not registered>";
             }
 
-            void HeaderWidget::SetIcon(const DataTypes::IManifestObject* target)
+            void HeaderWidget::UpdateUIForManifestObject(const DataTypes::IManifestObject* target)
             {
                 if (!target)
                 {
                     return;
                 }
 
+                const AZ::Edit::ElementData* editorElementData = nullptr;
+                const DataTypes::IGroup* sceneNodeGroup = nullptr;
+
+                // Retrieve information from the edit context to figure out if this HeaderWidget
+                // show have a visual divider, and potentially the icon.
+                if (target->RTTI_IsTypeOf(DataTypes::IGroup::TYPEINFO_Uuid()))
+                {
+                    sceneNodeGroup = azrtti_cast<const DataTypes::IGroup*>(&target);
+                    
+                    AZ::SerializeContext* serializeContext = nullptr;
+                    AZ::ComponentApplicationBus::BroadcastResult(serializeContext, &AZ::ComponentApplicationBus::Events::GetSerializeContext);
+                    AZ_Assert(serializeContext, "No serialize context");
+
+                    auto classData = serializeContext->FindClassData(target->RTTI_GetType());
+                    if (classData && classData->m_editData)
+                    {
+                        editorElementData = classData->m_editData->FindElementData(AZ::Edit::ClassElements::EditorData);
+
+
+                        if (auto categoryAttribute = editorElementData->FindAttribute(AZ::Edit::Attributes::CategoryStyle))
+                        {
+                            if (auto categoryAttributeData = azdynamic_cast<const AZ::Edit::AttributeData<const char*>*>(categoryAttribute))
+                            {
+                                AZStd::string categoryAttributeValue = categoryAttributeData->Get(&sceneNodeGroup);
+                                if (categoryAttributeValue.compare("display divider") == 0)
+                                {
+                                    ui->m_headerLine->show();
+                                    ui->m_headerLineSpacer->show();
+                                }
+                            }
+                        }
+                    }
+                }
+
+                // First, see if there's an icon registered on the ManifestMetaInfoBus.
                 AZStd::string iconPath;
                 EBUS_EVENT(Events::ManifestMetaInfoBus, GetIconPath, iconPath, *target);
+
+                // If there isn't, then attempt to retrieve it from the edit context.
+                if (iconPath.empty() && editorElementData)
+                {
+                    // Search the edit context for an icon.
+                    // It will have been reflected like:
+                    //  ->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/MeshCollider.svg")
+                    if (auto iconAttribute = editorElementData->FindAttribute(AZ::Edit::Attributes::Icon))
+                    {
+                        if (auto iconAttributeData = azdynamic_cast<const AZ::Edit::AttributeData<const char*>*>(iconAttribute))
+                        {
+                            AZStd::string iconAttributeValue = iconAttributeData->Get(&sceneNodeGroup);
+                            if (!iconAttributeValue.empty())
+                            {
+                                iconPath = AZStd::move(iconAttributeValue);
+                                        
+                                // The path is probably going to be relative to a scan directory,
+                                // especially if this node was defined in a Gem.
+                                // If a first check doesn't find the file, then see if the path can
+                                // be resolved via the asset system, and pull an absolute path from there.
+                                if (!QFile::exists(QString(iconPath.c_str())))
+                                {
+                                    AZStd::string iconFullPath;
+                                    bool pathFound = false;
+                                    using AssetSysReqBus = AzToolsFramework::AssetSystemRequestBus;
+                                    AssetSysReqBus::BroadcastResult(
+                                        pathFound, &AssetSysReqBus::Events::GetFullSourcePathFromRelativeProductPath,
+                                        iconPath, iconFullPath);
+                                    if (pathFound)
+                                    {
+                                        iconPath = AZStd::move(iconFullPath);
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+
                 if (iconPath.empty())
                 {
                     ui->m_icon->hide();
                 }
                 else
                 {
-                    ui->m_icon->setPixmap(QPixmap(iconPath.c_str()));
+                    ui->m_icon->setPixmap(QIcon(iconPath.c_str()).pixmap(QSize(ui->m_icon->size())));
+                    
                     ui->m_icon->show();
                 }
             }

+ 1 - 1
Code/Tools/SceneAPI/SceneUI/RowWidgets/HeaderWidget.h

@@ -57,7 +57,7 @@ namespace AZ
                 virtual void UpdateDeletable();
                 
                 virtual const char* GetSerializedName(const DataTypes::IManifestObject* target) const;
-                virtual void SetIcon(const DataTypes::IManifestObject* target);
+                virtual void UpdateUIForManifestObject(const DataTypes::IManifestObject* target);
 
                 AZStd::string m_objectName;
                 QScopedPointer<Ui::HeaderWidget> ui;

+ 110 - 35
Code/Tools/SceneAPI/SceneUI/RowWidgets/HeaderWidget.ui

@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>150</width>
-    <height>20</height>
+    <height>61</height>
    </rect>
   </property>
   <property name="sizePolicy">
@@ -16,58 +16,133 @@
     <verstretch>20</verstretch>
    </sizepolicy>
   </property>
-  <layout class="QHBoxLayout" name="horizontalLayout">
-   <property name="leftMargin">
-    <number>0</number>
-   </property>
-   <property name="topMargin">
-    <number>0</number>
-   </property>
-   <property name="rightMargin">
-    <number>0</number>
-   </property>
-   <property name="bottomMargin">
-    <number>0</number>
-   </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
    <item>
-    <widget class="QLabel" name="m_icon">
+    <widget class="QWidget" name="m_headerLineSpacer" native="true">
      <property name="sizePolicy">
-      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-       <horstretch>16</horstretch>
-       <verstretch>16</verstretch>
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>6</verstretch>
       </sizepolicy>
      </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>6</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>6</height>
+      </size>
+     </property>
     </widget>
    </item>
    <item>
-    <widget class="QLabel" name="m_nameLabel">
-     <property name="text">
-      <string>Name label</string>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <property name="spacing">
+      <number>6</number>
      </property>
-    </widget>
+     <item>
+      <widget class="QLabel" name="m_icon">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <horstretch>16</horstretch>
+         <verstretch>16</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>16</width>
+         <height>16</height>
+        </size>
+       </property>
+       <property name="baseSize">
+        <size>
+         <width>16</width>
+         <height>16</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="m_nameLabel">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize">
+        <size>
+         <width>0</width>
+         <height>18</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>16777215</width>
+         <height>18</height>
+        </size>
+       </property>
+       <property name="text">
+        <string>Name label</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QToolButton" name="m_deleteButton">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <horstretch>16</horstretch>
+         <verstretch>16</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize">
+        <size>
+         <width>16</width>
+         <height>16</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>16</width>
+         <height>16</height>
+        </size>
+       </property>
+       <property name="toolTip">
+        <string>Delete this entry</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
    </item>
    <item>
-    <widget class="QToolButton" name="m_deleteButton">
-     <property name="sizePolicy">
-      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-       <horstretch>16</horstretch>
-       <verstretch>16</verstretch>
-      </sizepolicy>
-     </property>
+    <widget class="Line" name="m_headerLine">
      <property name="minimumSize">
       <size>
-       <width>16</width>
-       <height>16</height>
+       <width>0</width>
+       <height>1</height>
       </size>
      </property>
      <property name="maximumSize">
       <size>
-       <width>16</width>
-       <height>16</height>
+       <width>16777215</width>
+       <height>1</height>
       </size>
      </property>
-     <property name="toolTip">
-      <string>Delete this entry</string>
+     <property name="styleSheet">
+      <string notr="true">color: rgb(126, 126, 126);</string>
+     </property>
+     <property name="frameShadow">
+      <enum>QFrame::Plain</enum>
+     </property>
+     <property name="lineWidth">
+      <number>2</number>
+     </property>
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>

+ 1 - 1
Code/Tools/SceneAPI/SceneUI/SceneUI.qrc

@@ -6,7 +6,7 @@
     </qresource>
     <qresource prefix="/SceneUI/Manifest">
       <file alias="TreeIcon.png">../../../../Assets/Editor/Icons/AssetImporter/tree.png</file>
-      <file alias="MeshGroupIcon.png">../../../../Assets/Editor/Icons/AssetImporter/mesh.png</file>
+      <file alias="MeshGroupIcon.svg">../../../../Assets/Editor/Icons/AssetImporter/Mesh.svg</file>
       <file alias="AnimationGroupIcon.png">../../../../Assets/Editor/Icons/AssetImporter/animation.png</file>
       <file alias="SkeletonGroupIcon.png">../../../../Assets/Editor/Icons/AssetImporter/skeleton.png</file>
       <file alias="SkinGroupIcon.png">../../../../Assets/Editor/Icons/AssetImporter/skin.png</file>

+ 1 - 0
Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Groups/ActorGroup.cpp

@@ -121,6 +121,7 @@ namespace EMotionFX
                         ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
                             ->Attribute("AutoExpand", true)
                             ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
+                            ->Attribute(AZ::Edit::Attributes::CategoryStyle, "display divider")
                         ->DataElement(AZ_CRC("ManifestName", 0x5215b349), &ActorGroup::m_name, "Name actor",
                             "Name for the group. This name will also be used as the name for the generated file.")
                             ->Attribute("FilterType", IActorGroup::TYPEINFO_Uuid())

+ 1 - 0
Gems/EMotionFX/Code/EMotionFX/Pipeline/SceneAPIExt/Groups/MotionGroup.cpp

@@ -104,6 +104,7 @@ namespace EMotionFX
                         ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
                             ->Attribute("AutoExpand", true)
                             ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
+                            ->Attribute(AZ::Edit::Attributes::CategoryStyle, "display divider")
                         ->DataElement(AZ_CRC("ManifestName", 0x5215b349), &MotionGroup::m_name, "Name motion",
                             "Name for the group. This name will also be used as the name for the generated file.")
                             ->Attribute("FilterType", IMotionGroup::TYPEINFO_Uuid())

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 3 - 0
Gems/PhysX/Assets/Editor/Icons/MeshCollider.svg


+ 2 - 0
Gems/PhysX/Code/Source/Pipeline/MeshGroup.cpp

@@ -618,6 +618,8 @@ namespace PhysX
                         ->ClassElement(AZ::Edit::ClassElements::EditorData, "")
                             ->Attribute(AZ::Edit::Attributes::AutoExpand, true)
                             ->Attribute(AZ::Edit::Attributes::NameLabelOverride, "")
+                            ->Attribute(AZ::Edit::Attributes::Icon, "Editor/Icons/MeshCollider.svg")
+                            ->Attribute(AZ::Edit::Attributes::CategoryStyle, "display divider")
 
                         ->DataElement(AZ_CRC_CE("ManifestName"), &MeshGroup::m_name, "Name PhysX Mesh",
                             "<span>Name for the group. This name will also be used as a part of the name for the "

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio