Merge remote-tracking branch 'upstream/stabilization/2110' into Atom/santorac/MoveDoubleSided

This commit is contained in:
santorac
2021-10-26 09:07:23 -07:00
12 changed files with 82 additions and 149 deletions
@@ -9,7 +9,7 @@
#import <AppKit/NSEvent.h>
#include "EditorDefs.h"
#include "QtEditorApplication.h"
#include "QtEditorApplication_mac.h"
// AzFramework
#include <AzFramework/Input/Buses/Notifications/RawInputNotificationBus_Platform.h>
@@ -258,10 +258,17 @@ namespace AzFramework
////////////////////////////////////////////////////////////////////////////////////////////////
void XcbNativeWindow::SetWindowTitle(const AZStd::string& title)
{
// Set the title of both the window and the task bar by using
// a buffer to hold the title twice, separated by a null-terminator
auto doubleTitleSize = (title.size() + 1) * 2;
AZStd::string doubleTitle(doubleTitleSize, '\0');
azstrncpy(doubleTitle.data(), doubleTitleSize, title.c_str(), title.size());
azstrncpy(&doubleTitle.data()[title.size() + 1], title.size(), title.c_str(), title.size());
xcb_void_cookie_t xcbCheckResult;
xcbCheckResult = xcb_change_property(
m_xcbConnection, XCB_PROP_MODE_REPLACE, m_xcbWindow, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, static_cast<uint32_t>(title.size()),
title.c_str());
m_xcbConnection, XCB_PROP_MODE_REPLACE, m_xcbWindow, XCB_ATOM_WM_CLASS, XCB_ATOM_STRING, 8, static_cast<uint32_t>(doubleTitle.size()),
doubleTitle.c_str());
AZ_Assert(ValidateXcbResult(xcbCheckResult), "Failed to set window title.");
}
@@ -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);
@@ -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();
@@ -166,6 +166,10 @@ namespace O3DE::ProjectManager
{
notification += " " + tr("and") + " ";
}
if (added && GemModel::GetDownloadStatus(modelIndex) == GemInfo::DownloadStatus::NotDownloaded)
{
m_downloadController->AddGemDownload(GemModel::GetName(modelIndex));
}
}
if (numChangedDependencies == 1 )
@@ -14,6 +14,7 @@
#include <AzCore/NativeUI/NativeUIRequests.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzCore/Utils/Utils.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzFramework/Components/TransformComponent.h>
@@ -115,7 +116,9 @@ namespace AZ
{
// GFX TODO - investigate window creation being part of the GameApplication.
m_nativeWindow = AZStd::make_unique<AzFramework::NativeWindow>("O3DELauncher", AzFramework::WindowGeometry(0, 0, 1920, 1080));
auto projectTitle = AZ::Utils::GetProjectName();
m_nativeWindow = AZStd::make_unique<AzFramework::NativeWindow>(projectTitle.c_str(), AzFramework::WindowGeometry(0, 0, 1920, 1080));
AZ_Assert(m_nativeWindow, "Failed to create the game window\n");
m_nativeWindow->Activate();
@@ -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;
+30 -129
View File
@@ -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);
+5 -2
View File
@@ -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;
+1 -1
View File
@@ -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);
+2 -2
View File
@@ -115,14 +115,14 @@ def get_gem_json_paths_from_cached_repo(repo_uri: str) -> set:
file_name = pathlib.Path(cache_filename).resolve()
if not file_name.is_file():
logger.error(f'Could not find cached repo json file for {repo_uri}')
return gem_list
return gem_set
with file_name.open('r') as f:
try:
repo_data = json.load(f)
except json.JSONDecodeError as e:
logger.error(f'{file_name} failed to load: {str(e)}')
return gem_list
return gem_set
# Get list of gems, then add all json paths to the list if they exist in the cache
repo_gems = []