Merge branch 'main' into hultonha_LYN-2315_camera-phase-2
This commit is contained in:
@@ -1509,10 +1509,10 @@ bool EditorViewportWidget::AddCameraMenuItems(QMenu* menu)
|
||||
}
|
||||
|
||||
action = customCameraMenu->addAction(tr("Look through entity"));
|
||||
AzToolsFramework::EntityIdList selectedEntityList;
|
||||
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
action->setCheckable(selectedEntityList.size() > 0 || m_viewSourceType == ViewSourceType::AZ_Entity);
|
||||
action->setEnabled(selectedEntityList.size() > 0 || m_viewSourceType == ViewSourceType::AZ_Entity);
|
||||
bool areAnyEntitiesSelected = false;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(areAnyEntitiesSelected, &AzToolsFramework::ToolsApplicationRequests::AreAnyEntitiesSelected);
|
||||
action->setCheckable(areAnyEntitiesSelected || m_viewSourceType == ViewSourceType::AZ_Entity);
|
||||
action->setEnabled(areAnyEntitiesSelected || m_viewSourceType == ViewSourceType::AZ_Entity);
|
||||
action->setChecked(m_viewSourceType == ViewSourceType::AZ_Entity);
|
||||
connect(action, &QAction::triggered, this, [this](bool isChecked)
|
||||
{
|
||||
|
||||
@@ -234,11 +234,8 @@ public:
|
||||
QPoint ViewportToWidget(const QPoint& point) const;
|
||||
QSize WidgetToViewport(const QSize& size) const;
|
||||
|
||||
/// Take raw input and create a final mouse interaction.
|
||||
/// @attention Do not map **point** from widget to viewport explicitly,
|
||||
/// this is handled internally by BuildMouseInteraction - just pass directly.
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
|
||||
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point);
|
||||
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
|
||||
|
||||
void SetPlayerPos()
|
||||
{
|
||||
|
||||
@@ -756,6 +756,7 @@ void MainWindow::InitActions()
|
||||
am->AddAction(ID_TOOLBAR_WIDGET_SNAP_GRID, QString());
|
||||
am->AddAction(ID_TOOLBAR_WIDGET_ENVIRONMENT_MODE, QString());
|
||||
am->AddAction(ID_TOOLBAR_WIDGET_DEBUG_MODE, QString());
|
||||
am->AddAction(ID_TOOLBAR_WIDGET_SPACER_RIGHT, QString());
|
||||
|
||||
// File actions
|
||||
am->AddAction(ID_FILE_NEW, tr("New Level"))
|
||||
@@ -1170,14 +1171,17 @@ void MainWindow::InitActions()
|
||||
am->AddAction(ID_AUDIO_REFRESH_AUDIO_SYSTEM, tr("Refresh Audio"))
|
||||
.Connect(&QAction::triggered, this, &MainWindow::OnRefreshAudioSystem);
|
||||
|
||||
// Fame actions
|
||||
// Game actions
|
||||
am->AddAction(ID_VIEW_SWITCHTOGAME, tr("Play &Game"))
|
||||
.SetIcon(QIcon(":/stylesheet/img/UI20/toolbar/Play.svg"))
|
||||
.SetShortcut(tr("Ctrl+G"))
|
||||
.SetToolTip(tr("Play Game (Ctrl+G)"))
|
||||
.SetStatusTip(tr("Activate the game input mode"))
|
||||
.SetApplyHoverEffect()
|
||||
.SetCheckable(true)
|
||||
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdatePlayGame);
|
||||
am->AddAction(ID_TOOLBAR_WIDGET_PLAYCONSOLE_LABEL, tr("Play Console"))
|
||||
.SetText(tr("Play Console"));
|
||||
am->AddAction(ID_SWITCH_PHYSICS, tr("Simulate"))
|
||||
.SetShortcut(tr("Ctrl+P"))
|
||||
.SetToolTip(tr("Simulate (Ctrl+P)"))
|
||||
@@ -1489,6 +1493,14 @@ QToolButton* MainWindow::CreateDebugModeButton()
|
||||
return debugModeButton;
|
||||
}
|
||||
|
||||
QWidget* MainWindow::CreateSpacerRightWidget()
|
||||
{
|
||||
QWidget* spacer = new QWidget();
|
||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
spacer->setVisible(true);
|
||||
return spacer;
|
||||
}
|
||||
|
||||
void MainWindow::InitEnvironmentModeMenu(CVarMenu* environmentModeMenu)
|
||||
{
|
||||
environmentModeMenu->clear();
|
||||
@@ -2395,6 +2407,9 @@ QWidget* MainWindow::CreateToolbarWidget(int actionId)
|
||||
case ID_TOOLBAR_WIDGET_DEBUG_MODE:
|
||||
w = CreateDebugModeButton();
|
||||
break;
|
||||
case ID_TOOLBAR_WIDGET_SPACER_RIGHT:
|
||||
w = CreateSpacerRightWidget();
|
||||
break;
|
||||
default:
|
||||
qWarning() << Q_FUNC_INFO << "Unknown id " << actionId;
|
||||
return nullptr;
|
||||
|
||||
@@ -215,6 +215,7 @@ private:
|
||||
|
||||
QWidget* CreateSnapToGridWidget();
|
||||
QWidget* CreateSnapToAngleWidget();
|
||||
QWidget* CreateSpacerRightWidget();
|
||||
|
||||
QToolButton* CreateUndoRedoButton(int command);
|
||||
|
||||
|
||||
@@ -238,11 +238,8 @@ public:
|
||||
QPoint ViewportToWidget(const QPoint& point) const;
|
||||
QSize WidgetToViewport(const QSize& size) const;
|
||||
|
||||
/// Take raw input and create a final mouse interaction.
|
||||
/// @attention Do not map **point** from widget to viewport explicitly,
|
||||
/// this is handled internally by BuildMouseInteraction - just pass directly.
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
|
||||
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point);
|
||||
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
|
||||
|
||||
void SetPlayerPos()
|
||||
{
|
||||
|
||||
@@ -397,4 +397,6 @@
|
||||
#define ID_TOOLBAR_WIDGET_SNAP_GRID 50008
|
||||
#define ID_TOOLBAR_WIDGET_ENVIRONMENT_MODE 50011
|
||||
#define ID_TOOLBAR_WIDGET_DEBUG_MODE 50012
|
||||
#define ID_TOOLBAR_WIDGET_SPACER_RIGHT 50013
|
||||
#define ID_TOOLBAR_WIDGET_PLAYCONSOLE_LABEL 50014
|
||||
#define ID_TOOLBAR_WIDGET_LAST 50020
|
||||
|
||||
@@ -511,6 +511,7 @@ void ToolbarManager::InitializeStandardToolbars()
|
||||
m_standardToolbars.reserve(5 + macroToolbars.size());
|
||||
m_standardToolbars.push_back(GetEditModeToolbar());
|
||||
m_standardToolbars.push_back(GetObjectToolbar());
|
||||
m_standardToolbars.push_back(GetPlayConsoleToolbar());
|
||||
|
||||
IPlugin* pGamePlugin = GetIEditor()->GetPluginManager()->GetPluginByGUID("{71CED8AB-54E2-4739-AA78-7590A5DC5AEB}");
|
||||
IPlugin* pDescriptionEditorPlugin = GetIEditor()->GetPluginManager()->GetPluginByGUID("{4B9B7074-2D58-4AFD-BBE1-BE469D48456A}");
|
||||
@@ -591,8 +592,6 @@ AmazonToolbar ToolbarManager::GetEditModeToolbar() const
|
||||
t.AddAction(ID_EDITMODE_ROTATE, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_EDITMODE_SCALE, ORIGINAL_TOOLBAR_VERSION);
|
||||
|
||||
t.AddAction(ID_VIEW_SWITCHTOGAME, TOOLBARS_WITH_PLAY_GAME);
|
||||
|
||||
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_TOOLBAR_WIDGET_SNAP_GRID, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_TOOLBAR_WIDGET_SNAP_ANGLE, ORIGINAL_TOOLBAR_VERSION);
|
||||
@@ -622,6 +621,18 @@ AmazonToolbar ToolbarManager::GetObjectToolbar() const
|
||||
return t;
|
||||
}
|
||||
|
||||
AmazonToolbar ToolbarManager::GetPlayConsoleToolbar() const
|
||||
{
|
||||
AmazonToolbar t = AmazonToolbar("PlayConsole", QObject::tr("Play Console"));
|
||||
t.SetMainToolbar(true);
|
||||
|
||||
t.AddAction(ID_TOOLBAR_WIDGET_SPACER_RIGHT, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_TOOLBAR_SEPARATOR, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_TOOLBAR_WIDGET_PLAYCONSOLE_LABEL, ORIGINAL_TOOLBAR_VERSION);
|
||||
t.AddAction(ID_VIEW_SWITCHTOGAME, TOOLBARS_WITH_PLAY_GAME);
|
||||
return t;
|
||||
}
|
||||
|
||||
AmazonToolbar ToolbarManager::GetEditorsToolbar() const
|
||||
{
|
||||
AmazonToolbar t = AmazonToolbar("Editors", QObject::tr("Editors Toolbar"));
|
||||
@@ -753,7 +764,7 @@ void ToolbarManager::InstantiateToolbars()
|
||||
for (int i = 0; i < numToolbars; ++i)
|
||||
{
|
||||
InstantiateToolbar(i);
|
||||
if (i == 1)
|
||||
if (i == 2)
|
||||
{
|
||||
// Hack. Just copying how it was
|
||||
m_mainWindow->addToolBarBreak();
|
||||
|
||||
@@ -167,6 +167,7 @@ public:
|
||||
AmazonToolbar GetObjectToolbar() const;
|
||||
AmazonToolbar GetEditorsToolbar() const;
|
||||
AmazonToolbar GetMiscToolbar() const;
|
||||
AmazonToolbar GetPlayConsoleToolbar() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ToolbarManager);
|
||||
|
||||
@@ -807,18 +807,11 @@ void CTrackViewDialog::UpdateActions()
|
||||
m_actions[ID_TRACKVIEW_MUTE_ALL]->setEnabled(true);
|
||||
m_actions[ID_ADDSCENETRACK]->setEnabled(true);
|
||||
|
||||
AzToolsFramework::EntityIdList entityIds;
|
||||
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
|
||||
entityIds, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
bool areAnyEntitiesSelected = false;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
areAnyEntitiesSelected, &AzToolsFramework::ToolsApplicationRequests::AreAnyEntitiesSelected);
|
||||
|
||||
if (entityIds.empty())
|
||||
{
|
||||
m_actions[ID_ADDNODE]->setEnabled(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_actions[ID_ADDNODE]->setEnabled(true);
|
||||
}
|
||||
m_actions[ID_ADDNODE]->setEnabled(areAnyEntitiesSelected);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1569,12 +1562,12 @@ void CTrackViewDialog::OnAddSelectedNode()
|
||||
sequence->MarkAsModified();
|
||||
}
|
||||
|
||||
AzToolsFramework::EntityIdList entityIds;
|
||||
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
|
||||
entityIds, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
int selectedEntitiesCount = 0;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount);
|
||||
|
||||
// check to make sure all nodes were added and notify user if they weren't
|
||||
if (addedNodes.GetCount() != entityIds.size())
|
||||
if (addedNodes.GetCount() != selectedEntitiesCount)
|
||||
{
|
||||
IMovieSystem* movieSystem = GetIEditor()->GetMovieSystem();
|
||||
|
||||
|
||||
@@ -1137,12 +1137,12 @@ void CTrackViewNodesCtrl::OnNMRclick(QPoint point)
|
||||
CTrackViewAnimNodeBundle addedNodes = groupNode->AddSelectedEntities(m_pTrackViewDialog->GetDefaultTracksForEntityNode());
|
||||
undoBatch.MarkEntityDirty(groupNode->GetSequence()->GetSequenceComponentEntityId());
|
||||
|
||||
AzToolsFramework::EntityIdList entityIds;
|
||||
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(
|
||||
entityIds, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
|
||||
int selectedEntitiesCount = 0;
|
||||
AzToolsFramework::ToolsApplicationRequestBus::BroadcastResult(
|
||||
selectedEntitiesCount, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntitiesCount);
|
||||
|
||||
// check to make sure all nodes were added and notify user if they weren't
|
||||
if (addedNodes.GetCount() != entityIds.size())
|
||||
if (addedNodes.GetCount() != selectedEntitiesCount)
|
||||
{
|
||||
IMovieSystem* movieSystem = GetIEditor()->GetMovieSystem();
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@
|
||||
// AzQtComponents
|
||||
#include <AzQtComponents/DragAndDrop/ViewportDragAndDrop.h>
|
||||
|
||||
#include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
|
||||
#include <AzToolsFramework/ViewportSelection/EditorSelectionUtil.h>
|
||||
|
||||
// Editor
|
||||
#include "ViewManager.h"
|
||||
#include "Include/ITransformManipulator.h"
|
||||
@@ -1091,6 +1094,13 @@ void QtViewport::SetAxisConstrain(int axis)
|
||||
m_activeAxis = axis;
|
||||
};
|
||||
|
||||
AzToolsFramework::ViewportInteraction::MouseInteraction QtViewport::BuildMouseInteraction(
|
||||
[[maybe_unused]] Qt::MouseButtons buttons, [[maybe_unused]] Qt::KeyboardModifiers modifiers, [[maybe_unused]] const QPoint& point)
|
||||
{
|
||||
// Implemented by sub-class
|
||||
return AzToolsFramework::ViewportInteraction::MouseInteraction();
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
bool QtViewport::HitTest(const QPoint& point, HitContext& hitInfo)
|
||||
{
|
||||
@@ -1103,7 +1113,51 @@ bool QtViewport::HitTest(const QPoint& point, HitContext& hitInfo)
|
||||
hitInfo.bUseSelectionHelpers = true;
|
||||
}
|
||||
|
||||
return GetIEditor()->GetObjectManager()->HitTest(hitInfo);
|
||||
const int viewportId = GetViewportId();
|
||||
|
||||
AzToolsFramework::EntityIdList visibleEntityIds;
|
||||
AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Event(
|
||||
viewportId,
|
||||
&AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequests::FindVisibleEntities,
|
||||
visibleEntityIds);
|
||||
|
||||
// Look through all visible entities to find the closest one to the specified mouse point
|
||||
using namespace AzToolsFramework::ViewportInteraction;
|
||||
AZ::EntityId entityIdUnderCursor;
|
||||
float closestDistance = std::numeric_limits<float>::max();
|
||||
MouseInteraction mouseInteraction = BuildMouseInteraction(QGuiApplication::mouseButtons(),
|
||||
QGuiApplication::queryKeyboardModifiers(),
|
||||
point);
|
||||
for (auto entityId : visibleEntityIds)
|
||||
{
|
||||
using AzFramework::ViewportInfo;
|
||||
// Check if components provide an aabb
|
||||
if (const AZ::Aabb aabb = AzToolsFramework::CalculateEditorEntitySelectionBounds(entityId, ViewportInfo{ viewportId });
|
||||
aabb.IsValid())
|
||||
{
|
||||
// Coarse grain check
|
||||
if (AzToolsFramework::AabbIntersectMouseRay(mouseInteraction, aabb))
|
||||
{
|
||||
// If success, pick against specific component
|
||||
if (AzToolsFramework::PickEntity(
|
||||
entityId, mouseInteraction,
|
||||
closestDistance, viewportId))
|
||||
{
|
||||
entityIdUnderCursor = entityId;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we hit a valid Entity, then store the distance in the HitContext
|
||||
// so that the caller can use this for calculations
|
||||
if (entityIdUnderCursor.IsValid())
|
||||
{
|
||||
hitInfo.dist = closestDistance;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#pragma once
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzToolsFramework/Viewport/ViewportTypes.h>
|
||||
#include <AzToolsFramework/ViewportUi/ViewportUiManager.h>
|
||||
#include <Cry_Color.h>
|
||||
#include "IPostRenderer.h"
|
||||
@@ -405,6 +406,12 @@ public:
|
||||
|
||||
void SetAxisConstrain(int axis);
|
||||
|
||||
/// Take raw input and create a final mouse interaction.
|
||||
/// @attention Do not map **point** from widget to viewport explicitly,
|
||||
/// this is handled internally by BuildMouseInteraction - just pass directly.
|
||||
virtual AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
|
||||
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Selection.
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user