removes Commands/EntityTransformCommand from AzToolsFramework
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#if 0
|
||||
|
||||
#include "EntityTransformCommand.h"
|
||||
#include <HexEdFramework/FrameworkCore/SelectionMessages.h>
|
||||
#include <HexEd/WorldEditor/ToolsComponents/TransformComponentBus.h>
|
||||
#include <AzToolsFramework/Undo/UndoCacheInterface.h>
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
TransformCommand::TransformCommand(const AZ::u64& contextId, const AZStd::string& friendlyName, const EntityList& captureEntities)
|
||||
: UndoSystem::URSequencePoint(friendlyName)
|
||||
, m_contextId(contextId)
|
||||
{
|
||||
for (auto it = captureEntities.begin(); it != captureEntities.end(); ++it)
|
||||
{
|
||||
SRT current;
|
||||
EBUS_EVENT_ID_RESULT(current, *it, TransformComponentMessages::Bus, GetLocalSRT);
|
||||
m_priorTransforms[*it] = current;
|
||||
m_nextTransforms[*it] = current;
|
||||
}
|
||||
|
||||
m_undoCacheInterface = AZ::Interface<UndoSystem::UndoCacheInterface>::Get();
|
||||
AZ_Assert(m_undoCacheInterface, "Could not get UndoCacheInterface on TransformCommand construction.");
|
||||
}
|
||||
|
||||
void TransformCommand::Post()
|
||||
{
|
||||
// add to undo stack
|
||||
UndoSystem::UndoStack* undoStack = NULL;
|
||||
EBUS_EVENT_ID_RESULT(undoStack, m_contextId, SelectionMessages::Bus, GetUndoStack);
|
||||
|
||||
if (undoStack)
|
||||
{
|
||||
undoStack->Post(this);
|
||||
}
|
||||
|
||||
for (auto it = m_priorTransforms.begin(); it != m_priorTransforms.end(); ++it)
|
||||
{
|
||||
m_undoCacheInterface->UpdateCache(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
void TransformCommand::Undo()
|
||||
{
|
||||
for (auto it = m_priorTransforms.begin(); it != m_priorTransforms.end(); ++it)
|
||||
{
|
||||
EBUS_EVENT_ID(it->first, TransformComponentMessages::Bus, SetLocalSRT, it->second);
|
||||
m_undoCacheInterface->UpdateCache(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
void TransformCommand::Redo()
|
||||
{
|
||||
for (auto it = m_nextTransforms.begin(); it != m_nextTransforms.end(); ++it)
|
||||
{
|
||||
EBUS_EVENT_ID(it->first, TransformComponentMessages::Bus, SetLocalSRT, it->second);
|
||||
m_undoCacheInterface->UpdateCache(it->first);
|
||||
}
|
||||
}
|
||||
|
||||
void TransformCommand::CaptureNewTransform(const AZ::EntityId entityId)
|
||||
{
|
||||
AZ_Assert(m_priorTransforms.find(entityId) != m_priorTransforms.end(), "You can't add new transforms during an operation");
|
||||
AZ_Assert(m_nextTransforms.find(entityId) != m_nextTransforms.end(), "You can't add new transforms during an operation");
|
||||
|
||||
SRT current;
|
||||
EBUS_EVENT_ID_RESULT(current, entityId, TransformComponentMessages::Bus, GetLocalSRT);
|
||||
m_nextTransforms[entityId] = current;
|
||||
}
|
||||
|
||||
void TransformCommand::RevertToPriorTransform(const AZ::EntityId entityId)
|
||||
{
|
||||
AZ_Assert(m_priorTransforms.find(entityId) != m_priorTransforms.end(), "No such entity!");
|
||||
|
||||
m_nextTransforms[entityId] = m_priorTransforms[entityId];
|
||||
EBUS_EVENT_ID(entityId, TransformComponentMessages::Bus, SetLocalSRT, m_priorTransforms[entityId]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,66 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
#ifndef TRANSFORM_COMMAND_H
|
||||
#define TRANSFORM_COMMAND_H
|
||||
|
||||
#if 0
|
||||
|
||||
#include <AzCore/base.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
#include <AzCore/Component/ComponentBus.h>
|
||||
#include <HexEdFramework/FrameworkCore/UndoSystem.h>
|
||||
#include <HexEd/WorldEditor/ToolsComponents/TransformComponentBus.h>
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AzToolsFramework
|
||||
{
|
||||
namespace UndoSystem
|
||||
{
|
||||
class UndoCacheInterface;
|
||||
}
|
||||
|
||||
typedef AZStd::vector<AZ::EntityId> EntityList;
|
||||
|
||||
// transform command specializes undo to just care about the transform of an entity instead of the entire thing, for performance.
|
||||
class TransformCommand
|
||||
: public UndoSystem::URSequencePoint
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(TransformCommand, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(TransformCommand);
|
||||
|
||||
TransformCommand(const AZ::u64& contextId, const AZStd::string& friendlyName, const EditorFramework::EntityList& captureEntities);
|
||||
virtual ~TransformCommand() {}
|
||||
|
||||
// the default will work for selections with out an undo stack(maybe move the undo stack here too
|
||||
void CaptureNewTransform(const AZ::EntityId entityId);
|
||||
void RevertToPriorTransform(const AZ::EntityId entityID);
|
||||
|
||||
virtual void Undo();
|
||||
virtual void Redo();
|
||||
|
||||
virtual void Post();
|
||||
|
||||
protected:
|
||||
AZ::u64 m_contextId;
|
||||
|
||||
typedef AZStd::unordered_map<AZ::EntityId, Components::SRT> CapturedTransforms;
|
||||
|
||||
CapturedTransforms m_priorTransforms;
|
||||
CapturedTransforms m_nextTransforms;
|
||||
|
||||
private:
|
||||
UndoCacheInterface* m_undoCacheInterface;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // disabled
|
||||
|
||||
#endif
|
||||
@@ -483,8 +483,6 @@ set(FILES
|
||||
Commands/EntityStateCommand.h
|
||||
Commands/SelectionCommand.cpp
|
||||
Commands/SelectionCommand.h
|
||||
Commands/EntityTransformCommand.cpp
|
||||
Commands/EntityTransformCommand.h
|
||||
Commands/PreemptiveUndoCache.cpp
|
||||
Commands/PreemptiveUndoCache.h
|
||||
Commands/BaseSliceCommand.cpp
|
||||
|
||||
Reference in New Issue
Block a user