Merge branch 'stabilization/2110' of https://github.com/aws-lumberyard-dev/o3de into stabilization/2110
This commit is contained in:
+2
-2
@@ -72,7 +72,7 @@ namespace AzToolsFramework
|
||||
|
||||
void EntityOutlinerTreeView::leaveEvent([[maybe_unused]] QEvent* event)
|
||||
{
|
||||
m_mousePosition = QPoint();
|
||||
m_mousePosition = QPoint(-1, -1);
|
||||
m_currentHoveredIndex = QModelIndex();
|
||||
update();
|
||||
}
|
||||
@@ -200,7 +200,7 @@ namespace AzToolsFramework
|
||||
const bool isEnabled = (this->model()->flags(index) & Qt::ItemIsEnabled);
|
||||
|
||||
const bool isSelected = selectionModel()->isSelected(index);
|
||||
const bool isHovered = (index == indexAt(m_mousePosition)) && isEnabled;
|
||||
const bool isHovered = (index == indexAt(m_mousePosition).siblingAtColumn(0)) && isEnabled;
|
||||
|
||||
// Paint the branch Selection/Hover Rect
|
||||
PaintBranchSelectionHoverRect(painter, rect, isSelected, isHovered);
|
||||
|
||||
+3
-6
@@ -153,6 +153,9 @@ namespace AzToolsFramework
|
||||
{
|
||||
initEntityOutlinerWidgetResources();
|
||||
|
||||
m_editorEntityUiInterface = AZ::Interface<AzToolsFramework::EditorEntityUiInterface>::Get();
|
||||
AZ_Assert(m_editorEntityUiInterface != nullptr, "EntityOutlinerWidget requires a EditorEntityUiInterface instance on Initialize.");
|
||||
|
||||
m_gui = new Ui::EntityOutlinerWidgetUI();
|
||||
m_gui->setupUi(this);
|
||||
|
||||
@@ -282,12 +285,6 @@ namespace AzToolsFramework
|
||||
|
||||
m_listModel->Initialize();
|
||||
|
||||
m_editorEntityUiInterface = AZ::Interface<AzToolsFramework::EditorEntityUiInterface>::Get();
|
||||
|
||||
AZ_Assert(
|
||||
m_editorEntityUiInterface != nullptr,
|
||||
"EntityOutlinerWidget requires a EditorEntityUiInterface instance on Initialize.");
|
||||
|
||||
EditorPickModeNotificationBus::Handler::BusConnect(GetEntityContextId());
|
||||
EntityHighlightMessages::Bus::Handler::BusConnect();
|
||||
EntityOutlinerModelNotificationBus::Handler::BusConnect();
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace AZ
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t originalVersion = m_materialTypeVersion;
|
||||
[[maybe_unused]] const uint32_t originalVersion = m_materialTypeVersion;
|
||||
|
||||
bool changesWereApplied = false;
|
||||
|
||||
|
||||
@@ -739,14 +739,32 @@ void ViewportInteraction::MouseWheelEvent(QWheelEvent* ev)
|
||||
|
||||
bool ViewportInteraction::KeyPressEvent(QKeyEvent* ev)
|
||||
{
|
||||
if (ev->key() == Qt::Key_Space)
|
||||
switch (ev->key())
|
||||
{
|
||||
case Qt::Key_Space:
|
||||
if (!ev->isAutoRepeat())
|
||||
{
|
||||
ActivateSpaceBar();
|
||||
}
|
||||
|
||||
return true;
|
||||
case Qt::Key_Up:
|
||||
Nudge(ViewportInteraction::NudgeDirection::Up,
|
||||
(ev->modifiers() & Qt::ShiftModifier) ? ViewportInteraction::NudgeSpeed::Fast : ViewportInteraction::NudgeSpeed::Slow);
|
||||
return true;
|
||||
case Qt::Key_Down:
|
||||
Nudge(ViewportInteraction::NudgeDirection::Down,
|
||||
(ev->modifiers() & Qt::ShiftModifier) ? ViewportInteraction::NudgeSpeed::Fast : ViewportInteraction::NudgeSpeed::Slow);
|
||||
return true;
|
||||
case Qt::Key_Left:
|
||||
Nudge(ViewportInteraction::NudgeDirection::Left,
|
||||
(ev->modifiers() & Qt::ShiftModifier) ? ViewportInteraction::NudgeSpeed::Fast : ViewportInteraction::NudgeSpeed::Slow);
|
||||
return true;
|
||||
case Qt::Key_Right:
|
||||
Nudge(ViewportInteraction::NudgeDirection::Right,
|
||||
(ev->modifiers() & Qt::ShiftModifier) ? ViewportInteraction::NudgeSpeed::Fast : ViewportInteraction::NudgeSpeed::Slow);
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -220,6 +220,7 @@ ViewportWidget::ViewportWidget(EditorWindow* parent)
|
||||
InitUiRenderer();
|
||||
|
||||
SetupShortcuts();
|
||||
installEventFilter(m_editorWindow);
|
||||
|
||||
// Setup a timer for the maximum refresh rate we want.
|
||||
// Refresh is actually triggered by interaction events and by the IdleUpdate. This avoids the UI
|
||||
@@ -258,6 +259,8 @@ ViewportWidget::~ViewportWidget()
|
||||
LyShinePassDataRequestBus::Handler::BusDisconnect();
|
||||
AZ::RPI::ViewportContextNotificationBus::Handler::BusDisconnect();
|
||||
|
||||
removeEventFilter(m_editorWindow);
|
||||
|
||||
m_uiRenderer.reset();
|
||||
|
||||
// Notify LyShine that this is no longer a valid UiRenderer.
|
||||
@@ -688,9 +691,9 @@ void ViewportWidget::wheelEvent(QWheelEvent* ev)
|
||||
Refresh();
|
||||
}
|
||||
|
||||
bool ViewportWidget::event(QEvent* ev)
|
||||
bool ViewportWidget::eventFilter([[maybe_unused]] QObject* watched, QEvent* event)
|
||||
{
|
||||
if (ev->type() == QEvent::ShortcutOverride)
|
||||
if (event->type() == QEvent::ShortcutOverride)
|
||||
{
|
||||
// When a shortcut is matched, Qt's event processing sends out a shortcut override event
|
||||
// to allow other systems to override it. If it's not overridden, then the key events
|
||||
@@ -698,40 +701,48 @@ bool ViewportWidget::event(QEvent* ev)
|
||||
// handler. In our case this causes a problem in preview mode for the Key_Delete event.
|
||||
// So, if we are preview mode avoid treating Key_Delete as a shortcut.
|
||||
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(ev);
|
||||
QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event);
|
||||
int key = keyEvent->key();
|
||||
|
||||
// Override the space bar shortcut so that the key gets handled by the viewport's KeyPress/KeyRelease
|
||||
// events when the viewport has the focus. The space bar is set up as a shortcut in order to give the
|
||||
// viewport the focus and activate the space bar when another widget has the focus. Once the shortcut
|
||||
// is pressed and focus is given to the viewport, the viewport takes over handling the space bar via
|
||||
// the KeyPress/KeyRelease events
|
||||
if (key == Qt::Key_Space)
|
||||
// the KeyPress/KeyRelease events.
|
||||
// Also ignore nudge shortcuts in edit/preview mode so that the KeyPressEvent will be sent.
|
||||
switch (key)
|
||||
{
|
||||
ev->accept();
|
||||
case Qt::Key_Space:
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_Down:
|
||||
case Qt::Key_Left:
|
||||
case Qt::Key_Right:
|
||||
{
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
UiEditorMode editorMode = m_editorWindow->GetEditorMode();
|
||||
if (editorMode == UiEditorMode::Preview)
|
||||
{
|
||||
switch (key)
|
||||
if (key == Qt::Key_Delete)
|
||||
{
|
||||
case Qt::Key_Delete:
|
||||
// Ignore nudge shortcuts in preview mode so that the KeyPressEvent will be sent
|
||||
case Qt::Key_Up:
|
||||
case Qt::Key_Down:
|
||||
case Qt::Key_Left:
|
||||
case Qt::Key_Right:
|
||||
{
|
||||
ev->accept();
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool ViewportWidget::event(QEvent* ev)
|
||||
{
|
||||
bool result = RenderViewportWidget::event(ev);
|
||||
return result;
|
||||
}
|
||||
@@ -742,8 +753,7 @@ void ViewportWidget::keyPressEvent(QKeyEvent* event)
|
||||
if (editorMode == UiEditorMode::Edit)
|
||||
{
|
||||
// in Edit mode just send input to ViewportInteraction
|
||||
bool handled = m_viewportInteraction->KeyPressEvent(event);
|
||||
if (!handled)
|
||||
if (!m_viewportInteraction->KeyPressEvent(event))
|
||||
{
|
||||
RenderViewportWidget::keyPressEvent(event);
|
||||
}
|
||||
@@ -1246,115 +1256,6 @@ void ViewportWidget::SetupShortcuts()
|
||||
{
|
||||
// Actions with shortcuts are created instead of direct shortcuts because the shortcut dispatcher only looks for matching actions
|
||||
|
||||
// Create nudge shortcuts that are active across the entire UI Editor window. Any widgets (such as the spin box widget) that
|
||||
// handle the same keys and want the shortcut to be ignored need to handle that with a shortcut override event.
|
||||
// In preview mode, the nudge shortcuts are ignored via the shortcut override event. KeyPressEvents are sent instead,
|
||||
// and passed along to the canvas
|
||||
|
||||
// Nudge up
|
||||
{
|
||||
QAction* action = new QAction("Up", this);
|
||||
action->setShortcut(QKeySequence(Qt::Key_Up));
|
||||
QObject::connect(action,
|
||||
&QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
m_viewportInteraction->Nudge(ViewportInteraction::NudgeDirection::Up, ViewportInteraction::NudgeSpeed::Slow);
|
||||
});
|
||||
addAction(action);
|
||||
}
|
||||
|
||||
// Nudge up fast
|
||||
{
|
||||
QAction* action = new QAction("Up Fast", this);
|
||||
action->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Up));
|
||||
QObject::connect(action,
|
||||
&QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
m_viewportInteraction->Nudge(ViewportInteraction::NudgeDirection::Up, ViewportInteraction::NudgeSpeed::Fast);
|
||||
});
|
||||
addAction(action);
|
||||
}
|
||||
|
||||
// Nudge down
|
||||
{
|
||||
QAction* action = new QAction("Down", this);
|
||||
action->setShortcut(QKeySequence(Qt::Key_Down));
|
||||
QObject::connect(action,
|
||||
&QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
m_viewportInteraction->Nudge(ViewportInteraction::NudgeDirection::Down, ViewportInteraction::NudgeSpeed::Slow);
|
||||
});
|
||||
addAction(action);
|
||||
}
|
||||
|
||||
// Nudge down fast
|
||||
{
|
||||
QAction* action = new QAction("Down Fast", this);
|
||||
action->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Down));
|
||||
QObject::connect(action,
|
||||
&QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
m_viewportInteraction->Nudge(ViewportInteraction::NudgeDirection::Down, ViewportInteraction::NudgeSpeed::Fast);
|
||||
});
|
||||
addAction(action);
|
||||
}
|
||||
|
||||
// Nudge left
|
||||
{
|
||||
QAction* action = new QAction("Left", this);
|
||||
action->setShortcut(QKeySequence(Qt::Key_Left));
|
||||
QObject::connect(action,
|
||||
&QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
m_viewportInteraction->Nudge(ViewportInteraction::NudgeDirection::Left, ViewportInteraction::NudgeSpeed::Slow);
|
||||
});
|
||||
addAction(action);
|
||||
}
|
||||
|
||||
// Nudge left fast
|
||||
{
|
||||
QAction* action = new QAction("Left Fast", this);
|
||||
action->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Left));
|
||||
QObject::connect(action,
|
||||
&QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
m_viewportInteraction->Nudge(ViewportInteraction::NudgeDirection::Left, ViewportInteraction::NudgeSpeed::Fast);
|
||||
});
|
||||
addAction(action);
|
||||
}
|
||||
|
||||
// Nudge right
|
||||
{
|
||||
QAction* action = new QAction("Right", this);
|
||||
action->setShortcut(QKeySequence(Qt::Key_Right));
|
||||
QObject::connect(action,
|
||||
&QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
m_viewportInteraction->Nudge(ViewportInteraction::NudgeDirection::Right, ViewportInteraction::NudgeSpeed::Slow);
|
||||
});
|
||||
addAction(action);
|
||||
}
|
||||
|
||||
// Nudge right fast
|
||||
{
|
||||
QAction* action = new QAction("Right Fast", this);
|
||||
action->setShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Right));
|
||||
QObject::connect(action,
|
||||
&QAction::triggered,
|
||||
[this]()
|
||||
{
|
||||
m_viewportInteraction->Nudge(ViewportInteraction::NudgeDirection::Right, ViewportInteraction::NudgeSpeed::Fast);
|
||||
});
|
||||
addAction(action);
|
||||
}
|
||||
|
||||
// Give the viewport focus and activate the space bar
|
||||
{
|
||||
QAction* action = new QAction("Viewport Focus", this);
|
||||
|
||||
@@ -122,12 +122,15 @@ protected:
|
||||
void wheelEvent(QWheelEvent* ev) override;
|
||||
|
||||
//! Prevents shortcuts from interfering with preview mode.
|
||||
bool eventFilter(QObject* watched, QEvent* event) override;
|
||||
|
||||
//! Handle events from Qt.
|
||||
bool event(QEvent* ev) override;
|
||||
|
||||
//! Key press event from Qt
|
||||
//! Key press event from Qt.
|
||||
void keyPressEvent(QKeyEvent* event) override;
|
||||
|
||||
//! Key release event from Qt
|
||||
//! Key release event from Qt.
|
||||
void keyReleaseEvent(QKeyEvent* event) override;
|
||||
|
||||
void focusOutEvent(QFocusEvent* ev) override;
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace PhysX
|
||||
const float scaleFactor = (maxHeightBounds <= minHeightBounds) ? 1.0f : AZStd::numeric_limits<int16_t>::max() / halfBounds;
|
||||
const float heightScale{ 1.0f / scaleFactor };
|
||||
|
||||
const uint8_t physxMaximumMaterialIndex = 0x7f;
|
||||
[[maybe_unused]] const uint8_t physxMaximumMaterialIndex = 0x7f;
|
||||
|
||||
// Delete the cached heightfield object if it is there, and create a new one and save in the shape configuration
|
||||
heightfieldConfig.SetCachedNativeHeightfield(nullptr);
|
||||
|
||||
Reference in New Issue
Block a user