Removes CommandHierarchyItemToggleIsSelected.h/cpp from Gems/LyShine

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2022-01-03 16:24:04 -08:00
parent 837a139464
commit d89b682e9c
4 changed files with 0 additions and 123 deletions
@@ -1,67 +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"
CommandHierarchyItemToggleIsSelected::CommandHierarchyItemToggleIsSelected(UndoStack* stack,
HierarchyWidget* hierarchy,
HierarchyItem* item)
: QUndoCommand()
, m_stack(stack)
, m_hierarchy(hierarchy)
, m_id(item->GetEntityId())
, m_toIsSelected(false)
{
setText(QString("toggle selection of \"%1\"").arg(item->GetElement()->GetName().c_str()));
EBUS_EVENT_ID_RESULT(m_toIsSelected, m_id, UiEditorBus, GetIsSelected);
m_toIsSelected = !m_toIsSelected;
}
void CommandHierarchyItemToggleIsSelected::undo()
{
UndoStackExecutionScope s(m_stack);
SetIsSelected(!m_toIsSelected);
}
void CommandHierarchyItemToggleIsSelected::redo()
{
UndoStackExecutionScope s(m_stack);
SetIsSelected(m_toIsSelected);
}
void CommandHierarchyItemToggleIsSelected::SetIsSelected(bool isSelected)
{
AZ::Entity* element = EntityHelpers::GetEntity(m_id);
if (!element)
{
// The element DOESN'T exist.
// Nothing to do.
return;
}
// This will do both the Runtime-side and Editor-side.
HierarchyItem::RttiCast(HierarchyHelpers::ElementToItem(m_hierarchy, element, false))->SetIsSelected(isSelected);
}
void CommandHierarchyItemToggleIsSelected::Push(UndoStack* stack,
HierarchyWidget* hierarchy,
HierarchyItem* item)
{
if (stack->GetIsExecuting())
{
// This is a redundant Qt notification.
// Nothing else to do.
return;
}
stack->push(new CommandHierarchyItemToggleIsSelected(stack,
hierarchy,
item));
}
@@ -1,52 +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 CommandHierarchyItemToggleIsSelected
: public QUndoCommand
{
public:
void undo() override;
void redo() override;
// IMPORTANT: We DON'T want this command to support mergeWith().
// Otherwise we leave commands on the undo stack that have no
// effect (NOOP).
//
// To avoid the NOOPs, we can either:
//
// (1) Delete the NOPs from the undo stack.
// or
// (2) NOT support mergeWith().
//
// The problem with (1) is that it only allows odd number of
// state changes to be undoable. (2) is more consistent
// by making all state changes undoable.
static void Push(UndoStack* stack,
HierarchyWidget* hierarchy,
HierarchyItem* item);
private:
CommandHierarchyItemToggleIsSelected(UndoStack* stack,
HierarchyWidget* hierarchy,
HierarchyItem* item);
void SetIsSelected(bool isSelected);
UndoStack* m_stack;
HierarchyWidget* m_hierarchy;
AZ::EntityId m_id;
bool m_toIsSelected;
};
-2
View File
@@ -42,7 +42,6 @@ class CommandHierarchyItemRename;
class CommandHierarchyItemReparent;
class CommandHierarchyItemToggleIsExpanded;
class CommandHierarchyItemToggleIsSelectable;
class CommandHierarchyItemToggleIsSelected;
class CommandHierarchyItemToggleIsVisible;
class CommandPropertiesChange;
class CommandViewportInteractionMode;
@@ -123,7 +122,6 @@ enum class FusibleCommand
#include "CommandHierarchyItemReparent.h"
#include "CommandHierarchyItemToggleIsExpanded.h"
#include "CommandHierarchyItemToggleIsSelectable.h"
#include "CommandHierarchyItemToggleIsSelected.h"
#include "CommandHierarchyItemToggleIsVisible.h"
#include "CommandPropertiesChange.h"
#include "CommandViewportInteractionMode.h"
@@ -50,8 +50,6 @@ set(FILES
Editor/CommandHierarchyItemToggleIsExpanded.h
Editor/CommandHierarchyItemToggleIsSelectable.cpp
Editor/CommandHierarchyItemToggleIsSelectable.h
Editor/CommandHierarchyItemToggleIsSelected.cpp
Editor/CommandHierarchyItemToggleIsSelected.h
Editor/CommandHierarchyItemToggleIsVisible.cpp
Editor/CommandHierarchyItemToggleIsVisible.h
Editor/CommandPropertiesChange.cpp