Update the FileIO Aliases (#4186)
* Update the FileIOAlias naming to make the cache, project root and engine root paths more clear The alias of `@root@`, `@assets@`, and `@projectplatformcache@` has been collapsed to `@projectproductassets@` The alias of `@devroot@` and `@engroot@` has been collapsed to `@engroot@` The alias of `@devassets@` and `@projectroot@` has been collapsed to `@projectroot@` Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated use of devassets and devroot properties in python Those properties now use projectroot and engroot Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updating the alias @engroot@ alias path comment in each platform specific LocalFileIO_*.cpp file Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Removed hardcoded size of 9 for the product asset alias. The ResolvePath function now just appends the @projectproductassets@ alias with the input path Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Remove duplicate @projectproductassets@ check in ProcessFileTreeRequest Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fix for typos in Hydra python test Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated LocalFileIO::Copy call on Windows to use the Unicode aware CopyFileW API Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated the AWSMetreicsGemAllocatorFixture to properly suppress asset cache write errors for Test file creation. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Removed unneeded call to set the @projectproductasstes@ alias at the bottom of the AssetSeedManagerTest SetUp Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Added a deprecated alias map to the FileIO System When a deprecated alias is accessed, the FileIO System logs an AZ_Error and indicates the alias that should be used Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated python test scripts to use the projectroot binding Retrieving the AutomatedTesting project path based on "<devroot>/AutomatedTesting" has been removed. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated references to devroot and devgame within the codebase The GetAbsoluteDevGameFolderPath functions has been replaced with direct call to AZ::Utils::GetProjectPath The GetAbsoluteDevRootFolderPath functions has been replaced with direct calls to AZ::Utils::GetEnginePath Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated <engroot>/AutomatedTesting references to projectroot Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Replaced references that assumes the project path is <engroot>/AutomatedTesting with <projectroot> in the AutomatedTesting python test Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Correct casing in emfxworkspace file Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Removed newly added AppendPathParts function Removed the Path constructors which accepts a PathIterable instance The PathIterable isn't safe to return to a user of the Path class as it might be referencing temporary paths supplied via PathView arguments Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fixed unused parameter warning Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Undid change to the LexicallyProximate function to set the path result to the base path. It needs to return the *this path if the pathResult is empty Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Moved the LocalFileIO ConvertToAbsolutePath implementations to AZ::Utils Fixed the ConvertToAbsolutePath implementation for Unix platforms to use a buffer that is size PATH_MAX(4096 on all our supported Unix platforms). Because the buffer before was AZ::IO::MaxPathLength which as a size of 1024, this was resulting in the Unix `realpath` function smashing the stack when it converts a path to an absolute path that is longer than 1024 characters Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated the EditorCore.Tests to attach the AZ Environment to the EditorCore shared library that is statically loaded on launch. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fixed for DeprecatedAlaisesKeyVisitor Visit function causing the non string_view overloads being hidden causing a hidden base class function warning Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Changed the AWSMetricsGemMock to use a temporary for writing test assets Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated the LocalFileIO::ResolvePath function to use HasRootPath to determine if a path starts with a root path such as "D:", "D:/" or "/" IsAbsolute was not the corect check as the path of "D:" is a relative path. To be absolute according to the Windows the path must have a root directory. i.e "D:/" or "D:\" Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Removed absolute path comment from LocalFile_UnixLike.cpp and LocalFile_Android.cpp FindFiles implementations Updated the ConvertToAlias to supply an AZ::IO::FixedMaxPath Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Replaced usage of the @projectproductassets@ alias with @engroot@ when referring to the LmbrCentral source folder in the CopyDependencyBuilderTest and the SeedBuilderTests Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated the ScriptCanvas Upgrade Tool to output backed up files to the Project User Path instead of the engine root Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fixed whitespacing issues in Application.cpp Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Remove unnecessary creation of a FixedMaxPath in the UpgradeTool.cpp Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Modified testSeedFolder variable in the SeedBuilderTests to use the @engroot@ alias instead of @projectproductassets@/.. alias when referring to the LmbrCentral Gem source path Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Updated references to the Project Asset Cache in the PythonTests. Those tests no longer use the logic `azlmbr.paths.projectroot / "Cache" / "pc"` to retrieve a path to the cache root but instead the `azlmbr.paths.projectproductassets` constant Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Fixed the FileIO Deprecated Alias test on Windows Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Removing @projectsourceassets@ alias, as it is only used once. Updated the PhysX EditorSystemComponent.cpp to query the ProjectPath form the SettingsRegistry. Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Replaced @projectproductassets@ alias with @products@ Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com> * Rollback changes to the PhysX EditorSystemComponent.cpp The changes to use the ProjectPath from the SettingsRegistry has been implemented in PR #4497 Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
643bd84739
commit
f648cb1fd8
@@ -1895,7 +1895,7 @@ void SandboxIntegrationManager::MakeSliceFromEntities(const AzToolsFramework::En
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(entitiesAndDescendants,
|
||||
&AzToolsFramework::ToolsApplicationRequestBus::Events::GatherEntitiesAndAllDescendents, entities);
|
||||
|
||||
const AZStd::string slicesAssetsPath = "@devassets@/Slices";
|
||||
const AZStd::string slicesAssetsPath = "@projectroot@/Slices";
|
||||
|
||||
if (!gEnv->pFileIO->Exists(slicesAssetsPath.c_str()))
|
||||
{
|
||||
|
||||
@@ -30,6 +30,7 @@ class CXTPDockingPaneLayout; // Needed for settings.h
|
||||
#include <AzCore/Component/ComponentApplicationBus.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/std/functional.h>
|
||||
#include <AzCore/Utils/Utils.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <Util/PathUtil.h>
|
||||
@@ -47,41 +48,6 @@ class CXTPDockingPaneLayout; // Needed for settings.h
|
||||
const char* AssetImporterWindow::s_documentationWebAddress = "http://docs.aws.amazon.com/lumberyard/latest/userguide/char-fbx-importer.html";
|
||||
const AZ::Uuid AssetImporterWindow::s_browseTag = AZ::Uuid::CreateString("{C240D2E1-BFD2-4FFA-BB5B-CC0FA389A5D3}");
|
||||
|
||||
void MakeUserFriendlySourceAssetPath(QString& out, const QString& sourcePath)
|
||||
{
|
||||
char devAssetsRoot[AZ_MAX_PATH_LEN] = { 0 };
|
||||
if (!gEnv->pFileIO->ResolvePath("@devroot@", devAssetsRoot, AZ_MAX_PATH_LEN))
|
||||
{
|
||||
out = sourcePath;
|
||||
return;
|
||||
}
|
||||
|
||||
AZStd::replace(devAssetsRoot, devAssetsRoot + AZ_MAX_PATH_LEN- 1, AZ_WRONG_FILESYSTEM_SEPARATOR, AZ_CORRECT_FILESYSTEM_SEPARATOR);
|
||||
|
||||
// Find if the sourcePathArray is a sub directory of the devAssets folder
|
||||
// Keep reference to sourcePathArray long enough to use in PathView
|
||||
QByteArray sourcePathArray = sourcePath.toUtf8();
|
||||
AZ::IO::PathView sourcePathRootView(sourcePathArray.data());
|
||||
AZ::IO::PathView devAssetsRootView(devAssetsRoot);
|
||||
auto [sourcePathIter, devAssetsIter] = AZStd::mismatch(sourcePathRootView.begin(), sourcePathRootView.end(),
|
||||
devAssetsRootView.begin(), devAssetsRootView.end());
|
||||
// If the devAssets path iterator is not equal to the end, then there was a mismistch while comparing it
|
||||
// against the source path indicating that the source path is not a sub-directory
|
||||
if (devAssetsIter != devAssetsRootView.end())
|
||||
{
|
||||
out = sourcePath;
|
||||
return;
|
||||
}
|
||||
|
||||
int offset = aznumeric_cast<int>(strlen(devAssetsRoot));
|
||||
if (sourcePath.at(offset) == AZ_CORRECT_FILESYSTEM_SEPARATOR)
|
||||
{
|
||||
++offset;
|
||||
}
|
||||
out = sourcePath.right(sourcePath.length() - offset);
|
||||
|
||||
}
|
||||
|
||||
AssetImporterWindow::AssetImporterWindow()
|
||||
: AssetImporterWindow(nullptr)
|
||||
{
|
||||
@@ -102,7 +68,7 @@ AssetImporterWindow::AssetImporterWindow(QWidget* parent)
|
||||
|
||||
AssetImporterWindow::~AssetImporterWindow()
|
||||
{
|
||||
AZ_Assert(m_processingOverlayIndex == AZ::SceneAPI::UI::OverlayWidget::s_invalidOverlayIndex,
|
||||
AZ_Assert(m_processingOverlayIndex == AZ::SceneAPI::UI::OverlayWidget::s_invalidOverlayIndex,
|
||||
"Processing overlay (and potentially background thread) still active at destruction.");
|
||||
AZ_Assert(!m_processingOverlay, "Processing overlay (and potentially background thread) still active at destruction.");
|
||||
}
|
||||
@@ -133,7 +99,7 @@ void AssetImporterWindow::OpenFile(const AZStd::string& filePath)
|
||||
QMessageBox::warning(this, "In progress", "Unable to close one or more windows at this time.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OpenFileInternal(filePath);
|
||||
}
|
||||
|
||||
@@ -146,7 +112,7 @@ void AssetImporterWindow::closeEvent(QCloseEvent* ev)
|
||||
|
||||
if (m_processingOverlay)
|
||||
{
|
||||
AZ_Assert(m_processingOverlayIndex != AZ::SceneAPI::UI::OverlayWidget::s_invalidOverlayIndex,
|
||||
AZ_Assert(m_processingOverlayIndex != AZ::SceneAPI::UI::OverlayWidget::s_invalidOverlayIndex,
|
||||
"Processing overlay present, but not the index in the overlay for it.");
|
||||
if (m_processingOverlay->HasProcessingCompleted())
|
||||
{
|
||||
@@ -157,7 +123,7 @@ void AssetImporterWindow::closeEvent(QCloseEvent* ev)
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, "Processing In Progress", "Unable to close the result window at this time.",
|
||||
QMessageBox::critical(this, "Processing In Progress", "Unable to close the result window at this time.",
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
ev->ignore();
|
||||
return;
|
||||
@@ -165,7 +131,7 @@ void AssetImporterWindow::closeEvent(QCloseEvent* ev)
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, "Processing In Progress", "Please wait until processing has completed to try again.",
|
||||
QMessageBox::critical(this, "Processing In Progress", "Please wait until processing has completed to try again.",
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
ev->ignore();
|
||||
return;
|
||||
@@ -199,7 +165,9 @@ void AssetImporterWindow::Init()
|
||||
// Load the style sheets
|
||||
AzQtComponents::StylesheetPreprocessor styleSheetProcessor(nullptr);
|
||||
|
||||
AZStd::string mainWindowQSSPath = Path::GetEditingRootFolder() + "\\Editor\\Styles\\AssetImporterWindow.qss";
|
||||
auto mainWindowQSSPath = AZ::IO::Path(AZ::Utils::GetEnginePath()) / "Assets";
|
||||
mainWindowQSSPath /= "Editor/Styles/AssetImporterWindow.qss";
|
||||
mainWindowQSSPath.MakePreferred();
|
||||
QFile mainWindowStyleSheetFile(mainWindowQSSPath.c_str());
|
||||
if (mainWindowStyleSheetFile.open(QFile::ReadOnly))
|
||||
{
|
||||
@@ -212,7 +180,7 @@ void AssetImporterWindow::Init()
|
||||
{
|
||||
ui->m_actionInspect->setVisible(false);
|
||||
}
|
||||
|
||||
|
||||
ResetMenuAccess(WindowState::InitialNothingLoaded);
|
||||
|
||||
// Setup the overlay system, and set the root to be the root display. The root display has the browse,
|
||||
@@ -220,7 +188,7 @@ void AssetImporterWindow::Init()
|
||||
m_overlay.reset(aznew AZ::SceneAPI::UI::OverlayWidget(this));
|
||||
m_rootDisplay.reset(aznew ImporterRootDisplay(m_serializeContext));
|
||||
connect(m_rootDisplay.data(), &ImporterRootDisplay::UpdateClicked, this, &AssetImporterWindow::UpdateClicked);
|
||||
|
||||
|
||||
connect(m_overlay.data(), &AZ::SceneAPI::UI::OverlayWidget::LayerAdded, this, &AssetImporterWindow::OverlayLayerAdded);
|
||||
connect(m_overlay.data(), &AZ::SceneAPI::UI::OverlayWidget::LayerRemoved, this, &AssetImporterWindow::OverlayLayerRemoved);
|
||||
|
||||
@@ -242,7 +210,7 @@ void AssetImporterWindow::Init()
|
||||
AZStd::string joinedExtensions;
|
||||
AzFramework::StringFunc::Join(joinedExtensions, extensions.begin(), extensions.end(), " or ");
|
||||
|
||||
AZStd::string firstLineText =
|
||||
AZStd::string firstLineText =
|
||||
AZStd::string::format(
|
||||
"%s files are available for use after placing them in any folder within your game project. "
|
||||
"These files will automatically be processed and may be accessed via the Asset Browser. <a href=\"%s\">Learn more...</a>",
|
||||
@@ -250,13 +218,13 @@ void AssetImporterWindow::Init()
|
||||
|
||||
ui->m_initialPromptFirstLine->setText(firstLineText.c_str());
|
||||
|
||||
AZStd::string secondLineText =
|
||||
AZStd::string secondLineText =
|
||||
AZStd::string::format("To adjust the %s settings, right-click the file in the Asset Browser and select \"Edit Settings\" from the context menu.", joinedExtensions.c_str());
|
||||
ui->m_initialPromptSecondLine->setText(secondLineText.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
AZStd::string firstLineText =
|
||||
AZStd::string firstLineText =
|
||||
AZStd::string::format(
|
||||
"Files are available for use after placing them in any folder within your game project. "
|
||||
"These files will automatically be processed and may be accessed via the Asset Browser. <a href=\"%s\">Learn more...</a>", s_documentationWebAddress);
|
||||
@@ -282,12 +250,12 @@ void AssetImporterWindow::OpenFileInternal(const AZStd::string& filePath)
|
||||
auto asyncLoadHandler = AZStd::make_shared<AZ::SceneAPI::SceneUI::AsyncOperationProcessingHandler>(
|
||||
s_browseTag,
|
||||
[this, filePath]()
|
||||
{
|
||||
m_assetImporterDocument->LoadScene(filePath);
|
||||
{
|
||||
m_assetImporterDocument->LoadScene(filePath);
|
||||
},
|
||||
[this]()
|
||||
{
|
||||
HandleAssetLoadingCompleted();
|
||||
HandleAssetLoadingCompleted();
|
||||
}, this);
|
||||
|
||||
m_processingOverlay.reset(new ProcessingOverlayWidget(m_overlay.data(), ProcessingOverlayWidget::Layout::Loading, s_browseTag));
|
||||
@@ -304,7 +272,7 @@ bool AssetImporterWindow::IsAllowedToChangeSourceFile()
|
||||
return true;
|
||||
}
|
||||
|
||||
QMessageBox messageBox(QMessageBox::Icon::NoIcon, "Unsaved changes",
|
||||
QMessageBox messageBox(QMessageBox::Icon::NoIcon, "Unsaved changes",
|
||||
"You have unsaved changes. Do you want to discard those changes?",
|
||||
QMessageBox::StandardButton::Discard | QMessageBox::StandardButton::Cancel, this);
|
||||
messageBox.exec();
|
||||
@@ -406,7 +374,7 @@ void AssetImporterWindow::OnSceneResetRequested()
|
||||
else
|
||||
{
|
||||
m_assetImporterDocument->ClearScene();
|
||||
AZ_TracePrintf(ErrorWindow, "Manifest reset returned in '%s'",
|
||||
AZ_TracePrintf(ErrorWindow, "Manifest reset returned in '%s'",
|
||||
result.GetResult() == ProcessingResult::Failure ? "Failure" : "Ignored");
|
||||
}
|
||||
},
|
||||
@@ -456,7 +424,7 @@ void AssetImporterWindow::OnInspect()
|
||||
// make sure the inspector doesn't outlive the AssetImporterWindow, since we own the data it will be inspecting.
|
||||
auto* theInspectWidget = aznew AZ::SceneAPI::UI::SceneGraphInspectWidget(*m_assetImporterDocument->GetScene());
|
||||
QObject::connect(this, &QObject::destroyed, theInspectWidget, [theInspectWidget]() { theInspectWidget->window()->close(); } );
|
||||
|
||||
|
||||
m_overlay->PushLayer(label, theInspectWidget, "Scene Inspector", buttons);
|
||||
}
|
||||
|
||||
@@ -483,7 +451,7 @@ void AssetImporterWindow::OverlayLayerRemoved()
|
||||
else
|
||||
{
|
||||
ResetMenuAccess(WindowState::InitialNothingLoaded);
|
||||
|
||||
|
||||
ui->m_initialBrowseContainer->show();
|
||||
m_rootDisplay->hide();
|
||||
}
|
||||
@@ -533,8 +501,9 @@ void AssetImporterWindow::HandleAssetLoadingCompleted()
|
||||
m_fullSourcePath = m_assetImporterDocument->GetScene()->GetSourceFilename();
|
||||
SetTitle(m_fullSourcePath.c_str());
|
||||
|
||||
QString userFriendlyFileName;
|
||||
MakeUserFriendlySourceAssetPath(userFriendlyFileName, m_fullSourcePath.c_str());
|
||||
AZ::IO::FixedMaxPath projectPath = AZ::Utils::GetProjectPath();
|
||||
AZ::IO::FixedMaxPath relativeSourcePath = AZ::IO::PathView(m_fullSourcePath).LexicallyProximate(projectPath);
|
||||
auto userFriendlyFileName = QString::fromUtf8(relativeSourcePath.c_str(), static_cast<int>(relativeSourcePath.Native().size()));
|
||||
m_rootDisplay->SetSceneDisplay(userFriendlyFileName, m_assetImporterDocument->GetScene());
|
||||
|
||||
// Once we've browsed to something successfully, we need to hide the initial browse button layer and
|
||||
|
||||
@@ -7,9 +7,11 @@
|
||||
*/
|
||||
|
||||
#include <AzCore/Debug/Profiler.h>
|
||||
#include <AzCore/IO/Path/Path.h>
|
||||
#include <AzCore/IO/SystemFile.h>
|
||||
#include <AzCore/std/algorithm.h>
|
||||
#include <AzCore/std/string/conversions.h>
|
||||
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
|
||||
#include <AzFramework/StringFunc/StringFunc.h>
|
||||
#include <AzToolsFramework/API/EditorAssetSystemAPI.h>
|
||||
#include <AzToolsFramework/Debug/TraceContext.h>
|
||||
@@ -50,22 +52,15 @@ namespace AZ
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
AZStd::string cleanPath = filePath;
|
||||
if (AzFramework::StringFunc::Path::IsRelative(filePath.c_str()))
|
||||
AZ::IO::Path enginePath;
|
||||
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
|
||||
{
|
||||
const char* absolutePath = nullptr;
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(absolutePath,
|
||||
&AzToolsFramework::AssetSystemRequestBus::Events::GetAbsoluteDevRootFolderPath);
|
||||
AZ_Assert(absolutePath, "Unable to retrieve the dev folder path");
|
||||
AzFramework::StringFunc::Path::Join(absolutePath, cleanPath.c_str(), cleanPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Normalizing is not needed if the path is relative as Join(...) will also normalize.
|
||||
AzFramework::StringFunc::Path::Normalize(cleanPath);
|
||||
settingsRegistry->Get(enginePath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder);
|
||||
}
|
||||
|
||||
auto sceneIt = m_scenes.find(cleanPath);
|
||||
AZ::IO::Path cleanPath = (enginePath / filePath).LexicallyNormal();
|
||||
|
||||
auto sceneIt = m_scenes.find(cleanPath.Native());
|
||||
if (sceneIt != m_scenes.end())
|
||||
{
|
||||
AZStd::shared_ptr<SceneAPI::Containers::Scene> scene = sceneIt->second.lock();
|
||||
@@ -98,14 +93,14 @@ namespace AZ
|
||||
}
|
||||
|
||||
AZStd::shared_ptr<SceneAPI::Containers::Scene> scene =
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath(cleanPath, sceneSourceGuid, AssetImportRequest::RequestingApplication::Editor, SceneAPI::SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
AssetImportRequest::LoadSceneFromVerifiedPath(cleanPath.Native(), sceneSourceGuid, AssetImportRequest::RequestingApplication::Editor, SceneAPI::SceneCore::LoadingComponent::TYPEINFO_Uuid());
|
||||
if (!scene)
|
||||
{
|
||||
AZ_TracePrintf(Utilities::ErrorWindow, "Failed to load the requested scene.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
m_scenes.emplace(AZStd::move(cleanPath), scene);
|
||||
m_scenes.emplace(AZStd::move(cleanPath.Native()), scene);
|
||||
|
||||
return scene;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,6 @@ namespace ProjectSettingsTool
|
||||
, LastPathBus::Handler()
|
||||
, m_ui(new Ui::ProjectSettingsToolWidget())
|
||||
, m_reconfigureProcess()
|
||||
, m_devRoot(GetDevRoot())
|
||||
, m_projectRoot(GetProjectRoot())
|
||||
, m_projectName(GetProjectName())
|
||||
, m_plistsInitVector(
|
||||
|
||||
@@ -147,7 +147,6 @@ namespace ProjectSettingsTool
|
||||
// The process used to reconfigure settings
|
||||
QProcess m_reconfigureProcess;
|
||||
|
||||
AZStd::string m_devRoot;
|
||||
AZStd::string m_projectRoot;
|
||||
AZStd::string m_projectName;
|
||||
|
||||
|
||||
@@ -27,37 +27,31 @@ namespace
|
||||
}
|
||||
|
||||
template<typename StringType>
|
||||
StringType GetAbsoluteDevRoot()
|
||||
StringType GetAbsoluteEngineRoot()
|
||||
{
|
||||
const char* devRoot = nullptr;
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
|
||||
devRoot,
|
||||
&AzToolsFramework::AssetSystemRequestBus::Handler::GetAbsoluteDevRootFolderPath);
|
||||
AZ::IO::FixedMaxPath engineRoot = AZ::Utils::GetEnginePath();
|
||||
|
||||
if (!devRoot)
|
||||
if (engineRoot.empty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
StringType devRootString(devRoot);
|
||||
ToUnixPath(devRootString);
|
||||
return devRootString;
|
||||
StringType engineRootString(engineRoot.c_str());
|
||||
ToUnixPath(engineRootString);
|
||||
return engineRootString;
|
||||
}
|
||||
|
||||
template<typename StringType>
|
||||
StringType GetAbsoluteProjectRoot()
|
||||
{
|
||||
const char* projectRoot = nullptr;
|
||||
AzToolsFramework::AssetSystemRequestBus::BroadcastResult(
|
||||
projectRoot,
|
||||
&AzToolsFramework::AssetSystemRequestBus::Handler::GetAbsoluteDevGameFolderPath);
|
||||
AZ::IO::FixedMaxPath projectRoot = AZ::Utils::GetProjectPath();
|
||||
|
||||
if (!projectRoot)
|
||||
if (projectRoot.empty())
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
StringType projectRootString(projectRoot);
|
||||
StringType projectRootString(projectRoot.c_str());
|
||||
ToUnixPath(projectRootString);
|
||||
return projectRootString;
|
||||
}
|
||||
@@ -87,9 +81,9 @@ namespace ProjectSettingsTool
|
||||
return reinterpret_cast<void*>(func);
|
||||
}
|
||||
|
||||
AZStd::string GetDevRoot()
|
||||
AZStd::string GetEngineRoot()
|
||||
{
|
||||
return GetAbsoluteDevRoot<AZStd::string>();
|
||||
return GetAbsoluteEngineRoot<AZStd::string>();
|
||||
}
|
||||
AZStd::string GetProjectRoot()
|
||||
{
|
||||
@@ -104,7 +98,7 @@ namespace ProjectSettingsTool
|
||||
QString SelectXmlFromFileDialog(const QString& currentFile)
|
||||
{
|
||||
// The selected file must be relative to this path
|
||||
QString defaultPath = GetAbsoluteDevRoot<QString>();
|
||||
QString defaultPath = GetAbsoluteEngineRoot<QString>();
|
||||
QString startPath;
|
||||
|
||||
// Choose the starting path for file dialog
|
||||
@@ -139,7 +133,7 @@ namespace ProjectSettingsTool
|
||||
|
||||
QString SelectImageFromFileDialog(const QString& currentFile)
|
||||
{
|
||||
QString defaultPath = QStringLiteral("%1Code%2/Resources/").arg(GetAbsoluteDevRoot<QString>(), ::GetProjectName<QString>());
|
||||
QString defaultPath = QStringLiteral("%1Code%2/Resources/").arg(GetAbsoluteEngineRoot<QString>(), ::GetProjectName<QString>());
|
||||
|
||||
QString startPath;
|
||||
|
||||
@@ -188,7 +182,7 @@ namespace ProjectSettingsTool
|
||||
// Android
|
||||
if (group <= ImageGroup::AndroidPortrait)
|
||||
{
|
||||
root = GetDevRoot() + "/Code/Tools/Android/ProjectBuilder/app_";
|
||||
root = GetEngineRoot() + "/Code/Tools/Android/ProjectBuilder/app_";
|
||||
}
|
||||
//Ios
|
||||
else
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
namespace ProjectSettingsTool
|
||||
{
|
||||
void* ConvertFunctorToVoid(AZStd::pair<QValidator::State, const QString>(*func)(const QString&));
|
||||
AZStd::string GetDevRoot();
|
||||
AZStd::string GetEngineRoot();
|
||||
AZStd::string GetProjectRoot();
|
||||
AZStd::string GetProjectName();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user