Integrating up through commit 90f050496
This commit is contained in:
@@ -18,6 +18,8 @@
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
|
||||
#include <AzToolsFramework/Undo/UndoCacheInterface.h>
|
||||
|
||||
// Enable to generate warnings for entity data changes not caught by undo batches.
|
||||
#if defined(AZ_DEBUG_BUILD) && !defined(ENABLE_UNDOCACHE_CONSISTENCY_CHECKS)
|
||||
# define ENABLE_UNDOCACHE_CONSISTENCY_CHECKS
|
||||
@@ -29,6 +31,7 @@ namespace AzToolsFramework
|
||||
// so that the user does not have to inform us before they make a change, only after they make a change
|
||||
// it also allows us to detect errors with change notification and not have to do multiple snapshots (before and after)
|
||||
class PreemptiveUndoCache
|
||||
: UndoSystem::UndoCacheInterface
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(PreemptiveUndoCache, AZ::SystemAllocator, 0);
|
||||
@@ -37,23 +40,21 @@ namespace AzToolsFramework
|
||||
PreemptiveUndoCache();
|
||||
~PreemptiveUndoCache();
|
||||
|
||||
void RegisterToUndoCacheInterface();
|
||||
|
||||
// UndoCacheInterface...
|
||||
void UpdateCache(const AZ::EntityId& entityId) override;
|
||||
void PurgeCache(const AZ::EntityId& entityId) override;
|
||||
void Clear() override;
|
||||
void Validate(const AZ::EntityId& entityId) override;
|
||||
|
||||
// whenever an entity appears in the world, as an atomic operation (ie, after all of its loading is complete, and the entity is active)
|
||||
// we snapshot it here. then, whenever an entity changes, we have what it used to be.
|
||||
typedef AZStd::vector<AZ::u8> CacheLineType;
|
||||
|
||||
void Validate(const AZ::EntityId& entityId);
|
||||
|
||||
// Store the new entity state or replace the old state
|
||||
void UpdateCache(const AZ::EntityId& entityId);
|
||||
|
||||
// remove the cache line for the entity, if there is one
|
||||
void PurgeCache(const AZ::EntityId& entityId);
|
||||
|
||||
// retrieve the last known state for an entity
|
||||
const CacheLineType& Retrieve(const AZ::EntityId& entityId);
|
||||
|
||||
// clear the entire cache:
|
||||
void Clear();
|
||||
protected:
|
||||
typedef AZStd::unordered_map<AZ::EntityId, CacheLineType> EntityStateMap;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user