Files
o3de/Code/Framework/AzToolsFramework/AzToolsFramework/Prefab/ProceduralPrefabSystemComponent.h
T
amzn-mike 71bb200e0a [LYN-7064] Hot Loading of Procedural Prefabs (#4923)
* Prefab hotloading - load and maintain asset references

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Working hotloading

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Clean up code, add comments

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add missing includes

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add event for template removal.

Clear ProceduralPrefabSystemComponent lookup when templates are removed.

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Add unit test.

Fix missing include, make sure source name is set

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix missing include

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix missing include

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Update comments to make ebus event behavior more clear

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix missing include

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix missing includes

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix missing include

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix temp directory usage which doesn't work on linux

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix temp directory usage which doesn't work on linux

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Use AZ::IO::Path for comparison.  Print paths on failure

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>

* Fix unit test - register asset with catalog so it can be looked up later

Signed-off-by: amzn-mike <80125227+amzn-mike@users.noreply.github.com>
2021-12-13 12:44:41 -08:00

48 lines
1.5 KiB
C++

/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzCore/Component/Component.h>
#include <Prefab/ProceduralPrefabSystemComponentInterface.h>
#include <AzFramework/Asset/AssetCatalogBus.h>
#include <AzToolsFramework/Prefab/PrefabPublicNotificationBus.h>
namespace AzToolsFramework
{
namespace Prefab
{
class ProceduralPrefabSystemComponent
: public AZ::Component
, ProceduralPrefabSystemComponentInterface
, AzFramework::AssetCatalogEventBus::Handler
, PrefabPublicNotificationBus::Handler
{
public:
AZ_COMPONENT(ProceduralPrefabSystemComponent, "{81211818-088A-49E6-894B-7A11764106B1}");
static void Reflect(AZ::ReflectContext* context);
protected:
void Activate() override;
void Deactivate() override;
void OnCatalogAssetChanged(const AZ::Data::AssetId&) override;
void OnTemplateRemoved(TemplateId templateId) override;
void OnAllTemplatesRemoved() override;
void RegisterProceduralPrefab(const AZStd::string& prefabFilePath, TemplateId templateId) override;
AZStd::mutex m_lookupMutex;
AZStd::unordered_map<AZ::Data::AssetId, TemplateId> m_assetIdToTemplateLookup;
};
} // namespace Prefab
} // namespace AzToolsFramework