Mesh Component: Add button to the Mesh Asset field to open mesh FBX settings (#7547)
This is an UX improvement for Mesh Component as the user can quickly access FBX settings of the mesh to modify it if they so desire. Video https://user-images.githubusercontent.com/27999040/153414278-f7996b9a-8a28-49d4-92a8-daeb9924b148.mp4 Signed-off-by: moraaar moraaar@amazon.com
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
#include <AzCore/RTTI/ReflectContext.h>
|
||||
#include <AzCore/Serialization/SerializeContext.h>
|
||||
#include <AzCore/Serialization/EditContext.h>
|
||||
|
||||
namespace AZ
|
||||
{
|
||||
@@ -35,6 +36,15 @@ namespace AZ
|
||||
->Field("MaterialSlots", &ModelAsset::m_materialSlots)
|
||||
->Field("LodAssets", &ModelAsset::m_lodAssets)
|
||||
;
|
||||
|
||||
// Note: This class needs to have edit context reflection so PropertyAssetCtrl::OnEditButtonClicked
|
||||
// can open the asset with the preferred asset editor (Scene Settings).
|
||||
if (auto* editContext = serializeContext->GetEditContext())
|
||||
{
|
||||
editContext->Class<ModelAsset>("Model Asset", "")
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,9 @@ namespace AZ
|
||||
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
|
||||
->Attribute(AZ::Edit::Attributes::AutoExpand, true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &MeshComponentConfig::m_modelAsset, "Mesh Asset", "Mesh asset reference")
|
||||
->Attribute(AZ_CRC_CE("EditButton"), "")
|
||||
->Attribute(AZ_CRC_CE("EditDescription"), "Open in Scene Settings")
|
||||
->Attribute(AZ_CRC_CE("DisableEditButtonWhenNoAssetSelected"), true)
|
||||
->DataElement(AZ::Edit::UIHandlers::Default, &MeshComponentConfig::m_sortKey, "Sort Key", "Transparent meshes are drawn by sort key then depth. Used this to force certain transparent meshes to draw before or after others.")
|
||||
->Attribute(AZ::Edit::Attributes::Visibility, &MeshComponentConfig::IsAssetSet)
|
||||
->DataElement(AZ::Edit::UIHandlers::CheckBox, &MeshComponentConfig::m_excludeFromReflectionCubeMaps, "Exclude from reflection cubemaps", "Mesh will not be visible in baked reflection probe cubemaps")
|
||||
|
||||
Reference in New Issue
Block a user