Fixed several material editor bugs related to file paths and hot reload prompts (#6374)
* draft Signed-off-by: Guthrie Adams <guthadam@amazon.com> * Removes automatic generation of relative paths for external references for materials Updated material editor functions for creating new materials, creating or saving model or lighting presets, to save to the project asset folder instead of the material folder which is not included in the new templates Changed function for getting saved file names to handle case where Qt save file dialog adds double extensions if the extension contains a dot Signed-off-by: Guthrie Adams <guthadam@amazon.com> * Fixed problems with material editor hot reloading after documents or dependencies changed. Triggering message boxes within the tick function, which is executed from the main application timer, caused the tick function to be called a second time recursively. Switched from using the tick bus to a timer so that the documents re opening and dialogs are triggered outside of the main tick. Signed-off-by: Guthrie Adams <guthadam@amazon.com>
This commit is contained in:
@@ -222,31 +222,15 @@ namespace AtomToolsFramework
|
||||
return true;
|
||||
}
|
||||
|
||||
AZStd::string GetExteralReferencePath(const AZStd::string& exportPath, const AZStd::string& referencePath, const uint32_t maxPathDepth)
|
||||
AZStd::string GetExteralReferencePath(
|
||||
const AZStd::string& exportPath, const AZStd::string& referencePath, const bool relativeToExportPath)
|
||||
{
|
||||
if (referencePath.empty())
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
AZ::IO::BasicPath<AZStd::string> exportFolder(exportPath);
|
||||
exportFolder.RemoveFilename();
|
||||
|
||||
const AZStd::string relativePath = AZ::IO::PathView(referencePath).LexicallyRelative(exportFolder).StringAsPosix();
|
||||
|
||||
// Count the difference in depth between the export file path and the referenced file path.
|
||||
uint32_t parentFolderCount = 0;
|
||||
AZStd::string::size_type pos = 0;
|
||||
const AZStd::string parentFolderToken = "..";
|
||||
while ((pos = relativePath.find(parentFolderToken, pos)) != AZStd::string::npos)
|
||||
{
|
||||
parentFolderCount++;
|
||||
pos += parentFolderToken.length();
|
||||
}
|
||||
|
||||
// If the difference in depth is too great then revert to using the asset folder relative path.
|
||||
// We could change this to only use relative paths for references in subfolders.
|
||||
if (parentFolderCount > maxPathDepth)
|
||||
if (!relativeToExportPath)
|
||||
{
|
||||
AZStd::string watchFolder;
|
||||
AZ::Data::AssetInfo assetInfo;
|
||||
@@ -260,7 +244,9 @@ namespace AtomToolsFramework
|
||||
}
|
||||
}
|
||||
|
||||
return relativePath;
|
||||
AZ::IO::BasicPath<AZStd::string> exportFolder(exportPath);
|
||||
exportFolder.RemoveFilename();
|
||||
return AZ::IO::PathView(referencePath).LexicallyRelative(exportFolder).StringAsPosix();
|
||||
}
|
||||
|
||||
const AtomToolsFramework::DynamicProperty* FindDynamicPropertyForInstanceDataNode(const AzToolsFramework::InstanceDataNode* pNode)
|
||||
|
||||
Reference in New Issue
Block a user