Add manipulator for atom render plugin in animation editor. (#7068)

* small bugfix

Signed-off-by: rhhong <rhhong@amazon.com>

* ActorInstanceId default to -1 when no %lastresult matches

Signed-off-by: rhhong <rhhong@amazon.com>

* CR feedback - wrap function to get the first available editor actor instance.

Signed-off-by: rhhong <rhhong@amazon.com>

* Remove mcore inline

Signed-off-by: rhhong <rhhong@amazon.com>

* Fixed the bug that delete an instance from actor manager crashes the editor.

Signed-off-by: rhhong <rhhong@amazon.com>

* Move the manipulator controller.

Signed-off-by: rhhong <rhhong@amazon.com>

* Add manipulator icon

Signed-off-by: rhhong <rhhong@amazon.com>

* Add manipulators

Signed-off-by: rhhong <rhhong@amazon.com>

* move more option to renderOption, and loading all going through the plugin

Signed-off-by: rhhong <rhhong@amazon.com>

* code cleanup

Signed-off-by: rhhong <rhhong@amazon.com>

* code cleanup

Signed-off-by: rhhong <rhhong@amazon.com>

* more code cleanup

Signed-off-by: rhhong <rhhong@amazon.com>

* CR FEEDBACK

Signed-off-by: rhhong <rhhong@amazon.com>

* Fix profile_nounity build

Signed-off-by: rhhong <rhhong@amazon.com>

* CR feedback - move more code to azToolsframework and share them between animation editor and editorlib

Signed-off-by: rhhong <rhhong@amazon.com>

* Using the MouseViewportRequests in viewportMessage and remove the custom bus

Signed-off-by: rhhong <rhhong@amazon.com>
This commit is contained in:
Roman
2022-01-25 11:25:18 -08:00
committed by GitHub
parent adfd77c67c
commit 55146d037a
26 changed files with 790 additions and 208 deletions
@@ -0,0 +1,60 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
#include <AzToolsFramework/Viewport/ViewportInteractionHelpers.h>
namespace AzToolsFramework::ViewportInteraction
{
MouseButton Helpers::GetMouseButton(const AzFramework::InputChannel& inputChannel)
{
using AzToolsFramework::ViewportInteraction::MouseButton;
using InputButton = AzFramework::InputDeviceMouse::Button;
const AzFramework::InputChannelId& id = inputChannel.GetInputChannelId();
if (id == InputButton::Left)
{
return MouseButton::Left;
}
if (id == InputButton::Middle)
{
return MouseButton::Middle;
}
if (id == InputButton::Right)
{
return MouseButton::Right;
}
return MouseButton::None;
}
bool Helpers::IsMouseMove(const AzFramework::InputChannel& inputChannel)
{
return inputChannel.GetInputChannelId() == AzFramework::InputDeviceMouse::SystemCursorPosition;
}
KeyboardModifier Helpers::GetKeyboardModifier(const AzFramework::InputChannel& inputChannel)
{
using AzToolsFramework::ViewportInteraction::KeyboardModifier;
using Key = AzFramework::InputDeviceKeyboard::Key;
const auto& id = inputChannel.GetInputChannelId();
if (id == Key::ModifierAltL || id == Key::ModifierAltR)
{
return KeyboardModifier::Alt;
}
if (id == Key::ModifierCtrlL || id == Key::ModifierCtrlR)
{
return KeyboardModifier::Ctrl;
}
if (id == Key::ModifierShiftL || id == Key::ModifierShiftR)
{
return KeyboardModifier::Shift;
}
return KeyboardModifier::None;
}
} // namespace AzToolsFramework::ViewportInteraction
@@ -0,0 +1,23 @@
/*
* Copyright (c) Contributors to the Open 3D Engine Project.
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include <AzFramework/Input/Channels/InputChannel.h>
#include <AzToolsFramework/Viewport/ViewportTypes.h>
namespace AzToolsFramework::ViewportInteraction
{
class Helpers
{
public:
static MouseButton GetMouseButton(const AzFramework::InputChannel& inputChannel);
static bool IsMouseMove(const AzFramework::InputChannel& inputChannel);
static KeyboardModifier GetKeyboardModifier(const AzFramework::InputChannel& inputChannel);
};
} // namespace AzToolsFramework::ViewportInteraction
@@ -150,6 +150,9 @@ namespace AzToolsFramework
static const AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
};
//! A bus to listen to just the MouseViewportRequests.
using ViewportMouseRequestBus = AZ::EBus<MouseViewportRequests, ViewportEBusTraits>;
//! Requests that can be made to the viewport to query and modify its state.
class ViewportInteractionRequests
{
@@ -504,6 +504,8 @@ set(FILES
Viewport/EditorContextMenu.cpp
Viewport/VertexContainerDisplay.h
Viewport/VertexContainerDisplay.cpp
Viewport/ViewportInteractionHelpers.h
Viewport/ViewportInteractionHelpers.cpp
Viewport/ViewportMessages.h
Viewport/ViewportMessages.cpp
Viewport/ViewportTypes.h