From aedc27030402c3108f459280fabdec7d8e5bae5d Mon Sep 17 00:00:00 2001 From: michabr <82236305+michabr@users.noreply.github.com> Date: Fri, 28 May 2021 13:40:08 -0700 Subject: [PATCH] Fix path not showing up in asset property control (#1037) --- .../UI/PropertyEditor/PropertyAssetCtrl.cpp | 15 ++++++++++----- .../Code/Editor/PropertyHandlerDirectory.cpp | 5 +++-- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp index dd39cf9b97..169a90497b 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/PropertyEditor/PropertyAssetCtrl.cpp @@ -953,11 +953,16 @@ namespace AzToolsFramework return; } - const AZ::Data::AssetId assetID = GetCurrentAssetID(); - m_currentAssetHint = ""; - - if (!m_unnamedType) + const AZStd::string& folderPath = GetFolderSelection(); + if (!folderPath.empty()) { + m_currentAssetHint = folderPath; + } + else + { + const AZ::Data::AssetId assetID = GetCurrentAssetID(); + m_currentAssetHint = ""; + AZ::Outcome jobOutcome = AZ::Failure(); AssetSystemJobRequestBus::BroadcastResult(jobOutcome, &AssetSystemJobRequestBus::Events::GetAssetJobsInfoByAssetID, assetID, false, false); @@ -971,7 +976,7 @@ namespace AzToolsFramework if (!jobs.empty()) { - // The default behavior is show to the source filename. + // The default behavior is to show the source filename. assetPath = jobs[0].m_sourceFile; AZStd::string errorLog; diff --git a/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp b/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp index 61f6e0f3dc..893790d0f5 100644 --- a/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp +++ b/Gems/LyShine/Code/Editor/PropertyHandlerDirectory.cpp @@ -158,7 +158,10 @@ bool PropertyHandlerDirectory::ReadValuesIntoGUI(size_t index, PropertyDirectory ctrl->blockSignals(true); { + // Set currently selected folder path + // Note: this must be done before setting asset type below which updates the GUI display ctrl->SetCurrentAssetHint(instance); + ctrl->SetFolderSelection(instance); // We need to set the asset type so the property panel labels get // populated properly (via SetCurrentAssetType). To avoid defining @@ -166,8 +169,6 @@ bool PropertyHandlerDirectory::ReadValuesIntoGUI(size_t index, PropertyDirectory // logic to run (otherwise it will early-out due to invalid asset type). const char* throwAwayAssetType = "{43EDD212-F589-43C8-BC02-A8F9243271CB}"; ctrl->SetCurrentAssetType(AZ::Data::AssetType(throwAwayAssetType)); - - ctrl->SetFolderSelection(instance); } ctrl->blockSignals(false);