Add "Registry" folders as scan folders (#4583)

* Add "Registry" folders as scan folders

For projects, Gems, and Engine, add the "Registry" folder as scan
folders.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>

* Change params for adding scan folder

Also add trailing newlines to setreg files.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>

* Adjust the priority order for project templates

Scan folder orders were way too high, they should be very low to become
highest priority order.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>

* Removes change of default assets folder to Assets

Need to revert this change so it can be done separately.
Renamed the scan folder to 'Project/Assets' to prep for Assets folder
change later on.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>

* Update platform configuration test to pass

Adjusted expectation of scan folder count from 1 to 2 per Gem for
'Assets' and 'Registry' now.

Signed-off-by: amzn-phist <52085794+amzn-phist@users.noreply.github.com>
monroegm-disable-blank-issue-2
amzn-phist 4 years ago committed by GitHub
parent 0217f45f3f
commit 80dcc34e6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,6 +29,10 @@ namespace AzFramework
AZStd::vector<AZ::IO::Path> m_absoluteSourcePaths; //!< Where the gem's source path folder are located(as an absolute path) AZStd::vector<AZ::IO::Path> m_absoluteSourcePaths; //!< Where the gem's source path folder are located(as an absolute path)
static constexpr const char* GetGemAssetFolder() { return "Assets"; } static constexpr const char* GetGemAssetFolder() { return "Assets"; }
static constexpr const char* GetGemRegistryFolder()
{
return "Registry";
}
}; };
//! Returns a list of GemInfo of all the gems that are active for the for the specified game project. //! Returns a list of GemInfo of all the gems that are active for the for the specified game project.

@ -590,20 +590,22 @@ TEST_F(PlatformConfigurationUnitTests, Test_GemHandling)
AssetUtilities::ResetAssetRoot(); AssetUtilities::ResetAssetRoot();
ASSERT_EQ(2, config.GetScanFolderCount()); ASSERT_EQ(4, config.GetScanFolderCount());
EXPECT_FALSE(config.GetScanFolderAt(0).IsRoot()); EXPECT_FALSE(config.GetScanFolderAt(0).IsRoot());
EXPECT_TRUE(config.GetScanFolderAt(0).RecurseSubFolders()); EXPECT_TRUE(config.GetScanFolderAt(0).RecurseSubFolders());
// the first one is a game gem, so its order should be above 1 but below 100. // the first one is a game gem, so its order should be above 1 but below 100.
EXPECT_GE(config.GetScanFolderAt(0).GetOrder(), 100); EXPECT_GE(config.GetScanFolderAt(0).GetOrder(), 100);
EXPECT_EQ(0, config.GetScanFolderAt(0).ScanPath().compare(expectedScanFolder, Qt::CaseInsensitive)); EXPECT_EQ(0, config.GetScanFolderAt(0).ScanPath().compare(expectedScanFolder, Qt::CaseInsensitive));
// for each gem, there are currently 1 scan folder, the gem assets folder, with no output prefix // for each gem, there are currently 2 scan folders:
// The Gem's 'Assets' folder
// The Gem's 'Registry' folder
expectedScanFolder = tempPath.absoluteFilePath("Gems/LmbrCentral/v2/Assets"); expectedScanFolder = tempPath.absoluteFilePath("Gems/LmbrCentral/v2/Assets");
EXPECT_FALSE(config.GetScanFolderAt(1).IsRoot() ); EXPECT_FALSE(config.GetScanFolderAt(2).IsRoot() );
EXPECT_TRUE(config.GetScanFolderAt(1).RecurseSubFolders()); EXPECT_TRUE(config.GetScanFolderAt(2).RecurseSubFolders());
EXPECT_GT(config.GetScanFolderAt(1).GetOrder(), config.GetScanFolderAt(0).GetOrder()); EXPECT_GT(config.GetScanFolderAt(2).GetOrder(), config.GetScanFolderAt(0).GetOrder());
EXPECT_EQ(0, config.GetScanFolderAt(1).ScanPath().compare(expectedScanFolder, Qt::CaseInsensitive)); EXPECT_EQ(0, config.GetScanFolderAt(2).ScanPath().compare(expectedScanFolder, Qt::CaseInsensitive));
} }
TEST_F(PlatformConfigurationUnitTests, Test_MetaFileTypes) TEST_F(PlatformConfigurationUnitTests, Test_MetaFileTypes)

@ -1582,6 +1582,24 @@ namespace AssetProcessor
gemOrder, gemOrder,
/*scanFolderId*/ 0, /*scanFolderId*/ 0,
/*canSaveNewAssets*/ true)); // Users can create assets like slices in Gem asset folders. /*canSaveNewAssets*/ true)); // Users can create assets like slices in Gem asset folders.
// Now add another scan folder on Gem/GemName/Registry...
gemFolder = gemDir.absoluteFilePath(AzFramework::GemInfo::GetGemRegistryFolder());
gemFolder = AssetUtilities::NormalizeDirectoryPath(gemFolder);
assetBrowserDisplayName = AzFramework::GemInfo::GetGemRegistryFolder();
portableKey = QString("gemregistry-%1").arg(gemNameAsUuid);
gemOrder++;
AZ_TracePrintf(AssetProcessor::DebugChannel, "Adding GEM registry folder for monitoring / scanning: %s.\n", gemFolder.toUtf8().data());
AddScanFolder(ScanFolderInfo(
gemFolder,
assetBrowserDisplayName,
portableKey,
isRoot,
isRecursive,
platforms,
gemOrder));
} }
} }
} }

@ -106,7 +106,7 @@
// "exclude": "mac" // "exclude": "mac"
// } // }
"ScanFolder Game": { "ScanFolder Project/Assets": {
"watch": "@PROJECTROOT@", "watch": "@PROJECTROOT@",
"display": "@PROJECTNAME@", "display": "@PROJECTNAME@",
"recursive": 1, "recursive": 1,
@ -129,6 +129,11 @@
"order": 30000, "order": 30000,
"include": "tools,renderer" "include": "tools,renderer"
}, },
"ScanFolder Engine/Registry": {
"watch": "@ENGINEROOT@/Registry",
"recursive": 1,
"order": 40000
},
// Excludes files that match the pattern or glob // Excludes files that match the pattern or glob
// if you use a pattern, remember to escape your backslashes (\\) // if you use a pattern, remember to escape your backslashes (\\)

@ -1,14 +1,21 @@
{ {
"Amazon": "Amazon": {
{ "AssetProcessor": {
"${Name}.Assets": "ScanFolder Project/ShaderLib": {
{ "watch": "@PROJECTROOT@/ShaderLib",
"SourcePaths": "recursive": 1,
[ "order": 1
"Assets", },
"ShaderLib", "ScanFolder Project/Shaders": {
"Shaders" "watch": "@PROJECTROOT@/Shaders",
] "recurisve": 1,
"order": 2
},
"ScanFolder Project/Registry": {
"watch": "@PROJECTROOT@/Registry",
"recursive": 1,
"order": 3
}
} }
} }
} }

@ -1,14 +1,21 @@
{ {
"Amazon": "Amazon": {
{ "AssetProcessor": {
"${Name}.Assets": "ScanFolder Project/ShaderLib": {
{ "watch": "@PROJECTROOT@/ShaderLib",
"SourcePaths": "recursive": 1,
[ "order": 1
"Assets", },
"ShaderLib", "ScanFolder Project/Shaders": {
"Shaders" "watch": "@PROJECTROOT@/Shaders",
] "recurisve": 1,
"order": 2
},
"ScanFolder Project/Registry": {
"watch": "@PROJECTROOT@/Registry",
"recursive": 1,
"order": 3
}
} }
} }
} }

Loading…
Cancel
Save