Removes CommandViewportInteractionMode from Gems/LyShine
Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
@@ -1,94 +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
|
||||
*
|
||||
*/
|
||||
#include "EditorCommon.h"
|
||||
|
||||
CommandViewportInteractionMode::CommandViewportInteractionMode(UndoStack* stack,
|
||||
ViewportInteraction* viewportInteraction,
|
||||
QAction* from,
|
||||
QAction* to)
|
||||
: QUndoCommand()
|
||||
, m_stack(stack)
|
||||
, m_viewportInteraction(viewportInteraction)
|
||||
, m_from(from)
|
||||
, m_to(to)
|
||||
{
|
||||
UpdateText();
|
||||
}
|
||||
|
||||
void CommandViewportInteractionMode::undo()
|
||||
{
|
||||
UndoStackExecutionScope s(m_stack);
|
||||
|
||||
SetMode(m_from);
|
||||
}
|
||||
|
||||
void CommandViewportInteractionMode::redo()
|
||||
{
|
||||
UndoStackExecutionScope s(m_stack);
|
||||
|
||||
SetMode(m_to);
|
||||
}
|
||||
|
||||
int CommandViewportInteractionMode::id() const
|
||||
{
|
||||
return (int)FusibleCommand::kViewportInteractionMode;
|
||||
}
|
||||
|
||||
bool CommandViewportInteractionMode::mergeWith(const QUndoCommand* other)
|
||||
{
|
||||
if (other->id() != id())
|
||||
{
|
||||
// NOT the same command type.
|
||||
return false;
|
||||
}
|
||||
|
||||
const CommandViewportInteractionMode* subsequent = static_cast<const CommandViewportInteractionMode*>(other);
|
||||
AZ_Assert(subsequent, "No command to merge with");
|
||||
|
||||
if (!((subsequent->m_stack == m_stack) &&
|
||||
(subsequent->m_viewportInteraction == m_viewportInteraction)))
|
||||
{
|
||||
// NOT the same context.
|
||||
return false;
|
||||
}
|
||||
|
||||
m_to = subsequent->m_to;
|
||||
|
||||
UpdateText();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CommandViewportInteractionMode::UpdateText()
|
||||
{
|
||||
setText(QString("mode change to %1").arg(ViewportHelpers::InteractionModeToString(m_to->data().toInt())));
|
||||
}
|
||||
|
||||
void CommandViewportInteractionMode::SetMode(QAction* action) const
|
||||
{
|
||||
action->trigger();
|
||||
|
||||
// IMPORTANT: It's NOT necessary to prevent this from executing on the
|
||||
// first run. We WON'T get a redundant Qt notification by this point.
|
||||
m_viewportInteraction->SetMode((ViewportInteraction::InteractionMode)action->data().toInt());
|
||||
}
|
||||
|
||||
void CommandViewportInteractionMode::Push(UndoStack* stack,
|
||||
ViewportInteraction* viewportInteraction,
|
||||
QAction* from,
|
||||
QAction* to)
|
||||
{
|
||||
if (stack->GetIsExecuting())
|
||||
{
|
||||
// This is a redundant Qt notification.
|
||||
// Nothing else to do.
|
||||
return;
|
||||
}
|
||||
|
||||
stack->push(new CommandViewportInteractionMode(stack, viewportInteraction, from, to));
|
||||
}
|
||||
@@ -1,43 +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
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QUndoCommand>
|
||||
|
||||
class CommandViewportInteractionMode
|
||||
: public QUndoCommand
|
||||
{
|
||||
public:
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
int id() const override;
|
||||
bool mergeWith(const QUndoCommand* other) override;
|
||||
|
||||
static void Push(UndoStack* stack,
|
||||
ViewportInteraction* viewportInteraction,
|
||||
QAction* from,
|
||||
QAction* to);
|
||||
|
||||
private:
|
||||
|
||||
CommandViewportInteractionMode(UndoStack* stack,
|
||||
ViewportInteraction* viewportInteraction,
|
||||
QAction* from,
|
||||
QAction* to);
|
||||
|
||||
void UpdateText();
|
||||
void SetMode(QAction* action) const;
|
||||
|
||||
UndoStack* m_stack;
|
||||
|
||||
ViewportInteraction* m_viewportInteraction;
|
||||
QAction* m_from;
|
||||
QAction* m_to;
|
||||
};
|
||||
@@ -44,7 +44,6 @@ class CommandHierarchyItemToggleIsExpanded;
|
||||
class CommandHierarchyItemToggleIsSelectable;
|
||||
class CommandHierarchyItemToggleIsVisible;
|
||||
class CommandPropertiesChange;
|
||||
class CommandViewportInteractionMode;
|
||||
class ComponentButton;
|
||||
class CoordinateSystemToolbarSection;
|
||||
class EditorMenu;
|
||||
@@ -124,7 +123,6 @@ enum class FusibleCommand
|
||||
#include "CommandHierarchyItemToggleIsSelectable.h"
|
||||
#include "CommandHierarchyItemToggleIsVisible.h"
|
||||
#include "CommandPropertiesChange.h"
|
||||
#include "CommandViewportInteractionMode.h"
|
||||
#include "ComponentButton.h"
|
||||
#include "CoordinateSystemToolbarSection.h"
|
||||
#include "EditorWindow.h"
|
||||
|
||||
@@ -54,8 +54,6 @@ set(FILES
|
||||
Editor/CommandHierarchyItemToggleIsVisible.h
|
||||
Editor/CommandPropertiesChange.cpp
|
||||
Editor/CommandPropertiesChange.h
|
||||
Editor/CommandViewportInteractionMode.cpp
|
||||
Editor/CommandViewportInteractionMode.h
|
||||
Editor/ComponentAssetHelpers.h
|
||||
Editor/ComponentButton.cpp
|
||||
Editor/ComponentButton.h
|
||||
|
||||
Reference in New Issue
Block a user