Updated PrefabBuilder to include product dependencies defined in AddProductDependency
This commit is contained in:
+30
-8
@@ -49,30 +49,42 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils
|
||||
return !m_prefabs.empty();
|
||||
}
|
||||
|
||||
void PrefabProcessorContext::RegisterProductDependency(AZStd::string& prefabName, AZStd::string& dependentPrefabName)
|
||||
bool PrefabProcessorContext::RegisterProductDependency(const AZStd::string& prefabName, const AZStd::string& dependentPrefabName)
|
||||
{
|
||||
using ConversionUtils = PrefabConversionUtils::ProcessedObjectStore;
|
||||
|
||||
uint32_t prefabSubId = ConversionUtils::BuildSubId(prefabName +
|
||||
uint32_t spawnableSubId = ConversionUtils::BuildSubId(prefabName +
|
||||
AzFramework::Spawnable::DotFileExtension);
|
||||
|
||||
uint32_t dependentPrefabSubId = ConversionUtils::BuildSubId(dependentPrefabName +
|
||||
uint32_t spawnablePrefabSubId = ConversionUtils::BuildSubId(dependentPrefabName +
|
||||
AzFramework::Spawnable::DotFileExtension);
|
||||
|
||||
RegisterProductDependency(prefabSubId, dependentPrefabSubId);
|
||||
return RegisterProductDependency(spawnableSubId, spawnablePrefabSubId);
|
||||
}
|
||||
|
||||
void PrefabProcessorContext::RegisterProductDependency(uint32_t spawnableAssetSubId, uint32_t dependentSpawnableAssetSubId)
|
||||
bool PrefabProcessorContext::RegisterProductDependency(const AZStd::string& prefabName, const AZ::Data::AssetId& dependentAssetId)
|
||||
{
|
||||
using ConversionUtils = PrefabConversionUtils::ProcessedObjectStore;
|
||||
|
||||
uint32_t spawnableSubId = ConversionUtils::BuildSubId(prefabName +
|
||||
AzFramework::Spawnable::DotFileExtension);
|
||||
|
||||
AZ::Data::AssetId spawnableAssetId(GetSourceUuid(), spawnableSubId);
|
||||
|
||||
return RegisterProductDependency(spawnableAssetId, dependentAssetId);
|
||||
}
|
||||
|
||||
bool PrefabProcessorContext::RegisterProductDependency(uint32_t spawnableAssetSubId, uint32_t dependentSpawnableAssetSubId)
|
||||
{
|
||||
AZ::Data::AssetId spawnableAssetId(GetSourceUuid(), spawnableAssetSubId);
|
||||
AZ::Data::AssetId dependentSpawnableAssetId(GetSourceUuid(), dependentSpawnableAssetSubId);
|
||||
|
||||
RegisterProductDependency(spawnableAssetId, dependentSpawnableAssetId);
|
||||
return RegisterProductDependency(spawnableAssetId, dependentSpawnableAssetId);
|
||||
}
|
||||
|
||||
void PrefabProcessorContext::RegisterProductDependency(AZ::Data::AssetId& assetId, AZ::Data::AssetId& dependentAssetId)
|
||||
bool PrefabProcessorContext::RegisterProductDependency(const AZ::Data::AssetId& assetId, const AZ::Data::AssetId& dependentAssetId)
|
||||
{
|
||||
m_registeredProductDependencies[assetId].emplace(dependentAssetId);
|
||||
return m_registeredProductDependencies[assetId].emplace(dependentAssetId).second;
|
||||
}
|
||||
|
||||
PrefabProcessorContext::ProcessedObjectStoreContainer& PrefabProcessorContext::GetProcessedObjects()
|
||||
@@ -85,6 +97,16 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils
|
||||
return m_products;
|
||||
}
|
||||
|
||||
PrefabProcessorContext::ProductDependencyContainer& PrefabProcessorContext::GetRegisteredProductDependencies()
|
||||
{
|
||||
return m_registeredProductDependencies;
|
||||
}
|
||||
|
||||
const PrefabProcessorContext::ProductDependencyContainer& PrefabProcessorContext::GetRegisteredProductDependencies() const
|
||||
{
|
||||
return m_registeredProductDependencies;
|
||||
}
|
||||
|
||||
void PrefabProcessorContext::SetPlatformTags(AZ::PlatformTagSet tags)
|
||||
{
|
||||
m_platformTags = AZStd::move(tags);
|
||||
|
||||
+9
-5
@@ -29,6 +29,8 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils
|
||||
{
|
||||
public:
|
||||
using ProcessedObjectStoreContainer = AZStd::vector<ProcessedObjectStore>;
|
||||
using ProductDependencyContainer =
|
||||
AZStd::unordered_map<AZ::Data::AssetId, AZStd::unordered_set<AZ::Data::AssetId>>;
|
||||
|
||||
AZ_CLASS_ALLOCATOR(PrefabProcessorContext, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(PrefabProcessorContext, "{C7D77E3A-C544-486B-B774-7C82C38FE22F}");
|
||||
@@ -41,13 +43,17 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils
|
||||
virtual void ListPrefabs(const AZStd::function<void(AZStd::string_view, const PrefabDom&)>& callback) const;
|
||||
virtual bool HasPrefabs() const;
|
||||
|
||||
virtual void RegisterProductDependency(AZStd::string& prefabName, AZStd::string& dependentPrefabName);
|
||||
virtual void RegisterProductDependency(uint32_t spawnableAssetSubId, uint32_t dependentSpawnableAssetSubId);
|
||||
virtual void RegisterProductDependency(AZ::Data::AssetId& assetId, AZ::Data::AssetId& dependentAssetId);
|
||||
virtual bool RegisterProductDependency(const AZStd::string& prefabName, const AZStd::string& dependentPrefabName);
|
||||
virtual bool RegisterProductDependency(const AZStd::string& prefabName, const AZ::Data::AssetId& dependentAssetId);
|
||||
virtual bool RegisterProductDependency(uint32_t spawnableAssetSubId, uint32_t dependentSpawnableAssetSubId);
|
||||
virtual bool RegisterProductDependency(const AZ::Data::AssetId& assetId, const AZ::Data::AssetId& dependentAssetId);
|
||||
|
||||
virtual ProcessedObjectStoreContainer& GetProcessedObjects();
|
||||
virtual const ProcessedObjectStoreContainer& GetProcessedObjects() const;
|
||||
|
||||
virtual ProductDependencyContainer& GetRegisteredProductDependencies();
|
||||
virtual const ProductDependencyContainer& GetRegisteredProductDependencies() const;
|
||||
|
||||
virtual void SetPlatformTags(AZ::PlatformTagSet tags);
|
||||
virtual const AZ::PlatformTagSet& GetPlatformTags() const;
|
||||
virtual const AZ::Uuid& GetSourceUuid() const;
|
||||
@@ -57,8 +63,6 @@ namespace AzToolsFramework::Prefab::PrefabConversionUtils
|
||||
|
||||
protected:
|
||||
using NamedPrefabContainer = AZStd::unordered_map<AZStd::string, PrefabDom>;
|
||||
using ProductDependencyContainer =
|
||||
AZStd::unordered_map<AZ::Data::AssetId, AZStd::unordered_set<AZ::Data::AssetId>>;
|
||||
|
||||
NamedPrefabContainer m_prefabs;
|
||||
ProcessedObjectStoreContainer m_products;
|
||||
|
||||
Reference in New Issue
Block a user