Integrating latest 47acbe8
This commit is contained in:
+2
-2
@@ -12,12 +12,12 @@
|
||||
#pragma once
|
||||
|
||||
class QAction;
|
||||
class QWidget;
|
||||
class QMenu;
|
||||
|
||||
namespace ScriptCanvasDeveloperEditor
|
||||
{
|
||||
namespace DynamicSlotFullCreation
|
||||
{
|
||||
QAction* CreateDynamicSlotFullCreationAction(QWidget* mainWindow);
|
||||
QAction* CreateDynamicSlotFullCreationAction(QMenu* mainWindow);
|
||||
};
|
||||
}
|
||||
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
class QAction;
|
||||
class QMenu;
|
||||
|
||||
namespace ScriptCanvasDeveloperEditor
|
||||
{
|
||||
namespace NodePaletteFullCreation
|
||||
{
|
||||
QAction* FullyConnectedNodePaletteCreation(QMenu* mainWindow);
|
||||
};
|
||||
}
|
||||
+2
-2
@@ -12,12 +12,12 @@
|
||||
#pragma once
|
||||
|
||||
class QAction;
|
||||
class QWidget;
|
||||
class QMenu;
|
||||
|
||||
namespace ScriptCanvasDeveloperEditor
|
||||
{
|
||||
namespace NodePaletteFullCreation
|
||||
{
|
||||
QAction* CreateNodePaletteFullCreationAction(QWidget* mainWindow);
|
||||
QAction* CreateNodePaletteFullCreationAction(QMenu* mainWindow);
|
||||
};
|
||||
}
|
||||
|
||||
+2
-2
@@ -12,12 +12,12 @@
|
||||
#pragma once
|
||||
|
||||
class QAction;
|
||||
class QWidget;
|
||||
class QMenu;
|
||||
|
||||
namespace ScriptCanvasDeveloperEditor
|
||||
{
|
||||
namespace VariablePaletteFullCreation
|
||||
{
|
||||
QAction* CreateVariablePaletteFullCreationAction(QWidget* mainWindow);
|
||||
QAction* CreateVariablePaletteFullCreationAction(QMenu* mainWindow);
|
||||
};
|
||||
}
|
||||
|
||||
+21
-1
@@ -13,8 +13,11 @@
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include <GraphCanvas/Types/Endpoint.h>
|
||||
#include <GraphCanvas/Widgets/NodePalette/TreeItems/NodePaletteTreeItem.h>
|
||||
|
||||
#include <ScriptCanvas/Bus/NodeIdPair.h>
|
||||
#include <ScriptCanvas/Core/Endpoint.h>
|
||||
#include <ScriptCanvas/Data/Data.h>
|
||||
|
||||
namespace ScriptCanvasDeveloperEditor
|
||||
@@ -23,6 +26,7 @@ namespace ScriptCanvasDeveloperEditor
|
||||
{
|
||||
public:
|
||||
virtual void SetupInterface(const AZ::EntityId& activeGraphCanvasGraphId, const ScriptCanvas::ScriptCanvasId& activeScriptCanvasId) = 0;
|
||||
virtual void OnProcessingComplete() {};
|
||||
};
|
||||
|
||||
class ProcessNodePaletteInterface
|
||||
@@ -40,13 +44,29 @@ namespace ScriptCanvasDeveloperEditor
|
||||
virtual bool ShouldProcessVariableType(const ScriptCanvas::Data::Type& dataType) const = 0;
|
||||
virtual void ProcessVariableType(const ScriptCanvas::Data::Type& dataType) = 0;
|
||||
};
|
||||
|
||||
|
||||
class DeveloperUtils
|
||||
{
|
||||
public:
|
||||
enum ConnectionStyle
|
||||
{
|
||||
NoConnections,
|
||||
SingleExecutionConnection
|
||||
};
|
||||
|
||||
struct CreateConnectedChainConfig
|
||||
{
|
||||
bool m_skipHandlers = false;
|
||||
ConnectionStyle m_connectionStyle = ConnectionStyle::NoConnections;
|
||||
|
||||
ScriptCanvasEditor::NodeIdPair m_fallbackNode;
|
||||
GraphCanvas::Endpoint m_previousEndpoint;
|
||||
};
|
||||
|
||||
static ScriptCanvasEditor::NodeIdPair HandleMimeEvent(GraphCanvas::GraphCanvasMimeEvent* mimeEvent, GraphCanvas::GraphId graphCanvasGraphId, const QRectF& viewportRectangle, int& widthOffset, int& heightOffset, int& maxRowHeight, AZ::Vector2 spacing);
|
||||
|
||||
static void UpdateViewportPositionOffsetForNode(GraphCanvas::NodeId nodeId, const QRectF& viewportRectangle, int& widthOffset, int& heightOffset, int& maxRowHeight, AZ::Vector2 spacing);
|
||||
static bool CreateConnectedChain(const ScriptCanvasEditor::NodeIdPair& nodeIdPair, CreateConnectedChainConfig& connectionConfig);
|
||||
|
||||
static void ProcessNodePalette(ProcessNodePaletteInterface& processNodePaletteInterface);
|
||||
static void ProcessVariablePalette(ProcessVariablePaletteInterface& processVariablePaletteInterface);
|
||||
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QWindow>
|
||||
|
||||
#include <AzCore/EBus/EBus.h>
|
||||
#include <AzCore/Memory/SystemAllocator.h>
|
||||
#include <AzCore/RTTI/RTTI.h>
|
||||
|
||||
#include <AzCore/Outcome/Outcome.h>
|
||||
|
||||
class QMainWindow;
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
typedef AZ::Outcome<void, AZStd::string> ActionReport;
|
||||
|
||||
/**
|
||||
EditorAutomationAction is the base class that all other actions will inherit from. Exposes a setup, and a tick function which returns whether or not the action is complete.
|
||||
*/
|
||||
class EditorAutomationAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(EditorAutomationAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(EditorAutomationAction, "{133E2ECE-5829-432F-BA37-60C75C5CCC34}")
|
||||
|
||||
EditorAutomationAction() = default;
|
||||
virtual ~EditorAutomationAction() = default;
|
||||
|
||||
bool IsAtPreconditionLimit() const { return m_preconditionAttempts >= 10; }
|
||||
|
||||
virtual bool IsMissingPrecondition() { return false; }
|
||||
|
||||
void ResetPreconditionAttempts() { m_preconditionAttempts = 0; }
|
||||
|
||||
EditorAutomationAction* GenerationPreconditionActions()
|
||||
{
|
||||
++m_preconditionAttempts;
|
||||
return GenerateMissingPreconditionAction();
|
||||
}
|
||||
|
||||
void SignalActionBegin()
|
||||
{
|
||||
ResetPreconditionAttempts();
|
||||
SetupAction();
|
||||
}
|
||||
|
||||
virtual bool Tick() = 0;
|
||||
|
||||
virtual ActionReport GenerateReport() const { return AZ::Success(); }
|
||||
|
||||
protected:
|
||||
|
||||
virtual EditorAutomationAction* GenerateMissingPreconditionAction() { return nullptr; }
|
||||
virtual void SetupAction() {}
|
||||
|
||||
private:
|
||||
|
||||
int m_preconditionAttempts = 0;
|
||||
};
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/PlatformIncl.h>
|
||||
|
||||
#include <QPoint>
|
||||
#include <QKeySequence>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationAction.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will simulate a key action(press or release) for the specified key
|
||||
*/
|
||||
class SimulateKeyAction
|
||||
: public EditorAutomationAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(SimulateKeyAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(SimulateKeyAction, "{07259AB5-E5B1-4A4E-8966-610CA3E5F5E3}", EditorAutomationAction);
|
||||
|
||||
enum class KeyAction
|
||||
{
|
||||
Press,
|
||||
Release
|
||||
};
|
||||
|
||||
SimulateKeyAction(KeyAction keyAction, AZ::u32 keyValue = 0);
|
||||
~SimulateKeyAction() override = default;
|
||||
|
||||
bool Tick() override;
|
||||
|
||||
private:
|
||||
|
||||
AZ::u32 m_keyValue;
|
||||
KeyAction m_keyAction;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a press action for the specified key
|
||||
*/
|
||||
class KeyPressAction
|
||||
: public SimulateKeyAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(KeyPressAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(KeyPressAction, "{20F93C69-993C-4658-974B-06F1EE9AFBAC}", SimulateKeyAction);
|
||||
|
||||
explicit KeyPressAction(AZ::u32 keyValue = 0)
|
||||
: SimulateKeyAction(SimulateKeyAction::KeyAction::Press, keyValue)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a release action for the specified key
|
||||
*/
|
||||
class KeyReleaseAction
|
||||
: public SimulateKeyAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(KeyReleaseAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(KeyReleaseAction, "{B4000C12-03F9-4AC1-B1BA-88D8B7FC4CB1}", SimulateKeyAction);
|
||||
|
||||
explicit KeyReleaseAction(AZ::u32 keyValue = 0)
|
||||
: SimulateKeyAction(SimulateKeyAction::KeyAction::Release, keyValue)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a press and a release action for the specified key(currently limited support for QChar to a-z,0-9, *, (, and ) )
|
||||
*/
|
||||
class TypeCharAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(TypeCharAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(TypeCharAction, "{67FBD994-18BB-4434-AD8E-70F446A9B185}", CompoundAction);
|
||||
|
||||
explicit TypeCharAction(QChar qChar);
|
||||
explicit TypeCharAction(AZ::u32 key);
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a user typing in the specified string.
|
||||
*/
|
||||
class TypeStringAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(TypeStringAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(TypeStringAction, "{51D701B1-6386-420C-A1BD-D72272BBBBD5}", CompoundAction);
|
||||
|
||||
explicit TypeStringAction(QString targetString);
|
||||
};
|
||||
}
|
||||
+160
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QPoint>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationAction.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will simulate a user pressing or releasing a mouse button
|
||||
*/
|
||||
class SimulateMouseButtonAction
|
||||
: public EditorAutomationAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(SimulateMouseButtonAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(SimulateMouseButtonAction, "{89D4E6F5-983C-4877-9A32-0929F7D2BB8E}", EditorAutomationAction);
|
||||
|
||||
enum class MouseAction
|
||||
{
|
||||
Press,
|
||||
Release
|
||||
};
|
||||
|
||||
SimulateMouseButtonAction(MouseAction mouseAction, Qt::MouseButton mouseButton = Qt::LeftButton);
|
||||
|
||||
void SetTarget(QWidget* targetDispatch);
|
||||
|
||||
bool Tick() override;
|
||||
|
||||
private:
|
||||
|
||||
QWidget* m_targetDispatch = nullptr;
|
||||
|
||||
MouseAction m_mouseAction;
|
||||
Qt::MouseButton m_mouseButton = Qt::LeftButton;
|
||||
Qt::KeyboardModifiers m_keyboardModifiers = Qt::NoModifier;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a user pressing a mouse button
|
||||
*/
|
||||
class PressMouseButtonAction
|
||||
: public SimulateMouseButtonAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(PressMouseButtonAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(PressMouseButtonAction, "{DA89D548-3506-4DB1-BCCF-6C03ABD75FFB}", SimulateMouseButtonAction);
|
||||
|
||||
PressMouseButtonAction(Qt::MouseButton mouseButton = Qt::LeftButton)
|
||||
: SimulateMouseButtonAction(SimulateMouseButtonAction::MouseAction::Press, mouseButton)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a user releasing a mouse button
|
||||
*/
|
||||
class ReleaseMouseButtonAction
|
||||
: public SimulateMouseButtonAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ReleaseMouseButtonAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(ReleaseMouseButtonAction, "{448D4A65-5BF8-4643-AE31-E979F176C3AF}", SimulateMouseButtonAction);
|
||||
|
||||
ReleaseMouseButtonAction(Qt::MouseButton mouseButton = Qt::LeftButton)
|
||||
: SimulateMouseButtonAction(SimulateMouseButtonAction::MouseAction::Release, mouseButton)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a user clicking a mouse button. Can take in a point to click on.
|
||||
*/
|
||||
class MouseClickAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(MouseClickAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(MouseClickAction, "{AEA337E8-0B2F-443B-AFFB-5688CB996D8E}", CompoundAction);
|
||||
|
||||
MouseClickAction(Qt::MouseButton mouseButton);
|
||||
MouseClickAction(Qt::MouseButton mouseButton, QPoint cursorPosition);
|
||||
~MouseClickAction() override = default;
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
protected:
|
||||
|
||||
void PopulateActionQueue();
|
||||
|
||||
private:
|
||||
|
||||
Qt::MouseButton m_mouseButton;
|
||||
Qt::KeyboardModifiers m_keyboardModifiers = Qt::NoModifier;
|
||||
|
||||
bool m_hasFixedTarget;
|
||||
QPoint m_cursorPosition;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a user moving their mouse to the specified point
|
||||
*/
|
||||
class MouseMoveAction
|
||||
: public EditorAutomationAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(MouseMoveAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(MouseMoveAction, "{AEA337E8-0B2F-443B-AFFB-5688CB996D8E}", EditorAutomationAction);
|
||||
|
||||
MouseMoveAction(QPoint targetPosition, int ticks = 20);
|
||||
~MouseMoveAction() override = default;
|
||||
|
||||
void SetupAction() override;
|
||||
bool Tick() override;
|
||||
|
||||
private:
|
||||
|
||||
int m_tickDuration = 0;
|
||||
int m_tickCount = 0;
|
||||
|
||||
bool m_hasStartPosition = false;
|
||||
QPoint m_startPosition;
|
||||
QPoint m_targetPosition;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will simulate a user draging the mouse between the specified points, using the specified button.
|
||||
*/
|
||||
class MouseDragAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(MouseDragAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(MouseDragAction, "{0B704B80-1BCB-4396-99A6-C5CAC462A7DB}", CompoundAction);
|
||||
|
||||
MouseDragAction(QPoint startPosition, QPoint endPosition, Qt::MouseButton holdButton = Qt::MouseButton::LeftButton);
|
||||
|
||||
private:
|
||||
|
||||
Qt::MouseButton m_holdButton;
|
||||
|
||||
QPoint m_startPosition;
|
||||
QPoint m_endPosition;
|
||||
};
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QPoint>
|
||||
#include <QWidget>
|
||||
|
||||
#include <GraphCanvas/Types/Endpoint.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationAction.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationTest.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will be composed of a series EditorAutomationActions that will be executed in order.
|
||||
The CompoundAction will take ownership of the actions added to it.
|
||||
*/
|
||||
class CompoundAction
|
||||
: public EditorAutomationAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CompoundAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CompoundAction, "{3F9A5736-111C-4D49-A3D5-BA3484D74F4D}", EditorAutomationAction);
|
||||
|
||||
CompoundAction();
|
||||
~CompoundAction() override;
|
||||
|
||||
void SetupAction() override;
|
||||
bool Tick() override;
|
||||
|
||||
void AddAction(EditorAutomationAction* action);
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void ClearActionQueue();
|
||||
|
||||
virtual void OnActionsComplete() {}
|
||||
|
||||
private:
|
||||
|
||||
AZStd::vector< ActionReport > m_errorReports;
|
||||
AZStd::vector< EditorAutomationAction* > m_actionQueue;
|
||||
|
||||
EditorAutomationActionRunner m_actionRunner;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will delay for the specified time
|
||||
*/
|
||||
class DelayAction
|
||||
: public EditorAutomationAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(DelayAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(DelayAction, "{44927F65-58DF-4142-8C04-6EC7A10050FB}", EditorAutomationAction);
|
||||
|
||||
DelayAction(AZStd::chrono::milliseconds delayTime = AZStd::chrono::milliseconds(250));
|
||||
|
||||
void SetupAction() override;
|
||||
bool Tick() override;
|
||||
|
||||
private:
|
||||
|
||||
AZStd::chrono::time_point<AZStd::chrono::system_clock> m_startPoint;
|
||||
|
||||
AZStd::chrono::milliseconds m_delay;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will delay so the OS can process the faked events, then pump the Qt application to process the events.
|
||||
*/
|
||||
class ProcessUserEventsAction
|
||||
: public DelayAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ProcessUserEventsAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(ProcessUserEventsAction, "{CB6D47D6-2E63-4277-BCD0-F9014D74CC48}", DelayAction);
|
||||
|
||||
ProcessUserEventsAction(AZStd::chrono::milliseconds delayTime = AZStd::chrono::milliseconds(250));
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
bool Tick() override;
|
||||
private:
|
||||
|
||||
bool m_delayComplete = false;
|
||||
bool m_processingComplete = false;
|
||||
AZStd::atomic<bool> m_processingEventsSwitch = false;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will print out the specified string during execution
|
||||
*/
|
||||
class TraceEvent
|
||||
: public EditorAutomationAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(TraceEvent, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(TraceEvent, "{A2C0B4B1-9FD7-4441-86EB-B63C8DDD2C97}", EditorAutomationAction);
|
||||
|
||||
TraceEvent(AZStd::string traceName);
|
||||
|
||||
bool Tick() override;
|
||||
|
||||
private:
|
||||
|
||||
AZStd::string m_traceName;
|
||||
};
|
||||
}
|
||||
+92
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Types/Endpoint.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will couple the two specified nodes together. The ordering of the coupling is decided by the specified connection type from the perspective of the 'nodeToPickUp'
|
||||
*/
|
||||
class CoupleNodesAction
|
||||
: public CompoundAction
|
||||
, public GraphCanvas::SceneNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CoupleNodesAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CoupleNodesAction, "{DC6B3198-E127-4833-BC44-B27083A36045}", CompoundAction);
|
||||
|
||||
CoupleNodesAction(GraphCanvas::NodeId nodeToPickUp, GraphCanvas::ConnectionType connectionType, GraphCanvas::NodeId coupleTarget);
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
AZStd::vector< GraphCanvas::ConnectionId > GetConnectionIds() const;
|
||||
|
||||
// GraphCanvas::SceneNotificaionBus
|
||||
void OnConnectionAdded(const AZ::EntityId& connectionId) override;
|
||||
////
|
||||
|
||||
protected:
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
QRectF m_sceneRect;
|
||||
|
||||
QRectF m_pickUpRect;
|
||||
QRectF m_targetRect;
|
||||
|
||||
GraphCanvas::NodeId m_nodeToPickUp;
|
||||
|
||||
GraphCanvas::ConnectionType m_connectionType;
|
||||
|
||||
GraphCanvas::NodeId m_targetNode;
|
||||
|
||||
AZStd::vector< GraphCanvas::ConnectionId > m_connections;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will attempt to create a connection between the two specified endpoints
|
||||
*/
|
||||
class ConnectEndpointsAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ConnectEndpointsAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(ConnectEndpointsAction, "{94941CCD-D8FA-4B01-8876-5D32723BD0C2}", CompoundAction);
|
||||
|
||||
ConnectEndpointsAction(GraphCanvas::Endpoint startEndpoint, GraphCanvas::Endpoint targetEndpoint);
|
||||
|
||||
GraphCanvas::ConnectionId GetConnectionId() const;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
QRectF m_sceneRect;
|
||||
|
||||
GraphCanvas::ConnectionId m_connectionId;
|
||||
|
||||
GraphCanvas::Endpoint m_startEndpoint;
|
||||
GraphCanvas::Endpoint m_targetEndpoint;
|
||||
};
|
||||
}
|
||||
+254
@@ -0,0 +1,254 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Types/Endpoint.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
#include <GraphCanvas/Widgets/NodePalette/NodePaletteWidget.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationModelIds.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will create the specified node from the NodePalette at the specified scene point
|
||||
*/
|
||||
class CreateNodeFromPaletteAction
|
||||
: public CompoundAction
|
||||
, public GraphCanvas::SceneNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateNodeFromPaletteAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateNodeFromPaletteAction, "{5711220C-48D6-4853-87B9-A9866B82DFCD}", CompoundAction);
|
||||
|
||||
CreateNodeFromPaletteAction(GraphCanvas::NodePaletteWidget* paletteWidget, GraphCanvas::GraphId graphId, QString nodeName, QPointF scenePoint);
|
||||
CreateNodeFromPaletteAction(GraphCanvas::NodePaletteWidget* paletteWidget, GraphCanvas::GraphId graphId, QString nodeName, GraphCanvas::ConnectionId connectionId);
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
GraphCanvas::NodeId GetCreatedNodeId() const;
|
||||
|
||||
// GraphCanvas::SceneNotificationBus::Handler
|
||||
void OnNodeAdded(const AZ::EntityId& nodeId, bool isPaste) override;
|
||||
////
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::ConnectionId m_spliceTarget;
|
||||
GraphCanvas::Endpoint m_sourceEndpoint;
|
||||
GraphCanvas::Endpoint m_targetEndpoint;
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
QPointF m_scenePoint;
|
||||
QString m_nodeName;
|
||||
|
||||
GraphCanvas::NodePaletteWidget* m_paletteWidget;
|
||||
|
||||
GraphCanvas::NodeId m_createdNodeId;
|
||||
|
||||
bool m_centerOnScene = false;
|
||||
bool m_writeToSearchFilter = false;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will create all nodes under the specified category from the NodePalette at the specified scene point
|
||||
*/
|
||||
class CreateCategoryFromNodePaletteAction
|
||||
: public CompoundAction
|
||||
, public GraphCanvas::SceneNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateCategoryFromNodePaletteAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateCategoryFromNodePaletteAction, "{FA073F04-5DE2-4124-9BAB-7507FFD046CD}", CompoundAction);
|
||||
|
||||
CreateCategoryFromNodePaletteAction(GraphCanvas::NodePaletteWidget* nodePalette, GraphCanvas::GraphId graphId, QString category, QPointF scenePoint);
|
||||
~CreateCategoryFromNodePaletteAction() override = default;
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
// GraphCanvas::SceneNotificationBus::Handler
|
||||
void OnNodeAdded(const AZ::EntityId& nodeId, bool isPaste) override;
|
||||
////
|
||||
|
||||
AZStd::vector< GraphCanvas::NodeId > GetCreatedNodes() const;
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
QPointF m_scenePoint;
|
||||
|
||||
QString m_categoryName;
|
||||
|
||||
GraphCanvas::NodePaletteWidget* m_paletteWidget;
|
||||
|
||||
int m_expectedCreations = 0;
|
||||
AZStd::vector< GraphCanvas::NodeId > m_createdNodeIds;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will create the specified node at the specified point using the context menu.
|
||||
Can specify a ConnectionId instead of a scene point to use the context menu to splice a node onto the given connection as well
|
||||
*/
|
||||
class CreateNodeFromContextMenuAction
|
||||
: public CompoundAction
|
||||
, public GraphCanvas::SceneNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateNodeFromContextMenuAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateNodeFromContextMenuAction, "{0318F9D3-6433-400F-9E29-41B57A8ADB32}", CompoundAction);
|
||||
|
||||
CreateNodeFromContextMenuAction(GraphCanvas::GraphId graphId, QString nodeName, QPointF scenePoint);
|
||||
CreateNodeFromContextMenuAction(GraphCanvas::GraphId graphId, QString nodeName, AZ::EntityId connectionId);
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
// GraphCanvas::SceneNotificationBus::Handler
|
||||
void OnNodeAdded(const AZ::EntityId& nodeId, bool isPaste) override;
|
||||
////
|
||||
|
||||
AZ::EntityId GetCreatedNodeId() const;
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete();
|
||||
|
||||
private:
|
||||
|
||||
AZ::EntityId m_spliceTarget;
|
||||
GraphCanvas::Endpoint m_sourceEndpoint;
|
||||
GraphCanvas::Endpoint m_targetEndpoint;
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
QPointF m_scenePoint;
|
||||
QString m_nodeName;
|
||||
|
||||
GraphCanvas::NodeId m_createdNodeId;
|
||||
|
||||
bool m_centerOnScene = false;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will create the specified node at the specified point by dragging a connection from the specified endpoint.
|
||||
Will place the new node at a 'reasonable' distance from the specified endpoint, or at the specified point.
|
||||
*/
|
||||
class CreateNodeFromProposalAction
|
||||
: public CompoundAction
|
||||
, public GraphCanvas::SceneNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateNodeFromProposalAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateNodeFromProposalAction, "{236A56E5-73A8-42B0-9239-77670DD4EA44}", CompoundAction);
|
||||
|
||||
CreateNodeFromProposalAction(GraphCanvas::GraphId graphId, GraphCanvas::Endpoint endpoint, QString nodeName);
|
||||
CreateNodeFromProposalAction(GraphCanvas::GraphId graphId, GraphCanvas::Endpoint endpoint, QString nodeName, QPointF scenePoint);
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
// GraphCanvas::SceneNotificationBus::Handler
|
||||
void OnNodeAdded(const AZ::EntityId& nodeId, bool isPaste) override;
|
||||
////
|
||||
|
||||
AZ::EntityId GetCreatedNodeId() const;
|
||||
AZ::EntityId GetConnectionId() const;
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
|
||||
GraphCanvas::Endpoint m_endpoint;
|
||||
|
||||
QPointF m_scenePoint;
|
||||
QString m_nodeName;
|
||||
|
||||
GraphCanvas::NodeId m_createdNodeId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will create a group using the specified creation type[Hotkey action or toolbar click]
|
||||
*/
|
||||
class CreateGroupAction
|
||||
: public CompoundAction
|
||||
, public GraphCanvas::SceneNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
|
||||
enum class CreationType
|
||||
{
|
||||
Toolbar,
|
||||
Hotkey
|
||||
};
|
||||
|
||||
AZ_CLASS_ALLOCATOR(CreateGroupAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateGroupAction, "{853F34EB-F8AB-47E3-A601-35091DC23E11}", CompoundAction);
|
||||
|
||||
CreateGroupAction(GraphCanvas::EditorId editorGraph, GraphCanvas::GraphId graphId, CreationType creationType = CreationType::Hotkey);
|
||||
~CreateGroupAction() override = default;
|
||||
|
||||
void SetupAction();
|
||||
|
||||
// GraphCanvas::SceneNotificationBus::Handler
|
||||
void OnNodeAdded(const AZ::EntityId& groupId, bool isPaste = false) override;
|
||||
////
|
||||
|
||||
AZ::EntityId GetCreatedGroupId() const;
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void SetupToolbarAction();
|
||||
void SetupHotkeyAction();
|
||||
|
||||
void OnActionsComplete();
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::EditorId m_editorId;
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
|
||||
CreationType m_creationType = CreationType::Hotkey;
|
||||
|
||||
AZ::EntityId m_createdGroup;
|
||||
};
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will center the specified graph onto the specified point
|
||||
*/
|
||||
class CenterOnScenePointAction
|
||||
: public EditorAutomationAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CenterOnScenePointAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CenterOnScenePointAction, "{527B3EE0-258F-4D0C-8642-6923D81A9C40}", EditorAutomationAction);
|
||||
|
||||
CenterOnScenePointAction(GraphCanvas::GraphId graphId, QPointF scenePoint);
|
||||
~CenterOnScenePointAction() override = default;
|
||||
|
||||
bool Tick() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
QPointF m_scenePoint;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will ensure that the given rect is visible inside of the specified graph
|
||||
*/
|
||||
class EnsureSceneRectVisibleAction
|
||||
: public DelayAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(EnsureSceneRectVisibleAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(EnsureSceneRectVisibleAction, "{BF412F21-62F1-48AA-891E-266C986820FA}", DelayAction);
|
||||
|
||||
EnsureSceneRectVisibleAction(GraphCanvas::GraphId graphId, QRectF sceneRect);
|
||||
~EnsureSceneRectVisibleAction() override = default;
|
||||
|
||||
void SetupAction() override;
|
||||
bool Tick() override;
|
||||
|
||||
private:
|
||||
|
||||
bool m_firstTick = false;
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
QRectF m_sceneRect;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will move the mouse to the specified point in the scene.
|
||||
*/
|
||||
class SceneMouseMoveAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(SceneMouseMoveAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(SceneMouseMoveAction, "{A26D0034-0682-4F61-9425-EF659D1ABAD0}", CompoundAction);
|
||||
|
||||
SceneMouseMoveAction(GraphCanvas::GraphId graphId, QPointF scenePoint);
|
||||
~SceneMouseMoveAction() override = default;
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
GraphCanvas::ViewId m_viewId;
|
||||
|
||||
QPointF m_scenePoint;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will drag the mouse between the two specified points in the scene
|
||||
*/
|
||||
class SceneMouseDragAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(SceneMouseDragAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(SceneMouseDragAction, "{5A422603-1A84-40B2-B051-94D324F94C7A}", CompoundAction);
|
||||
|
||||
SceneMouseDragAction(GraphCanvas::GraphId graphId, QPointF sceneStart, QPointF sceneEnd, Qt::MouseButton mouseButton = Qt::MouseButton::LeftButton);
|
||||
~SceneMouseDragAction() override = default;
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
GraphCanvas::ViewId m_viewId;
|
||||
|
||||
QPointF m_sceneStart;
|
||||
QPointF m_sceneEnd;
|
||||
|
||||
Qt::MouseButton m_mouseButton;
|
||||
};
|
||||
}
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Components/SceneBus.h>
|
||||
#include <GraphCanvas/Editor/EditorTypes.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will select the specified entity inside of the active Graph scene
|
||||
*/
|
||||
class SelectSceneElementAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(SelectSceneElementAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(SelectSceneElementAction, "{D1EA3B23-D7FD-411A-87BC-4D9D88D35A03}", CompoundAction);
|
||||
|
||||
SelectSceneElementAction(AZ::EntityId sceneMemberId);
|
||||
~SelectSceneElementAction() override = default;
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction();
|
||||
|
||||
private:
|
||||
|
||||
QPointF m_scenePoint;
|
||||
|
||||
AZ::EntityId m_sceneMemberId;
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
GraphCanvas::ViewId m_viewId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will alt click the specified entity inside of the active Graph scene in order
|
||||
Should delete the element that is clicked on
|
||||
*/
|
||||
class AltClickSceneElementAction
|
||||
: public CompoundAction
|
||||
, public GraphCanvas::SceneNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(AltClickSceneElementAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(AltClickSceneElementAction, "{FF99EC14-53B3-474E-A7A1-6D30800B9583}", CompoundAction);
|
||||
|
||||
AltClickSceneElementAction(AZ::EntityId sceneMemberId);
|
||||
~AltClickSceneElementAction() override = default;
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
// SceneNotificaitonBus
|
||||
void OnNodeRemoved(const AZ::EntityId& nodeId);
|
||||
|
||||
void OnConnectionRemoved(const AZ::EntityId& connectionId);
|
||||
////
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
QPointF m_scenePoint;
|
||||
|
||||
bool m_sceneMemberRemoved = false;
|
||||
AZ::EntityId m_sceneMemberId;
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
GraphCanvas::ViewId m_viewId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will move the mouse to the NodePropertyDisplay for the specified GraphCanvas SlotId
|
||||
*/
|
||||
class MouseToNodePropertyEditorAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(MouseToNodePropertyEditorAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(MouseToNodePropertyEditorAction, "{03BE0BBE-B977-4103-BC6D-0357B7CEA46E}", CompoundAction);
|
||||
|
||||
MouseToNodePropertyEditorAction(GraphCanvas::SlotId slotId);
|
||||
~MouseToNodePropertyEditorAction() override = default;
|
||||
|
||||
void SetupAction();
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::SlotId m_slotId;
|
||||
};
|
||||
}
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Editor/AssetEditorBus.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
|
||||
//! This action waits for the signal from AssetEditorNotificationBus that signals the active graph
|
||||
//! has changed, meaning that in the context of these tests, the newly created graph is in focus.
|
||||
class WaitForNewGraphAction
|
||||
: public EditorAutomationAction
|
||||
, public GraphCanvas::AssetEditorNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(WaitForNewGraphAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(WaitForNewGraphAction, "{0632736B-ACC3-4051-9772-3A7169B375E9}", EditorAutomationAction);
|
||||
|
||||
WaitForNewGraphAction();
|
||||
~WaitForNewGraphAction() override;
|
||||
|
||||
bool Tick() override;
|
||||
|
||||
const GraphCanvas::GraphId& GetGraphId() const { return m_graphId; }
|
||||
|
||||
private:
|
||||
|
||||
// AssetEditorNotificationBus...
|
||||
void OnActiveGraphChanged(const AZ::EntityId& graphId) override;
|
||||
|
||||
|
||||
bool m_newGraphCreated = false;
|
||||
AZ::EntityId m_graphId;
|
||||
};
|
||||
|
||||
|
||||
//! Action that will create a new runtime graph using the toolbar button
|
||||
class CreateNewGraphAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateNewGraphAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateNewGraphAction, "{26A316D4-ADCC-4796-A3C5-E0545EB96C0E}", CompoundAction);
|
||||
|
||||
CreateNewGraphAction();
|
||||
~CreateNewGraphAction() override = default;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
GraphCanvas::GraphId GetGraphId() const;
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
WaitForNewGraphAction* m_newGraphAction;
|
||||
};
|
||||
|
||||
//! Action that will create a new function graph using the toolbar button
|
||||
class CreateNewFunctionAction
|
||||
: public CreateNewGraphAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateNewFunctionAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateNewFunctionAction, "{EF730E0B-AA26-4A81-BC48-22FBEB06CBF9}", CreateNewGraphAction);
|
||||
|
||||
CreateNewFunctionAction();
|
||||
~CreateNewFunctionAction() override = default;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
};
|
||||
|
||||
//! Action that will forcibly close the active graph, bypassing any prompts for saving
|
||||
class ForceCloseActiveGraphAction
|
||||
: public ProcessUserEventsAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ForceCloseActiveGraphAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(ForceCloseActiveGraphAction, "{39BE4561-49A3-4087-BC70-15773EC2117F}", ProcessUserEventsAction);
|
||||
|
||||
ForceCloseActiveGraphAction();
|
||||
~ForceCloseActiveGraphAction() override = default;
|
||||
|
||||
void SetupAction() override;
|
||||
bool Tick() override;
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::GraphId m_activeGraphId;
|
||||
|
||||
bool m_firstTick = false;
|
||||
};
|
||||
}
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractItemView>
|
||||
#include <QLineEdit>
|
||||
#include <QRect>
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <GraphCanvas/Types/Endpoint.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
#include <GraphCanvas/Widgets/NodePalette/NodePaletteWidget.h>
|
||||
|
||||
#include <ScriptCanvas/Core/Datum.h>
|
||||
#include <ScriptCanvas/Variable/VariableCore.h>
|
||||
#include <ScriptCanvas/Variable/VariableBus.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will create a variable in the active graph using the specified creation action
|
||||
*/
|
||||
class CreateVariableAction
|
||||
: public CompoundAction
|
||||
, public ScriptCanvas::GraphVariableManagerNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
|
||||
enum class CreationType
|
||||
{
|
||||
Palette,
|
||||
AutoComplete,
|
||||
Programmatic
|
||||
};
|
||||
|
||||
AZ_CLASS_ALLOCATOR(CreateVariableAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateVariableAction, "{0C2A4B3C-FCE3-4611-BACB-4651B40CD715}", CompoundAction);
|
||||
|
||||
CreateVariableAction(ScriptCanvas::Data::Type dataType, CreationType creationType = CreationType::AutoComplete);
|
||||
CreateVariableAction(ScriptCanvas::Data::Type dataType, QString variableName, CreationType creationType = CreationType::AutoComplete);
|
||||
~CreateVariableAction() override = default;
|
||||
|
||||
void SetErrorOnNameMisMatch(bool enabled);
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
ScriptCanvas::VariableId GetVariableId() const;
|
||||
|
||||
// GraphVariableManagerNotificationBus
|
||||
void OnVariableAddedToGraph(const ScriptCanvas::VariableId& variableId, AZStd::string_view variableName) override;
|
||||
////
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
CreationType m_creationType = CreationType::AutoComplete;
|
||||
|
||||
bool m_errorOnNameMismatch = true;
|
||||
QString m_variableName;
|
||||
|
||||
ScriptCanvas::Data::Type m_dataType;
|
||||
QString m_typeName;
|
||||
|
||||
ScriptCanvas::ScriptCanvasId m_scriptCanvasId;
|
||||
ScriptCanvas::VariableId m_variableId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will create a get/set variable node from the variable palette
|
||||
*/
|
||||
class CreateVariableNodeFromGraphPalette
|
||||
: public CompoundAction
|
||||
, public GraphCanvas::SceneNotificationBus::Handler
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(CreateVariableNodeFromGraphPalette, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(CreateVariableNodeFromGraphPalette, "{B0E36790-2BED-4338-A462-7F302AFA5671}", CompoundAction);
|
||||
|
||||
CreateVariableNodeFromGraphPalette(const AZStd::string& variableName, const GraphCanvas::GraphId& graphId, QPoint scenePoint, Qt::KeyboardModifier = Qt::KeyboardModifier::ShiftModifier);
|
||||
~CreateVariableNodeFromGraphPalette() override = default;
|
||||
|
||||
bool IsMissingPrecondition() override;
|
||||
EditorAutomationAction* GenerateMissingPreconditionAction() override;
|
||||
|
||||
void SetupAction();
|
||||
|
||||
// GraphCanvas::SceneNotificationBus
|
||||
void OnNodeAdded(const AZ::EntityId& nodeId, bool isPaste) override;
|
||||
////
|
||||
|
||||
AZ::EntityId GetCreatedNodeId() const;
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
|
||||
protected:
|
||||
|
||||
void OnActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
QTableView* m_graphPalette = nullptr;
|
||||
QLineEdit* m_textFilter = nullptr;
|
||||
|
||||
bool m_isShowingPalette = false;
|
||||
bool m_isFiltered = false;
|
||||
bool m_indexIsVisible = false;
|
||||
bool m_scenePointVisible = false;
|
||||
|
||||
QModelIndex m_displayIndex;
|
||||
|
||||
AZStd::string m_variableName;
|
||||
|
||||
GraphCanvas::GraphId m_graphId;
|
||||
GraphCanvas::ViewId m_viewId;
|
||||
QPoint m_scenePoint;
|
||||
|
||||
AZ::EntityId m_createdNodeId;
|
||||
|
||||
Qt::KeyboardModifier m_modifier;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will ensure that VariableWidget is showing the active GraphVariables list
|
||||
*/
|
||||
class ShowGraphVariablesAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(ShowGraphVariablesAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(ShowGraphVariablesAction, "{853F34EB-F8AB-47E3-A601-35091DC23E11}", CompoundAction);
|
||||
|
||||
ShowGraphVariablesAction() = default;
|
||||
~ShowGraphVariablesAction() override = default;
|
||||
|
||||
void SetupAction();
|
||||
|
||||
ActionReport GenerateReport() const override;
|
||||
};
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractItemView>
|
||||
#include <QLineEdit>
|
||||
#include <QRect>
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationAction that will write a string to the specified line edit.
|
||||
*/
|
||||
class WriteToLineEditAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(WriteToLineEditAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(WriteToLineEditAction, "{EAF64BDE-9A06-4169-8FD1-50D6BFEBA73A}", CompoundAction);
|
||||
|
||||
WriteToLineEditAction(QLineEdit* targetEdit, QString targetText);
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
private:
|
||||
|
||||
QLineEdit* m_targetEdit;
|
||||
QString m_targetText;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationAction that will move the mouse to the specified row for the specified ItemView
|
||||
*/
|
||||
class MoveMouseToViewRowAction
|
||||
: public CompoundAction
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(MoveMouseToViewRowAction, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(MoveMouseToViewRowAction, "{094DD153-BDE4-4E56-B14A-25FE5C6348A1}", CompoundAction);
|
||||
|
||||
MoveMouseToViewRowAction(QAbstractItemView* tableView, int row, QModelIndex parentIndex = QModelIndex());
|
||||
~MoveMouseToViewRowAction() override = default;
|
||||
|
||||
void SetupAction() override;
|
||||
|
||||
private:
|
||||
|
||||
QAbstractItemView* m_itemView = nullptr;
|
||||
int m_row;
|
||||
QModelIndex m_parentIndex;
|
||||
};
|
||||
}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <AzCore/std/string/string.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
typedef AZStd::string AutomationStateModelId;
|
||||
namespace StateModelIds
|
||||
{
|
||||
static const char* GraphCanvasId = "::GraphCanvasId";
|
||||
static const char* ScriptCanvasId = "::ScriptCanvasId";
|
||||
static const char* ViewId = "::ViewId";
|
||||
static const char* MinorStep = "::MinorStep";
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Types/Endpoint.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ConnectionActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationState that will couple the two specified nodes together. The ordering of the coupling is decided by the specified connection type from the perspective of the 'nodeToPickUp'
|
||||
*/
|
||||
class CoupleNodesState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
CoupleNodesState(AutomationStateModelId firstNode, GraphCanvas::ConnectionType connectionType, AutomationStateModelId secondNode, AutomationStateModelId outputId = "");
|
||||
~CoupleNodesState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_pickUpNode;
|
||||
AutomationStateModelId m_targetNode;
|
||||
|
||||
GraphCanvas::ConnectionType m_connectionType;
|
||||
|
||||
CoupleNodesAction* m_coupleNodesAction = nullptr;
|
||||
|
||||
AutomationStateModelId m_outputId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will attempt to create a connection between the two specified endpoints
|
||||
*/
|
||||
class ConnectEndpointsState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
ConnectEndpointsState(AutomationStateModelId sourceEndpoint, AutomationStateModelId targetEndpoint, AutomationStateModelId outputId = "");
|
||||
~ConnectEndpointsState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_sourceEndpoint;
|
||||
AutomationStateModelId m_targetEndpoint;
|
||||
|
||||
ConnectEndpointsAction* m_connectEndpointsAction = nullptr;
|
||||
|
||||
AutomationStateModelId m_outputId;
|
||||
};
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Types/Endpoint.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
#include <GraphCanvas/Widgets/NodePalette/NodePaletteWidget.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationModelIds.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/CreateElementsActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationState that will create the specified node from the NodePalette either at the specified point, or via splicing
|
||||
*/
|
||||
class CreateNodeFromPaletteState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
enum class CreationType
|
||||
{
|
||||
ScenePosition,
|
||||
Splice
|
||||
};
|
||||
|
||||
CreateNodeFromPaletteState(GraphCanvas::NodePaletteWidget* paletteWidget, const QString& nodeName, CreationType creationType, AutomationStateModelId creationDataId, AutomationStateModelId outputId = "");
|
||||
~CreateNodeFromPaletteState() override = default;
|
||||
|
||||
protected:
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::NodePaletteWidget* m_nodePaletteWidget = nullptr;
|
||||
QString m_nodeName;
|
||||
|
||||
CreationType m_creationType;
|
||||
AutomationStateModelId m_creationDataId;
|
||||
|
||||
AutomationStateModelId m_outputId;
|
||||
|
||||
CreateNodeFromPaletteAction* m_createNodeAction = nullptr;
|
||||
DelayAction m_delayAction;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will create all of the nodes under the specified category
|
||||
*/
|
||||
class CreateCategoryFromNodePaletteState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
|
||||
CreateCategoryFromNodePaletteState(GraphCanvas::NodePaletteWidget* paletteWidget, AutomationStateModelId categoryId, AutomationStateModelId scenePoint, AutomationStateModelId outputId = "");
|
||||
~CreateCategoryFromNodePaletteState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_categoryId;
|
||||
AutomationStateModelId m_scenePoint;
|
||||
AutomationStateModelId m_outputId;
|
||||
|
||||
GraphCanvas::NodePaletteWidget* m_paletteWidget = nullptr;
|
||||
|
||||
CreateCategoryFromNodePaletteAction* m_creationAction = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will create the specified node at either the specified point using the context menu, or by
|
||||
splicing it onto a ConnectionId
|
||||
*/
|
||||
class CreateNodeFromContextMenuState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
enum class CreationType
|
||||
{
|
||||
ScenePosition,
|
||||
Splice
|
||||
};
|
||||
|
||||
CreateNodeFromContextMenuState(const QString& nodeName, CreationType creationType, AutomationStateModelId creationDataId, AutomationStateModelId outputId = "");
|
||||
~CreateNodeFromContextMenuState() override = default;
|
||||
|
||||
protected:
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
QString m_nodeName;
|
||||
|
||||
CreationType m_creationType;
|
||||
AutomationStateModelId m_creationDataId;
|
||||
|
||||
AutomationStateModelId m_outputId;
|
||||
|
||||
CreateNodeFromContextMenuAction* m_createNodeAction = nullptr;
|
||||
DelayAction m_delayAction;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will create the specified node at the specified point by dragging a connection from the specified endpoint.
|
||||
Will place the new node at a 'reasonable' distance from the specified endpoint, or at the specified point.
|
||||
*/
|
||||
class CreateNodeFromProposalState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
CreateNodeFromProposalState(const QString& nodeName, AutomationStateModelId endpointId, AutomationStateModelId scenePointId = "", AutomationStateModelId nodeOutputId = "", AutomationStateModelId connectionOutputId = "");
|
||||
~CreateNodeFromProposalState() override = default;
|
||||
|
||||
protected:
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
QString m_nodeName;
|
||||
|
||||
AutomationStateModelId m_endpointId = nullptr;
|
||||
|
||||
AutomationStateModelId m_scenePointId;
|
||||
AutomationStateModelId m_nodeOutputId;
|
||||
AutomationStateModelId m_connectionOutputId;
|
||||
|
||||
CreateNodeFromProposalAction* m_createNodeAction = nullptr;
|
||||
DelayAction m_delayAction;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will create a Group using the specified creation method.
|
||||
*/
|
||||
class CreateGroupState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
CreateGroupState(GraphCanvas::EditorId editorId, CreateGroupAction::CreationType creationType = CreateGroupAction::CreationType::Hotkey, AutomationStateModelId outputId = "");
|
||||
~CreateGroupState() override = default;
|
||||
|
||||
protected:
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
GraphCanvas::EditorId m_editorId;
|
||||
CreateGroupAction::CreationType m_creationType;
|
||||
|
||||
AutomationStateModelId m_outputId;
|
||||
|
||||
CreateGroupAction* m_createGroupAction;
|
||||
DelayAction m_delayAction;
|
||||
};
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/EditorViewActions.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/EditorMouseActions.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/EditorKeyActions.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/WidgetActions.h>
|
||||
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationState that will move the mouse to a particular point in the scene.
|
||||
*/
|
||||
class SceneMouseMoveState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
SceneMouseMoveState(AutomationStateModelId targetPoint);
|
||||
~SceneMouseMoveState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_targetPoint;
|
||||
|
||||
SceneMouseMoveAction* m_moveAction = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will execute a Mouse Drag Action inside of the scene
|
||||
*/
|
||||
class SceneMouseDragState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
SceneMouseDragState(AutomationStateModelId startPoint, AutomationStateModelId endPoint, Qt::MouseButton mouseButton = Qt::MouseButton::LeftButton);
|
||||
~SceneMouseDragState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_startPoint;
|
||||
AutomationStateModelId m_endPoint;
|
||||
|
||||
Qt::MouseButton m_mouseButton;
|
||||
|
||||
SceneMouseDragAction* m_dragAction = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will find the view center and store it in the supplied id.
|
||||
*/
|
||||
class FindViewCenterState
|
||||
: public CustomActionState
|
||||
{
|
||||
public:
|
||||
FindViewCenterState(AutomationStateModelId outputId);
|
||||
~FindViewCenterState() override = default;
|
||||
|
||||
void OnCustomAction();
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_outputId;
|
||||
};
|
||||
}
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
#include <GraphCanvas/Editor/EditorTypes.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/ElementInteractions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationState that will select the specified target
|
||||
*/
|
||||
class SelectSceneElementState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
SelectSceneElementState(AutomationStateModelId targetId);
|
||||
~SelectSceneElementState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
SelectSceneElementAction* m_selectSceneElement = nullptr;
|
||||
|
||||
AutomationStateModelId m_targetId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will execute the alt click scene element action
|
||||
*/
|
||||
class AltClickSceneElementState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
AltClickSceneElementState(AutomationStateModelId targetId);
|
||||
~AltClickSceneElementState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
AltClickSceneElementAction* m_altClickAction = nullptr;
|
||||
|
||||
AutomationStateModelId m_targetId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will execute the mouse to node property editor action
|
||||
*/
|
||||
class MouseToNodePropertyEditorState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
MouseToNodePropertyEditorState(AutomationStateModelId slotId);
|
||||
~MouseToNodePropertyEditorState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
ProcessUserEventsAction m_processEvents;
|
||||
MouseToNodePropertyEditorAction* m_moveToPropertyAction = nullptr;
|
||||
|
||||
AutomationStateModelId m_slotId;
|
||||
};
|
||||
}
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Editor/AssetEditorBus.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/GraphActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationState that will create a runtime graph
|
||||
*/
|
||||
DefineStateId(CreateRuntimeGraphState);
|
||||
|
||||
class CreateRuntimeGraphState
|
||||
: public StaticIdAutomationState<CreateRuntimeGraphStateId>
|
||||
{
|
||||
public:
|
||||
|
||||
CreateRuntimeGraphState();
|
||||
~CreateRuntimeGraphState() override = default;
|
||||
|
||||
protected:
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
CreateNewGraphAction m_createNewGraphAction;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will create a function graph
|
||||
*/
|
||||
DefineStateId(CreateFunctionGraphState);
|
||||
|
||||
class CreateFunctionGraphState
|
||||
: public StaticIdAutomationState<CreateFunctionGraphStateId>
|
||||
{
|
||||
public:
|
||||
|
||||
CreateFunctionGraphState();
|
||||
~CreateFunctionGraphState() override = default;
|
||||
|
||||
protected:
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
CreateNewFunctionAction m_createNewFunctionAction;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will force close the currently opened graph, bypassing any save prompts.
|
||||
*/
|
||||
DefineStateId(ForceCloseActiveGraphState);
|
||||
|
||||
class ForceCloseActiveGraphState
|
||||
: public StaticIdAutomationState<ForceCloseActiveGraphStateId>
|
||||
{
|
||||
public:
|
||||
|
||||
ForceCloseActiveGraphState();
|
||||
~ForceCloseActiveGraphState() override = default;
|
||||
|
||||
protected:
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
|
||||
private:
|
||||
|
||||
ForceCloseActiveGraphAction m_forceCloseActiveGraph;
|
||||
};
|
||||
}
|
||||
+197
@@ -0,0 +1,197 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/EditorKeyActions.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/EditorMouseActions.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/WidgetActions.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/EditorViewActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
struct FindPositionOffsets
|
||||
{
|
||||
// 0 is top. 1 is bottom.
|
||||
float m_verticalPosition = 0;
|
||||
|
||||
// Offset will be added on to the relative anchor point
|
||||
int m_verticalOffset = 0;
|
||||
|
||||
// 0 is left, 1 is right
|
||||
float m_horizontalPosition = 0;
|
||||
|
||||
// Offset will be added on to the relative anchor point
|
||||
int m_horizontalOffset = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will find the node position and store it in the supplied id.
|
||||
- By default will return the 'center' of the node. The offset vector will determine
|
||||
a direction on the node to offset to the edge of, and the length deterines how much
|
||||
extra space to apply in that offset direction
|
||||
|
||||
0 is right/up, 1 is left/down
|
||||
*/
|
||||
class FindNodePosition
|
||||
: public CustomActionState
|
||||
{
|
||||
public:
|
||||
FindNodePosition(AutomationStateModelId nodeId, AutomationStateModelId outputId, FindPositionOffsets offsets = FindPositionOffsets());
|
||||
~FindNodePosition() override = default;
|
||||
|
||||
void OnCustomAction() override;
|
||||
|
||||
private:
|
||||
|
||||
FindPositionOffsets m_offsets;
|
||||
|
||||
AutomationStateModelId m_nodeId;
|
||||
AutomationStateModelId m_outputId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will find the group position and store it in the supplied id.
|
||||
- By default will return the 'center' of the node. The offset vector will determine
|
||||
a direction on the node to offset to the edge of, and the length deterines how much
|
||||
extra space to apply in that offset direction
|
||||
|
||||
0 is right/up, 1 is left/down
|
||||
*/
|
||||
class FindGroupPosition
|
||||
: public CustomActionState
|
||||
{
|
||||
public:
|
||||
FindGroupPosition(AutomationStateModelId groupId, AutomationStateModelId outputId, FindPositionOffsets offsets = FindPositionOffsets());
|
||||
~FindGroupPosition() override = default;
|
||||
|
||||
void OnCustomAction() override;
|
||||
|
||||
private:
|
||||
|
||||
FindPositionOffsets m_offsets;
|
||||
|
||||
AutomationStateModelId m_groupId;
|
||||
AutomationStateModelId m_outputId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will find an endpoint of the specified type on the supplied node.
|
||||
Slot number will be the number of the slot that you are looking for(index 0).
|
||||
*/
|
||||
class FindEndpointOfTypeState
|
||||
: public CustomActionState
|
||||
{
|
||||
public:
|
||||
|
||||
FindEndpointOfTypeState(AutomationStateModelId targetNodeId, AutomationStateModelId outputId, GraphCanvas::ConnectionType connectionType, GraphCanvas::SlotType slotType, int slotNumber = 0);
|
||||
~FindEndpointOfTypeState() override = default;
|
||||
|
||||
void OnCustomAction() override;
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_targetNodeId;
|
||||
AutomationStateModelId m_outputId;
|
||||
|
||||
int m_slotNumber;
|
||||
|
||||
GraphCanvas::ConnectionType m_connectionType = GraphCanvas::ConnectionType::CT_Invalid;
|
||||
GraphCanvas::SlotType m_slotType = GraphCanvas::SlotTypes::Invalid;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will find the last connection for the specified endpoint
|
||||
*/
|
||||
class GetLastConnection
|
||||
: public CustomActionState
|
||||
{
|
||||
public:
|
||||
GetLastConnection(AutomationStateModelId targetEndpoint, AutomationStateModelId outputId);
|
||||
~GetLastConnection() override = default;
|
||||
|
||||
void OnCustomAction() override;
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_targetEndpoint;
|
||||
AutomationStateModelId m_outputId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will delete the specified row from the GraphVariablesPalette
|
||||
*/
|
||||
class DeleteVariableRowFromPaletteState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
|
||||
DeleteVariableRowFromPaletteState(int row);
|
||||
~DeleteVariableRowFromPaletteState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
int m_row = 0;
|
||||
int m_rowCount = 0;
|
||||
|
||||
MoveMouseToViewRowAction* m_mouseToRow = nullptr;
|
||||
|
||||
MouseClickAction m_clickAction;
|
||||
TypeCharAction m_deleteAction;
|
||||
ProcessUserEventsAction m_processEvents;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState will confirm the supplied group status of the provided scene member to the provided group.
|
||||
*/
|
||||
class CheckIsInGroup
|
||||
: public CustomActionState
|
||||
{
|
||||
public:
|
||||
CheckIsInGroup(AutomationStateModelId sceneMemberId, AutomationStateModelId groupId, bool expectResult, AZStd::string stateName = "");
|
||||
~CheckIsInGroup() override = default;
|
||||
|
||||
void OnCustomAction() override;
|
||||
|
||||
private:
|
||||
|
||||
bool m_expectResult = false;
|
||||
|
||||
AutomationStateModelId m_sceneMemberId;
|
||||
AutomationStateModelId m_groupId;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that triggers the specified character with the 'ctrl' key.
|
||||
*/
|
||||
class TriggerHotKey
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
TriggerHotKey(QChar hotkey, AZStd::string stateId = "");
|
||||
~TriggerHotKey() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
|
||||
private:
|
||||
|
||||
TypeCharAction m_typeAction;
|
||||
|
||||
ProcessUserEventsAction m_processEvents;
|
||||
|
||||
KeyPressAction m_pressCtrlAction;
|
||||
KeyReleaseAction m_releaseCtrlAction;
|
||||
};
|
||||
}
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QAbstractItemView>
|
||||
#include <QLineEdit>
|
||||
#include <QRect>
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
#include <QWidget>
|
||||
|
||||
#include <GraphCanvas/Types/Endpoint.h>
|
||||
#include <GraphCanvas/Types/Types.h>
|
||||
#include <GraphCanvas/Widgets/NodePalette/NodePaletteWidget.h>
|
||||
|
||||
#include <ScriptCanvas/Core/Datum.h>
|
||||
#include <ScriptCanvas/Variable/VariableCore.h>
|
||||
#include <ScriptCanvas/Variable/VariableBus.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/GenericActions.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationActions/ScriptCanvasActions/VariableActions.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
EditorAutomationState that will create a variable and give it a name(assuming one is provided), using the specified creation method.
|
||||
*/
|
||||
class CreateVariableState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
CreateVariableState(AutomationStateModelId dataTypeId, AutomationStateModelId nameId, bool errorOnNameMismatch = true, CreateVariableAction::CreationType creationType = CreateVariableAction::CreationType::AutoComplete, AutomationStateModelId outputId = "");
|
||||
~CreateVariableState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
|
||||
AutomationStateModelId m_dataTypeId;
|
||||
AutomationStateModelId m_nameId;
|
||||
AutomationStateModelId m_outputId;
|
||||
|
||||
CreateVariableAction::CreationType m_creationType;
|
||||
|
||||
bool m_errorOnNameMismatch = true;
|
||||
|
||||
CreateVariableAction* m_createVariableAction = nullptr;
|
||||
};
|
||||
|
||||
/**
|
||||
EditorAutomationState that will create a variable node by holding down a modifier and dragging off of the GraphVariablePalette
|
||||
*/
|
||||
class CreateVariableNodeFromGraphPaletteState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
CreateVariableNodeFromGraphPaletteState(AutomationStateModelId variableNameId, AutomationStateModelId scenePoint, Qt::KeyboardModifier modifier, AutomationStateModelId outputId);
|
||||
~CreateVariableNodeFromGraphPaletteState() override = default;
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) override;
|
||||
void OnStateActionsComplete() override;
|
||||
|
||||
private:
|
||||
AutomationStateModelId m_variableNameId;
|
||||
AutomationStateModelId m_scenePoint;
|
||||
AutomationStateModelId m_outputId;
|
||||
|
||||
Qt::KeyboardModifier m_modifier;
|
||||
|
||||
CreateVariableNodeFromGraphPalette* m_createVariable = nullptr;
|
||||
};
|
||||
}
|
||||
+337
@@ -0,0 +1,337 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
#include <AzCore/Component/TickBus.h>
|
||||
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationAction.h>
|
||||
#include <ScriptCanvasDeveloperEditor/EditorAutomation/EditorAutomationModelIds.h>
|
||||
|
||||
namespace ScriptCanvasDeveloper
|
||||
{
|
||||
/**
|
||||
ActionRunner that will manage the editor automation stack, and handle pushing the precondition elements into the queue.
|
||||
Will not take ownership of all actions added manually, but any precondition elements will be deleted.
|
||||
|
||||
Needs to be externally ticked.
|
||||
*/
|
||||
class EditorAutomationActionRunner
|
||||
{
|
||||
public:
|
||||
|
||||
EditorAutomationActionRunner() = default;
|
||||
~EditorAutomationActionRunner();
|
||||
|
||||
void Reset();
|
||||
bool Tick();
|
||||
|
||||
// Pushes actions onto a stack.
|
||||
void AddAction(EditorAutomationAction* actionToRun);
|
||||
|
||||
bool HasActions() const;
|
||||
|
||||
bool HasErrors() const;
|
||||
const AZStd::vector< ActionReport >& GetErrors() const;
|
||||
|
||||
private:
|
||||
|
||||
AZStd::vector< ActionReport > m_errorReports;
|
||||
AZStd::vector< EditorAutomationAction* > m_executionStack;
|
||||
AZStd::unordered_set< EditorAutomationAction* > m_actionsToDelete;
|
||||
|
||||
EditorAutomationAction* m_currentAction = nullptr;
|
||||
};
|
||||
|
||||
class StateModel
|
||||
{
|
||||
public:
|
||||
|
||||
typedef AZStd::string DataKey;
|
||||
|
||||
StateModel() = default;
|
||||
virtual ~StateModel() = default;
|
||||
|
||||
|
||||
const AZStd::any* FindStateData(const DataKey& dataId) const;
|
||||
|
||||
template<typename T>
|
||||
const T* GetStateDataAs(const DataKey& dataId) const
|
||||
{
|
||||
const AZStd::any* stateData = FindStateData(dataId);
|
||||
return AZStd::any_cast<T>(stateData);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SetStateData(const DataKey& dataId, const T& data)
|
||||
{
|
||||
auto insertResult = m_stateData.insert(dataId);
|
||||
auto dataIter = insertResult.first;
|
||||
|
||||
dataIter->second = data;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
void ClearModelData();
|
||||
|
||||
|
||||
private:
|
||||
AZStd::unordered_map< DataKey, AZStd::any > m_stateData;
|
||||
};
|
||||
|
||||
template <AZ::u32 Id>
|
||||
struct StateTraits
|
||||
{
|
||||
static int StateID() { return Id; }
|
||||
};
|
||||
|
||||
class EditorAutomationState
|
||||
{
|
||||
public:
|
||||
static constexpr int EXIT_STATE_ID = (-1);
|
||||
|
||||
AZ_TYPE_INFO(EditorAutomationState, "{B18A0531-E3C2-4209-8A9E-1B0195C28443}");
|
||||
AZ_CLASS_ALLOCATOR(EditorAutomationState, AZ::SystemAllocator, 0);
|
||||
|
||||
virtual ~EditorAutomationState() = default;
|
||||
|
||||
virtual int GetStateId() const = 0;
|
||||
virtual const char* GetStateName() const = 0;
|
||||
|
||||
void SetStateModel(StateModel* stateModel)
|
||||
{
|
||||
m_stateModel = stateModel;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void SetModelData(StateModel::DataKey dataKey, const T& modelData)
|
||||
{
|
||||
m_stateModel->SetStateData<T>(dataKey, modelData);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
const T* GetModelData(StateModel::DataKey dataKey)
|
||||
{
|
||||
return m_stateModel->GetStateDataAs<T>(dataKey);
|
||||
}
|
||||
|
||||
StateModel* GetStateModel() const
|
||||
{
|
||||
return m_stateModel;
|
||||
}
|
||||
|
||||
void SetupStateActions(EditorAutomationActionRunner& actionRunner)
|
||||
{
|
||||
m_error = "";
|
||||
|
||||
OnSetupStateActions(actionRunner);
|
||||
}
|
||||
|
||||
void StateActionsComplete()
|
||||
{
|
||||
OnStateActionsComplete();
|
||||
}
|
||||
|
||||
bool HasErrors() const
|
||||
{
|
||||
return !m_error.empty();
|
||||
}
|
||||
|
||||
void ReportError(AZStd::string error)
|
||||
{
|
||||
m_error += AZStd::string::format("%s - %s\n", GetStateName(), error.c_str());
|
||||
}
|
||||
|
||||
const AZStd::string& GetError() const
|
||||
{
|
||||
return m_error;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void OnSetupStateActions(EditorAutomationActionRunner& actionRunner) = 0;
|
||||
virtual void OnStateActionsComplete() {};
|
||||
|
||||
private:
|
||||
StateModel* m_stateModel = nullptr;
|
||||
|
||||
AZStd::string m_error;
|
||||
};
|
||||
|
||||
template <typename Traits>
|
||||
class StaticIdAutomationState : public EditorAutomationState
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_TYPE_INFO(StaticIdAutomationState, "{7E7450F7-5553-4877-8AC9-365A052F2758}");
|
||||
|
||||
StaticIdAutomationState() = default;
|
||||
|
||||
int GetStateId() const override { return Traits::StateID(); }
|
||||
const char* GetStateName() const override { return Traits::StateName(); }
|
||||
|
||||
static int StateID() { return Traits::StateID(); }
|
||||
};
|
||||
|
||||
// In order to re-use some states with different constructions setups without needing
|
||||
// a bunch of one off states to re-configure the pre-existing states through data model values
|
||||
// named state provides a way for states to construct their names at the expense of not
|
||||
// being able to statically reference the name/stateid.
|
||||
class NamedAutomationState : public EditorAutomationState
|
||||
{
|
||||
public:
|
||||
|
||||
AZ_TYPE_INFO(NamedAutomationState, "{62DD037C-D80F-4B1B-9F3E-9F05400ABA24}");
|
||||
|
||||
NamedAutomationState() = delete;
|
||||
NamedAutomationState(const char* name)
|
||||
{
|
||||
SetStateName(name);
|
||||
m_stateId = AZ::Crc32(name);
|
||||
}
|
||||
|
||||
NamedAutomationState(const AZStd::string& stateName)
|
||||
{
|
||||
SetStateName(stateName);
|
||||
}
|
||||
|
||||
int GetStateId() const override { return m_stateId; }
|
||||
|
||||
protected:
|
||||
|
||||
void SetStateName(const AZStd::string& stateName)
|
||||
{
|
||||
m_name = stateName;
|
||||
m_stateId = AZ_CRC(stateName.c_str());
|
||||
}
|
||||
|
||||
const char* GetStateName() const override { return m_name.c_str(); }
|
||||
|
||||
private:
|
||||
|
||||
AZStd::string m_name;
|
||||
int m_stateId = EXIT_STATE_ID;
|
||||
};
|
||||
|
||||
class CustomActionState
|
||||
: public NamedAutomationState
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(CustomActionState, "{DA39829B-08F8-47BF-890D-9DA695BAD5A0}");
|
||||
|
||||
CustomActionState(const char* name)
|
||||
: NamedAutomationState(name)
|
||||
{
|
||||
}
|
||||
|
||||
void OnSetupStateActions(EditorAutomationActionRunner&) override final
|
||||
{
|
||||
}
|
||||
|
||||
void OnStateActionsComplete() override final
|
||||
{
|
||||
OnCustomAction();
|
||||
}
|
||||
|
||||
virtual void OnCustomAction() = 0;
|
||||
};
|
||||
|
||||
#define DefineStateId(className) class className##Id : public StateTraits<AZ_CRC_CE(#className)> {\
|
||||
public:\
|
||||
static const char* StateName()\
|
||||
{\
|
||||
return #className;\
|
||||
}\
|
||||
};
|
||||
|
||||
/**
|
||||
Generic test base class that will handle incrementing test steps, running the action runner, and interface with the test dialog to report back errors.
|
||||
*/
|
||||
class EditorAutomationTest
|
||||
: public AZ::SystemTickBus::Handler
|
||||
, public StateModel
|
||||
{
|
||||
public:
|
||||
AZ_CLASS_ALLOCATOR(EditorAutomationTest, AZ::SystemAllocator, 0);
|
||||
AZ_RTTI(EditorAutomationTest, "{C46081C5-E7E9-47C7-96D4-29E7D1C4D403}");
|
||||
|
||||
~EditorAutomationTest();
|
||||
|
||||
void StartTest();
|
||||
|
||||
// AZ::SystemTick::Handler
|
||||
void OnSystemTick();
|
||||
////
|
||||
|
||||
void AddState(EditorAutomationState* newState);
|
||||
|
||||
void SetHasCustomTransitions(bool hasCustomTransition);
|
||||
|
||||
template <typename IdClass>
|
||||
void SetInitialStateId()
|
||||
{
|
||||
m_initialStateId = IdClass::StateID();
|
||||
AZ_TracePrintf("Script Canvas", "Initial State: %s\n", IdClass::StateName());
|
||||
}
|
||||
|
||||
virtual void OnTestStarting() {}
|
||||
virtual void OnStateComplete(int /*stateId*/) {}
|
||||
virtual void OnTestComplete() {}
|
||||
|
||||
|
||||
bool HasRun() const;
|
||||
bool IsRunning() const;
|
||||
|
||||
void SetTestName(QString testName) { m_testName = testName; }
|
||||
QString GetTestName() { return m_testName; }
|
||||
bool HasErrors() const { return !m_testErrors.empty(); }
|
||||
|
||||
AZStd::vector< AZStd::string > GetErrors() const { return m_testErrors; }
|
||||
|
||||
protected:
|
||||
|
||||
bool SetupState(int stateId);
|
||||
|
||||
int FindNextState(int stateId);
|
||||
|
||||
virtual int EvaluateTransition(int)
|
||||
{
|
||||
return EditorAutomationState::EXIT_STATE_ID;
|
||||
}
|
||||
|
||||
EditorAutomationTest(QString testName);
|
||||
|
||||
void AddError(AZStd::string error);
|
||||
|
||||
EditorAutomationActionRunner m_actionRunner;
|
||||
AZStd::vector< AZStd::string > m_testErrors;
|
||||
|
||||
bool m_hasCustomTransitions = false;
|
||||
|
||||
AZStd::vector< int > m_registrationOrder;
|
||||
AZStd::unordered_map< int, EditorAutomationState* > m_states;
|
||||
|
||||
private:
|
||||
|
||||
QString m_testName;
|
||||
|
||||
int m_initialStateId = EditorAutomationState::EXIT_STATE_ID;
|
||||
|
||||
int m_stateId = EditorAutomationState::EXIT_STATE_ID;
|
||||
EditorAutomationState* m_currentState = nullptr;
|
||||
//int m_state = 0;
|
||||
|
||||
bool m_hasRun = false;
|
||||
};
|
||||
}
|
||||
+2
-2
@@ -13,12 +13,12 @@
|
||||
#pragma once
|
||||
|
||||
class QAction;
|
||||
class QWidget;
|
||||
class QMenu;
|
||||
|
||||
namespace ScriptCanvasDeveloperEditor
|
||||
{
|
||||
namespace NodeListDumpAction
|
||||
{
|
||||
QAction* CreateNodeListDumpAction(QWidget* mainWindow);
|
||||
QAction* CreateNodeListDumpAction(QMenu* mainWindow);
|
||||
};
|
||||
}
|
||||
|
||||
+3
-1
@@ -15,6 +15,8 @@
|
||||
#include <AzCore/Component/Component.h>
|
||||
#include <ScriptCanvas/Bus/ScriptCanvasBus.h>
|
||||
|
||||
class QMainWindow;
|
||||
|
||||
namespace ScriptCanvasDeveloperEditor
|
||||
{
|
||||
class SystemComponent
|
||||
@@ -38,6 +40,6 @@ namespace ScriptCanvasDeveloperEditor
|
||||
////
|
||||
|
||||
// ScriptCanvasEditor::UINotificationBus
|
||||
void MainWindowCreationEvent(QWidget*) override;
|
||||
void MainWindowCreationEvent(QMainWindow* mainWindow) override;
|
||||
};
|
||||
}
|
||||
|
||||
+2
-2
@@ -13,12 +13,12 @@
|
||||
#pragma once
|
||||
|
||||
class QAction;
|
||||
class QWidget;
|
||||
class QMenu;
|
||||
|
||||
namespace ScriptCanvasDeveloperEditor
|
||||
{
|
||||
namespace TSGenerateAction
|
||||
{
|
||||
QAction* SetupTSFileAction(QWidget* mainWindow);
|
||||
QAction* SetupTSFileAction(QMenu* mainWindow);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user