Merge branch 'development' into Prefab/SaveAllPrefabs

Signed-off-by: srikappa-amzn <srikappa@amazon.com>
This commit is contained in:
srikappa-amzn
2021-09-02 23:40:54 -07:00
2357 changed files with 473642 additions and 159101 deletions
+1
View File
@@ -326,6 +326,7 @@ ActionManager::MenuWrapper ActionManager::FindMenu(const QString& menuId)
return *menuIt;
}
AZ_UNUSED(menuId); // Prevent unused warning in release builds
AZ_Warning("ActionManager", false, "Did not find menu with menuId %s", menuId.toUtf8().data());
return nullptr;
}();
+1 -1
View File
@@ -628,7 +628,7 @@ void CAnimationContext::GoToFrameCmd(IConsoleCmdArgs* pArgs)
float targetFrame = (float)atof(pArgs->GetArg(1));
if (pSeq->GetTimeRange().start > targetFrame || targetFrame > pSeq->GetTimeRange().end)
{
gEnv->pLog->LogError("GoToFrame: requested time %f is outside the range of sequence %s (%f, %f)", targetFrame, pSeq->GetName(), pSeq->GetTimeRange().start, pSeq->GetTimeRange().end);
gEnv->pLog->LogError("GoToFrame: requested time %f is outside the range of sequence %s (%f, %f)", targetFrame, pSeq->GetName().c_str(), pSeq->GetTimeRange().start, pSeq->GetTimeRange().end);
return;
}
GetIEditor()->GetAnimation()->m_currTime = targetFrame;
@@ -327,7 +327,7 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
if (!vetoOpenerFound)
{
// if we found no valid openers and no veto openers then just allow it to be opened with the operating system itself.
menu->addAction(QObject::tr("Open with associated application..."), [this, fullFilePath]()
menu->addAction(QObject::tr("Open with associated application..."), [fullFilePath]()
{
OpenWithOS(fullFilePath);
});
@@ -90,6 +90,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
m_tableModel->setFilterRole(Qt::DisplayRole);
m_tableModel->setSourceModel(m_filterModel.data());
m_tableModel->setDynamicSortFilter(true);
m_ui->m_assetBrowserTableViewWidget->setModel(m_tableModel.data());
connect(
+2
View File
@@ -174,6 +174,8 @@ ly_add_target(
Legacy::EditorLib
ProjectManager
)
ly_set_gem_variant_to_load(TARGETS Editor VARIANTS Tools)
set_property(SOURCE
CryEdit.cpp
APPEND PROPERTY
-1
View File
@@ -130,7 +130,6 @@ private:
private:
ISplineInterpolator* m_pSpline;
bool m_bAutoDelete;
bool m_bNoZoom;
QRect m_rcClipRect;
+4 -1
View File
@@ -298,7 +298,6 @@ Lines CConsoleSCB::s_pendingLines;
CConsoleSCB::CConsoleSCB(QWidget* parent)
: QWidget(parent)
, ui(new Ui::Console())
, m_richEditTextLength(0)
, m_backgroundTheme(gSettings.consoleBackgroundColorTheme)
{
m_lines = s_pendingLines;
@@ -574,6 +573,10 @@ static CVarBlock* VarBlockFromConsoleVars()
IVariable* pVariable = nullptr;
for (int i = 0; i < cmdCount; i++)
{
if (!cmds[i].data())
{
continue;
}
ICVar* pCVar = console->GetCVar(cmds[i].data());
if (!pCVar)
{
-1
View File
@@ -191,7 +191,6 @@ private:
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
QScopedPointer<Ui::Console> ui;
int m_richEditTextLength;
Lines m_lines;
static Lines s_pendingLines;
+3 -9
View File
@@ -30,12 +30,6 @@ namespace ImageHistogram
const QColor kGreenSectionColor = QColor(220, 255, 220);
const QColor kBlueSectionColor = QColor(220, 220, 255);
const QColor kSplitSeparatorColor = QColor(100, 100, 0);
const QColor kButtonBackColor = QColor(20, 20, 20);
const QColor kBtnLightColor(200, 200, 200);
const QColor kBtnShadowColor(50, 50, 50);
const int kButtonWidth = 40;
const QColor kButtonTextColor(255, 255, 0);
const int kTextLeftSpacing = 4;
const int kTextFontSize = 70;
const char* kTextFontFace = "Arial";
const QColor kTextColor(255, 255, 255);
@@ -194,7 +188,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
float scale = 0;
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
i = CLAMP(i, 0, kNumColorLevels - 1);
i = AZStd::clamp(i, 0, kNumColorLevels - 1);
switch (m_drawMode)
{
@@ -259,7 +253,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
for (size_t x = 0, xCount = abs(rcGraph.width()); x < xCount; ++x)
{
i = static_cast<int>(((float)x / graphWidth) * (kNumColorLevels - 1));
i = CLAMP(i, 0, kNumColorLevels - 1);
i = AZStd::clamp(i, 0, kNumColorLevels - 1);
crtX = static_cast<UINT>(rcGraph.left() + x + 1);
scaleR = scaleG = scaleB = scaleA = 0;
@@ -351,7 +345,7 @@ void CImageHistogramDisplay::paintEvent([[maybe_unused]] QPaintEvent* event)
{
pos = (float)x / graphWidth;
i = static_cast<int>((float)((int)(pos * kNumColorLevels) % aThirdOfNumColorLevels) / aThirdOfNumColorLevels * kNumColorLevels);
i = CLAMP(i, 0, kNumColorLevels - 1);
i = AZStd::clamp(i, 0, kNumColorLevels - 1);
scale = 0;
// R
+2 -4
View File
@@ -101,7 +101,7 @@ void CSplineCtrl::PointToTimeValue(const QPoint& point, float& time, float& valu
{
time = XOfsToTime(point.x());
float t = float(m_rcSpline.bottom() - point.y()) / m_rcSpline.height();
value = LERP(m_fMinValue, m_fMaxValue, t);
value = AZ::Lerp(m_fMinValue, m_fMaxValue, t);
}
//////////////////////////////////////////////////////////////////////////
@@ -109,7 +109,7 @@ float CSplineCtrl::XOfsToTime(int x)
{
// m_fMinTime to m_fMaxTime time range.
float t = float(x - m_rcSpline.left()) / m_rcSpline.width();
return LERP(m_fMinTime, m_fMaxTime, t);
return AZ::Lerp(m_fMinTime, m_fMaxTime, t);
}
//////////////////////////////////////////////////////////////////////////
@@ -123,8 +123,6 @@ void CSplineCtrl::paintEvent(QPaintEvent* event)
{
QPainter painter(this);
QRect rcClient = rect();
if (m_pSpline)
{
m_bSelectedKeys.resize(m_pSpline->GetKeyCount());
-2
View File
@@ -819,8 +819,6 @@ void SplineWidget::DrawSpline(QPainter* painter, SSplineInfo& splineInfo, float
{
const QPen pOldPen = painter->pen();
const QRect rcClip = painter->clipBoundingRect().intersected(m_rcSpline).toRect();
//////////////////////////////////////////////////////////////////////////
ISplineInterpolator* pSpline = splineInfo.pSpline;
ISplineInterpolator* pDetailSpline = splineInfo.pDetailSpline;
-5
View File
@@ -18,11 +18,6 @@
#include "ScopedVariableSetter.h"
#include "GridUtils.h"
static const QColor timeMarkerCol = QColor(255, 0, 255);
static const QColor textCol = QColor(0, 0, 0);
static const QColor ltgrayCol = QColor(110, 110, 110);
QColor InterpolateColor(const QColor& c1, const QColor& c2, float fraction)
{
const int r = static_cast<int>(static_cast<float>(c2.red() - c1.red()) * fraction + c1.red());
-1
View File
@@ -136,7 +136,6 @@ protected:
void DrawFrameTicks(QPainter* dc);
private:
bool m_bAutoDelete;
QRect m_rcClient;
QRect m_rcTimeline;
float m_fTimeMarker;
+1 -2
View File
@@ -14,6 +14,7 @@
#include <QPoint>
#include <QRect>
#include "Cry_Vector2.h"
#include <AzCore/Casting/numeric_cast.h>
//////////////////////////////////////////////////////////////////////////
class CWndGridHelper
@@ -81,8 +82,6 @@ public:
newzoom.y = 0.01f;
}
Vec2 prevz = zoom;
// Zoom to mouse position.
float ofsx = origin.x;
float ofsy = origin.y;
+1 -6
View File
@@ -41,8 +41,6 @@ using namespace AZ;
using namespace AzToolsFramework;
static const char* const s_LUAEditorName = "Lua Editor";
static const char* const s_shortTimeInterval = "debug";
static const char* const s_assetImporterMetricsIdentifier = "AssetImporter";
// top level menu ids
static const char* const s_fileMenuId = "FileMenu";
@@ -50,7 +48,6 @@ static const char* const s_editMenuId = "EditMenu";
static const char* const s_gameMenuId = "GameMenu";
static const char* const s_toolMenuId = "ToolMenu";
static const char* const s_viewMenuId = "ViewMenu";
static const char* const s_awsMenuId = "AwsMenu";
static const char* const s_helpMenuId = "HelpMenu";
static bool CompareLayoutNames(const QString& name1, const QString& name2)
@@ -157,13 +154,11 @@ namespace
}
}
LevelEditorMenuHandler::LevelEditorMenuHandler(
MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager, QSettings& settings)
LevelEditorMenuHandler::LevelEditorMenuHandler(MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager)
: QObject(mainWindow)
, m_mainWindow(mainWindow)
, m_viewPaneManager(viewPaneManager)
, m_actionManager(mainWindow->GetActionManager())
, m_settings(settings)
{
#if defined(AZ_PLATFORM_MAC)
// Hide the non-native toolbar, then setNativeMenuBar to ensure it is always visible on macOS.
+1 -3
View File
@@ -33,7 +33,7 @@ class LevelEditorMenuHandler
{
Q_OBJECT
public:
LevelEditorMenuHandler(MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager, QSettings& settings);
LevelEditorMenuHandler(MainWindow* mainWindow, QtViewPaneManager* const viewPaneManager);
~LevelEditorMenuHandler();
void Initialize();
@@ -106,7 +106,6 @@ private:
ActionManager::MenuWrapper m_toolsMenu;
QMenu* m_mostRecentLevelsMenu = nullptr;
QMenu* m_mostRecentProjectsMenu = nullptr;
QMenu* m_editmenu = nullptr;
ActionManager::MenuWrapper m_viewPanesMenu;
@@ -117,7 +116,6 @@ private:
int m_viewPaneVersion = 0;
QList<QMenu*> m_topLevelMenus;
QSettings& m_settings;
};
#endif // LEVELEDITORMENUHANDLER_H
+1 -1
View File
@@ -425,7 +425,7 @@ namespace Editor
AZStd::array<BYTE, sizeof(RAWINPUT)> rawInputBytesArray;
LPBYTE rawInputBytes = rawInputBytesArray.data();
const UINT bytesCopied = GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize);
[[maybe_unused]] const UINT bytesCopied = GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize);
CRY_ASSERT(bytesCopied == rawInputSize);
RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes;
+27 -12
View File
@@ -79,7 +79,6 @@ AZ_POP_DISABLE_WARNING
// CryCommon
#include <CryCommon/ITimer.h>
#include <CryCommon/IPhysics.h>
#include <CryCommon/ILevelSystem.h>
// Editor
@@ -449,13 +448,6 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_OPEN_TRACKVIEW, OnOpenTrackView)
ON_COMMAND(ID_OPEN_UICANVASEDITOR, OnOpenUICanvasEditor)
#if defined(AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS)
#define AZ_RESTRICTED_PLATFORM_EXPANSION(CodeName, CODENAME, codename, PrivateName, PRIVATENAME, privatename, PublicName, PUBLICNAME, publicname, PublicAuxName1, PublicAuxName2, PublicAuxName3)\
ON_COMMAND_RANGE(ID_GAME_##CODENAME##_ENABLELOWSPEC, ID_GAME_##CODENAME##_ENABLEHIGHSPEC, OnChangeGameSpec)
AZ_TOOLS_EXPAND_FOR_RESTRICTED_PLATFORMS
#undef AZ_RESTRICTED_PLATFORM_EXPANSION
#endif
ON_COMMAND(ID_OPEN_QUICK_ACCESS_BAR, OnOpenQuickAccessBar)
ON_COMMAND(ID_FILE_SAVE_LEVEL, OnFileSave)
@@ -560,7 +552,9 @@ public:
{ "NSDocumentRevisionsDebugMode", nsDocumentRevisionsDebugMode},
{ "skipWelcomeScreenDialog", m_bSkipWelcomeScreenDialog},
{ "autotest_mode", m_bAutotestMode},
{ "regdumpall", dummy }
{ "regdumpall", dummy },
{ "attach-debugger", dummy }, // Attaches a debugger for the current application
{ "wait-for-debugger", dummy }, // Waits until a debugger is attached to the current application
};
QString dummyString;
@@ -2315,7 +2309,7 @@ int CCryEditApp::IdleProcessing(bool bBackgroundUpdate)
int res = 0;
if (bIsAppWindow || m_bForceProcessIdle || m_bKeepEditorActive
// Automated tests must always keep the editor active, or they can get stuck
|| m_bAutotestMode)
|| m_bAutotestMode || m_bRunPythonTestScript)
{
res = 1;
bActive = true;
@@ -3965,11 +3959,19 @@ void CCryEditApp::OpenLUAEditor(const char* files)
AZStd::string_view exePath;
AZ::ComponentApplicationBus::BroadcastResult(exePath, &AZ::ComponentApplicationRequests::GetExecutableFolder);
AZStd::string process = AZStd::string::format("\"%.*s" AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING "LuaIDE"
#if defined(AZ_PLATFORM_LINUX)
// On Linux platforms, launching a process is not done through a shell and its arguments are passed in
// separately. There is no need to wrap the process path in case of spaces in the path
constexpr const char* argumentQuoteString = "";
#else
constexpr const char* argumentQuoteString = "\"";
#endif
AZStd::string process = AZStd::string::format("%s%.*s" AZ_CORRECT_FILESYSTEM_SEPARATOR_STRING "LuaIDE"
#if defined(AZ_PLATFORM_WINDOWS)
".exe"
#endif
"\"", aznumeric_cast<int>(exePath.size()), exePath.data());
"%s", argumentQuoteString, aznumeric_cast<int>(exePath.size()), exePath.data(), argumentQuoteString);
AZStd::string processArgs = AZStd::string::format("%s -engine-path \"%s\"", args.c_str(), engineRoot);
StartProcessDetached(process.c_str(), processArgs.c_str());
@@ -4066,6 +4068,19 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
{
CryAllocatorsRAII cryAllocatorsRAII;
// Debugging utilities
for (int i = 1; i < argc; ++i)
{
if (azstricmp(argv[i], "--attach-debugger") == 0)
{
AZ::Debug::Trace::AttachDebugger();
}
else if (azstricmp(argv[i], "--wait-for-debugger") == 0)
{
AZ::Debug::Trace::WaitForDebugger();
}
}
// ensure the EditorEventsBus context gets created inside EditorLib
[[maybe_unused]] const auto& editorEventsContext = AzToolsFramework::EditorEvents::Bus::GetOrCreateContext();
+5 -13
View File
@@ -350,7 +350,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
// Register this level and its content hash as version
GetIEditor()->GetSettingsManager()->AddToolVersion(fileName, levelHash);
GetIEditor()->GetSettingsManager()->RegisterEvent(loadEvent);
LOADING_TIME_PROFILE_SECTION(gEnv->pSystem);
CAutoDocNotReady autoDocNotReady;
HEAP_CHECK
@@ -1072,14 +1072,6 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
return bSaved;
}
static void GetUserSettingsFile(const QString& levelFolder, QString& userSettings)
{
const char* pUserName = GetISystem()->GetUserName();
QString fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
userSettings = Path::Make(levelFolder, fileName);
}
static bool TryRenameFile(const QString& oldPath, const QString& newPath, int retryAttempts=10)
{
QFile(newPath).setPermissions(QFile::ReadOther | QFile::WriteOther);
@@ -1101,7 +1093,7 @@ static bool TryRenameFile(const QString& oldPath, const QString& newPath, int re
bool CCryEditDoc::SaveLevel(const QString& filename)
{
AZ_PROFILE_FUNCTION(AzToolsFramework);
AZ_PROFILE_FUNCTION(Editor);
QWaitCursor wait;
CAutoCheckOutDialogEnableForAll enableForAll;
@@ -1121,7 +1113,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
{
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel BackupBeforeSave");
AZ_PROFILE_SCOPE(Editor, "CCryEditDoc::SaveLevel BackupBeforeSave");
BackupBeforeSave();
}
@@ -1232,7 +1224,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
CPakFile pakFile;
{
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Open PakFile");
AZ_PROFILE_SCOPE(Editor, "CCryEditDoc::SaveLevel Open PakFile");
if (!pakFile.Open(tempSaveFile.toUtf8().data(), false))
{
gEnv->pLog->LogWarning("Unable to open pack file %s for writing", tempSaveFile.toUtf8().data());
@@ -1263,7 +1255,7 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
AZ::IO::ByteContainerStream<AZStd::vector<char>> entitySaveStream(&entitySaveBuffer);
{
AZ_PROFILE_SCOPE(AzToolsFramework, "CCryEditDoc::SaveLevel Save Entities To Stream");
AZ_PROFILE_SCOPE(Editor, "CCryEditDoc::SaveLevel Save Entities To Stream");
EBUS_EVENT_RESULT(
savedEntities, AzToolsFramework::EditorEntityContextRequestBus, SaveToStreamForEditor, entitySaveStream, layerEntities,
instancesInLayers);
+13 -5
View File
@@ -97,11 +97,6 @@ namespace
}
}
const char* PyGetGameFolder()
{
return Path::GetEditingGameDataFolder().c_str();
}
AZStd::string PyGetGameFolderAsString()
{
return Path::GetEditingGameDataFolder();
@@ -406,6 +401,16 @@ inline namespace Commands
{
return static_cast<int>(GetIEditor()->GetEditorConfigPlatform());
}
bool PyAttachDebugger()
{
return AZ::Debug::Trace::AttachDebugger();
}
bool PyWaitForDebugger(float timeoutSeconds = -1.f)
{
return AZ::Debug::Trace::WaitForDebugger(timeoutSeconds);
}
}
namespace AzToolsFramework
@@ -453,6 +458,9 @@ namespace AzToolsFramework
addLegacyGeneral(behaviorContext->Method("start_process_detached", PyStartProcessDetached, nullptr, "Launches a detached process with an optional space separated list of arguments."));
addLegacyGeneral(behaviorContext->Method("launch_lua_editor", PyLaunchLUAEditor, nullptr, "Launches the Lua editor, may receive a list of space separate file paths, or an empty string to only open the editor."));
addLegacyGeneral(behaviorContext->Method("attach_debugger", PyAttachDebugger, nullptr, "Prompts for attaching the debugger"));
addLegacyGeneral(behaviorContext->Method("wait_for_debugger", PyWaitForDebugger, behaviorContext->MakeDefaultValues(-1.f), "Pauses this thread execution until the debugger has been attached"));
// this will put these methods into the 'azlmbr.legacy.checkout_dialog' module
auto addCheckoutDialog = [](AZ::BehaviorContext::GlobalMethodBuilder methodBuilder)
{
@@ -1,75 +0,0 @@
/*
* 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
*
*/
// Description : Calculate the reference frame for sub-object selections.
#include "EditorDefs.h"
#include "SubObjectSelectionReferenceFrameCalculator.h"
SubObjectSelectionReferenceFrameCalculator::SubObjectSelectionReferenceFrameCalculator(ESubObjElementType selectionType)
: m_anySelected(false)
, pos(0.0f, 0.0f, 0.0f)
, normal(0.0f, 0.0f, 0.0f)
, nNormals(0)
, selectionType(selectionType)
, bUseExplicitFrame(false)
, bExplicitAnySelected(false)
{
}
void SubObjectSelectionReferenceFrameCalculator::SetExplicitFrame(bool bAnySelected, const Matrix34& refFrame)
{
this->m_refFrame = refFrame;
this->bUseExplicitFrame = true;
this->bExplicitAnySelected = bAnySelected;
}
bool SubObjectSelectionReferenceFrameCalculator::GetFrame(Matrix34& refFrame)
{
if (this->bUseExplicitFrame)
{
refFrame = this->m_refFrame;
return this->bExplicitAnySelected;
}
else
{
refFrame.SetIdentity();
if (this->nNormals > 0)
{
this->normal = this->normal / static_cast<float>(this->nNormals);
if (!this->normal.IsZero())
{
this->normal.Normalize();
}
// Average position.
this->pos = this->pos / static_cast<float>(this->nNormals);
refFrame.SetTranslation(this->pos);
}
if (this->m_anySelected)
{
if (!this->normal.IsZero())
{
Vec3 xAxis(1, 0, 0), yAxis(0, 1, 0), zAxis(0, 0, 1);
if (this->normal.IsEquivalent(zAxis) || normal.IsEquivalent(-zAxis))
{
zAxis = xAxis;
}
xAxis = this->normal.Cross(zAxis).GetNormalized();
yAxis = xAxis.Cross(this->normal).GetNormalized();
refFrame.SetFromVectors(xAxis, yAxis, normal, pos);
}
}
return m_anySelected;
}
}
@@ -1,42 +0,0 @@
/*
* 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
*
*/
// Description : Calculate the reference frame for sub-object selections.
#ifndef CRYINCLUDE_EDITOR_EDITMODE_SUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
#define CRYINCLUDE_EDITOR_EDITMODE_SUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
#pragma once
#include "ISubObjectSelectionReferenceFrameCalculator.h"
#include "Objects/SubObjSelection.h"
class SubObjectSelectionReferenceFrameCalculator
: public ISubObjectSelectionReferenceFrameCalculator
{
public:
SubObjectSelectionReferenceFrameCalculator(ESubObjElementType selectionType);
virtual void SetExplicitFrame(bool bAnySelected, const Matrix34& refFrame);
bool GetFrame(Matrix34& refFrame);
private:
bool m_anySelected;
Vec3 pos;
Vec3 normal;
int nNormals;
ESubObjElementType selectionType;
std::vector<Vec3> positions;
Matrix34 m_refFrame;
bool bUseExplicitFrame;
bool bExplicitAnySelected;
};
#endif // CRYINCLUDE_EDITOR_EDITMODE_SUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
-4
View File
@@ -8,8 +8,6 @@
#pragma once
#ifndef CRYINCLUDE_EDITOR_EDITORDEFS_H
#define CRYINCLUDE_EDITOR_EDITORDEFS_H
#include <AzCore/PlatformDef.h>
@@ -186,5 +184,3 @@
#endif
#endif
#endif // CRYINCLUDE_EDITOR_EDITORDEFS_H
@@ -0,0 +1,286 @@
/*
* 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 <EditorModularViewportCameraComposer.h>
#include <AtomToolsFramework/Viewport/ModularViewportCameraControllerRequestBus.h>
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzFramework/Render/IntersectorInterface.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <EditorViewportSettings.h>
namespace SandboxEditor
{
static AzFramework::TranslateCameraInputChannelIds BuildTranslateCameraInputChannelIds()
{
AzFramework::TranslateCameraInputChannelIds translateCameraInputChannelIds;
translateCameraInputChannelIds.m_leftChannelId = SandboxEditor::CameraTranslateLeftChannelId();
translateCameraInputChannelIds.m_rightChannelId = SandboxEditor::CameraTranslateRightChannelId();
translateCameraInputChannelIds.m_forwardChannelId = SandboxEditor::CameraTranslateForwardChannelId();
translateCameraInputChannelIds.m_backwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId();
translateCameraInputChannelIds.m_upChannelId = SandboxEditor::CameraTranslateUpChannelId();
translateCameraInputChannelIds.m_downChannelId = SandboxEditor::CameraTranslateDownChannelId();
translateCameraInputChannelIds.m_boostChannelId = SandboxEditor::CameraTranslateBoostChannelId();
return translateCameraInputChannelIds;
}
EditorModularViewportCameraComposer::EditorModularViewportCameraComposer(const AzFramework::ViewportId viewportId)
: m_viewportId(viewportId)
{
EditorModularViewportCameraComposerNotificationBus::Handler::BusConnect(viewportId);
}
EditorModularViewportCameraComposer::~EditorModularViewportCameraComposer()
{
EditorModularViewportCameraComposerNotificationBus::Handler::BusDisconnect();
}
AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> EditorModularViewportCameraComposer::
CreateModularViewportCameraController()
{
SetupCameras();
auto controller = AZStd::make_shared<AtomToolsFramework::ModularViewportCameraController>();
controller->SetCameraViewportContextBuilderCallback(
[viewportId = m_viewportId](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
{
cameraViewportContext = AZStd::make_unique<AtomToolsFramework::ModularCameraViewportContextImpl>(viewportId);
});
controller->SetCameraPriorityBuilderCallback(
[](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn)
{
cameraControllerPriorityFn = AtomToolsFramework::DefaultCameraControllerPriority;
});
controller->SetCameraPropsBuilderCallback(
[](AzFramework::CameraProps& cameraProps)
{
cameraProps.m_rotateSmoothnessFn = []
{
return SandboxEditor::CameraRotateSmoothness();
};
cameraProps.m_translateSmoothnessFn = []
{
return SandboxEditor::CameraTranslateSmoothness();
};
cameraProps.m_rotateSmoothingEnabledFn = []
{
return SandboxEditor::CameraRotateSmoothingEnabled();
};
cameraProps.m_translateSmoothingEnabledFn = []
{
return SandboxEditor::CameraTranslateSmoothingEnabled();
};
});
controller->SetCameraListBuilderCallback(
[this](AzFramework::Cameras& cameras)
{
cameras.AddCamera(m_firstPersonRotateCamera);
cameras.AddCamera(m_firstPersonPanCamera);
cameras.AddCamera(m_firstPersonTranslateCamera);
cameras.AddCamera(m_firstPersonScrollCamera);
cameras.AddCamera(m_orbitCamera);
});
return controller;
}
void EditorModularViewportCameraComposer::SetupCameras()
{
const auto hideCursor = [viewportId = m_viewportId]
{
if (SandboxEditor::CameraCaptureCursorForLook())
{
AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event(
viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::BeginCursorCapture);
}
};
const auto showCursor = [viewportId = m_viewportId]
{
if (SandboxEditor::CameraCaptureCursorForLook())
{
AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event(
viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::EndCursorCapture);
}
};
m_firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(SandboxEditor::CameraFreeLookChannelId());
m_firstPersonRotateCamera->m_rotateSpeedFn = []
{
return SandboxEditor::CameraRotateSpeed();
};
// default behavior is to hide the cursor but this can be disabled (useful for remote desktop)
// note: See CaptureCursorLook in the Settings Registry
m_firstPersonRotateCamera->SetActivationBeganFn(hideCursor);
m_firstPersonRotateCamera->SetActivationEndedFn(showCursor);
m_firstPersonPanCamera =
AZStd::make_shared<AzFramework::PanCameraInput>(SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan);
m_firstPersonPanCamera->m_panSpeedFn = []
{
return SandboxEditor::CameraPanSpeed();
};
m_firstPersonPanCamera->m_invertPanXFn = []
{
return SandboxEditor::CameraPanInvertedX();
};
m_firstPersonPanCamera->m_invertPanYFn = []
{
return SandboxEditor::CameraPanInvertedY();
};
const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds();
m_firstPersonTranslateCamera =
AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::LookTranslation, translateCameraInputChannelIds);
m_firstPersonTranslateCamera->m_translateSpeedFn = []
{
return SandboxEditor::CameraTranslateSpeed();
};
m_firstPersonTranslateCamera->m_boostMultiplierFn = []
{
return SandboxEditor::CameraBoostMultiplier();
};
m_firstPersonScrollCamera = AZStd::make_shared<AzFramework::ScrollTranslationCameraInput>();
m_firstPersonScrollCamera->m_scrollSpeedFn = []
{
return SandboxEditor::CameraScrollSpeed();
};
m_orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>(SandboxEditor::CameraOrbitChannelId());
m_orbitCamera->SetLookAtFn(
[viewportId = m_viewportId](const AZ::Vector3& position, const AZ::Vector3& direction) -> AZStd::optional<AZ::Vector3>
{
AZStd::optional<AZ::Vector3> lookAtAfterInterpolation;
AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult(
lookAtAfterInterpolation, viewportId,
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::LookAtAfterInterpolation);
// initially attempt to use the last set look at point after an interpolation has finished
if (lookAtAfterInterpolation.has_value())
{
return *lookAtAfterInterpolation;
}
const float RayDistance = 1000.0f;
AzFramework::RenderGeometry::RayRequest ray;
ray.m_startWorldPosition = position;
ray.m_endWorldPosition = position + direction * RayDistance;
ray.m_onlyVisible = true;
AzFramework::RenderGeometry::RayResult renderGeometryIntersectionResult;
AzFramework::RenderGeometry::IntersectorBus::EventResult(
renderGeometryIntersectionResult, AzToolsFramework::GetEntityContextId(),
&AzFramework::RenderGeometry::IntersectorBus::Events::RayIntersect, ray);
// attempt a ray intersection with any visible mesh and return the intersection position if successful
if (renderGeometryIntersectionResult)
{
return renderGeometryIntersectionResult.m_worldPosition;
}
// if there is no selection or no intersection, fallback to default camera orbit behavior (ground plane
// intersection)
return {};
});
m_orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(SandboxEditor::CameraOrbitLookChannelId());
m_orbitRotateCamera->m_rotateSpeedFn = []
{
return SandboxEditor::CameraRotateSpeed();
};
m_orbitRotateCamera->m_invertYawFn = []
{
return SandboxEditor::CameraOrbitYawRotationInverted();
};
m_orbitTranslateCamera =
AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::OrbitTranslation, translateCameraInputChannelIds);
m_orbitTranslateCamera->m_translateSpeedFn = []
{
return SandboxEditor::CameraTranslateSpeed();
};
m_orbitTranslateCamera->m_boostMultiplierFn = []
{
return SandboxEditor::CameraBoostMultiplier();
};
m_orbitDollyScrollCamera = AZStd::make_shared<AzFramework::OrbitDollyScrollCameraInput>();
m_orbitDollyScrollCamera->m_scrollSpeedFn = []
{
return SandboxEditor::CameraScrollSpeed();
};
m_orbitDollyMoveCamera =
AZStd::make_shared<AzFramework::OrbitDollyCursorMoveCameraInput>(SandboxEditor::CameraOrbitDollyChannelId());
m_orbitDollyMoveCamera->m_cursorSpeedFn = []
{
return SandboxEditor::CameraDollyMotionSpeed();
};
m_orbitPanCamera = AZStd::make_shared<AzFramework::PanCameraInput>(SandboxEditor::CameraOrbitPanChannelId(), AzFramework::OrbitPan);
m_orbitPanCamera->m_panSpeedFn = []
{
return SandboxEditor::CameraPanSpeed();
};
m_orbitPanCamera->m_invertPanXFn = []
{
return SandboxEditor::CameraPanInvertedX();
};
m_orbitPanCamera->m_invertPanYFn = []
{
return SandboxEditor::CameraPanInvertedY();
};
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitRotateCamera);
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitTranslateCamera);
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitDollyScrollCamera);
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitDollyMoveCamera);
m_orbitCamera->m_orbitCameras.AddCamera(m_orbitPanCamera);
}
void EditorModularViewportCameraComposer::OnEditorModularViewportCameraComposerSettingsChanged()
{
const auto translateCameraInputChannelIds = BuildTranslateCameraInputChannelIds();
m_firstPersonTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds);
m_orbitTranslateCamera->SetTranslateCameraInputChannelIds(translateCameraInputChannelIds);
m_firstPersonPanCamera->SetPanInputChannelId(SandboxEditor::CameraFreePanChannelId());
m_orbitPanCamera->SetPanInputChannelId(SandboxEditor::CameraOrbitPanChannelId());
m_firstPersonRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraFreeLookChannelId());
m_orbitRotateCamera->SetRotateInputChannelId(SandboxEditor::CameraOrbitLookChannelId());
m_orbitCamera->SetOrbitInputChannelId(SandboxEditor::CameraOrbitChannelId());
m_orbitDollyMoveCamera->SetDollyInputChannelId(SandboxEditor::CameraOrbitDollyChannelId());
}
} // namespace SandboxEditor
@@ -0,0 +1,48 @@
/*
* 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 <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
#include <AzFramework/Viewport/CameraInput.h>
#include <EditorModularViewportCameraComposerBus.h>
#include <SandboxAPI.h>
namespace SandboxEditor
{
//! Type responsible for building the editor's modular viewport camera controller.
class EditorModularViewportCameraComposer : private EditorModularViewportCameraComposerNotificationBus::Handler
{
public:
SANDBOX_API explicit EditorModularViewportCameraComposer(AzFramework::ViewportId viewportId);
SANDBOX_API ~EditorModularViewportCameraComposer();
//! Build a ModularViewportCameraController from the associated camera inputs.
SANDBOX_API AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateModularViewportCameraController();
private:
//! Setup all internal camera inputs.
void SetupCameras();
// EditorModularViewportCameraComposerNotificationBus overrides ...
void OnEditorModularViewportCameraComposerSettingsChanged() override;
AZStd::shared_ptr<AzFramework::RotateCameraInput> m_firstPersonRotateCamera;
AZStd::shared_ptr<AzFramework::PanCameraInput> m_firstPersonPanCamera;
AZStd::shared_ptr<AzFramework::TranslateCameraInput> m_firstPersonTranslateCamera;
AZStd::shared_ptr<AzFramework::ScrollTranslationCameraInput> m_firstPersonScrollCamera;
AZStd::shared_ptr<AzFramework::OrbitCameraInput> m_orbitCamera;
AZStd::shared_ptr<AzFramework::RotateCameraInput> m_orbitRotateCamera;
AZStd::shared_ptr<AzFramework::TranslateCameraInput> m_orbitTranslateCamera;
AZStd::shared_ptr<AzFramework::OrbitDollyScrollCameraInput> m_orbitDollyScrollCamera;
AZStd::shared_ptr<AzFramework::OrbitDollyCursorMoveCameraInput> m_orbitDollyMoveCamera;
AZStd::shared_ptr<AzFramework::PanCameraInput> m_orbitPanCamera;
AzFramework::ViewportId m_viewportId;
};
} // namespace SandboxEditor
@@ -0,0 +1,31 @@
/*
* 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 <AzCore/EBus/EBus.h>
#include <AzFramework/Viewport/ViewportId.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
namespace SandboxEditor
{
//! Notifications for changes to the editor modular viewport camera controller.
class EditorModularViewportCameraComposerNotifications
{
public:
//! Notify any listeners when changes have been made to the modular viewport camera settings.
//! @note This is used to update any cached input channels when controls are modified.
virtual void OnEditorModularViewportCameraComposerSettingsChanged() = 0;
protected:
~EditorModularViewportCameraComposerNotifications() = default;
};
using EditorModularViewportCameraComposerNotificationBus =
AZ::EBus<EditorModularViewportCameraComposerNotifications, AzToolsFramework::ViewportInteraction::ViewportEBusTraits>;
} // namespace SandboxEditor
+1 -8
View File
@@ -47,7 +47,6 @@ struct ToolTip
class CEditorPanelUtils_Impl
: public IEditorPanelUtils
{
#pragma region Drag & Drop
public:
void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
{
@@ -56,8 +55,7 @@ public:
GetIEditor()->GetViewManager()->GetView(i)->SetGlobalDropCallback(dropCallback, custom);
}
}
#pragma endregion
#pragma region Preview Window
public:
int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override
@@ -72,8 +70,6 @@ public:
settings->SetDebugFlags(flags);
}
#pragma endregion
#pragma region Shortcuts
protected:
QVector<HotKey> hotkeys;
bool m_hotkeysAreEnabled;
@@ -408,8 +404,6 @@ public:
return m_hotkeysAreEnabled;
}
#pragma endregion
#pragma region ToolTip
protected:
QMap<QString, ToolTip> m_tooltips;
@@ -539,7 +533,6 @@ public:
}
return GetToolTip(path).disabledContent;
}
#pragma endregion ToolTip
};
IEditorPanelUtils* CreateEditorPanelUtils()
@@ -5,51 +5,220 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "EditorDefs.h"
#include "EditorPreferencesPageViewportMovement.h"
#include <AzCore/std/sort.h>
#include <AzFramework/Input/Buses/Requests/InputDeviceRequestBus.h>
#include <AzFramework/Input/Devices/Keyboard/InputDeviceKeyboard.h>
#include <AzFramework/Input/Devices/Mouse/InputDeviceMouse.h>
#include <AzQtComponents/Components/StyleManager.h>
#include <EditorModularViewportCameraComposerBus.h>
// Editor
#include "Settings.h"
#include "EditorViewportSettings.h"
#include "Settings.h"
static AZStd::vector<AZStd::string> GetInputNamesByDevice(const AzFramework::InputDeviceId inputDeviceId)
{
AzFramework::InputDeviceRequests::InputChannelIdSet availableInputChannelIds;
AzFramework::InputDeviceRequestBus::Event(
inputDeviceId, &AzFramework::InputDeviceRequests::GetInputChannelIds, availableInputChannelIds);
AZStd::vector<AZStd::string> inputChannelNames;
for (const AzFramework::InputChannelId& inputChannelId : availableInputChannelIds)
{
inputChannelNames.push_back(inputChannelId.GetName());
}
AZStd::sort(inputChannelNames.begin(), inputChannelNames.end());
return inputChannelNames;
}
static AZStd::vector<AZStd::string> GetEditorInputNames()
{
// function static to defer having to call GetInputNamesByDevice for every CameraInputSettings member
static bool inputNamesGenerated = false;
static AZStd::vector<AZStd::string> inputNames;
if (!inputNamesGenerated)
{
AZStd::vector<AZStd::string> keyboardInputNames = GetInputNamesByDevice(AzFramework::InputDeviceKeyboard::Id);
AZStd::vector<AZStd::string> mouseInputNames = GetInputNamesByDevice(AzFramework::InputDeviceMouse::Id);
inputNames.insert(inputNames.end(), mouseInputNames.begin(), mouseInputNames.end());
inputNames.insert(inputNames.end(), keyboardInputNames.begin(), keyboardInputNames.end());
inputNamesGenerated = true;
}
return inputNames;
}
void CEditorPreferencesPage_ViewportMovement::Reflect(AZ::SerializeContext& serialize)
{
serialize.Class<CameraMovementSettings>()
->Version(1)
->Field("MoveSpeed", &CameraMovementSettings::m_moveSpeed)
->Version(2)
->Field("TranslateSpeed", &CameraMovementSettings::m_translateSpeed)
->Field("RotateSpeed", &CameraMovementSettings::m_rotateSpeed)
->Field("FastMoveSpeed", &CameraMovementSettings::m_fastMoveSpeed)
->Field("WheelZoomSpeed", &CameraMovementSettings::m_wheelZoomSpeed)
->Field("InvertYAxis", &CameraMovementSettings::m_invertYRotation)
->Field("InvertPan", &CameraMovementSettings::m_invertPan);
->Field("BoostMultiplier", &CameraMovementSettings::m_boostMultiplier)
->Field("ScrollSpeed", &CameraMovementSettings::m_scrollSpeed)
->Field("DollySpeed", &CameraMovementSettings::m_dollySpeed)
->Field("PanSpeed", &CameraMovementSettings::m_panSpeed)
->Field("RotateSmoothing", &CameraMovementSettings::m_rotateSmoothing)
->Field("RotateSmoothness", &CameraMovementSettings::m_rotateSmoothness)
->Field("TranslateSmoothing", &CameraMovementSettings::m_translateSmoothing)
->Field("TranslateSmoothness", &CameraMovementSettings::m_translateSmoothness)
->Field("CaptureCursorLook", &CameraMovementSettings::m_captureCursorLook)
->Field("OrbitYawRotationInverted", &CameraMovementSettings::m_orbitYawRotationInverted)
->Field("PanInvertedX", &CameraMovementSettings::m_panInvertedX)
->Field("PanInvertedY", &CameraMovementSettings::m_panInvertedY);
serialize.Class<CameraInputSettings>()
->Version(1)
->Field("TranslateForward", &CameraInputSettings::m_translateForwardChannelId)
->Field("TranslateBackward", &CameraInputSettings::m_translateBackwardChannelId)
->Field("TranslateLeft", &CameraInputSettings::m_translateLeftChannelId)
->Field("TranslateRight", &CameraInputSettings::m_translateRightChannelId)
->Field("TranslateUp", &CameraInputSettings::m_translateUpChannelId)
->Field("TranslateDown", &CameraInputSettings::m_translateDownChannelId)
->Field("Boost", &CameraInputSettings::m_boostChannelId)
->Field("Orbit", &CameraInputSettings::m_orbitChannelId)
->Field("FreeLook", &CameraInputSettings::m_freeLookChannelId)
->Field("FreePan", &CameraInputSettings::m_freePanChannelId)
->Field("OrbitLook", &CameraInputSettings::m_orbitLookChannelId)
->Field("OrbitDolly", &CameraInputSettings::m_orbitDollyChannelId)
->Field("OrbitPan", &CameraInputSettings::m_orbitPanChannelId);
serialize.Class<CEditorPreferencesPage_ViewportMovement>()
->Version(1)
->Field("CameraMovementSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings);
->Field("CameraMovementSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings)
->Field("CameraInputSettings", &CEditorPreferencesPage_ViewportMovement::m_cameraInputSettings);
AZ::EditContext* editContext = serialize.GetEditContext();
if (editContext)
if (AZ::EditContext* editContext = serialize.GetEditContext())
{
editContext->Class<CameraMovementSettings>("Camera Movement Settings", "")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_moveSpeed, "Camera Movement Speed", "Camera Movement Speed")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSpeed, "Camera Rotation Speed", "Camera Rotation Speed")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_fastMoveSpeed, "Fast Movement Scale", "Fast Movement Scale (holding shift")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_wheelZoomSpeed, "Wheel Zoom Speed", "Wheel Zoom Speed")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_invertYRotation, "Invert Y Axis", "Invert Y Rotation (holding RMB)")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_invertPan, "Invert Pan", "Invert Pan (holding MMB)");
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_translateSpeed, "Camera Movement Speed", "Camera movement speed")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSpeed, "Camera Rotation Speed", "Camera rotation speed")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_boostMultiplier, "Camera Boost Multiplier",
"Camera boost multiplier to apply to movement speed")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_scrollSpeed, "Camera Scroll Speed",
"Camera movement speed while using scroll/wheel input")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_dollySpeed, "Camera Dolly Speed",
"Camera movement speed while using mouse motion to move in and out")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_panSpeed, "Camera Pan Speed",
"Camera movement speed while panning using the mouse")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_rotateSmoothing, "Camera Rotate Smoothing",
"Is camera rotation smoothing enabled or disabled")
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree)
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_rotateSmoothness, "Camera Rotate Smoothness",
"Amount of camera smoothing to apply while rotating the camera")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::RotateSmoothingVisibility)
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_translateSmoothing, "Camera Translate Smoothing",
"Is camera translation smoothing enabled or disabled")
->Attribute(AZ::Edit::Attributes::ChangeNotify, AZ::Edit::PropertyRefreshLevels::EntireTree)
->DataElement(
AZ::Edit::UIHandlers::SpinBox, &CameraMovementSettings::m_translateSmoothness, "Camera Translate Smoothness",
"Amount of camera smoothing to apply while translating the camera")
->Attribute(AZ::Edit::Attributes::Min, 0.01f)
->Attribute(AZ::Edit::Attributes::Visibility, &CameraMovementSettings::TranslateSmoothingVisibility)
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_orbitYawRotationInverted, "Camera Orbit Yaw Inverted",
"Inverted yaw rotation while orbiting")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedX, "Invert Pan X",
"Invert direction of pan in local X axis")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_panInvertedY, "Invert Pan Y",
"Invert direction of pan in local Y axis")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &CameraMovementSettings::m_captureCursorLook, "Camera Capture Look Cursor",
"Should the cursor be captured (hidden) while performing free look");
editContext->Class<CEditorPreferencesPage_ViewportMovement>("Gizmo Movement Preferences", "Gizmo Movement Preferences")
editContext->Class<CameraInputSettings>("Camera Input Settings", "")
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateForwardChannelId, "Translate Forward",
"Key/button to move the camera forward")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateBackwardChannelId, "Translate Backward",
"Key/button to move the camera backward")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateLeftChannelId, "Translate Left",
"Key/button to move the camera left")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateRightChannelId, "Translate Right",
"Key/button to move the camera right")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateUpChannelId, "Translate Up",
"Key/button to move the camera up")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_translateDownChannelId, "Translate Down",
"Key/button to move the camera down")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_boostChannelId, "Boost",
"Key/button to move the camera more quickly")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitChannelId, "Orbit",
"Key/button to begin the camera orbit behavior")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_freeLookChannelId, "Free Look",
"Key/button to begin camera free look")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_freePanChannelId, "Free Pan", "Key/button to begin camera free pan")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitLookChannelId, "Orbit Look",
"Key/button to begin camera orbit look")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitDollyChannelId, "Orbit Dolly",
"Key/button to begin camera orbit dolly")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames)
->DataElement(
AZ::Edit::UIHandlers::ComboBox, &CameraInputSettings::m_orbitPanChannelId, "Orbit Pan",
"Key/button to begin camera orbit pan")
->Attribute(AZ::Edit::Attributes::StringList, &GetEditorInputNames);
editContext->Class<CEditorPreferencesPage_ViewportMovement>("Viewport Preferences", "Viewport Preferences")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings, "Camera Movement Settings", "Camera Movement Settings");
->DataElement(
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraMovementSettings,
"Camera Movement Settings", "Camera Movement Settings")
->DataElement(
AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_ViewportMovement::m_cameraInputSettings, "Camera Input Settings",
"Camera Input Settings");
}
}
CEditorPreferencesPage_ViewportMovement::CEditorPreferencesPage_ViewportMovement()
{
InitializeSettings();
@@ -68,21 +237,67 @@ QIcon& CEditorPreferencesPage_ViewportMovement::GetIcon()
void CEditorPreferencesPage_ViewportMovement::OnApply()
{
SandboxEditor::SetCameraTranslateSpeed(m_cameraMovementSettings.m_moveSpeed);
SandboxEditor::SetCameraTranslateSpeed(m_cameraMovementSettings.m_translateSpeed);
SandboxEditor::SetCameraRotateSpeed(m_cameraMovementSettings.m_rotateSpeed);
SandboxEditor::SetCameraBoostMultiplier(m_cameraMovementSettings.m_fastMoveSpeed);
SandboxEditor::SetCameraScrollSpeed(m_cameraMovementSettings.m_wheelZoomSpeed);
SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_invertYRotation);
SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_invertPan);
SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_invertPan);
SandboxEditor::SetCameraBoostMultiplier(m_cameraMovementSettings.m_boostMultiplier);
SandboxEditor::SetCameraScrollSpeed(m_cameraMovementSettings.m_scrollSpeed);
SandboxEditor::SetCameraDollyMotionSpeed(m_cameraMovementSettings.m_dollySpeed);
SandboxEditor::SetCameraPanSpeed(m_cameraMovementSettings.m_panSpeed);
SandboxEditor::SetCameraRotateSmoothness(m_cameraMovementSettings.m_rotateSmoothness);
SandboxEditor::SetCameraRotateSmoothingEnabled(m_cameraMovementSettings.m_rotateSmoothing);
SandboxEditor::SetCameraTranslateSmoothness(m_cameraMovementSettings.m_translateSmoothness);
SandboxEditor::SetCameraTranslateSmoothingEnabled(m_cameraMovementSettings.m_translateSmoothing);
SandboxEditor::SetCameraCaptureCursorForLook(m_cameraMovementSettings.m_captureCursorLook);
SandboxEditor::SetCameraOrbitYawRotationInverted(m_cameraMovementSettings.m_orbitYawRotationInverted);
SandboxEditor::SetCameraPanInvertedX(m_cameraMovementSettings.m_panInvertedX);
SandboxEditor::SetCameraPanInvertedY(m_cameraMovementSettings.m_panInvertedY);
SandboxEditor::SetCameraTranslateForwardChannelId(m_cameraInputSettings.m_translateForwardChannelId);
SandboxEditor::SetCameraTranslateBackwardChannelId(m_cameraInputSettings.m_translateBackwardChannelId);
SandboxEditor::SetCameraTranslateLeftChannelId(m_cameraInputSettings.m_translateLeftChannelId);
SandboxEditor::SetCameraTranslateRightChannelId(m_cameraInputSettings.m_translateRightChannelId);
SandboxEditor::SetCameraTranslateUpChannelId(m_cameraInputSettings.m_translateUpChannelId);
SandboxEditor::SetCameraTranslateDownChannelId(m_cameraInputSettings.m_translateDownChannelId);
SandboxEditor::SetCameraTranslateBoostChannelId(m_cameraInputSettings.m_boostChannelId);
SandboxEditor::SetCameraOrbitChannelId(m_cameraInputSettings.m_orbitChannelId);
SandboxEditor::SetCameraFreeLookChannelId(m_cameraInputSettings.m_freeLookChannelId);
SandboxEditor::SetCameraFreePanChannelId(m_cameraInputSettings.m_freePanChannelId);
SandboxEditor::SetCameraOrbitLookChannelId(m_cameraInputSettings.m_orbitLookChannelId);
SandboxEditor::SetCameraOrbitDollyChannelId(m_cameraInputSettings.m_orbitDollyChannelId);
SandboxEditor::SetCameraOrbitPanChannelId(m_cameraInputSettings.m_orbitPanChannelId);
SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Broadcast(
&SandboxEditor::EditorModularViewportCameraComposerNotificationBus::Events::OnEditorModularViewportCameraComposerSettingsChanged);
}
void CEditorPreferencesPage_ViewportMovement::InitializeSettings()
{
m_cameraMovementSettings.m_moveSpeed = SandboxEditor::CameraTranslateSpeed();
m_cameraMovementSettings.m_translateSpeed = SandboxEditor::CameraTranslateSpeed();
m_cameraMovementSettings.m_rotateSpeed = SandboxEditor::CameraRotateSpeed();
m_cameraMovementSettings.m_fastMoveSpeed = SandboxEditor::CameraBoostMultiplier();
m_cameraMovementSettings.m_wheelZoomSpeed = SandboxEditor::CameraScrollSpeed();
m_cameraMovementSettings.m_invertYRotation = SandboxEditor::CameraOrbitYawRotationInverted();
m_cameraMovementSettings.m_invertPan = SandboxEditor::CameraPanInvertedX() && SandboxEditor::CameraPanInvertedY();
m_cameraMovementSettings.m_boostMultiplier = SandboxEditor::CameraBoostMultiplier();
m_cameraMovementSettings.m_scrollSpeed = SandboxEditor::CameraScrollSpeed();
m_cameraMovementSettings.m_dollySpeed = SandboxEditor::CameraDollyMotionSpeed();
m_cameraMovementSettings.m_panSpeed = SandboxEditor::CameraPanSpeed();
m_cameraMovementSettings.m_rotateSmoothness = SandboxEditor::CameraRotateSmoothness();
m_cameraMovementSettings.m_rotateSmoothing = SandboxEditor::CameraRotateSmoothingEnabled();
m_cameraMovementSettings.m_translateSmoothness = SandboxEditor::CameraTranslateSmoothness();
m_cameraMovementSettings.m_translateSmoothing = SandboxEditor::CameraTranslateSmoothingEnabled();
m_cameraMovementSettings.m_captureCursorLook = SandboxEditor::CameraCaptureCursorForLook();
m_cameraMovementSettings.m_orbitYawRotationInverted = SandboxEditor::CameraOrbitYawRotationInverted();
m_cameraMovementSettings.m_panInvertedX = SandboxEditor::CameraPanInvertedX();
m_cameraMovementSettings.m_panInvertedY = SandboxEditor::CameraPanInvertedY();
m_cameraInputSettings.m_translateForwardChannelId = SandboxEditor::CameraTranslateForwardChannelId().GetName();
m_cameraInputSettings.m_translateBackwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId().GetName();
m_cameraInputSettings.m_translateLeftChannelId = SandboxEditor::CameraTranslateLeftChannelId().GetName();
m_cameraInputSettings.m_translateRightChannelId = SandboxEditor::CameraTranslateRightChannelId().GetName();
m_cameraInputSettings.m_translateUpChannelId = SandboxEditor::CameraTranslateUpChannelId().GetName();
m_cameraInputSettings.m_translateDownChannelId = SandboxEditor::CameraTranslateDownChannelId().GetName();
m_cameraInputSettings.m_boostChannelId = SandboxEditor::CameraTranslateBoostChannelId().GetName();
m_cameraInputSettings.m_orbitChannelId = SandboxEditor::CameraOrbitChannelId().GetName();
m_cameraInputSettings.m_freeLookChannelId = SandboxEditor::CameraFreeLookChannelId().GetName();
m_cameraInputSettings.m_freePanChannelId = SandboxEditor::CameraFreePanChannelId().GetName();
m_cameraInputSettings.m_orbitLookChannelId = SandboxEditor::CameraOrbitLookChannelId().GetName();
m_cameraInputSettings.m_orbitDollyChannelId = SandboxEditor::CameraOrbitDollyChannelId().GetName();
m_cameraInputSettings.m_orbitPanChannelId = SandboxEditor::CameraOrbitPanChannelId().GetName();
}
@@ -5,17 +5,21 @@
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#pragma once
#include "Include/IPreferencesPage.h"
#include <AzCore/Serialization/SerializeContext.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/RTTI/RTTI.h>
#include <AzCore/Serialization/EditContext.h>
#include <AzCore/Serialization/SerializeContext.h>
#include <QIcon>
inline AZ::Crc32 EditorPropertyVisibility(const bool enabled)
{
return enabled ? AZ::Edit::PropertyVisibility::Show : AZ::Edit::PropertyVisibility::Hide;
}
class CEditorPreferencesPage_ViewportMovement
: public IPreferencesPage
class CEditorPreferencesPage_ViewportMovement : public IPreferencesPage
{
public:
AZ_RTTI(CEditorPreferencesPage_ViewportMovement, "{BC593332-7EAF-4171-8A35-1C5DE5B40909}", IPreferencesPage)
@@ -25,12 +29,22 @@ public:
CEditorPreferencesPage_ViewportMovement();
virtual ~CEditorPreferencesPage_ViewportMovement() = default;
virtual const char* GetCategory() override { return "Viewports"; }
virtual const char* GetCategory() override
{
return "Viewports";
}
virtual const char* GetTitle();
virtual QIcon& GetIcon() override;
virtual void OnApply() override;
virtual void OnCancel() override {}
virtual bool OnQueryCancel() override { return true; }
virtual void OnCancel() override
{
}
virtual bool OnQueryCancel() override
{
return true;
}
private:
void InitializeSettings();
@@ -39,16 +53,53 @@ private:
{
AZ_TYPE_INFO(CameraMovementSettings, "{60B8C07E-5F48-4171-A50B-F45558B5CCA1}")
float m_moveSpeed;
float m_translateSpeed;
float m_rotateSpeed;
float m_fastMoveSpeed;
float m_wheelZoomSpeed;
bool m_invertYRotation;
bool m_invertPan;
float m_scrollSpeed;
float m_dollySpeed;
float m_panSpeed;
float m_boostMultiplier;
float m_rotateSmoothness;
bool m_rotateSmoothing;
float m_translateSmoothness;
bool m_translateSmoothing;
bool m_captureCursorLook;
bool m_orbitYawRotationInverted;
bool m_panInvertedX;
bool m_panInvertedY;
AZ::Crc32 RotateSmoothingVisibility() const
{
return EditorPropertyVisibility(m_rotateSmoothing);
}
AZ::Crc32 TranslateSmoothingVisibility() const
{
return EditorPropertyVisibility(m_translateSmoothing);
}
};
struct CameraInputSettings
{
AZ_TYPE_INFO(struct CameraInputSettings, "{A250FAD4-662E-4896-B030-D4ED03679377}")
AZStd::string m_translateForwardChannelId;
AZStd::string m_translateBackwardChannelId;
AZStd::string m_translateLeftChannelId;
AZStd::string m_translateRightChannelId;
AZStd::string m_translateUpChannelId;
AZStd::string m_translateDownChannelId;
AZStd::string m_boostChannelId;
AZStd::string m_orbitChannelId;
AZStd::string m_freeLookChannelId;
AZStd::string m_freePanChannelId;
AZStd::string m_orbitLookChannelId;
AZStd::string m_orbitDollyChannelId;
AZStd::string m_orbitPanChannelId;
};
CameraMovementSettings m_cameraMovementSettings;
CameraInputSettings m_cameraInputSettings;
QIcon m_icon;
};
+19 -4
View File
@@ -33,6 +33,7 @@ namespace SandboxEditor
constexpr AZStd::string_view CameraTranslateSmoothnessSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothness";
constexpr AZStd::string_view CameraTranslateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/TranslateSmoothing";
constexpr AZStd::string_view CameraRotateSmoothingSetting = "/Amazon/Preferences/Editor/Camera/RotateSmoothing";
constexpr AZStd::string_view CameraCaptureCursorLookSetting = "/Amazon/Preferences/Editor/Camera/CaptureCursorLook";
constexpr AZStd::string_view CameraTranslateForwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateForwardId";
constexpr AZStd::string_view CameraTranslateBackwardIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateBackwardId";
constexpr AZStd::string_view CameraTranslateLeftIdSetting = "/Amazon/Preferences/Editor/Camera/CameraTranslateLeftId";
@@ -60,9 +61,13 @@ namespace SandboxEditor
AZStd::remove_cvref_t<T> GetRegistry(const AZStd::string_view setting, T&& defaultValue)
{
AZStd::remove_cvref_t<T> value = AZStd::forward<T>(defaultValue);
if (auto* registry = AZ::SettingsRegistry::Get())
if (const auto* registry = AZ::SettingsRegistry::Get())
{
registry->Get(value, setting);
T potentialValue;
if (registry->Get(potentialValue, setting))
{
value = AZStd::move(potentialValue);
}
}
return value;
@@ -281,6 +286,16 @@ namespace SandboxEditor
SetRegistry(CameraTranslateSmoothingSetting, enabled);
}
bool CameraCaptureCursorForLook()
{
return GetRegistry(CameraCaptureCursorLookSetting, true);
}
void SetCameraCaptureCursorForLook(const bool capture)
{
SetRegistry(CameraCaptureCursorLookSetting, capture);
}
AzFramework::InputChannelId CameraTranslateForwardChannelId()
{
return AzFramework::InputChannelId(
@@ -352,7 +367,7 @@ namespace SandboxEditor
void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId)
{
SetRegistry(CameraTranslateDownIdSetting, cameraTranslateBoostId);
SetRegistry(CameraTranslateBoostIdSetting, cameraTranslateBoostId);
}
AzFramework::InputChannelId CameraOrbitChannelId()
@@ -360,7 +375,7 @@ namespace SandboxEditor
return AzFramework::InputChannelId(GetRegistry(CameraOrbitIdSetting, AZStd::string("keyboard_key_modifier_alt_l")).c_str());
}
void SetCameraOrbitChannelChannelId(AZStd::string_view cameraOrbitId)
void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId)
{
SetRegistry(CameraOrbitIdSetting, cameraOrbitId);
}
+4 -1
View File
@@ -86,6 +86,9 @@ namespace SandboxEditor
SANDBOX_API bool CameraTranslateSmoothingEnabled();
SANDBOX_API void SetCameraTranslateSmoothingEnabled(bool enabled);
SANDBOX_API bool CameraCaptureCursorForLook();
SANDBOX_API void SetCameraCaptureCursorForLook(bool capture);
SANDBOX_API AzFramework::InputChannelId CameraTranslateForwardChannelId();
SANDBOX_API void SetCameraTranslateForwardChannelId(AZStd::string_view cameraTranslateForwardId);
@@ -108,7 +111,7 @@ namespace SandboxEditor
SANDBOX_API void SetCameraTranslateBoostChannelId(AZStd::string_view cameraTranslateBoostId);
SANDBOX_API AzFramework::InputChannelId CameraOrbitChannelId();
SANDBOX_API void SetCameraOrbitChannelChannelId(AZStd::string_view cameraOrbitId);
SANDBOX_API void SetCameraOrbitChannelId(AZStd::string_view cameraOrbitId);
SANDBOX_API AzFramework::InputChannelId CameraFreeLookChannelId();
SANDBOX_API void SetCameraFreeLookChannelId(AZStd::string_view cameraFreeLookId);
+21 -305
View File
@@ -50,10 +50,10 @@
// AtomToolsFramework
#include <AtomToolsFramework/Viewport/RenderViewportWidget.h>
#include <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
// CryCommon
#include <CryCommon/HMDBus.h>
#include <CryCommon/IRenderAuxGeom.h>
// AzFramework
#include <AzFramework/Render/IntersectorInterface.h>
@@ -69,7 +69,6 @@
#include "Include/IDisplayViewport.h"
#include "Objects/ObjectManager.h"
#include "ProcessInfo.h"
#include "IPostEffectGroup.h"
#include "EditorPreferencesPageGeneral.h"
#include "ViewportManipulatorController.h"
#include "EditorViewportSettings.h"
@@ -99,12 +98,10 @@
#include <QtGui/private/qhighdpiscaling_p.h>
#include <IEntityRenderState.h>
#include <IPhysics.h>
#include <IStatObj.h>
AZ_CVAR(
bool, ed_visibility_logTiming, false, nullptr, AZ::ConsoleFunctorFlags::Null, "Output the timing of the new IVisibilitySystem query");
AZ_CVAR(bool, ed_showCursorCameraLook, true, nullptr, AZ::ConsoleFunctorFlags::Null, "Show the cursor when using free look with the new camera system");
EditorViewportWidget* EditorViewportWidget::m_pPrimaryViewport = nullptr;
@@ -394,8 +391,6 @@ void EditorViewportWidget::UpdateContent(int flags)
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::Update()
{
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
if (Editor::EditorQtApplication::instance()->isMovingOrResizing())
{
return;
@@ -742,9 +737,13 @@ void EditorViewportWidget::OnBeginPrepareRender()
RenderAll();
// Draw 2D helpers.
#ifdef LYSHINE_ATOM_TODO
TransformationMatrices backupSceneMatrices;
#endif
m_debugDisplay->DepthTestOff();
//m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
#ifdef LYSHINE_ATOM_TODO
m_renderer->Set2DMode(m_rcClient.right(), m_rcClient.bottom(), backupSceneMatrices);
#endif
auto prevState = m_debugDisplay->GetState();
m_debugDisplay->SetState(e_Mode3D | e_AlphaBlended | e_FillModeSolid | e_CullModeBack | e_DepthWriteOn | e_DepthTestOn);
@@ -957,15 +956,11 @@ AzFramework::CameraState EditorViewportWidget::GetCameraState()
AZ::Vector3 EditorViewportWidget::PickTerrain(const AzFramework::ScreenPoint& point)
{
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
return LYVec3ToAZVec3(ViewToWorld(AzToolsFramework::ViewportInteraction::QPointFromScreenPoint(point), nullptr, true));
}
AZ::EntityId EditorViewportWidget::PickEntity(const AzFramework::ScreenPoint& point)
{
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
PreWidgetRendering();
AZ::EntityId entityId;
@@ -992,8 +987,6 @@ float EditorViewportWidget::TerrainHeight(const AZ::Vector2& position)
void EditorViewportWidget::FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntitiesOut)
{
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
visibleEntitiesOut.assign(m_entityVisibilityQuery.Begin(), m_entityVisibilityQuery.End());
}
@@ -1033,216 +1026,6 @@ bool EditorViewportWidget::ShowingWorldSpace()
return BuildKeyboardModifiers(QGuiApplication::queryKeyboardModifiers()).Shift();
}
AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateModularViewportCameraController(
const AzFramework::ViewportId viewportId)
{
auto controller = AZStd::make_shared<AtomToolsFramework::ModularViewportCameraController>();
controller->SetCameraViewportContextBuilderCallback(
[viewportId](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
{
cameraViewportContext = AZStd::make_unique<AtomToolsFramework::ModularCameraViewportContextImpl>(viewportId);
});
controller->SetCameraPriorityBuilderCallback(
[](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn)
{
cameraControllerPriorityFn = AtomToolsFramework::DefaultCameraControllerPriority;
});
controller->SetCameraPropsBuilderCallback(
[](AzFramework::CameraProps& cameraProps)
{
cameraProps.m_rotateSmoothnessFn = []
{
return SandboxEditor::CameraRotateSmoothness();
};
cameraProps.m_translateSmoothnessFn = []
{
return SandboxEditor::CameraTranslateSmoothness();
};
cameraProps.m_rotateSmoothingEnabledFn = []
{
return SandboxEditor::CameraRotateSmoothingEnabled();
};
cameraProps.m_translateSmoothingEnabledFn = []
{
return SandboxEditor::CameraTranslateSmoothingEnabled();
};
});
controller->SetCameraListBuilderCallback(
[viewportId](AzFramework::Cameras& cameras)
{
const auto hideCursor = [viewportId]
{
AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event(
viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::BeginCursorCapture);
};
const auto showCursor = [viewportId]
{
AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Event(
viewportId, &AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Events::EndCursorCapture);
};
auto firstPersonRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(SandboxEditor::CameraFreeLookChannelId());
firstPersonRotateCamera->m_rotateSpeedFn = []
{
return SandboxEditor::CameraRotateSpeed();
};
if (!ed_showCursorCameraLook)
{
// default behavior is to hide the cursor but this can be disabled (useful for remote desktop)
firstPersonRotateCamera->SetActivationBeganFn(hideCursor);
firstPersonRotateCamera->SetActivationEndedFn(showCursor);
}
auto firstPersonPanCamera =
AZStd::make_shared<AzFramework::PanCameraInput>(SandboxEditor::CameraFreePanChannelId(), AzFramework::LookPan);
firstPersonPanCamera->m_panSpeedFn = []
{
return SandboxEditor::CameraPanSpeed();
};
firstPersonPanCamera->m_invertPanXFn = []
{
return SandboxEditor::CameraPanInvertedX();
};
firstPersonPanCamera->m_invertPanYFn = []
{
return SandboxEditor::CameraPanInvertedY();
};
AzFramework::TranslateCameraInputChannels translateCameraInputChannels;
translateCameraInputChannels.m_leftChannelId = SandboxEditor::CameraTranslateLeftChannelId();
translateCameraInputChannels.m_rightChannelId = SandboxEditor::CameraTranslateRightChannelId();
translateCameraInputChannels.m_forwardChannelId = SandboxEditor::CameraTranslateForwardChannelId();
translateCameraInputChannels.m_backwardChannelId = SandboxEditor::CameraTranslateBackwardChannelId();
translateCameraInputChannels.m_upChannelId = SandboxEditor::CameraTranslateUpChannelId();
translateCameraInputChannels.m_downChannelId = SandboxEditor::CameraTranslateDownChannelId();
translateCameraInputChannels.m_boostChannelId = SandboxEditor::CameraTranslateBoostChannelId();
auto firstPersonTranslateCamera =
AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::LookTranslation, translateCameraInputChannels);
firstPersonTranslateCamera->m_translateSpeedFn = []
{
return SandboxEditor::CameraTranslateSpeed();
};
firstPersonTranslateCamera->m_boostMultiplierFn = []
{
return SandboxEditor::CameraBoostMultiplier();
};
auto firstPersonWheelCamera = AZStd::make_shared<AzFramework::ScrollTranslationCameraInput>();
firstPersonWheelCamera->m_scrollSpeedFn = []
{
return SandboxEditor::CameraScrollSpeed();
};
auto orbitCamera = AZStd::make_shared<AzFramework::OrbitCameraInput>(SandboxEditor::CameraOrbitChannelId());
orbitCamera->SetLookAtFn(
[viewportId](const AZ::Vector3& position, const AZ::Vector3& direction) -> AZStd::optional<AZ::Vector3>
{
AZStd::optional<AZ::Vector3> lookAtAfterInterpolation;
AtomToolsFramework::ModularViewportCameraControllerRequestBus::EventResult(
lookAtAfterInterpolation, viewportId,
&AtomToolsFramework::ModularViewportCameraControllerRequestBus::Events::LookAtAfterInterpolation);
// initially attempt to use the last set look at point after an interpolation has finished
if (lookAtAfterInterpolation.has_value())
{
return *lookAtAfterInterpolation;
}
const float RayDistance = 1000.0f;
AzFramework::RenderGeometry::RayRequest ray;
ray.m_startWorldPosition = position;
ray.m_endWorldPosition = position + direction * RayDistance;
ray.m_onlyVisible = true;
AzFramework::RenderGeometry::RayResult renderGeometryIntersectionResult;
AzFramework::RenderGeometry::IntersectorBus::EventResult(
renderGeometryIntersectionResult, AzToolsFramework::GetEntityContextId(),
&AzFramework::RenderGeometry::IntersectorBus::Events::RayIntersect, ray);
// attempt a ray intersection with any visible mesh and return the intersection position if successful
if (renderGeometryIntersectionResult)
{
return renderGeometryIntersectionResult.m_worldPosition;
}
// if there is no selection or no intersection, fallback to default camera orbit behavior (ground plane
// intersection)
return {};
});
auto orbitRotateCamera = AZStd::make_shared<AzFramework::RotateCameraInput>(SandboxEditor::CameraOrbitLookChannelId());
orbitRotateCamera->m_rotateSpeedFn = []
{
return SandboxEditor::CameraRotateSpeed();
};
orbitRotateCamera->m_invertYawFn = []
{
return SandboxEditor::CameraOrbitYawRotationInverted();
};
auto orbitTranslateCamera =
AZStd::make_shared<AzFramework::TranslateCameraInput>(AzFramework::OrbitTranslation, translateCameraInputChannels);
orbitTranslateCamera->m_translateSpeedFn = []
{
return SandboxEditor::CameraTranslateSpeed();
};
orbitTranslateCamera->m_boostMultiplierFn = []
{
return SandboxEditor::CameraBoostMultiplier();
};
auto orbitDollyWheelCamera = AZStd::make_shared<AzFramework::OrbitDollyScrollCameraInput>();
orbitDollyWheelCamera->m_scrollSpeedFn = []
{
return SandboxEditor::CameraScrollSpeed();
};
auto orbitDollyMoveCamera =
AZStd::make_shared<AzFramework::OrbitDollyCursorMoveCameraInput>(SandboxEditor::CameraOrbitDollyChannelId());
orbitDollyMoveCamera->m_cursorSpeedFn = []
{
return SandboxEditor::CameraDollyMotionSpeed();
};
auto orbitPanCamera = AZStd::make_shared<AzFramework::PanCameraInput>(SandboxEditor::CameraOrbitPanChannelId(), AzFramework::OrbitPan);
orbitPanCamera->m_panSpeedFn = []
{
return SandboxEditor::CameraPanSpeed();
};
orbitPanCamera->m_invertPanXFn = []
{
return SandboxEditor::CameraPanInvertedX();
};
orbitPanCamera->m_invertPanYFn = []
{
return SandboxEditor::CameraPanInvertedY();
};
orbitCamera->m_orbitCameras.AddCamera(orbitRotateCamera);
orbitCamera->m_orbitCameras.AddCamera(orbitTranslateCamera);
orbitCamera->m_orbitCameras.AddCamera(orbitDollyWheelCamera);
orbitCamera->m_orbitCameras.AddCamera(orbitDollyMoveCamera);
orbitCamera->m_orbitCameras.AddCamera(orbitPanCamera);
cameras.AddCamera(firstPersonRotateCamera);
cameras.AddCamera(firstPersonPanCamera);
cameras.AddCamera(firstPersonTranslateCamera);
cameras.AddCamera(firstPersonWheelCamera);
cameras.AddCamera(orbitCamera);
});
return controller;
}
void EditorViewportWidget::SetViewportId(int id)
{
CViewport::SetViewportId(id);
@@ -1287,8 +1070,9 @@ void EditorViewportWidget::SetViewportId(int id)
m_renderViewport->GetControllerList()->Add(AZStd::make_shared<SandboxEditor::ViewportManipulatorController>());
m_renderViewport->GetControllerList()->Add(CreateModularViewportCameraController(AzFramework::ViewportId(id)));
m_editorModularViewportCameraComposer = AZStd::make_unique<SandboxEditor::EditorModularViewportCameraComposer>(AzFramework::ViewportId(id));
m_renderViewport->GetControllerList()->Add(m_editorModularViewportCameraComposer->CreateModularViewportCameraController());
m_renderViewport->SetViewportSettings(&g_EditorViewportSettings);
UpdateScene();
@@ -1648,7 +1432,7 @@ void EditorViewportWidget::SetViewTM(const Matrix34& camMatrix, bool bMoveOnly)
{
// Should be impossible anyways
AZ_Assert(false, "Internal logic error - view entity Id and view source type out of sync. Please report this as a bug");
return ShouldUpdateObject::No;
return ShouldUpdateObject::No;
}
// Check that the current view is the same view as the view entity view
@@ -1741,7 +1525,7 @@ AZ::EntityId EditorViewportWidget::GetCurrentViewEntityId()
&AZ::RPI::ViewProviderBus::Events::GetView
);
const bool isViewEntityCorrect = viewEntityView == GetCurrentAtomView();
[[maybe_unused]] const bool isViewEntityCorrect = viewEntityView == GetCurrentAtomView();
AZ_Error("EditorViewportWidget", isViewEntityCorrect,
"GetCurrentViewEntityId called while the current view is being changed. "
"You may get inconsistent results if you make use of the returned entity ID. "
@@ -1975,12 +1759,12 @@ Vec3 EditorViewportWidget::ViewToWorld(
{
AZ_PROFILE_FUNCTION(Editor);
AZ_UNUSED(collideWithTerrain)
AZ_UNUSED(onlyTerrain)
AZ_UNUSED(bTestRenderMesh)
AZ_UNUSED(bSkipVegetation)
AZ_UNUSED(bSkipVegetation)
AZ_UNUSED(collideWithObject)
AZ_UNUSED(collideWithTerrain);
AZ_UNUSED(onlyTerrain);
AZ_UNUSED(bTestRenderMesh);
AZ_UNUSED(bSkipVegetation);
AZ_UNUSED(bSkipVegetation);
AZ_UNUSED(collideWithObject);
auto ray = m_renderViewport->ViewportScreenToWorldRay(AzToolsFramework::ViewportInteraction::ScreenPointFromQPoint(vp));
if (!ray.has_value())
@@ -2004,82 +1788,15 @@ Vec3 EditorViewportWidget::ViewToWorld(
//////////////////////////////////////////////////////////////////////////
Vec3 EditorViewportWidget::ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh)
{
AZ_UNUSED(vp)
AZ_UNUSED(onlyTerrain)
AZ_UNUSED(bTestRenderMesh)
AZ_UNUSED(vp);
AZ_UNUSED(onlyTerrain);
AZ_UNUSED(bTestRenderMesh);
AZ_PROFILE_FUNCTION(Editor);
return Vec3(0, 0, 1);
}
//////////////////////////////////////////////////////////////////////////
bool EditorViewportWidget::AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const
{
Matrix34A objMat, objMatInv;
Matrix33 objRot, objRotInv;
if (hit.pCollider->GetiForeignData() != PHYS_FOREIGN_ID_STATIC)
{
return false;
}
IRenderNode* pNode = (IRenderNode*) hit.pCollider->GetForeignData(PHYS_FOREIGN_ID_STATIC);
if (!pNode || !pNode->GetEntityStatObj())
{
return false;
}
IStatObj* pEntObject = pNode->GetEntityStatObj(hit.partid, 0, &objMat, false);
if (!pEntObject || !pEntObject->GetRenderMesh())
{
return false;
}
objRot = Matrix33(objMat);
objRot.NoScale(); // No scale.
objRotInv = objRot;
objRotInv.Invert();
float fWorldScale = objMat.GetColumn(0).GetLength(); // GetScale
float fWorldScaleInv = 1.0f / fWorldScale;
// transform decal into object space
objMatInv = objMat;
objMatInv.Invert();
// put into normal object space hit direction of projection
Vec3 invhitn = -(hit.n);
Vec3 vOS_HitDir = objRotInv.TransformVector(invhitn).GetNormalized();
// put into position object space hit position
Vec3 vOS_HitPos = objMatInv.TransformPoint(hit.pt);
vOS_HitPos -= vOS_HitDir * RENDER_MESH_TEST_DISTANCE * fWorldScaleInv;
IRenderMesh* pRM = pEntObject->GetRenderMesh();
AABB aabbRNode;
pRM->GetBBox(aabbRNode.min, aabbRNode.max);
Vec3 vOut(0, 0, 0);
if (!Intersect::Ray_AABB(Ray(vOS_HitPos, vOS_HitDir), aabbRNode, vOut))
{
return false;
}
if (!pRM || !pRM->GetVerticesCount())
{
return false;
}
if (RayRenderMeshIntersection(pRM, vOS_HitPos, vOS_HitDir, outPos, outNormal))
{
outNormal = objRot.TransformVector(outNormal).GetNormalized();
outPos = objMat.TransformPoint(outPos);
return true;
}
return false;
}
//////////////////////////////////////////////////////////////////////////
bool EditorViewportWidget::RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const
{
@@ -2512,7 +2229,7 @@ void EditorViewportWidget::SetViewFromEntityPerspective(const AZ::EntityId& enti
void EditorViewportWidget::SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, [[maybe_unused]] bool lockCameraMovement)
{
// This is an editor event, so is only serviced during edit mode, not play game mode
//
//
if (m_playInEditorState != PlayInEditorState::Editor)
{
AZ_Warning("EditorViewportWidget", false,
@@ -2634,7 +2351,6 @@ void EditorViewportWidget::ShowCursor()
//////////////////////////////////////////////////////////////////////////
void EditorViewportWidget::PushDisableRendering()
{
assert(m_disableRenderingCount >= 0);
++m_disableRenderingCount;
}
+3 -5
View File
@@ -19,6 +19,7 @@
#include "Undo/Undo.h"
#include "Util/PredefinedAspectRatios.h"
#include "EditorViewportSettings.h"
#include "EditorModularViewportCameraComposer.h"
#include <AzCore/Component/EntityId.h>
#include <AzCore/std/optional.h>
@@ -220,7 +221,6 @@ private:
// Draw a selected region if it has been selected
void RenderSelectedRegion();
bool AdjustObjectPosition(const ray_hit& hit, Vec3& outNormal, Vec3& outPos) const;
bool RayRenderMeshIntersection(IRenderMesh* pRenderMesh, const Vec3& vInPos, const Vec3& vInDir, Vec3& vOutPos, Vec3& vOutNormal) const;
bool AddCameraMenuItems(QMenu* menu);
@@ -370,6 +370,8 @@ private:
// This widget holds a reference to the manipulator manage because its responsible for drawing manipulators
AZStd::shared_ptr<AzToolsFramework::ManipulatorManager> m_manipulatorManager;
AZStd::unique_ptr<SandboxEditor::EditorModularViewportCameraComposer> m_editorModularViewportCameraComposer;
// Helper for getting EditorEntityNotificationBus events
AZStd::unique_ptr<AZ::ViewportHelpers::EditorEntityNotifications> m_editorEntityNotifications;
@@ -390,7 +392,3 @@ private:
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
//! Creates a modular camera controller in the configuration used by the editor viewport.
SANDBOX_API AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateModularViewportCameraController(
const AzFramework::ViewportId viewportId);
+10 -11
View File
@@ -356,10 +356,9 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh
for (int v = 0; v < meshDesc.m_nCoorCount; ++v)
{
Export::UV tc;
meshDesc.m_pTexCoord[v].ExportTo(tc.u, tc.v);
tc.v = 1.0f - tc.v;
pObj->m_texCoords.push_back(tc);
Vec2 uv = meshDesc.m_pTexCoord[v].GetUV();
uv.y = 1.0f - uv.y;
pObj->m_texCoords.push_back({uv.x,uv.y});
}
if (pIndMesh->GetSubSetCount() && !(pIndMesh->GetSubSetCount() == 1 && pIndMesh->GetSubSet(0).nNumIndices == 0))
@@ -622,7 +621,7 @@ bool CExportManager::ShowFBXExportDialog()
if (pivotObjectNode && !pivotObjectNode->IsGroupNode())
{
m_pivotEntityObject = static_cast<CEntityObject*>(GetIEditor()->GetObjectManager()->FindObject(pivotObjectNode->GetName()));
m_pivotEntityObject = static_cast<CEntityObject*>(GetIEditor()->GetObjectManager()->FindObject(pivotObjectNode->GetName().c_str()));
if (m_pivotEntityObject)
{
@@ -807,7 +806,7 @@ void CExportManager::FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode*
if (numAllTracks > 0)
{
XmlNodeRef objNode = writeNode->createNode(CleanXMLText(pObjectNode->GetName()).toUtf8().data());
XmlNodeRef objNode = writeNode->createNode(CleanXMLText(pObjectNode->GetName().c_str()).toUtf8().data());
writeNode->setAttr("time", m_animTimeExportPrimarySequenceCurrentTime);
for (unsigned int trackID = 0; trackID < numAllTracks; ++trackID)
@@ -818,7 +817,7 @@ void CExportManager::FillAnimTimeNode(XmlNodeRef writeNode, CTrackViewAnimNode*
if (trackType == AnimParamType::Animation || trackType == AnimParamType::Sound)
{
QString childName = CleanXMLText(childTrack->GetName());
QString childName = CleanXMLText(childTrack->GetName().c_str());
if (childName.isEmpty())
{
@@ -976,7 +975,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo
else
{
// In case of exporting animation/sound times data
const QString sequenceName = pSubSequence->GetName();
const QString sequenceName = QString::fromUtf8(pSubSequence->GetName().c_str());
XmlNodeRef subSeqNode2 = seqNode->createNode(sequenceName.toUtf8().data());
if (sequenceName == m_animTimeExportPrimarySequenceName)
@@ -1253,14 +1252,14 @@ void CExportManager::SaveNodeKeysTimeToXML()
m_soundKeyTimeExport = exportDialog.IsSoundExportChecked();
QString filters = "All files (*.xml)";
QString defaultName = QString(pSequence->GetName()) + ".xml";
QString defaultName = QString::fromUtf8(pSequence->GetName().c_str()) + ".xml";
QtUtil::QtMFCScopedHWNDCapture cap;
CAutoDirectoryRestoreFileDialog dlg(QFileDialog::AcceptSave, QFileDialog::AnyFile, "xml", defaultName, filters, {}, {}, cap);
if (dlg.exec())
{
m_animTimeNode = XmlHelpers::CreateXmlNode(pSequence->GetName());
m_animTimeExportPrimarySequenceName = pSequence->GetName();
m_animTimeNode = XmlHelpers::CreateXmlNode(pSequence->GetName().c_str());
m_animTimeExportPrimarySequenceName = QString::fromUtf8(pSequence->GetName().c_str());
m_data.Clear();
m_animTimeExportPrimarySequenceCurrentTime = 0.0;
-6
View File
@@ -17,12 +17,6 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_FBXExporterDialog.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
namespace
{
const uint kDefaultFPS = 30u;
}
CFBXExporterDialog::CFBXExporterDialog(bool bDisplayOnlyFPSSetting, QWidget* pParent)
: QDialog(pParent)
, m_ui(new Ui::FBXExporterDialog)
+1 -2
View File
@@ -497,8 +497,7 @@ bool CGameEngine::LoadLevel(
[[maybe_unused]] bool bDeleteAIGraph,
bool bReleaseResources)
{
LOADING_TIME_PROFILE_SECTION(GetIEditor()->GetSystem());
m_bLevelLoaded = false;
m_bLevelLoaded = false;
CLogFile::FormatLine("Loading map '%s' into engine...", m_levelPath.toUtf8().data());
// Switch the current directory back to the Primary CD folder first.
// The engine might have trouble to find some files when the current
-1
View File
@@ -102,7 +102,6 @@ private:
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
bool m_bAutoExportMode;
int m_numExportedMaterials;
static CGameExporter* m_pCurrentExporter;
};
-125
View File
@@ -161,61 +161,6 @@ void* CTriMesh::ReAllocElements(void* old_ptr, int new_elem_num, int size_of_ele
return realloc(old_ptr, new_elem_num * size_of_element);
}
//////////////////////////////////////////////////////////////////////////
// Unshare all vertices and split on 3 arrays, positions/texcoords.
//////////////////////////////////////////////////////////////////////////
void CTriMesh::SetFromMesh(CMesh& mesh)
{
bbox = mesh.m_bbox;
int maxVerts = mesh.GetIndexCount();
SetVertexCount(maxVerts);
SetUVCount(maxVerts);
if (mesh.m_pColor0)
{
SetColorsCount(maxVerts);
}
SetFacesCount(mesh.GetIndexCount());
int numv = 0;
int numface = 0;
for (int nSubset = 0; nSubset < mesh.GetSubSetCount(); nSubset++)
{
SMeshSubset& subset = mesh.m_subsets[nSubset];
for (int i = subset.nFirstIndexId; i < subset.nFirstIndexId + subset.nNumIndices; i += 3)
{
CTriFace& face = pFaces[numface++];
for (int j = 0; j < 3; j++)
{
int idx = mesh.m_pIndices[i + j];
pVertices[numv].pos = mesh.m_pPositions ? mesh.m_pPositions[idx] : mesh.m_pPositionsF16[idx].ToVec3();
pWeights[numv] = 0.0f;
pUV[numv] = mesh.m_pTexCoord[idx];
if (mesh.m_pColor0)
{
pColors[numv] = mesh.m_pColor0[idx];
}
face.v [j] = numv;
face.uv[j] = numv;
face.n [j] = mesh.m_pNorms[idx].GetN();
face.MatID = static_cast<unsigned char>(subset.nMatID);
face.flags = 0;
numv++;
}
}
}
SetFacesCount(numface);
SharePositions();
ShareUV();
UpdateEdges();
CalcFaceNormals();
}
/////////////////////////////////////////////////////////////////////////////////////
inline int FindVertexInHash(const Vec3& vPosToFind, const CTriVertex* pVectors, std::vector<int>& hash, float fEpsilon)
{
@@ -360,76 +305,6 @@ void CTriMesh::CalcFaceNormals()
#define TEX_EPS 0.001f
#define VER_EPS 0.001f
//////////////////////////////////////////////////////////////////////////
void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
{
{
const int maxVerts = nFacesCount * 3;
pIndexedMesh->SetVertexCount(maxVerts);
pIndexedMesh->SetTexCoordCount(maxVerts);
if (pColors)
{
pIndexedMesh->SetColorCount(maxVerts);
}
pIndexedMesh->SetIndexCount(0);
pIndexedMesh->SetFaceCount(nFacesCount);
}
//////////////////////////////////////////////////////////////////////////
// To find really used materials
std::vector<int> usedMaterialIds;
uint16 MatIdToSubset[MAX_SUB_MATERIALS];
uint16 nLastSubsetId = 0;
memset(MatIdToSubset, 0, sizeof(MatIdToSubset));
//////////////////////////////////////////////////////////////////////////
CMesh& mesh = *pIndexedMesh->GetMesh();
AABB bb;
bb.Reset();
for (int i = 0; i < nFacesCount; ++i)
{
const CTriFace& face = pFaces[i];
SMeshFace& meshFace = mesh.m_pFaces[i];
// Remap new used material ID to index of chunk id.
if (!MatIdToSubset[face.MatID])
{
MatIdToSubset[face.MatID] = 1 + nLastSubsetId++;
usedMaterialIds.push_back(face.MatID); // Order of material ids in usedMaterialIds correspond to the indices of chunks.
}
meshFace.nSubset = static_cast<unsigned char>(MatIdToSubset[face.MatID] - 1);
for (int j = 0; j < 3; ++j)
{
const int dstVIdx = i * 3 + j;
mesh.m_pPositions[dstVIdx] = pVertices[face.v[j]].pos;
mesh.m_pNorms[dstVIdx] = SMeshNormal(face.n[j]);
mesh.m_pTexCoord[dstVIdx] = pUV[face.uv[j]];
if (pColors)
{
mesh.m_pColor0[dstVIdx] = pColors[face.v[j]];
}
meshFace.v[j] = dstVIdx;
bb.Add(mesh.m_pPositions[dstVIdx]);
}
}
pIndexedMesh->SetBBox(bb);
pIndexedMesh->SetSubSetCount(static_cast<int>(usedMaterialIds.size()));
for (int i = 0; i < usedMaterialIds.size(); i++)
{
pIndexedMesh->SetSubsetMaterialId(i, usedMaterialIds[i]);
}
pIndexedMesh->Optimize();
}
//////////////////////////////////////////////////////////////////////////
void CTriMesh::CopyStream(CTriMesh& fromMesh, int stream)
{
-2
View File
@@ -198,8 +198,6 @@ public:
void GetStreamInfo(int stream, void*& pStream, int& nElementSize) const;
int GetStreamSize(int stream) const { return m_streamSize[stream]; };
void SetFromMesh(CMesh& mesh);
void UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const;
// Calculate per face normal.
void CalcFaceNormals();
+3 -4
View File
@@ -6,9 +6,6 @@
*
*/
#ifndef CRYINCLUDE_EDITOR_IEDITOR_H
#define CRYINCLUDE_EDITOR_IEDITOR_H
#pragma once
#ifdef PLUGIN_EXPORTS
@@ -25,6 +22,7 @@
#include <WinWidgetId.h>
#include <AzCore/Component/EntityId.h>
#include <AzCore/Debug/Budget.h>
class QMenu;
@@ -738,4 +736,5 @@ struct IInitializeUIInfo
virtual void SetInfoText(const char* text) = 0;
};
#endif // CRYINCLUDE_EDITOR_IEDITOR_H
AZ_DECLARE_BUDGET(Editor);
-10
View File
@@ -84,12 +84,6 @@ AZ_POP_DISABLE_WARNING
#include "IEditorPanelUtils.h"
#include "EditorPanelUtils.h"
// even in Release mode, the editor will return its heap, because there's no Profile build configuration for the editor
#ifdef _RELEASE
#undef _RELEASE
#endif
#include "Core/QtEditorApplication.h" // for Editor::EditorQtApplication
static CCryEditDoc * theDocument;
@@ -104,8 +98,6 @@ static CCryEditDoc * theDocument;
#define VERIFY(EXPRESSION) { auto e = EXPRESSION; assert(e); }
#endif
#undef GetCommandLine
const char* CEditorImpl::m_crashLogFileName = "SessionStatus/editor_statuses.json";
CEditorImpl::CEditorImpl()
@@ -405,8 +397,6 @@ void CEditorImpl::Update()
// Make sure this is not called recursively
m_bUpdates = false;
FUNCTION_PROFILER(GetSystem(), PROFILE_EDITOR);
//@FIXME: Restore this latter.
//if (GetGameEngine() && GetGameEngine()->IsLevelLoaded())
{
-13
View File
@@ -27,19 +27,6 @@
namespace
{
// Object names in this array must correspond to EObject enumeration.
const char* g_ObjectNames[eStatObject_COUNT] =
{
"Objects/Arrow.cgf",
"Objects/Axis.cgf",
"Objects/Sphere.cgf",
"Objects/Anchor.cgf",
"Objects/entrypoint.cgf",
"Objects/hidepoint.cgf",
"Objects/hidepoint_sec.cgf",
"Objects/reinforcement_point.cgf",
};
const char* g_IconNames[eIcon_COUNT] =
{
"Icons/ScaleWarning.png",
-3
View File
@@ -15,9 +15,6 @@
#pragma once
struct IStatObj;
struct IMaterial;
#include "Include/IIconManager.h" // for IIconManager
#include "IEditor.h" // for IDocListener
+18 -9
View File
@@ -8,14 +8,12 @@
// Description : Classes to deal with commands
#ifndef CRYINCLUDE_EDITOR_INCLUDE_COMMAND_H
#define CRYINCLUDE_EDITOR_INCLUDE_COMMAND_H
#pragma once
#include <QString>
#include <AzCore/std/containers/vector.h>
#include <AzCore/std/string/conversions.h>
#include <CryCommon/LegacyAllocator.h>
#include "Util/EditorUtils.h"
inline AZStd::string ToString(const QString& s)
@@ -23,8 +21,20 @@ inline AZStd::string ToString(const QString& s)
return s.toUtf8().data();
}
class CCommand
{
static inline bool FromString(int32 &val, const char* s) {
if(!s)
{
return false;
}
val = (int)strtol(s, nullptr, 10);
if(val==0 && errno!=0) {
return false;
}
return true;
}
public:
CCommand(
const AZStd::string& module,
@@ -77,7 +87,7 @@ public:
return false;
}
}
int GetArgCount() const
size_t GetArgCount() const
{ return m_args.size(); }
const AZStd::string& GetArg(int i) const
{
@@ -85,7 +95,7 @@ public:
return m_args[i];
}
private:
DynArray<AZStd::string> m_args;
AZStd::vector<AZStd::string,AZ::StdLegacyAllocator> m_args;
unsigned char m_stringFlags; // This is needed to quote string parameters when logging a command.
};
@@ -115,7 +125,7 @@ protected:
static inline AZStd::string ToString_(const char* val)
{ return val; }
template <typename T>
static bool FromString_(T& t, const char* s) { return ::FromString(t, s); }
static bool FromString_(T& t, const char* s) { return FromString(t, s); }
static inline bool FromString_(const char*& val, const char* s)
{ return (val = s) != 0; }
@@ -789,4 +799,3 @@ QString CCommand6<LIST(6, P)>::Execute(const CCommand::CArgs& args)
}
return "";
}
#endif // CRYINCLUDE_EDITOR_INCLUDE_COMMAND_H
-4
View File
@@ -6,8 +6,6 @@
*
*/
#pragma once
#ifndef CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H
#define CRYINCLUDE_EDITOR_INCLUDE_IEDITORMATERIAL_H
#include "BaseLibraryItem.h"
@@ -20,5 +18,3 @@ struct IEditorMaterial
virtual _smart_ptr<IMaterial> GetMatInfo(bool bUseExistingEngineMaterial = false) = 0;
virtual void DisableHighlightForFrame() = 0;
};
#endif
+2 -1
View File
@@ -9,6 +9,7 @@
#pragma once
#include "../Include/SandboxAPI.h"
#include <CryCommon/LegacyAllocator.h>
#include <set>
class QWidget;
@@ -103,7 +104,7 @@ struct IFileUtil
}
};
typedef DynArray<FileDesc> FileArray;
using FileArray = AZStd::vector<FileDesc, AZ::StdLegacyAllocator>;
typedef bool (* ScanDirectoryUpdateCallBack)(const QString& msg);
+1 -1
View File
@@ -89,7 +89,7 @@ public:
//! Get array of objects, managed by manager (not contain sub objects of groups).
//! @param layer if 0 get objects for all layers, or layer to get objects from.
virtual void GetObjects(CBaseObjectsArray& objects) const = 0;
virtual void GetObjects(DynArray<CBaseObject*>& objects) const = 0;
//virtual void GetObjects(DynArray<CBaseObject*>& objects) const = 0;
//! Get array of objects that pass the filter.
//! @param filter The filter functor, return true if you want to get the certain obj, return false if want to skip it.
@@ -1,24 +0,0 @@
/*
* 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
*
*/
// Description : Calculate the reference frame for sub-object selections.
#ifndef CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
#define CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
#pragma once
class ISubObjectSelectionReferenceFrameCalculator
{
public:
virtual void SetExplicitFrame(bool bAnySelected, const Matrix34& refFrame) = 0;
};
#endif // CRYINCLUDE_EDITOR_INCLUDE_ISUBOBJECTSELECTIONREFERENCEFRAMECALCULATOR_H
-1
View File
@@ -183,7 +183,6 @@ void CLayoutWnd::MaximizeViewport(int paneId)
QString viewClass = m_viewType[paneId];
const QRect rc = rect();
if (!m_bMaximized)
{
CLayoutViewPane* pViewPane = GetViewPane(paneId);
-16
View File
@@ -32,22 +32,6 @@ static const char lastLoadPathFilename[] = "lastLoadPath.preset";
// Folder in which levels are stored
static const char kLevelsFolder[] = "Levels";
// List of folder names that are used to detect a level folder
static const char* kLevelFolderNames[] =
{
"Layers",
"Minimap",
"LevelData"
};
// List of files that are used to detect a level folder
static const char* kLevelFileNames[] =
{
"level.pak",
"filelist.xml",
"levelshadercache.pak",
};
CLevelFileDialog::CLevelFileDialog(bool openDialog, QWidget* parent)
: QDialog(parent)
, m_bOpenDialog(openDialog)
-1
View File
@@ -64,7 +64,6 @@ private:
QString m_fileName;
QString m_filter;
const bool m_bOpenDialog;
bool m_initialized = false;
LevelTreeModel* const m_model;
LevelTreeModelFilter* const m_filterModel;
};
+3 -4
View File
@@ -9,7 +9,6 @@
#include <AzTest/AzTest.h>
#include <IEditor.h>
#include <SFunctor.h>
#include <RenderHelpers/AxisHelper.h>
class CEditorMock
@@ -85,8 +84,8 @@ public:
MOCK_METHOD0(GetObjectManager, struct IObjectManager* ());
MOCK_METHOD0(GetSettingsManager, CSettingsManager* ());
MOCK_METHOD1(GetDBItemManager, IDataBaseManager* (EDataBaseItemType));
MOCK_METHOD0(GetMaterialManagerLibrary, IBaseLibraryManager* ());
MOCK_METHOD0(GetIEditorMaterialManager, IEditorMaterialManager* ());
MOCK_METHOD0(GetMaterialManagerLibrary, IBaseLibraryManager* ());
MOCK_METHOD0(GetIEditorMaterialManager, IEditorMaterialManager* ());
MOCK_METHOD0(GetIconManager, IIconManager* ());
MOCK_METHOD0(GetMusicManager, CMusicManager* ());
MOCK_METHOD2(GetTerrainElevation, float(float , float ));
@@ -183,7 +182,7 @@ public:
MOCK_METHOD0(GetEnv, SSystemGlobalEnvironment* ());
MOCK_METHOD0(GetImageUtil, IImageUtil* ());
MOCK_METHOD0(GetEditorSettings, SEditorSettings* ());
MOCK_METHOD0(GetLogFile, ILogFile* ());
MOCK_METHOD0(GetLogFile, ILogFile* ());
MOCK_METHOD0(UnloadPlugins, void());
MOCK_METHOD0(LoadPlugins, void());
MOCK_METHOD1(GetSearchPath, QString(EEditorPathName));
@@ -7,6 +7,7 @@
*/
#include <AtomToolsFramework/Viewport/ModularViewportCameraController.h>
#include <AzCore/Settings/SettingsRegistryImpl.h>
#include <AzFramework/Viewport/ViewportControllerList.h>
#include <AzToolsFramework/Input/QtEventToAzInputManager.h>
#include <AzToolsFramework/UnitTest/AzToolsFrameworkTestHelpers.h>
@@ -19,41 +20,43 @@ namespace UnitTest
using AzToolsFramework::ViewportInteraction::MouseInteractionEvent;
class ModularViewportCameraControllerFixture : public AllocatorsTestFixture
class ViewportMouseCursorRequestImpl : public AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Handler
{
public:
static const AzFramework::ViewportId TestViewportId;
void SetUp() override
void Connect(const AzFramework::ViewportId viewportId, AzToolsFramework::QtEventToAzInputMapper* inputChannelMapper)
{
AllocatorsTestFixture::SetUp();
m_rootWidget = AZStd::make_unique<QWidget>();
m_rootWidget->setFixedSize(WidgetSize);
m_controllerList = AZStd::make_shared<AzFramework::ViewportControllerList>();
m_controllerList->RegisterViewportContext(TestViewportId);
m_inputChannelMapper = AZStd::make_unique<AzToolsFramework::QtEventToAzInputMapper>(m_rootWidget.get(), TestViewportId);
AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Handler::BusConnect(viewportId);
m_inputChannelMapper = inputChannelMapper;
}
void TearDown() override
void Disconnect()
{
m_inputChannelMapper.reset();
m_controllerList->UnregisterViewportContext(TestViewportId);
m_controllerList.reset();
m_rootWidget.reset();
AllocatorsTestFixture::TearDown();
AzToolsFramework::ViewportInteraction::ViewportMouseCursorRequestBus::Handler::BusDisconnect();
}
AZStd::unique_ptr<QWidget> m_rootWidget;
AzFramework::ViewportControllerListPtr m_controllerList;
AZStd::unique_ptr<AzToolsFramework::QtEventToAzInputMapper> m_inputChannelMapper;
// ViewportMouseCursorRequestBus overrides ...
void BeginCursorCapture() override;
void EndCursorCapture() override;
bool IsMouseOver() const override;
private:
AzToolsFramework::QtEventToAzInputMapper* m_inputChannelMapper = nullptr;
};
const AzFramework::ViewportId ModularViewportCameraControllerFixture::TestViewportId = AzFramework::ViewportId(0);
void ViewportMouseCursorRequestImpl::BeginCursorCapture()
{
m_inputChannelMapper->SetCursorCaptureEnabled(true);
}
void ViewportMouseCursorRequestImpl::EndCursorCapture()
{
m_inputChannelMapper->SetCursorCaptureEnabled(false);
}
bool ViewportMouseCursorRequestImpl::IsMouseOver() const
{
return true;
}
class TestModularCameraViewportContextImpl : public AtomToolsFramework::ModularCameraViewportContext
{
@@ -77,94 +80,290 @@ namespace UnitTest
AZ::Transform m_cameraTransform = AZ::Transform::CreateIdentity();
};
TEST_F(ModularViewportCameraControllerFixture, Mouse_movement_does_not_accumulate_excessive_drift_in_modular_viewport_camera)
class ModularViewportCameraControllerFixture : public AllocatorsTestFixture
{
AzFramework::NativeWindowHandle nativeWindowHandle = nullptr;
public:
static const AzFramework::ViewportId TestViewportId;
const float deltaTime = 1.0f / 60.0f; // mimic 60fps
void SetUp() override
{
AllocatorsTestFixture::SetUp();
m_rootWidget = AZStd::make_unique<QWidget>();
m_rootWidget->setFixedSize(WidgetSize);
m_controllerList = AZStd::make_shared<AzFramework::ViewportControllerList>();
m_controllerList->RegisterViewportContext(TestViewportId);
m_inputChannelMapper = AZStd::make_unique<AzToolsFramework::QtEventToAzInputMapper>(m_rootWidget.get(), TestViewportId);
m_settingsRegistry = AZStd::make_unique<AZ::SettingsRegistryImpl>();
AZ::SettingsRegistry::Register(m_settingsRegistry.get());
}
void TearDown() override
{
AZ::SettingsRegistry::Unregister(m_settingsRegistry.get());
m_settingsRegistry.reset();
m_inputChannelMapper.reset();
m_controllerList->UnregisterViewportContext(TestViewportId);
m_controllerList.reset();
m_rootWidget.reset();
AllocatorsTestFixture::TearDown();
}
void PrepareCollaborators()
{
AzFramework::NativeWindowHandle nativeWindowHandle = nullptr;
// listen for events signaled from QtEventToAzInputMapper and forward to the controller list
QObject::connect(
m_inputChannelMapper.get(), &AzToolsFramework::QtEventToAzInputMapper::InputChannelUpdated, m_rootWidget.get(),
[this, nativeWindowHandle](const AzFramework::InputChannel* inputChannel, [[maybe_unused]] QEvent* event)
{
m_controllerList->HandleInputChannelEvent(
AzFramework::ViewportControllerInputEvent{ TestViewportId, nativeWindowHandle, *inputChannel });
});
m_mockWindowRequests.Connect(nativeWindowHandle);
using ::testing::Return;
// note: WindowRequests is used internally by ModularViewportCameraController, this ensures it returns the viewport size we want
ON_CALL(m_mockWindowRequests, GetClientAreaSize())
.WillByDefault(Return(AzFramework::WindowSize(WidgetSize.width(), WidgetSize.height())));
// respond to begin/end cursor capture events
m_viewportMouseCursorRequests.Connect(TestViewportId, m_inputChannelMapper.get());
// create editor modular camera
m_editorModularViewportCameraComposer = AZStd::make_unique<SandboxEditor::EditorModularViewportCameraComposer>(TestViewportId);
auto controller = m_editorModularViewportCameraComposer->CreateModularViewportCameraController();
// set some overrides for the test
controller->SetCameraViewportContextBuilderCallback(
[this](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
{
cameraViewportContext = AZStd::make_unique<TestModularCameraViewportContextImpl>();
m_cameraViewportContextView = cameraViewportContext.get();
});
// disable smoothing in the test
controller->SetCameraPropsBuilderCallback(
[](AzFramework::CameraProps& cameraProps)
{
cameraProps.m_rotateSmoothingEnabledFn = []
{
return false;
};
cameraProps.m_translateSmoothingEnabledFn = []
{
return false;
};
});
m_controllerList->Add(controller);
}
void HaltCollaborators()
{
m_editorModularViewportCameraComposer.reset();
m_mockWindowRequests.Disconnect();
m_viewportMouseCursorRequests.Disconnect();
m_cameraViewportContextView = nullptr;
}
void RepeatDiagonalMouseMovements(const AZStd::function<float()>& deltaTimeFn)
{
// move to the center of the screen
const auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2);
MouseMove(m_rootWidget.get(), start, QPoint(0, 0));
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTimeFn()), AZ::ScriptTimePoint() });
// move mouse diagonally to top right, then to bottom left and back repeatedly
auto current = start;
auto halfDelta = QPoint(200, -200);
const int iterationsPerDiagonal = 50;
for (int diagonals = 0; diagonals < 80; ++diagonals)
{
for (int i = 0; i < iterationsPerDiagonal; ++i)
{
MousePressAndMove(m_rootWidget.get(), current, halfDelta / iterationsPerDiagonal, Qt::MouseButton::RightButton);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTimeFn()), AZ::ScriptTimePoint() });
current += halfDelta / iterationsPerDiagonal;
}
if (diagonals % 2 == 0)
{
halfDelta.setX(halfDelta.x() * -1);
halfDelta.setY(halfDelta.y() * -1);
}
}
QTest::mouseRelease(m_rootWidget.get(), Qt::MouseButton::RightButton, Qt::KeyboardModifier::NoModifier, current);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTimeFn()), AZ::ScriptTimePoint() });
}
AZStd::unique_ptr<QWidget> m_rootWidget;
AzFramework::ViewportControllerListPtr m_controllerList;
AZStd::unique_ptr<AzToolsFramework::QtEventToAzInputMapper> m_inputChannelMapper;
::testing::NiceMock<MockWindowRequests> m_mockWindowRequests;
ViewportMouseCursorRequestImpl m_viewportMouseCursorRequests;
AtomToolsFramework::ModularCameraViewportContext* m_cameraViewportContextView = nullptr;
AZStd::unique_ptr<AZ::SettingsRegistryInterface> m_settingsRegistry;
AZStd::unique_ptr<SandboxEditor::EditorModularViewportCameraComposer> m_editorModularViewportCameraComposer;
};
const AzFramework::ViewportId ModularViewportCameraControllerFixture::TestViewportId = AzFramework::ViewportId(0);
TEST_F(ModularViewportCameraControllerFixture, MouseMovementDoesNotAccumulateExcessiveDriftInModularViewportCameraWithVaryingDeltaTime)
{
SandboxEditor::SetCameraCaptureCursorForLook(false);
// Given
// listen for events signaled from QtEventToAzInputMapper and forward to the controller list
QObject::connect(
m_inputChannelMapper.get(), &AzToolsFramework::QtEventToAzInputMapper::InputChannelUpdated, m_rootWidget.get(),
[this, nativeWindowHandle](const AzFramework::InputChannel* inputChannel, [[maybe_unused]] QEvent* event)
PrepareCollaborators();
// When
RepeatDiagonalMouseMovements(
[t = 0.0f]() mutable
{
m_controllerList->HandleInputChannelEvent(
AzFramework::ViewportControllerInputEvent{ TestViewportId, nativeWindowHandle, *inputChannel });
// vary between 30 and 50 fps (40 +/- 10)
const float fps = 40.0f + (10.0f * AZStd::sin(t));
t += AZ::DegToRad(5.0f);
return 1.0f / fps;
});
using ::testing::NiceMock;
using ::testing::Return;
// Then
// ensure the camera rotation is the identity (no significant drift has occurred as we moved the mouse)
const AZ::Transform cameraRotation = m_cameraViewportContextView->GetCameraTransform();
EXPECT_THAT(cameraRotation.GetRotation(), IsClose(AZ::Quaternion::CreateIdentity()));
NiceMock<MockWindowRequests> mockWindowRequests;
mockWindowRequests.Connect(nativeWindowHandle);
// Clean-up
HaltCollaborators();
}
// note: WindowRequests is used internally by ModularViewportCameraController, this ensures it returns the viewport size we want
ON_CALL(mockWindowRequests, GetClientAreaSize())
.WillByDefault(Return(AzFramework::WindowSize(WidgetSize.width(), WidgetSize.height())));
class ModularViewportCameraControllerDeltaTimeParamFixture
: public ModularViewportCameraControllerFixture
, public ::testing::WithParamInterface<float> // delta time
{
};
// create editor modular camera
auto controller = CreateModularViewportCameraController(TestViewportId);
TEST_P(
ModularViewportCameraControllerDeltaTimeParamFixture,
MouseMovementDoesNotAccumulateExcessiveDriftInModularViewportCameraWithFixedDeltaTime)
{
SandboxEditor::SetCameraCaptureCursorForLook(false);
// set some overrides for the test
AtomToolsFramework::ModularCameraViewportContext* cameraViewportContextView = nullptr;
controller->SetCameraViewportContextBuilderCallback(
[&cameraViewportContextView](AZStd::unique_ptr<AtomToolsFramework::ModularCameraViewportContext>& cameraViewportContext)
// Given
PrepareCollaborators();
// When
RepeatDiagonalMouseMovements(
[this]
{
cameraViewportContext = AZStd::make_unique<TestModularCameraViewportContextImpl>();
cameraViewportContextView = cameraViewportContext.get();
return GetParam();
});
controller->SetCameraPropsBuilderCallback(
[](AzFramework::CameraProps& cameraProps)
{
cameraProps.m_rotateSmoothingEnabledFn = []
{
return false;
};
// Then
// ensure the camera rotation is the identity (no significant drift has occurred as we moved the mouse)
const AZ::Transform cameraRotation = m_cameraViewportContextView->GetCameraTransform();
EXPECT_THAT(cameraRotation.GetRotation(), IsClose(AZ::Quaternion::CreateIdentity()));
cameraProps.m_translateSmoothingEnabledFn = []
{
return false;
};
});
// Clean-up
HaltCollaborators();
}
m_controllerList->Add(controller);
INSTANTIATE_TEST_CASE_P(
All, ModularViewportCameraControllerDeltaTimeParamFixture, testing::Values(1.0f / 60.0f, 1.0f / 50.0f, 1.0f / 30.0f));
TEST_F(ModularViewportCameraControllerFixture, MouseMovementOrientatesCameraWhenCursorIsCaptured)
{
// Given
PrepareCollaborators();
// ensure cursor is captured
SandboxEditor::SetCameraCaptureCursorForLook(true);
const float deltaTime = 1.0f / 60.0f;
// When
// move to the center of the screen
auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2);
MouseMove(m_rootWidget.get(), start, QPoint(0, 0));
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// When
// move mouse diagonally to top right, then to bottom left and back repeatedly
auto current = start;
auto halfDelta = QPoint(200, -200);
const int iterationsPerDiagonal = 50;
for (int diagonals = 0; diagonals < 80; ++diagonals)
{
for (int i = 0; i < iterationsPerDiagonal; ++i)
{
MousePressAndMove(m_rootWidget.get(), current, halfDelta / iterationsPerDiagonal, Qt::MouseButton::RightButton);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
current += halfDelta / iterationsPerDiagonal;
}
const auto mouseDelta = QPoint(5, 0);
if (diagonals % 2 == 0)
{
halfDelta.setX(halfDelta.x() * -1);
halfDelta.setY(halfDelta.y() * -1);
}
// initial movement to begin the camera behavior
MousePressAndMove(m_rootWidget.get(), start, mouseDelta, Qt::MouseButton::RightButton);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// move the cursor right
for (int i = 0; i < 50; ++i)
{
MousePressAndMove(m_rootWidget.get(), start + mouseDelta, mouseDelta, Qt::MouseButton::RightButton);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
}
QTest::mouseRelease(m_rootWidget.get(), Qt::MouseButton::RightButton, Qt::KeyboardModifier::NoModifier, current);
// move the cursor left (do an extra iteration moving left to account for the initial dead-zone)
for (int i = 0; i < 51; ++i)
{
MousePressAndMove(m_rootWidget.get(), start + mouseDelta, -mouseDelta, Qt::MouseButton::RightButton);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
}
QTest::mouseRelease(m_rootWidget.get(), Qt::MouseButton::RightButton, Qt::KeyboardModifier::NoModifier, start + mouseDelta);
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// Then
// ensure the camera rotation is the identity (no significant drift has occurred as we moved the mouse)
const AZ::Transform cameraRotation = cameraViewportContextView->GetCameraTransform();
EXPECT_THAT(cameraRotation.GetRotation(), IsClose(AZ::Quaternion::CreateIdentity()));
// retrieve the amount of yaw rotation
const AZ::Quaternion cameraRotation = m_cameraViewportContextView->GetCameraTransform().GetRotation();
const auto eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromQuaternion(cameraRotation));
mockWindowRequests.Disconnect();
// camera should be back at the center (no yaw)
using ::testing::FloatNear;
EXPECT_THAT(eulerAngles.GetZ(), FloatNear(0.0f, 0.001f));
// Clean-up
HaltCollaborators();
}
TEST_F(ModularViewportCameraControllerFixture, CameraDoesNotContinueToRotateGivenNoInputWhenCaptured)
{
// Given
PrepareCollaborators();
SandboxEditor::SetCameraCaptureCursorForLook(true);
const float deltaTime = 1.0f / 60.0f;
// When
// move to the center of the screen
auto start = QPoint(WidgetSize.width() / 2, WidgetSize.height() / 2);
MouseMove(m_rootWidget.get(), start, QPoint(0, 0));
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
// will move a small amount initially
const auto mouseDelta = QPoint(5, 0);
MousePressAndMove(m_rootWidget.get(), start, mouseDelta, Qt::MouseButton::RightButton);
// ensure further updates to not continue to rotate
for (int i = 0; i < 50; ++i)
{
m_controllerList->UpdateViewport({ TestViewportId, AzFramework::FloatSeconds(deltaTime), AZ::ScriptTimePoint() });
}
// Then
// ensure the camera rotation is no longer the identity
const AZ::Quaternion cameraRotation = m_cameraViewportContextView->GetCameraTransform().GetRotation();
const auto eulerAngles = AzFramework::EulerAngles(AZ::Matrix3x3::CreateFromQuaternion(cameraRotation));
// initial amount of rotation after first mouse move
using ::testing::FloatNear;
EXPECT_THAT(eulerAngles.GetZ(), FloatNear(-0.025f, 0.001f));
// Clean-up
HaltCollaborators();
}
} // namespace UnitTest
+6 -7
View File
@@ -179,19 +179,17 @@ void CLogFile::FormatLineV(const char * format, va_list argList)
void CLogFile::AboutSystem()
{
char szBuffer[MAX_LOGBUFFER_SIZE];
wchar_t szBufferW[MAX_LOGBUFFER_SIZE];
#if defined(AZ_PLATFORM_WINDOWS) || defined(AZ_PLATFORM_LINUX)
//////////////////////////////////////////////////////////////////////
// Write the system informations to the log
//////////////////////////////////////////////////////////////////////
wchar_t szLanguageBufferW[64];
char szBuffer[MAX_LOGBUFFER_SIZE];
//wchar_t szCPUModel[64];
MEMORYSTATUS MemoryStatus;
#endif // defined(AZ_PLATFORM_WINDOWS) || defined(AZ_PLATFORM_LINUX)
#if defined(AZ_PLATFORM_WINDOWS)
wchar_t szLanguageBufferW[64];
DEVMODE DisplayConfig;
OSVERSIONINFO OSVerInfo;
OSVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
@@ -288,7 +286,7 @@ AZ_POP_DISABLE_WARNING
str += "Version Unknown";
}
}
azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, " %d.%d", OSVerInfo.dwMajorVersion, OSVerInfo.dwMinorVersion);
azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, " %ld.%ld", OSVerInfo.dwMajorVersion, OSVerInfo.dwMinorVersion);
str += szBuffer;
//////////////////////////////////////////////////////////////////////
@@ -296,6 +294,7 @@ AZ_POP_DISABLE_WARNING
//////////////////////////////////////////////////////////////////////
str += " (";
wchar_t szBufferW[MAX_LOGBUFFER_SIZE];
GetWindowsDirectoryW(szBufferW, sizeof(szBufferW));
AZStd::to_string(szBuffer, MAX_LOGBUFFER_SIZE, szBufferW);
str += szBuffer;
@@ -338,7 +337,7 @@ AZ_POP_DISABLE_WARNING
str += " ";
azstrdate(szBuffer);
str += szBuffer;
azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, ", system running for %d minutes", GetTickCount() / 60000);
azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, ", system running for %ld minutes", GetTickCount() / 60000);
str += szBuffer;
CryLog("%s", str.toUtf8().data());
#else
@@ -388,7 +387,7 @@ AZ_POP_DISABLE_WARNING
L"(Unknown graphics card)", szLanguageBufferW, sizeof(szLanguageBufferW),
L"system.ini");
AZStd::to_string(szLanguageBuffer, szLanguageBufferW);
azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, "Current display mode is %dx%dx%d, %s",
azsnprintf(szBuffer, MAX_LOGBUFFER_SIZE, "Current display mode is %ldx%ldx%ld, %s",
DisplayConfig.dmPelsWidth, DisplayConfig.dmPelsHeight,
DisplayConfig.dmBitsPerPel, szLanguageBuffer.c_str());
CryLog("%s", szBuffer);
+26 -6
View File
@@ -15,6 +15,7 @@
// AzQtComponents
#include <AzQtComponents/Components/Widgets/CheckBox.h>
#include <AzQtComponents/Components/Style.h>
#include <AzQtComponents/Utilities/DesktopUtilities.h>
// Qt
#include <QMenu>
@@ -209,7 +210,7 @@ MainStatusBar::MainStatusBar(QWidget* parent)
addPermanentWidget(new StatusBarItem(QStringLiteral("connection"), true, this, true), 1);
addPermanentWidget(new StatusBarItem(QStringLiteral("game_info"), this, true), 1);
addPermanentWidget(new GameInfoItem(QStringLiteral("game_info"), this), 1);
addPermanentWidget(new MemoryStatusItem(QStringLiteral("memory"), this), 1);
}
@@ -221,11 +222,6 @@ void MainStatusBar::Init()
500
}; //in ms, so 2 FPS
AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
QString strGameInfo;
strGameInfo = tr("GameFolder: '%1'").arg(projectPath.c_str());
SetItem(QStringLiteral("game_info"), strGameInfo, tr("Game Info"), QPixmap());
//ask for updates for items regularly. This is basically what MFC does
auto timer = new QTimer(this);
timer->setInterval(statusbarTimerUpdateInterval);
@@ -436,5 +432,29 @@ QString GeneralStatusItem::CurrentText() const
return StatusBarItem::CurrentText();
}
GameInfoItem::GameInfoItem(QString name, MainStatusBar* parent)
: StatusBarItem(name, parent, true)
{
m_projectPath = QString::fromUtf8(AZ::Utils::GetProjectPath().c_str());
SetText(QObject::tr("GameFolder: '%1'").arg(m_projectPath));
SetToolTip(QObject::tr("Game Info"));
setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(this, &QWidget::customContextMenuRequested, this, &GameInfoItem::OnShowContextMenu);
}
void GameInfoItem::OnShowContextMenu(const QPoint& pos)
{
QMenu contextMenu(this);
// Context menu action to open the project folder in file browser
contextMenu.addAction(AzQtComponents::fileBrowserActionName(), this, [this]() {
AzQtComponents::ShowFileOnDesktop(m_projectPath);
});
contextMenu.exec(mapToGlobal(pos));
}
#include <moc_MainStatusBar.cpp>
#include <moc_MainStatusBarItems.cpp>
+14
View File
@@ -71,3 +71,17 @@ public:
private:
void updateStatus();
};
class GameInfoItem
: public StatusBarItem
{
Q_OBJECT
public:
GameInfoItem(QString name, MainStatusBar* parent);
private Q_SLOTS:
void OnShowContextMenu(const QPoint& pos);
private:
QString m_projectPath;
};
+1 -7
View File
@@ -108,12 +108,6 @@ using namespace AzToolsFramework;
#define LAYOUTS_WILDCARD "*.layout"
#define DUMMY_LAYOUT_NAME "Dummy_Layout"
static const char* g_openViewPaneEventName = "OpenViewPaneEvent"; //Sent when users open view panes;
static const char* g_viewPaneAttributeName = "ViewPaneName"; //Name of the current view pane
static const char* g_openLocationAttributeName = "OpenLocation"; //Indicates where the current view pane is opened from
static const char* g_assetImporterName = "AssetImporter";
class CEditorOpenViewCommand
: public _i_reference_target_t
{
@@ -303,7 +297,7 @@ MainWindow::MainWindow(QWidget* parent)
, m_settings("O3DE", "O3DE")
, m_toolbarManager(new ToolbarManager(m_actionManager, this))
, m_assetImporterManager(new AssetImporterManager(this))
, m_levelEditorMenuHandler(new LevelEditorMenuHandler(this, m_viewPaneManager, m_settings))
, m_levelEditorMenuHandler(new LevelEditorMenuHandler(this, m_viewPaneManager))
, m_sourceControlNotifHandler(new AzToolsFramework::QtSourceControlNotificationHandler(this))
, m_viewPaneHost(nullptr)
, m_autoSaveTimer(nullptr)
+2
View File
@@ -76,6 +76,7 @@
</qresource>
<qresource prefix="/Application">
<file>res/o3de_editor.ico</file>
<file alias="o3de_application_reverse.svg">res/o3de_application_reverse.svg</file>
</qresource>
<qresource prefix="/Icons">
<file alias="Eye.svg">res/Eye.svg</file>
@@ -152,6 +153,7 @@
<file alias="error_report_error.svg">res/error_report_error.svg</file>
<file alias="error_report_warning.svg">res/error_report_warning.svg</file>
<file alias="error_report_comment.svg">res/error_report_comment.svg</file>
<file alias="error_report_helper.svg">res/error_report_helper.svg</file>
<file>particles_tree_00.png</file>
<file>particles_tree_01.png</file>
<file>particles_tree_02.png</file>
+4 -51
View File
@@ -38,7 +38,6 @@
// To use the Andrew's algorithm in order to make convex hull from the points, this header is needed.
#include "Util/GeometryUtil.h"
namespace {
QColor kLinkColorParent = QColor(0, 255, 255);
QColor kLinkColorChild = QColor(0, 0, 255);
@@ -1928,7 +1927,7 @@ bool CBaseObject::HitTestRectBounds(HitContext& hc, const AABB& box)
//////////////////////////////////////////////////////////////////////////
bool CBaseObject::HitTestRect(HitContext& hc)
{
AZ_PROFILE_FUNCTION(Entity);
AZ_PROFILE_FUNCTION(Editor);
AABB box;
@@ -1965,7 +1964,7 @@ bool CBaseObject::HitHelperTest(HitContext& hc)
//////////////////////////////////////////////////////////////////////////
bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
{
AZ_PROFILE_FUNCTION(Entity);
AZ_PROFILE_FUNCTION(Editor);
bool bResult = false;
@@ -2038,7 +2037,7 @@ bool CBaseObject::HitHelperAtTest(HitContext& hc, const Vec3& pos)
//////////////////////////////////////////////////////////////////////////
CBaseObject* CBaseObject::GetChild(size_t const i) const
{
assert(i >= 0 && i < m_childs.size());
assert(i < m_childs.size());
return m_childs[i];
}
@@ -2058,53 +2057,7 @@ bool CBaseObject::IsChildOf(CBaseObject* node)
}
//////////////////////////////////////////////////////////////////////////
void CBaseObject::GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj) const
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
{
continue;
}
outAllChildren.push_back(pChild);
GetAllChildren(outAllChildren, pChild);
}
}
void CBaseObject::GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChildren, CBaseObject* pObj) const
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
{
continue;
}
outAllChildren.push_back(pChild);
GetAllChildren(outAllChildren, pChild);
}
}
void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* pObj) const
{
const CBaseObject* pBaseObj = pObj ? pObj : this;
for (size_t i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == nullptr)
{
continue;
}
outAllChildren.AddObject(pChild);
GetAllChildren(outAllChildren, pChild);
}
}
//////////////////////////////////////////////////////////////////////////
void CBaseObject::CloneChildren(CBaseObject* pFromObject)
@@ -2729,7 +2682,7 @@ void CBaseObject::SetMinSpec(uint32 nSpec, bool bSetChildren)
// Set min spec for all childs.
if (bSetChildren)
{
for (size_t i = m_childs.size() - 1; i >= 0; --i)
for (int i = static_cast<int>(m_childs.size()) - 1; i >= 0; --i)
{
m_childs[i]->SetMinSpec(nSpec, true);
}
-6
View File
@@ -33,7 +33,6 @@ class CGizmo;
class CObjectArchive;
struct SSubObjSelectionModifyContext;
struct SRayHitInfo;
class ISubObjectSelectionReferenceFrameCalculator;
class CPopupMenuItem;
class QMenu;
struct IRenderNode;
@@ -409,10 +408,6 @@ public:
CBaseObject* GetParent() const { return m_parent; };
//! Scans hierarchy up to determine if we child of specified node.
virtual bool IsChildOf(CBaseObject* node);
//! Get all child objects
void GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj = nullptr) const;
void GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChildren, CBaseObject* pObj = nullptr) const;
void GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* pObj = nullptr) const;
//! Clone Children
void CloneChildren(CBaseObject* pFromObject);
//! Attach new child node.
@@ -571,7 +566,6 @@ public:
// Return true if object support selecting of this sub object element type.
virtual bool StartSubObjSelection([[maybe_unused]] int elemType) { return false; };
virtual void EndSubObjectSelection() {};
virtual void CalculateSubObjectSelectionReferenceFrame([[maybe_unused]] ISubObjectSelectionReferenceFrameCalculator* pCalculator) { };
virtual void ModifySubObjSelection([[maybe_unused]] SSubObjSelectionModifyContext& modCtx) {};
virtual void AcceptSubObjectModify() {};
+1 -1
View File
@@ -18,6 +18,7 @@
#include "SandboxAPI.h"
#include <Cry_Color.h>
#include <Cry_Geo.h>
#include <AzCore/std/containers/vector.h>
#include <QColor>
@@ -63,7 +64,6 @@ struct SANDBOX_API DisplayContext
CDisplaySettings* settings;
IDisplayViewport* view;
IRenderer* renderer;
IRenderAuxGeom* pRenderAuxGeom;
IIconManager* pIconManager;
CCamera* camera;
+23 -6
View File
@@ -26,7 +26,6 @@
DisplayContext::DisplayContext()
{
view = 0;
renderer = 0;
flags = 0;
settings = 0;
pIconManager = 0;
@@ -1083,7 +1082,10 @@ void DisplayContext::DrawTerrainLine(Vec3 worldPos1, Vec3 worldPos2)
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawTextLabel(const Vec3& pos, float size, const char* text, const bool bCenter, [[maybe_unused]] int srcOffsetX, [[maybe_unused]] int scrOffsetY)
{
ColorF col(m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f));
AZ_ErrorOnce(nullptr, false, "DisplayContext::DrawTextLabel needs to be removed/ported to use Atom");
#if 0
ColorF col(m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f));
float fCol[4] = { col.r, col.g, col.b, col.a };
if (flags & DISPLAY_2D)
@@ -1096,13 +1098,28 @@ void DisplayContext::DrawTextLabel(const Vec3& pos, float size, const char* text
{
renderer->DrawLabelEx(pos, size, fCol, true, true, text);
}
#else
AZ_UNUSED(pos);
AZ_UNUSED(size);
AZ_UNUSED(text);
AZ_UNUSED(bCenter);
#endif
}
//////////////////////////////////////////////////////////////////////////
void DisplayContext::Draw2dTextLabel(float x, float y, float size, const char* text, bool bCenter)
{
AZ_ErrorOnce(nullptr, false, "DisplayContext::Draw2dTextLabel needs to be removed/ported to use Atom");
#if 0
float col[4] = { m_color4b.r * (1.0f / 255.0f), m_color4b.g * (1.0f / 255.0f), m_color4b.b * (1.0f / 255.0f), m_color4b.a * (1.0f / 255.0f) };
renderer->Draw2dLabel(x, y, size, col, bCenter, "%s", text);
#else
AZ_UNUSED(x);
AZ_UNUSED(y);
AZ_UNUSED(size);
AZ_UNUSED(text);
AZ_UNUSED(bCenter);
#endif
}
//////////////////////////////////////////////////////////////////////////
@@ -1261,10 +1278,6 @@ void DisplayContext::DrawTextureLabel(const Vec3& pos, int nWidth, int nHeight,
//////////////////////////////////////////////////////////////////////////
void DisplayContext::Flush2D()
{
#ifndef PHYSICS_EDITOR
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
#endif
if (m_textureLabels.empty())
{
return;
@@ -1273,6 +1286,9 @@ void DisplayContext::Flush2D()
int rcw, rch;
view->GetDimensions(&rcw, &rch);
AZ_ErrorOnce(nullptr, false, "DisplayContext::Flush2D needs to be removed/ported to use Atom");
#if 0
TransformationMatrices backupSceneMatrices;
renderer->Set2DMode(rcw, rch, backupSceneMatrices, 0.0f, 1.0f);
@@ -1314,6 +1330,7 @@ void DisplayContext::Flush2D()
}
renderer->Unset2DMode(backupSceneMatrices);
#endif
m_textureLabels.clear();
}
+2 -2
View File
@@ -497,7 +497,7 @@ bool CEntityObject::HitTestRect(HitContext& hc)
//////////////////////////////////////////////////////////////////////////
int CEntityObject::MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags)
{
AZ_PROFILE_FUNCTION(Editor);
AZ_PROFILE_FUNCTION(Entity);
if (event == eMouseMove || event == eMouseLDown)
{
@@ -1416,7 +1416,7 @@ void CEntityObject::PostClone(CBaseObject* pFromObject, CObjectCloneContext& ctx
void CEntityObject::ResolveEventTarget(CBaseObject* object, unsigned int index)
{
// Find target id.
assert(index >= 0 && index < m_eventTargets.size());
assert(index < m_eventTargets.size());
if (object)
{
object->AddEventListener(this);
-2
View File
@@ -18,8 +18,6 @@
//////////////////////////////////////////////////////////////////////////
void CGizmoManager::Display(DisplayContext& dc)
{
FUNCTION_PROFILER(GetIEditor()->GetSystem(), PROFILE_EDITOR);
AABB bbox;
std::vector<CGizmo*> todelete;
for (Gizmos::iterator it = m_gizmos.begin(); it != m_gizmos.end(); ++it)
+11 -26
View File
@@ -37,7 +37,6 @@ AZ_CVAR(
bool, ed_visibility_use, true, nullptr, AZ::ConsoleFunctorFlags::Null,
"Enable/disable using the new IVisibilitySystem for Entity visibility determination");
/*!
* Class Description used for object templates.
* This description filled from Xml template files.
@@ -760,16 +759,16 @@ void CObjectManager::GetObjects(CBaseObjectsArray& objects) const
}
}
void CObjectManager::GetObjects(DynArray<CBaseObject*>& objects) const
{
CBaseObjectsArray objectArray;
GetObjects(objectArray);
objects.clear();
for (size_t i = 0, iCount(objectArray.size()); i < iCount; ++i)
{
objects.push_back(objectArray[i]);
}
}
//void CObjectManager::GetObjects(DynArray<CBaseObject*>& objects) const
//{
// CBaseObjectsArray objectArray;
// GetObjects(objectArray);
// objects.clear();
// for (size_t i = 0, iCount(objectArray.size()); i < iCount; ++i)
// {
// objects.push_back(objectArray[i]);
// }
//}
void CObjectManager::GetObjects(CBaseObjectsArray& objects, BaseObjectFilterFunctor const& filter) const
{
@@ -1556,11 +1555,8 @@ void CObjectManager::DeleteSelection()
// Make sure to unlock selection.
GetIEditor()->LockSelection(false);
GUID bID = GUID_NULL;
int i;
CSelectionGroup objects;
for (i = 0; i < m_currSelection->GetCount(); i++)
for (int i = 0; i < m_currSelection->GetCount(); i++)
{
// Check condition(s) if object could be deleted
if (!IsObjectDeletionAllowed(m_currSelection->GetObject(i)))
@@ -2900,17 +2896,6 @@ namespace
return AZ::Vector3(position.x, position.y, position.z);
}
AZ::Vector3 PyGetWorldObjectPosition(const char* pName)
{
CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(pName);
if (!pObject)
{
throw std::logic_error((QString("\"") + pName + "\" is an invalid object.").toUtf8().data());
}
Vec3 position = pObject->GetWorldPos();
return AZ::Vector3(position.x, position.y, position.z);
}
void PySetObjectPosition(const char* pName, float fValueX, float fValueY, float fValueZ)
{
CBaseObject* pObject = GetIEditor()->GetObjectManager()->FindObject(pName);
+1 -1
View File
@@ -122,7 +122,7 @@ public:
//! Get array of objects, managed by manager (not contain sub objects of groups).
//! @param layer if 0 get objects for all layers, or layer to get objects from.
void GetObjects(CBaseObjectsArray& objects) const;
void GetObjects(DynArray<CBaseObject*>& objects) const;
//void GetObjects(DynArray<CBaseObject*>& objects) const;
//! Get array of objects that pass the filter.
//! @param filter The filter functor, return true if you want to get the certain obj, return false if want to skip it.
@@ -19,7 +19,6 @@
#include "Objects/ObjectLoader.h"
#include "Objects/SelectionGroup.h"
//////////////////////////////////////////////////////////////////////////
// CUndoBaseObjectNew implementation.
//////////////////////////////////////////////////////////////////////////
-2
View File
@@ -316,8 +316,6 @@ void CSelectionGroup::Rotate(const Ang3& angles, int referenceCoordSys)
// return;
// Rotate selection about selection center.
Vec3 center = GetCenter();
Matrix34 rotateTM = Matrix34::CreateRotationXYZ(DEG2RAD(angles));
Rotate(rotateTM, referenceCoordSys);
}
+7 -2
View File
@@ -27,9 +27,11 @@
//////////////////////////////////////////////////////////////////////////
#define AXIS_SIZE 0.1f
#if 0
namespace {
int s_highlightAxis = 0;
}
#endif
//////////////////////////////////////////////////////////////////////////
CTrackGizmo::CTrackGizmo()
@@ -175,13 +177,15 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org)
y = y * fScreenScale;
z = z * fScreenScale;
Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1);
AZ_ErrorOnce(nullptr, false, "CTrackGizmo::DrawAxis needs to be removed/ported to use Atom");
#if 0
float col[4] = { 1, 1, 1, 1 };
float hcol[4] = { 1, 0, 0, 1 };
dc.renderer->DrawLabelEx(org + x, 1.2f, col, true, true, "X");
dc.renderer->DrawLabelEx(org + y, 1.2f, col, true, true, "Y");
dc.renderer->DrawLabelEx(org + z, 1.2f, col, true, true, "Z");
Vec3 colX(1, 0, 0), colY(0, 1, 0), colZ(0, 0, 1);
if (s_highlightAxis)
{
float col2[4] = { 1, 0, 0, 1 };
@@ -201,6 +205,7 @@ void CTrackGizmo::DrawAxis(DisplayContext& dc, const Vec3& org)
dc.renderer->DrawLabelEx(org + z, 1.2f, col2, true, true, "Z");
}
}
#endif
x = x * 0.8f;
y = y * 0.8f;
@@ -33,7 +33,7 @@
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "icon_128 _2x.png",
"filename" : "icon_128_2x.png",
"scale" : "2x"
},
{
@@ -45,7 +45,7 @@
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "icon_256 _2x.png",
"filename" : "icon_256_2x.png",
"scale" : "2x"
},
{
@@ -65,4 +65,4 @@
"version" : 1,
"author" : "xcode"
}
}
}
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2
size 32037
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9f41a37d2347a617e93bd97adaf6d4c161c471ca3ef7e04b98c65ddda52396dc
size 27833
oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da
size 5980
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da
size 5980
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b07984494059bf827bc485cbea06d12e0283811face1a18799495f9ba7ae8af1
size 20779
oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7
size 644
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926
size 21857
oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7
size 644
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07631f41b8dea80713d2463f81a713a9a93798975b6fb50afbeeb13d26c57fa2
size 48899
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2
size 32037
oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6
size 12600
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6
size 12600
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926
size 21857
oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6
size 1295
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad83faf98b49f4e37112baedeae726f4f8d71bcdd1961d9cdad31f043f8ca666
size 24003
oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6
size 1295
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:68529a6c11d5ffa7ecd9d5bbb11ceea28e6852bd45946b525af09602c9a1e1bf
size 48899
oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542
size 19204
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8a70003840b418848b2ce6c18ed7cbbfcd6fcf76598a6601dca8b98d9b6c1a2f
size 114706
oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542
size 19204
@@ -33,7 +33,7 @@
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "icon_128 _2x.png",
"filename" : "icon_128_2x.png",
"scale" : "2x"
},
{
@@ -45,7 +45,7 @@
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "icon_256 _2x.png",
"filename" : "icon_256_2x.png",
"scale" : "2x"
},
{
@@ -65,4 +65,4 @@
"version" : 1,
"author" : "xcode"
}
}
}
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2
size 32037
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9f41a37d2347a617e93bd97adaf6d4c161c471ca3ef7e04b98c65ddda52396dc
size 27833
oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da
size 5980
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:94cb43469dfb05d348845883914ac6d5936e851c93ae6e76d16efea90cdc27da
size 5980
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b07984494059bf827bc485cbea06d12e0283811face1a18799495f9ba7ae8af1
size 20779
oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7
size 644
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926
size 21857
oid sha256:cc6a4cf056f9814a23a4f74ea0aa9cd3628a03c2349bef73c64edfed75788cb7
size 644
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:07631f41b8dea80713d2463f81a713a9a93798975b6fb50afbeeb13d26c57fa2
size 48899
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e38257b6917cdf5d73e90e6009f10c8736d62b20c4e785085305075c7e6320e2
size 32037
oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6
size 12600
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0e52fba265079da19fb72aefe1cb0a4b9f8075e10341084fffb38a1b0850cd6
size 12600
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e645142d284de40aafb7a4a858f3df92b6a5ba9b03fa5f1a2d3cb25211597926
size 21857
oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6
size 1295
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad83faf98b49f4e37112baedeae726f4f8d71bcdd1961d9cdad31f043f8ca666
size 24003
oid sha256:53abfa6e6b4d3eff79851a2a95c762223bc610a6646e3370fd1113c57cc8e0e6
size 1295
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:68529a6c11d5ffa7ecd9d5bbb11ceea28e6852bd45946b525af09602c9a1e1bf
size 48899
oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542
size 19204
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8a70003840b418848b2ce6c18ed7cbbfcd6fcf76598a6601dca8b98d9b6c1a2f
size 114706
oid sha256:f778e4aa9577faca2609343d435da745dc6f342ea7a726573441cecc870bf542
size 19204
+2 -2
View File
@@ -66,8 +66,8 @@ int main(int argc, char* argv[])
processLaunchInfo.m_environmentVariables = &envVars;
processLaunchInfo.m_showWindow = true;
AzFramework::ProcessWatcher* processWatcher = AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE);
AzFramework::ProcessLauncher::LaunchUnwatchedProcess(processLaunchInfo);
application.Destroy();
return 0;
+1
View File
@@ -13,6 +13,7 @@
#include "Include/IEditorClassFactory.h"
#include "Util/GuidUtil.h"
#include <map>
//! Derive from this class to decrease the amount of work for creating a new class description
//! Provides standard reference counter implementation for IUnknown
@@ -40,6 +40,7 @@
#include <LmbrCentral/Rendering/MaterialOwnerBus.h>
#include <IDisplayViewport.h>
#include <CryCommon/Cry_GeoIntersect.h>
#include <MathConversion.h>
#include <TrackView/TrackViewAnimNode.h>
#include <ViewManager.h>
@@ -49,11 +50,6 @@
* Scalars for icon drawing behavior.
*/
static const int s_kIconSize = 36; /// Icon display size (in pixels)
static const float s_kIconMaxWorldDist = 200.f; /// Icons are culled past this range
static const float s_kIconMinScale = 0.1f; /// Minimum scale for icons in the distance
static const float s_kIconMaxScale = 1.0f; /// Maximum scale for icons near the camera
static const float s_kIconCloseDist = 3.f; /// Distance at which icons are at maximum scale
static const float s_kIconFarDist = 40.f; /// Distance at which icons are at minimum scale
CComponentEntityObject::CComponentEntityObject()
: m_hasIcon(false)
@@ -528,7 +528,6 @@ void SandboxIntegrationManager::EntityParentChanged(
oldAncestor = nextParentId;
} while (oldAncestor.IsValid());
AZ::EntityId newAncestors = newParentId;
AZ::EntityId newAncestor = newParentId;
bool isGoingToRootScene = false;
@@ -721,7 +720,7 @@ void SandboxIntegrationManager::PopulateEditorGlobalContextMenu(QMenu* menu, con
if (selected.size() > 0)
{
action = menu->addAction(QObject::tr("Find in Entity Outliner"));
QObject::connect(action, &QAction::triggered, [this, selected]
QObject::connect(action, &QAction::triggered, [selected]
{
AzToolsFramework::EditorEntityContextNotificationBus::Broadcast(&EditorEntityContextNotification::OnFocusInEntityOutliner, selected);
});
@@ -842,7 +841,7 @@ void SandboxIntegrationManager::SetupLayerContextMenu(QMenu* menu)
QAction* findLayerAssetAction = menu->addAction(QObject::tr("Find layer in Asset Browser"));
findLayerAssetAction->setToolTip(QObject::tr("Selects this layer in the Asset Browser"));
QObject::connect(findLayerAssetAction, &QAction::triggered, [this, fullFilePath] {
QObject::connect(findLayerAssetAction, &QAction::triggered, [fullFilePath] {
QtViewPaneManager::instance()->OpenPane(LyViewPane::AssetBrowser);
AzToolsFramework::AssetBrowser::AssetBrowserViewRequestBus::Broadcast(
@@ -280,7 +280,6 @@ private:
private:
AZ::Vector2 m_contextMenuViewPoint;
AZ::Vector3 m_sliceWorldPos;
int m_inObjectPickMode;
short m_startedUndoRecordingNestingLevel; // used in OnBegin/EndUndo to ensure we only accept undo's we started recording
@@ -298,8 +297,6 @@ private:
const AZStd::string m_defaultComponentViewportIconLocation = "Icons/Components/Viewport/Component_Placeholder.svg";
const AZStd::string m_defaultEntityIconLocation = "Icons/Components/Viewport/Transform.svg";
bool m_debugDisplayBusImplementationActive = false;
AzToolsFramework::Prefab::PrefabIntegrationManager* m_prefabIntegrationManager = nullptr;
AzToolsFramework::EditorEntityUiInterface* m_editorEntityUiInterface = nullptr;

Some files were not shown because too many files have changed in this diff Show More