Bladeren bron

Fixed QueryAbsolutePathDependenciesRecursive not handling absolute paths.

Fixed SourceAssetDetailsPanel having empty entries for dependencies with UUIDs that can't be resolved

Signed-off-by: amzn-mike <[email protected]>
amzn-mike 2 jaren geleden
bovenliggende
commit
8a638df765

+ 24 - 1
Code/Tools/AssetProcessor/native/AssetManager/assetProcessorManager.cpp

@@ -5148,7 +5148,30 @@ namespace AssetProcessor
                 // If the dependency is an asset, this will resolve to a valid UUID
                 // If the dependency is an asset, this will resolve to a valid UUID
                 // If the dependency is not an asset, this will resolve to an invalid UUID which will simply return no results for our
                 // If the dependency is not an asset, this will resolve to an invalid UUID which will simply return no results for our
                 // search
                 // search
-                searchUuid = AssetUtilities::CreateSafeSourceUUIDFromName(toSearch.GetPath().c_str());
+
+                if (AZ::IO::PathView(toSearch.GetPath()).IsAbsolute())
+                {
+                    QString relativePath;
+                    QString scanFolderPath;
+
+                    if(!m_platformConfig->ConvertToRelativePath(toSearch.GetPath().c_str(), relativePath, scanFolderPath))
+                    {
+                        AZ_TracePrintf(
+                            AssetProcessor::DebugChannel,
+                            "QueryAbsolutePathDependenciesRecursive: Failed to convert path %s to relative path.  Source dependency chain "
+                            "may be broken.\n",
+                            toSearch.GetPath().c_str());
+                        searchUuid = AZ::Uuid::CreateNull();
+                    }
+                    else
+                    {
+                        searchUuid = AssetUtilities::CreateSafeSourceUUIDFromName(relativePath.toUtf8().constData());
+                    }
+                }
+                else
+                {
+                    searchUuid = AssetUtilities::CreateSafeSourceUUIDFromName(toSearch.GetPath().c_str());
+                }
             }
             }
             else
             else
             {
             {

+ 4 - 4
Code/Tools/AssetProcessor/native/tests/assetmanager/AssetProcessorManagerTest.cpp

@@ -959,13 +959,13 @@ TEST_F(AssetProcessorManagerTest, QueryAbsolutePathDependenciesRecursive_BasicTe
     newEntry1.m_sourceDependencyID = AzToolsFramework::AssetDatabase::InvalidEntryId;
     newEntry1.m_sourceDependencyID = AzToolsFramework::AssetDatabase::InvalidEntryId;
     newEntry1.m_builderGuid = AZ::Uuid::CreateRandom();
     newEntry1.m_builderGuid = AZ::Uuid::CreateRandom();
     newEntry1.m_sourceGuid = m_aUuid;
     newEntry1.m_sourceGuid = m_aUuid;
-    newEntry1.m_dependsOnSource = PathOrUuid(m_bUuid);
+    newEntry1.m_dependsOnSource = PathOrUuid(m_assetRootDir.absoluteFilePath("subfolder1/b.txt").toUtf8().constData());
 
 
     SourceFileDependencyEntry newEntry2; // b depends on C
     SourceFileDependencyEntry newEntry2; // b depends on C
     newEntry2.m_sourceDependencyID = AzToolsFramework::AssetDatabase::InvalidEntryId;
     newEntry2.m_sourceDependencyID = AzToolsFramework::AssetDatabase::InvalidEntryId;
     newEntry2.m_builderGuid = AZ::Uuid::CreateRandom();
     newEntry2.m_builderGuid = AZ::Uuid::CreateRandom();
     newEntry2.m_sourceGuid = m_bUuid;
     newEntry2.m_sourceGuid = m_bUuid;
-    newEntry2.m_dependsOnSource = PathOrUuid("c.txt");
+    newEntry2.m_dependsOnSource = PathOrUuid(m_cUuid);
 
 
     SourceFileDependencyEntry newEntry3;  // b also depends on D
     SourceFileDependencyEntry newEntry3;  // b also depends on D
     newEntry3.m_sourceDependencyID = AzToolsFramework::AssetDatabase::InvalidEntryId;
     newEntry3.m_sourceDependencyID = AzToolsFramework::AssetDatabase::InvalidEntryId;
@@ -988,8 +988,8 @@ TEST_F(AssetProcessorManagerTest, QueryAbsolutePathDependenciesRecursive_BasicTe
 
 
     // make sure the corresponding values in the map are also correct
     // make sure the corresponding values in the map are also correct
     EXPECT_STREQ(dependencies[m_assetRootDir.absoluteFilePath("subfolder1/a.txt").toUtf8().constData()].c_str(), m_aUuid.ToFixedString(false, false).c_str());
     EXPECT_STREQ(dependencies[m_assetRootDir.absoluteFilePath("subfolder1/a.txt").toUtf8().constData()].c_str(), m_aUuid.ToFixedString(false, false).c_str());
-    EXPECT_STREQ(dependencies[m_assetRootDir.absoluteFilePath("subfolder1/b.txt").toUtf8().constData()].c_str(), m_bUuid.ToFixedString(false, false).c_str());
-    EXPECT_STREQ(dependencies[m_assetRootDir.absoluteFilePath("subfolder1/c.txt").toUtf8().constData()].c_str(), "c.txt");
+    EXPECT_STREQ(dependencies[m_assetRootDir.absoluteFilePath("subfolder1/b.txt").toUtf8().constData()].c_str(), m_assetRootDir.absoluteFilePath("subfolder1/b.txt").toUtf8().constData());
+    EXPECT_STREQ(dependencies[m_assetRootDir.absoluteFilePath("subfolder1/c.txt").toUtf8().constData()].c_str(), m_cUuid.ToFixedString(false, false).c_str());
     EXPECT_STREQ(dependencies[m_assetRootDir.absoluteFilePath("subfolder1/d.txt").toUtf8().constData()].c_str(), "d.txt");
     EXPECT_STREQ(dependencies[m_assetRootDir.absoluteFilePath("subfolder1/d.txt").toUtf8().constData()].c_str(), "d.txt");
 
 
     dependencies.clear();
     dependencies.clear();

+ 5 - 0
Code/Tools/AssetProcessor/native/ui/SourceAssetDetailsPanel.cpp

@@ -308,6 +308,11 @@ namespace AssetProcessor
                         return false;
                         return false;
                     });
                     });
 
 
+                if (sourceName.empty())
+                {
+                    sourceName = AZStd::string::format("Invalid UUID - %s", sourceFileDependencyEntry.m_sourceGuid.ToFixedString().c_str());
+                }
+
                 // Qt handles cleanup automatically, setting this as the parent means
                 // Qt handles cleanup automatically, setting this as the parent means
                 // when this panel is torn down, these widgets will be destroyed.
                 // when this panel is torn down, these widgets will be destroyed.
                 GoToButton* rowGoToButton = new GoToButton(this);
                 GoToButton* rowGoToButton = new GoToButton(this);