Merge branch 'development' into cmake/SPEC-2513_w4018

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>

# Conflicts:
#	Gems/EMotionFX/Code/EMotionFX/Source/Actor.cpp
monroegm-disable-blank-issue-2
Esteban Papp 4 years ago
commit 2d1ed48fea

1
.gitignore vendored

@ -25,3 +25,4 @@ TestResults/**
*.swatches
/imgui.ini
/scripts/project_manager/logs/
/AutomatedTesting/Gem/PythonTests/scripting/TestResults

@ -12,6 +12,11 @@
################################################################################
if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
# Only enable AWS automated tests on Windows
if(NOT "${PAL_PLATFORM_NAME}" STREQUAL "Windows")
return()
endif()
# Enable after installing NodeJS and CDK on jenkins Windows AMI.
ly_add_pytest(
NAME AutomatedTesting::AWSTests

@ -93,6 +93,7 @@ def run():
general.idle_wait_frames(100)
for i in range(1, 101):
benchmarker.capture_pass_timestamp(i)
benchmarker.capture_cpu_frame_time(i)
general.exit_game_mode()
helper.wait_for_condition(function=lambda: not general.is_in_game_mode(), timeout_in_seconds=2.0)
general.log("Capturing complete.")

@ -61,6 +61,25 @@ class BenchmarkHelper(object):
general.log('Failed to capture pass timestamps.')
return self.capturedData
def capture_cpu_frame_time(self, frame_number):
"""
Capture CPU frame times and block further execution until it has been written to the disk.
"""
self.handler = azlmbr.atom.ProfilingCaptureNotificationBusHandler()
self.handler.connect()
self.handler.add_callback('OnCaptureCpuFrameTimeFinished', self.on_data_captured)
self.done = False
self.capturedData = False
success = azlmbr.atom.ProfilingCaptureRequestBus(
azlmbr.bus.Broadcast, "CaptureCpuFrameTime", f'{self.output_path}/cpu_frame{frame_number}_time.json')
if success:
self.wait_until_data()
general.log('CPU frame time captured.')
else:
general.log('Failed to capture CPU frame time.')
return self.capturedData
def on_data_captured(self, parameters):
# the parameters come in as a tuple
if parameters[0]:

@ -99,6 +99,7 @@ class TestPerformanceBenchmarkSuite(object):
expected_lines = [
"Benchmark metadata captured.",
"Pass timestamps captured.",
"CPU frame time captured.",
"Capturing complete.",
"Captured data successfully."
]
@ -106,6 +107,7 @@ class TestPerformanceBenchmarkSuite(object):
unexpected_lines = [
"Failed to capture data.",
"Failed to capture pass timestamps.",
"Failed to capture CPU frame time.",
"Failed to capture benchmark metadata."
]

@ -93,11 +93,11 @@ def ScriptCanvasComponent_OnEntityActivatedDeactivated_PrintMessage():
if entity_dict["name"] == "Controller":
sc_component.get_property_tree()
sc_component.set_component_property_value(
"Properties|Variable Fields|Variables|[0]|Name,Value|Datum|Datum|EntityToActivate",
"Properties|Variables|EntityToActivate|Datum|Datum|value|EntityToActivate",
entity_to_activate.id,
)
sc_component.set_component_property_value(
"Properties|Variable Fields|Variables|[1]|Name,Value|Datum|Datum|EntityToDeactivate",
"Properties|Variables|EntityToDeactivate|Datum|Datum|value|EntityToDeactivate",
entity_to_deactivate.id,
)
return entity

@ -11,7 +11,6 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
if (PAL_TRAIT_BUILD_SERIALIZECONTEXTTOOLS)
list(APPEND additional_dependencies AZ::SerializeContextTools) # test_CLITool_SerializeContextTools depends on it
endif()
list(APPEND additional_dependencies AZ::AssetBundlerBatch) # test_CLITool_AssetBundlerBatch_Works depends on it
ly_add_pytest(
NAME AutomatedTesting::SmokeTest
@ -26,26 +25,27 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
${aditional_dependencies}
AZ::AzTestRunner
AZ::AssetBundlerBatch
${additional_dependencies}
COMPONENT
Smoke
)
ly_add_pytest(
NAME AutomatedTesting::SandboxTest
TEST_SUITE sandbox
NAME AutomatedTesting::LoadLevelGPU
TEST_SUITE smoke
TEST_SERIAL
PATH ${CMAKE_CURRENT_LIST_DIR}
PYTEST_MARKS "SUITE_sandbox"
TIMEOUT 1500
TEST_REQUIRES gpu
PATH ${CMAKE_CURRENT_LIST_DIR}/test_RemoteConsole_GPULoadLevel_Works.py
TIMEOUT 100
RUNTIME_DEPENDENCIES
AZ::AssetProcessor
AZ::PythonBindingsExample
Legacy::Editor
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
COMPONENT
Sandbox
Smoke
)
ly_add_pytest(
@ -74,4 +74,5 @@ if(PAL_TRAIT_BUILD_TESTS_SUPPORTED AND PAL_TRAIT_BUILD_HOST_TOOLS)
AutomatedTesting.GameLauncher
AutomatedTesting.Assets
)
endif()

@ -0,0 +1,44 @@
"""
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
UI Apps: AutomatedTesting.GameLauncher
Launch AutomatedTesting.GameLauncher with Simple level
Test should run in both gpu and non gpu
"""
import pytest
import psutil
import ly_test_tools.environment.waiter as waiter
import editor_python_test_tools.hydra_test_utils as editor_test_utils
from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
from ly_remote_console.remote_console_commands import (
send_command_and_expect_response as send_command_and_expect_response,
)
@pytest.mark.parametrize("launcher_platform", ["windows"])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("level", ["Simple"])
@pytest.mark.SUITE_smoke
class TestRemoteConsoleLoadLevelWorks(object):
@pytest.fixture
def remote_console_instance(self, request):
console = RemoteConsole()
def teardown():
if console.connected:
console.stop()
request.addfinalizer(teardown)
return console
def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
expected_lines = ['Level system is loading "Simple"']
editor_test_utils.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines, null_renderer=True)

@ -0,0 +1,43 @@
"""
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
UI Apps: AutomatedTesting.GameLauncher
Launch AutomatedTesting.GameLauncher with Simple level
Test should run in both gpu and non gpu
"""
import pytest
import psutil
import ly_test_tools.environment.waiter as waiter
import editor_python_test_tools.hydra_test_utils as editor_test_utils
from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
from ly_remote_console.remote_console_commands import (
send_command_and_expect_response as send_command_and_expect_response,
)
@pytest.mark.parametrize("launcher_platform", ["windows"])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("level", ["Simple"])
class TestRemoteConsoleLoadLevelWorks(object):
@pytest.fixture
def remote_console_instance(self, request):
console = RemoteConsole()
def teardown():
if console.connected:
console.stop()
request.addfinalizer(teardown)
return console
def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
expected_lines = ['Level system is loading "Simple"']
editor_test_utils.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines, null_renderer=False)

@ -1,105 +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
UI Apps: AutomatedTesting.GameLauncher
Launch AutomatedTesting.GameLauncher with Simple level
Test should run in both gpu and non gpu
"""
import pytest
import psutil
# Bail on the test if ly_test_tools doesn't exist.
pytest.importorskip("ly_test_tools")
import ly_test_tools.environment.waiter as waiter
from ly_remote_console.remote_console_commands import RemoteConsole as RemoteConsole
from ly_remote_console.remote_console_commands import (
send_command_and_expect_response as send_command_and_expect_response,
)
@pytest.mark.parametrize("launcher_platform", ["windows"])
@pytest.mark.parametrize("project", ["AutomatedTesting"])
@pytest.mark.parametrize("level", ["Simple"])
@pytest.mark.SUITE_sandbox
class TestRemoteConsoleLoadLevelWorks(object):
@pytest.fixture
def remote_console_instance(self, request):
console = RemoteConsole()
def teardown():
if console.connected:
console.stop()
request.addfinalizer(teardown)
return console
def test_RemoteConsole_LoadLevel_Works(self, launcher, level, remote_console_instance, launcher_platform):
expected_lines = ['Level system is loading "Simple"']
self.launch_and_validate_results_launcher(launcher, level, remote_console_instance, expected_lines)
def launch_and_validate_results_launcher(
self,
launcher,
level,
remote_console_instance,
expected_lines,
null_renderer=False,
port_listener_timeout=120,
log_monitor_timeout=300,
remote_console_port=4600,
):
"""
Runs the launcher with the specified level, and monitors Game.log for expected lines.
:param launcher: Configured launcher object to run test against.
:param level: The level to load in the launcher.
:param remote_console_instance: Configured Remote Console object.
:param expected_lines: Expected lines to search log for.
:oaram null_renderer: Specifies the test does not require the renderer. Defaults to True.
:param port_listener_timeout: Timeout for verifying successful connection to Remote Console.
:param log_monitor_timeout: Timeout for monitoring for lines in Game.log
:param remote_console_port: The port used to communicate with the Remote Console.
"""
def _check_for_listening_port(port):
"""
Checks to see if the connection to the designated port was established.
:param port: Port to listen to.
:return: True if port is listening.
"""
port_listening = False
for conn in psutil.net_connections():
if "port={}".format(port) in str(conn):
port_listening = True
return port_listening
if null_renderer:
launcher.args.extend(["-NullRenderer"])
# Start the Launcher
with launcher.start():
# Ensure Remote Console can be reached
waiter.wait_for(
lambda: _check_for_listening_port(remote_console_port),
port_listener_timeout,
exc=AssertionError("Port {} not listening.".format(remote_console_port)),
)
remote_console_instance.start(timeout=30)
# Load the specified level in the launcher
send_command_and_expect_response(
remote_console_instance, f"loadlevel {level}", "LEVEL_LOAD_END", timeout=30
)
# Monitor the console for expected lines
for line in expected_lines:
assert remote_console_instance.expect_log_line(
line, log_monitor_timeout
), f"Expected line not found: {line}"

@ -28,8 +28,8 @@ include(cmake/FileUtil.cmake)
include(cmake/PAL.cmake)
include(cmake/PALTools.cmake)
include(cmake/RuntimeDependencies.cmake)
include(cmake/Install.cmake)
include(cmake/Configurations.cmake) # Requires to be after PAL so we get platform variable definitions
include(cmake/Install.cmake)
include(cmake/Dependencies.cmake)
include(cmake/Deployment.cmake)
include(cmake/3rdParty.cmake)

@ -952,7 +952,8 @@ void Q2DViewport::DrawViewerMarker(DisplayContext& dc)
dc.SetColor(QColor(0, 0, 255)); // blue
dc.DrawWireBox(-dim * noScale, dim * noScale);
float fov = GetIEditor()->GetSystem()->GetViewCamera().GetFov();
constexpr float DefaultFov = 60.f;
float fov = DefaultFov;
Vec3 q[4];
float dist = 30;

@ -25,7 +25,7 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_AboutDialog.h>
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=NULL*/)
CAboutDialog::CAboutDialog(QString versionText, QString richTextCopyrightNotice, QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_ui(new Ui::CAboutDialog)
{

@ -16,7 +16,6 @@
// Editor
#include "TrackView/TrackViewDialog.h"
#include "RenderViewport.h"
#include "ViewManager.h"
#include "Objects/SelectionGroup.h"
#include "Include/IObjectManager.h"
@ -29,7 +28,7 @@ class CMovieCallback
: public IMovieCallback
{
protected:
virtual void OnMovieCallback(ECallbackReason reason, [[maybe_unused]] IAnimNode* pNode)
void OnMovieCallback(ECallbackReason reason, [[maybe_unused]] IAnimNode* pNode) override
{
switch (reason)
{
@ -49,7 +48,7 @@ protected:
}
}
void OnSetCamera(const SCameraParams& Params)
void OnSetCamera(const SCameraParams& Params) override
{
// Only switch camera when in Play mode.
GUID camObjId = GUID_NULL;
@ -61,15 +60,6 @@ protected:
{
camObjId = pEditorEntity->GetId();
}
CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
{
if (!rvp->IsSequenceCamera())
{
return;
}
}
}
// Switch camera in active rendering view.
@ -79,14 +69,14 @@ protected:
}
};
bool IsSequenceCamUsed() const
bool IsSequenceCamUsed() const override
{
if (gEnv->IsEditorGameMode() == true)
{
return true;
}
if (GetIEditor()->GetViewManager() == NULL)
if (GetIEditor()->GetViewManager() == nullptr)
{
return false;
}
@ -113,7 +103,7 @@ public:
CAnimationContextPostRender(CAnimationContext* pAC)
: m_pAC(pAC){}
void OnPostRender() const { assert(m_pAC); m_pAC->OnPostRender(); }
void OnPostRender() const override { assert(m_pAC); m_pAC->OnPostRender(); }
protected:
CAnimationContext* m_pAC;

@ -82,6 +82,7 @@ AzAssetBrowserWindow::AzAssetBrowserWindow(QWidget* parent)
m_ui->m_assetBrowserTableViewWidget->setVisible(false);
m_ui->m_toggleDisplayViewBtn->setVisible(false);
m_ui->m_searchWidget->SetFilterInputInterval(AZStd::chrono::milliseconds(250));
if (ed_useNewAssetBrowserTableView)
{
m_ui->m_toggleDisplayViewBtn->setVisible(true);

@ -24,10 +24,10 @@ class CUndoBaseLibrary
: public IUndoObject
{
public:
CUndoBaseLibrary(CBaseLibrary* pLib, const QString& description, const QString& selectedItem = 0)
CUndoBaseLibrary(CBaseLibrary* pLib, const QString& description, const QString& selectedItem = QString())
: m_pLib(pLib)
, m_description(description)
, m_redo(0)
, m_redo(nullptr)
, m_selectedItem(selectedItem)
{
assert(m_pLib);
@ -36,16 +36,16 @@ public:
m_pLib->Serialize(m_undo, false);
}
virtual QString GetEditorObjectName()
QString GetEditorObjectName() override
{
return m_selectedItem;
}
protected:
virtual int GetSize() { return sizeof(CUndoBaseLibrary); }
virtual QString GetDescription() { return m_description; };
int GetSize() override { return sizeof(CUndoBaseLibrary); }
QString GetDescription() override { return m_description; };
virtual void Undo(bool bUndo)
void Undo(bool bUndo) override
{
if (bUndo)
{
@ -57,7 +57,7 @@ protected:
GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
}
virtual void Redo()
void Redo() override
{
m_pLib->Serialize(m_redo, true);
m_pLib->SetModified();
@ -107,7 +107,7 @@ void CBaseLibrary::RemoveAllItems()
// Unregister item in case it was registered. It is ok if it wasn't. This is still safe to call.
m_pManager->UnregisterItem(m_items[i]);
// Clear library item.
m_items[i]->m_library = NULL;
m_items[i]->m_library = nullptr;
}
m_items.clear();
Release();
@ -216,7 +216,7 @@ IDataBaseItem* CBaseLibrary::FindItem(const QString& name)
return m_items[i];
}
}
return NULL;
return nullptr;
}
bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
@ -233,8 +233,8 @@ bool CBaseLibrary::AddLibraryToSourceControl(const QString& fullPathName) const
bool CBaseLibrary::SaveLibrary(const char* name, bool saveEmptyLibrary)
{
assert(name != NULL);
if (name == NULL)
assert(name != nullptr);
if (name == nullptr)
{
CryFatalError("The library you are attempting to save has no name specified.");
return false;

@ -54,7 +54,7 @@ public:
}
protected:
virtual int GetSize()
int GetSize() override
{
return m_size;
}
@ -64,7 +64,7 @@ protected:
return m_description;
}
virtual void Undo(bool bUndo)
void Undo(bool bUndo) override
{
//find the libItem
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
@ -95,7 +95,7 @@ protected:
libItem->Serialize(m_undoCtx);
}
virtual void Redo()
void Redo() override
{
//find the libItem
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
@ -124,7 +124,7 @@ private:
//////////////////////////////////////////////////////////////////////////
CBaseLibraryItem::CBaseLibraryItem()
{
m_library = 0;
m_library = nullptr;
GenerateId();
m_bModified = false;
}
@ -266,7 +266,7 @@ void CBaseLibraryItem::SetLibrary(CBaseLibrary* pLibrary)
void CBaseLibraryItem::SetModified(bool bModified)
{
m_bModified = bModified;
if (m_bModified && m_library != NULL)
if (m_bModified && m_library != nullptr)
{
m_library->SetModified(bModified);
}

@ -26,7 +26,7 @@ class CUndoBaseLibraryManager
: public IUndoObject
{
public:
CUndoBaseLibraryManager(CBaseLibraryManager* pMngr, const QString& description, const QString& modifiedManager = 0)
CUndoBaseLibraryManager(CBaseLibraryManager* pMngr, const QString& description, const QString& modifiedManager = nullptr)
: m_pMngr(pMngr)
, m_description(description)
, m_editorObject(modifiedManager)
@ -35,16 +35,16 @@ public:
SerializeTo(m_undos);
}
virtual QString GetEditorObjectName()
QString GetEditorObjectName() override
{
return m_editorObject;
}
protected:
virtual int GetSize() { return sizeof(CUndoBaseLibraryManager); }
virtual QString GetDescription() { return m_description; };
int GetSize() override { return sizeof(CUndoBaseLibraryManager); }
QString GetDescription() override { return m_description; };
virtual void Undo(bool bUndo)
void Undo(bool bUndo) override
{
if (bUndo)
{
@ -55,7 +55,7 @@ protected:
GetIEditor()->Notify(eNotify_OnDataBaseUpdate);
}
virtual void Redo()
void Redo() override
{
m_pMngr->ClearAll();
UnserializeFrom(m_redos);
@ -203,7 +203,7 @@ int CBaseLibraryManager::FindLibraryIndex(const QString& library)
//////////////////////////////////////////////////////////////////////////
IDataBaseItem* CBaseLibraryManager::FindItem(REFGUID guid) const
{
CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, (CBaseLibraryItem*)0);
CBaseLibraryItem* pMtl = stl::find_in_map(m_itemsGuidMap, guid, nullptr);
return pMtl;
}
@ -226,7 +226,7 @@ void CBaseLibraryManager::SplitFullItemName(const QString& fullItemName, QString
IDataBaseItem* CBaseLibraryManager::FindItemByName(const QString& fullItemName)
{
AZStd::lock_guard<AZStd::mutex> lock(m_itemsNameMapMutex);
return stl::find_in_map(m_itemsNameMap, fullItemName, 0);
return stl::find_in_map(m_itemsNameMap, fullItemName, nullptr);
}
//////////////////////////////////////////////////////////////////////////
@ -420,7 +420,7 @@ IDataBaseLibrary* CBaseLibraryManager::GetLibrary(int index) const
//////////////////////////////////////////////////////////////////////////
IDataBaseLibrary* CBaseLibraryManager::GetLevelLibrary() const
{
IDataBaseLibrary* pLevelLib = NULL;
IDataBaseLibrary* pLevelLib = nullptr;
for (int i = 0; i < GetLibraryCount(); i++)
{
@ -531,7 +531,7 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
// search for strings in the database that might have a similar name (ignore case)
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
{
//Check if the item is in the target library first.
IDataBaseLibrary* itemLibrary = pItem->GetLibrary();
@ -590,7 +590,7 @@ QString CBaseLibraryManager::MakeUniqueItemName(const QString& srcName, const QS
void CBaseLibraryManager::Validate()
{
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
{
pItem->Validate();
}
@ -617,7 +617,7 @@ void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem, REFGUID newGuid)
{
return;
}
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, (CBaseLibraryItem*)0);
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, newGuid, nullptr);
if (!pOldItem)
{
pItem->m_guid = newGuid;
@ -677,7 +677,7 @@ void CBaseLibraryManager::RegisterItem(CBaseLibraryItem* pItem)
{
return;
}
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), (CBaseLibraryItem*)0);
CBaseLibraryItem* pOldItem = stl::find_in_map(m_itemsGuidMap, pItem->GetGUID(), nullptr);
if (!pOldItem)
{
m_itemsGuidMap[pItem->GetGUID()] = pItem;
@ -789,7 +789,7 @@ QString CBaseLibraryManager::MakeFullItemName(IDataBaseLibrary* pLibrary, const
void CBaseLibraryManager::GatherUsedResources(CUsedResources& resources)
{
IDataBaseItemEnumerator* pEnum = GetItemEnumerator();
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != NULL; pItem = pEnum->GetNext())
for (IDataBaseItem* pItem = pEnum->GetFirst(); pItem != nullptr; pItem = pEnum->GetNext())
{
pItem->GatherUsedResources(resources);
}
@ -815,15 +815,15 @@ void CBaseLibraryManager::OnEditorNotifyEvent(EEditorNotifyEvent event)
switch (event)
{
case eNotify_OnBeginNewScene:
SetSelectedItem(0);
SetSelectedItem(nullptr);
ClearAll();
break;
case eNotify_OnBeginSceneOpen:
SetSelectedItem(0);
SetSelectedItem(nullptr);
ClearAll();
break;
case eNotify_OnCloseScene:
SetSelectedItem(0);
SetSelectedItem(nullptr);
ClearAll();
break;
}

@ -34,7 +34,7 @@ public:
CANCEL = QDialog::Rejected
};
CCheckOutDialog(const QString& file, QWidget* pParent = NULL); // standard constructor
CCheckOutDialog(const QString& file, QWidget* pParent = nullptr); // standard constructor
virtual ~CCheckOutDialog();
// Dialog Data

@ -48,7 +48,7 @@ namespace Config
}
}
return NULL;
return nullptr;
}
const IConfigVar* CConfigGroup::GetVar(const char* szName) const
@ -63,7 +63,7 @@ namespace Config
}
}
return NULL;
return nullptr;
}
IConfigVar* CConfigGroup::GetVar(uint index)
@ -73,7 +73,7 @@ namespace Config
return m_vars[index];
}
return NULL;
return nullptr;
}
const IConfigVar* CConfigGroup::GetVar(uint index) const
@ -83,7 +83,7 @@ namespace Config
return m_vars[index];
}
return NULL;
return nullptr;
}
void CConfigGroup::SaveToXML(XmlNodeRef node)
@ -127,7 +127,7 @@ namespace Config
case IConfigVar::eType_STRING:
{
string currentValue = 0;
string currentValue = nullptr;
var->Get(&currentValue);
node->setAttr(szName, currentValue);
break;
@ -186,7 +186,7 @@ namespace Config
case IConfigVar::eType_STRING:
{
string currentValue = 0;
string currentValue = nullptr;
var->GetDefault(&currentValue);
QString readValue(currentValue.c_str());
if (node->getAttr(szName, readValue))

@ -37,7 +37,7 @@ namespace Config
, m_description(szDescription)
, m_type(varType)
, m_flags(flags)
, m_ptr(NULL)
, m_ptr(nullptr)
{};
virtual ~IConfigVar() = default;

@ -28,7 +28,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
CString* pArrNames = pRecentFileList->m_arrNames;
assert(pArrNames != NULL);
assert(pArrNames != nullptr);
if (!pArrNames)
{
return;
@ -52,7 +52,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
if (m_pParent->IsCustomizeMode())
{
m_dwHideFlags = 0;
SetEnabled(TRUE);
SetEnabled(true);
return;
}
@ -61,7 +61,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
SetDescription("No recently opened files");
m_dwHideFlags = 0;
SetEnabled(FALSE);
SetEnabled(false);
return;
}
@ -105,7 +105,7 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
int nId = iMRU + GetFirstMruID();
CXTPControl* pControl = m_pControls->Add(xtpControlButton, nId, _T(""), m_nIndex + iLastValidMRU + 1, TRUE);
CXTPControl* pControl = m_pControls->Add(xtpControlButton, nId, _T(""), m_nIndex + iLastValidMRU + 1, true);
assert(pControl);
pControl->SetCaption(CXTPControlWindowList::ConstructCaption(strName, iLastValidMRU + 1));
@ -130,6 +130,6 @@ void CControlMRU::OnCalcDynamicSize(DWORD dwMode)
SetCaption(CString(MAKEINTRESOURCE(IDS_NORECENTFILE_CAPTION)));
SetDescription("No recently opened files");
m_dwHideFlags = 0;
SetEnabled(FALSE);
SetEnabled(false);
}
}

@ -62,7 +62,7 @@ int crtAllocHook(int nAllocType, void* pvData,
{
if (nBlockUse == _CRT_BLOCK)
{
return(TRUE);
return TRUE;
}
static int total_cnt = 0;

@ -127,7 +127,6 @@ AZ_POP_DISABLE_WARNING
#include "Util/AutoDirectoryRestoreFileDialog.h"
#include "Util/EditorAutoLevelLoadTest.h"
#include "Util/IndexedFiles.h"
#include "AboutDialog.h"
#include <AzToolsFramework/PythonTerminal/ScriptHelpDialog.h>
@ -267,13 +266,13 @@ CCrySingleDocTemplate* CCryDocManager::SetDefaultTemplate(CCrySingleDocTemplate*
// Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
void CCryDocManager::OnFileNew()
{
assert(m_pDefTemplate != NULL);
assert(m_pDefTemplate != nullptr);
m_pDefTemplate->OpenDocumentFile(NULL);
m_pDefTemplate->OpenDocumentFile(nullptr);
// if returns NULL, the user has already been alerted
}
BOOL CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT nIDSTitle,
[[maybe_unused]] DWORD lFlags, BOOL bOpenFileDialog, [[maybe_unused]] CDocTemplate* pTemplate)
bool CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT nIDSTitle,
[[maybe_unused]] DWORD lFlags, bool bOpenFileDialog, [[maybe_unused]] CDocTemplate* pTemplate)
{
CLevelFileDialog levelFileDialog(bOpenFileDialog);
levelFileDialog.show();
@ -287,15 +286,15 @@ BOOL CCryDocManager::DoPromptFileName(QString& fileName, [[maybe_unused]] UINT n
return false;
}
CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU)
CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, bool bAddToMRU)
{
assert(lpszFileName != NULL);
assert(lpszFileName != nullptr);
// find the highest confidence
auto pos = m_templateList.begin();
CCrySingleDocTemplate::Confidence bestMatch = CCrySingleDocTemplate::noAttempt;
CCrySingleDocTemplate* pBestTemplate = NULL;
CCryEditDoc* pOpenDocument = NULL;
CCrySingleDocTemplate* pBestTemplate = nullptr;
CCryEditDoc* pOpenDocument = nullptr;
if (lpszFileName[0] == '\"')
{
@ -312,7 +311,7 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToM
auto pTemplate = *(pos++);
CCrySingleDocTemplate::Confidence match;
assert(pOpenDocument == NULL);
assert(pOpenDocument == nullptr);
match = pTemplate->MatchDocType(szPath.toUtf8().data(), pOpenDocument);
if (match > bestMatch)
{
@ -325,18 +324,18 @@ CCryEditDoc* CCryDocManager::OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToM
}
}
if (pOpenDocument != NULL)
if (pOpenDocument != nullptr)
{
return pOpenDocument;
}
if (pBestTemplate == NULL)
if (pBestTemplate == nullptr)
{
QMessageBox::critical(AzToolsFramework::GetActiveWindow(), QString(), QObject::tr("Failed to open document."));
return NULL;
return nullptr;
}
return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, FALSE);
return pBestTemplate->OpenDocumentFile(szPath.toUtf8().data(), bAddToMRU, false);
}
//////////////////////////////////////////////////////////////////////////////
@ -654,7 +653,7 @@ struct SharedData
//
// This function uses a technique similar to that described in KB
// article Q141752 to locate the previous instance of the application. .
BOOL CCryEditApp::FirstInstance(bool bForceNewInstance)
bool CCryEditApp::FirstInstance(bool bForceNewInstance)
{
QSystemSemaphore sem(QString(O3DEApplicationName) + "_sem", 1);
sem.acquire();
@ -802,12 +801,12 @@ void CCryEditApp::InitDirectory()
// Needed to work with custom memory manager.
//////////////////////////////////////////////////////////////////////////
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible /*= true*/)
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, bool bMakeVisible /*= true*/)
{
return OpenDocumentFile(lpszPathName, true, bMakeVisible);
}
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL bAddToMRU, [[maybe_unused]] BOOL bMakeVisible)
CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, bool bAddToMRU, [[maybe_unused]] bool bMakeVisible)
{
CCryEditDoc* pCurDoc = GetIEditor()->GetDocument();
@ -848,8 +847,8 @@ CCryEditDoc* CCrySingleDocTemplate::OpenDocumentFile(LPCTSTR lpszPathName, BOOL
CCrySingleDocTemplate::Confidence CCrySingleDocTemplate::MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch)
{
assert(lpszPathName != NULL);
rpDocMatch = NULL;
assert(lpszPathName != nullptr);
rpDocMatch = nullptr;
// go through all documents
CCryEditDoc* pDoc = GetIEditor()->GetDocument();
@ -1056,7 +1055,7 @@ AZ::Outcome<void, AZStd::string> CCryEditApp::InitGameSystem(HWND hwndForInputSy
}
/////////////////////////////////////////////////////////////////////////////
BOOL CCryEditApp::CheckIfAlreadyRunning()
bool CCryEditApp::CheckIfAlreadyRunning()
{
bool bForceNewInstance = false;
@ -1300,7 +1299,7 @@ void CCryEditApp::InitLevel(const CEditCommandLineInfo& cmdInfo)
}
/////////////////////////////////////////////////////////////////////////////
BOOL CCryEditApp::InitConsole()
bool CCryEditApp::InitConsole()
{
// Execute command from cmdline -exec_line if applicable
if (!m_execLineCmd.isEmpty())
@ -1432,7 +1431,7 @@ struct CCryEditApp::PythonOutputHandler
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
}
virtual ~PythonOutputHandler()
~PythonOutputHandler() override
{
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
}
@ -1464,7 +1463,7 @@ struct PythonTestOutputHandler final
: public CCryEditApp::PythonOutputHandler
{
PythonTestOutputHandler() = default;
virtual ~PythonTestOutputHandler() = default;
~PythonTestOutputHandler() override = default;
void OnTraceMessage(AZStd::string_view message) override
{
@ -1590,7 +1589,7 @@ void CCryEditApp::RunInitPythonScript(CEditCommandLineInfo& cmdInfo)
/////////////////////////////////////////////////////////////////////////////
// CCryEditApp initialization
BOOL CCryEditApp::InitInstance()
bool CCryEditApp::InitInstance()
{
QElapsedTimer startupTimer;
startupTimer.start();
@ -1617,7 +1616,7 @@ BOOL CCryEditApp::InitInstance()
{
CAboutDialog aboutDlg(FormatVersion(m_pEditor->GetFileVersion()), FormatRichTextCopyrightNotice());
aboutDlg.exec();
return FALSE;
return false;
}
// Reflect property control classes to the serialize context...
@ -1627,9 +1626,6 @@ BOOL CCryEditApp::InitInstance()
ReflectedVarInit::setupReflection(serializeContext);
RegisterReflectedVarHandlers();
QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
CreateSplashScreen();
// Register the application's document templates. Document templates
@ -1715,18 +1711,6 @@ BOOL CCryEditApp::InitInstance()
if (IsInRegularEditorMode())
{
CIndexedFiles::Create();
if (gEnv->pConsole->GetCVar("ed_indexfiles")->GetIVal())
{
Log("Started game resource files indexing...");
CIndexedFiles::StartFileIndexing();
}
else
{
Log("Game resource files indexing is disabled.");
}
// QuickAccessBar creation should be before m_pMainWnd->SetFocus(),
// since it receives the focus at creation time. It brakes MainFrame key accelerators.
m_pQuickAccessBar = new CQuickAccessBar;
@ -1772,7 +1756,7 @@ BOOL CCryEditApp::InitInstance()
}
}
SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), 0);
SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), nullptr);
if (!GetIEditor()->IsInMatEditMode())
{
m_pEditor->InitFinished();
@ -1857,8 +1841,8 @@ void CCryEditApp::RegisterEventLoopHook(IEventLoopHook* pHook)
void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
{
IEventLoopHook* pPrevious = 0;
for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != 0; pHook = pHook->pNextHook)
IEventLoopHook* pPrevious = nullptr;
for (IEventLoopHook* pHook = m_pEventLoopHook; pHook != nullptr; pHook = pHook->pNextHook)
{
if (pHook == pHookToRemove)
{
@ -1871,7 +1855,7 @@ void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
m_pEventLoopHook = pHookToRemove->pNextHook;
}
pHookToRemove->pNextHook = 0;
pHookToRemove->pNextHook = nullptr;
return;
}
}
@ -1894,7 +1878,7 @@ void CCryEditApp::LoadFile(QString fileName)
if (MainWindow::instance() || m_pConsoleDialog)
{
SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
}
GetIEditor()->SetModifiedFlag(false);
@ -1935,7 +1919,7 @@ void CCryEditApp::EnableAccelerator([[maybe_unused]] bool bEnable)
CMainFrame *mainFrame = (CMainFrame*)m_pMainWnd;
if (mainFrame->m_hAccelTable)
DestroyAcceleratorTable( mainFrame->m_hAccelTable );
mainFrame->m_hAccelTable = NULL;
mainFrame->m_hAccelTable = nullptr;
mainFrame->LoadAccelTable( MAKEINTRESOURCE(IDR_GAMEACCELERATOR) );
CLogFile::WriteLine( "Disable Accelerators" );
}
@ -2163,12 +2147,6 @@ int CCryEditApp::ExitInstance(int exitCode)
}
}
if (IsInRegularEditorMode())
{
CIndexedFiles::AbortFileIndexing();
CIndexedFiles::Destroy();
}
if (GetIEditor() && !GetIEditor()->IsInMatEditMode())
{
//Nobody seems to know in what case that kind of exit can happen so instrumented to see if it happens at all
@ -2278,7 +2256,7 @@ void CCryEditApp::EnableIdleProcessing()
AZ_Assert(m_disableIdleProcessingCounter >= 0, "m_disableIdleProcessingCounter must be nonnegative");
}
BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
bool CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
{
if (0 == m_disableIdleProcessingCounter)
{
@ -2286,7 +2264,7 @@ BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
}
else
{
return 0;
return false;
}
}
@ -3161,7 +3139,7 @@ void CCryEditApp::OnCreateLevel()
//////////////////////////////////////////////////////////////////////////
bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
{
BOOL bIsDocModified = GetIEditor()->GetDocument()->IsModified();
bool bIsDocModified = GetIEditor()->GetDocument()->IsModified();
if (GetIEditor()->GetDocument()->IsDocumentReady() && bIsDocModified)
{
QString str = QObject::tr("Level %1 has been changed. Save Level?").arg(GetIEditor()->GetGameEngine()->GetLevelName());
@ -3249,11 +3227,11 @@ bool CCryEditApp::CreateLevel(bool& wasCreateLevelOperationCancelled)
#ifdef WIN32
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
nullptr,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
windowsErrorMessage.data(),
windowsErrorMessage.length(), NULL);
windowsErrorMessage.length(), nullptr);
_getcwd(cwd.data(), cwd.length());
#else
windowsErrorMessage = strerror(dw);
@ -3663,24 +3641,12 @@ void CCryEditApp::OnToolsPreferences()
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchToDefaultCamera()
{
CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
{
rvp->SetDefaultCamera();
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
{
Q_ASSERT(action->isCheckable());
CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
{
action->setEnabled(true);
action->setChecked(rvp->IsDefaultCamera());
}
else
{
action->setEnabled(false);
}
@ -3689,39 +3655,12 @@ void CCryEditApp::OnUpdateSwitchToDefaultCamera(QAction* action)
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchToSequenceCamera()
{
CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
{
rvp->SetSequenceCamera();
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
{
Q_ASSERT(action->isCheckable());
CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport))
{
bool enableAction = false;
// only enable if we're editing a sequence in Track View and have cameras in the level
if (GetIEditor()->GetAnimation()->GetSequence())
{
AZ::EBusAggregateResults<AZ::EntityId> componentCameras;
Camera::CameraBus::BroadcastResult(componentCameras, &Camera::CameraRequests::GetCameras);
const int numCameras = componentCameras.values.size();
enableAction = (numCameras > 0);
}
action->setEnabled(enableAction);
action->setChecked(rvp->IsSequenceCamera());
}
else
{
action->setEnabled(false);
}
@ -3730,31 +3669,12 @@ void CCryEditApp::OnUpdateSwitchToSequenceCamera(QAction* action)
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchToSelectedcamera()
{
CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
{
rvp->SetSelectedCamera();
}
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
{
Q_ASSERT(action->isCheckable());
AzToolsFramework::EntityIdList selectedEntityList;
AzToolsFramework::ToolsApplicationRequests::Bus::BroadcastResult(selectedEntityList, &AzToolsFramework::ToolsApplicationRequests::GetSelectedEntities);
AZ::EBusAggregateResults<AZ::EntityId> cameras;
Camera::CameraBus::BroadcastResult(cameras, &Camera::CameraRequests::GetCameras);
bool isCameraComponentSelected = selectedEntityList.size() > 0 ? AZStd::find(cameras.values.begin(), cameras.values.end(), *selectedEntityList.begin()) != cameras.values.end() : false;
CViewport* pViewport = GetIEditor()->GetViewManager()->GetSelectedViewport();
CRenderViewport* rvp = viewport_cast<CRenderViewport*>(pViewport);
if (isCameraComponentSelected && rvp)
{
action->setEnabled(true);
action->setChecked(rvp->IsSelectedCamera());
}
else
{
action->setEnabled(false);
}
@ -3763,11 +3683,7 @@ void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchcameraNext()
{
CViewport* vp = GetIEditor()->GetActiveView();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
{
rvp->CycleCamera();
}
}
//////////////////////////////////////////////////////////////////////////
@ -3840,7 +3756,7 @@ bool CCryEditApp::IsInRegularEditorMode()
void CCryEditApp::OnOpenQuickAccessBar()
{
if (m_pQuickAccessBar == NULL)
if (m_pQuickAccessBar == nullptr)
{
return;
}
@ -4188,7 +4104,7 @@ extern "C" int AZ_DLL_EXPORT CryEditMain(int argc, char* argv[])
int exitCode = 0;
BOOL didCryEditStart = CCryEditApp::instance()->InitInstance();
bool didCryEditStart = CCryEditApp::instance()->InitInstance();
AZ_Error("Editor", didCryEditStart, "O3DE Editor did not initialize correctly, and will close."
"\nThis could be because of incorrectly configured components, or missing required gems."
"\nSee other errors for more details.");

@ -135,16 +135,16 @@ public:
virtual void AddToRecentFileList(const QString& lpszPathName);
ECreateLevelResult CreateLevel(const QString& levelName, QString& fullyQualifiedLevelName);
static void InitDirectory();
BOOL FirstInstance(bool bForceNewInstance = false);
bool FirstInstance(bool bForceNewInstance = false);
void InitFromCommandLine(CEditCommandLineInfo& cmdInfo);
BOOL CheckIfAlreadyRunning();
bool CheckIfAlreadyRunning();
//! @return successful outcome if initialization succeeded. or failed outcome with error message.
AZ::Outcome<void, AZStd::string> InitGameSystem(HWND hwndForInputSystem);
void CreateSplashScreen();
void InitPlugins();
bool InitGame();
BOOL InitConsole();
bool InitConsole();
int IdleProcessing(bool bBackground);
bool IsWindowInForeground();
void RunInitPythonScript(CEditCommandLineInfo& cmdInfo);
@ -171,9 +171,9 @@ public:
// Overrides
// ClassWizard generated virtual function overrides
public:
virtual BOOL InitInstance();
virtual bool InitInstance();
virtual int ExitInstance(int exitCode = 0);
virtual BOOL OnIdle(LONG lCount);
virtual bool OnIdle(LONG lCount);
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName);
CCryDocManager* GetDocManager() { return m_pDocManager; }
@ -448,8 +448,8 @@ public:
~CCrySingleDocTemplate() {};
// avoid creating another CMainFrame
// close other type docs before opening any things
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bAddToMRU, BOOL bMakeVisible);
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, BOOL bMakeVisible = TRUE);
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, bool bAddToMRU, bool bMakeVisible);
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszPathName, bool bMakeVisible = true);
virtual Confidence MatchDocType(LPCTSTR lpszPathName, CCryEditDoc*& rpDocMatch);
private:
@ -465,9 +465,9 @@ public:
CCrySingleDocTemplate* SetDefaultTemplate(CCrySingleDocTemplate* pNew);
// Copied from MFC to get rid of the silly ugly unoverridable doc-type pick dialog
virtual void OnFileNew();
virtual BOOL DoPromptFileName(QString& fileName, UINT nIDSTitle,
DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate);
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName, BOOL bAddToMRU);
virtual bool DoPromptFileName(QString& fileName, UINT nIDSTitle,
DWORD lFlags, bool bOpenFileDialog, CDocTemplate* pTemplate);
virtual CCryEditDoc* OpenDocumentFile(LPCTSTR lpszFileName, bool bAddToMRU);
QVector<CCrySingleDocTemplate*> m_templateList;
};

@ -19,6 +19,7 @@
#include <AzCore/Asset/AssetManager.h>
#include <AzCore/Interface/Interface.h>
#include <AzCore/Utils/Utils.h>
#include <MathConversion.h>
// AzFramework
#include <AzFramework/Archive/IArchive.h>
@ -53,6 +54,7 @@
#include "MainWindow.h"
#include "LevelFileDialog.h"
#include "StatObjBus.h"
#include "Undo/Undo.h"
#include <Atom/RPI.Public/ViewportContext.h>
#include <Atom/RPI.Public/ViewportContextBus.h>
@ -95,7 +97,7 @@ namespace Internal
{
bool SaveLevel()
{
if (!GetIEditor()->GetDocument()->DoSave(GetIEditor()->GetDocument()->GetActivePathName(), TRUE))
if (!GetIEditor()->GetDocument()->DoSave(GetIEditor()->GetDocument()->GetActivePathName(), true))
{
return false;
}
@ -261,7 +263,7 @@ void CCryEditDoc::DeleteContents()
GetIEditor()->GetObjectManager()->DeleteAllObjects();
// Load scripts data
SetModifiedFlag(FALSE);
SetModifiedFlag(false);
SetModifiedModules(eModifiedNothing);
// Clear error reports if open.
CErrorReportDialog::Clear();
@ -303,7 +305,7 @@ void CCryEditDoc::Save(TDocMultiArchive& arrXmlAr)
{
CAutoDocNotReady autoDocNotReady;
if (arrXmlAr[DMAS_GENERAL] != NULL)
if (arrXmlAr[DMAS_GENERAL] != nullptr)
{
(*arrXmlAr[DMAS_GENERAL]).root = XmlHelpers::CreateXmlNode("Level");
(*arrXmlAr[DMAS_GENERAL]).root->setAttr("WaterColor", m_waterColor);
@ -481,7 +483,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
if (!pObj)
{
pObj = GetIEditor()->GetObjectManager()->NewObject("SequenceObject", 0, fullname);
pObj = GetIEditor()->GetObjectManager()->NewObject("SequenceObject", nullptr, fullname);
}
}
}
@ -665,7 +667,7 @@ int CCryEditDoc::GetModifiedModule()
return m_modifiedModuleFlags;
}
BOOL CCryEditDoc::CanCloseFrame()
bool CCryEditDoc::CanCloseFrame()
{
// Ask the base class to ask for saving, which also includes the save
// status of the plugins. Additionaly we query if all the plugins can exit
@ -674,21 +676,21 @@ BOOL CCryEditDoc::CanCloseFrame()
// are not serialized in the project file
if (!SaveModified())
{
return FALSE;
return false;
}
if (!GetIEditor()->GetPluginManager()->CanAllPluginsExitNow())
{
return FALSE;
return false;
}
// If there is an export in process, exiting will corrupt it
if (CGameExporter::GetCurrentExporter() != nullptr)
{
return FALSE;
return false;
}
return TRUE;
return true;
}
bool CCryEditDoc::SaveModified()
@ -733,7 +735,7 @@ bool CCryEditDoc::OnOpenDocument(const QString& lpszPathName)
TOpenDocContext context;
if (!BeforeOpenDocument(lpszPathName, context))
{
return FALSE;
return false;
}
return DoOpenDocument(context);
}
@ -776,7 +778,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
context.absoluteLevelPath = absolutePath;
context.absoluteSlicePath = "";
}
return TRUE;
return true;
}
bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
@ -813,7 +815,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
if (!LoadXmlArchiveArray(arrXmlAr, levelFilePath, levelFolderAbsolutePath))
{
m_bLoadFailed = true;
return FALSE;
return false;
}
}
if (!LoadLevel(arrXmlAr, context.absoluteLevelPath))
@ -825,7 +827,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
if (m_bLoadFailed)
{
return FALSE;
return false;
}
// Load AZ entities for the editor.
@ -846,7 +848,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
if (m_bLoadFailed)
{
return FALSE;
return false;
}
StartStreamingLoad();
@ -863,7 +865,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
// level.
SetLevelExported(true);
return TRUE;
return true;
}
bool CCryEditDoc::OnNewDocument()
@ -959,7 +961,7 @@ bool CCryEditDoc::BeforeSaveDocument(const QString& lpszPathName, TSaveDocContex
bool bSaved(true);
context.bSaved = bSaved;
return TRUE;
return true;
}
bool CCryEditDoc::HasLayerNameConflicts() const
@ -1044,7 +1046,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
else
{
CLogFile::WriteLine("$3Document successfully saved");
SetModifiedFlag(FALSE);
SetModifiedFlag(false);
SetModifiedModules(eModifiedNothing);
MainWindow::instance()->ResetAutoSaveTimers();
}
@ -1596,7 +1598,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
// Set level path directly *after* DeleteContents(), since that will unload the previous level and clear the level path.
GetIEditor()->GetGameEngine()->SetLevelPath(folderPath);
SetModifiedFlag(TRUE); // dirty during de-serialize
SetModifiedFlag(true); // dirty during de-serialize
SetModifiedModules(eModifiedAll);
Load(arrXmlAr, absoluteCryFilePath);
@ -1606,7 +1608,7 @@ bool CCryEditDoc::LoadLevel(TDocMultiArchive& arrXmlAr, const QString& absoluteC
{
pIPak->GetResourceList(AZ::IO::IArchive::RFOM_NextLevel)->Clear();
}
SetModifiedFlag(FALSE); // start off with unmodified
SetModifiedFlag(false); // start off with unmodified
SetModifiedModules(eModifiedNothing);
SetDocumentReady(true);
GetIEditor()->Notify(eNotify_OnEndLoad);
@ -1982,7 +1984,7 @@ void CCryEditDoc::OnStartLevelResourceList()
gEnv->pCryPak->GetResourceList(AZ::IO::IArchive::RFOM_Level)->Clear();
}
BOOL CCryEditDoc::DoFileSave()
bool CCryEditDoc::DoFileSave()
{
if (GetEditMode() == CCryEditDoc::DocumentEditingMode::LevelEdit)
{
@ -2000,15 +2002,15 @@ BOOL CCryEditDoc::DoFileSave()
QString newLevelPath = filename.left(filename.lastIndexOf('/') + 1);
GetIEditor()->GetDocument()->SetPathName(filename);
GetIEditor()->GetGameEngine()->SetLevelPath(newLevelPath);
return TRUE;
return true;
}
}
return FALSE;
return false;
}
}
if (!IsDocumentReady())
{
return FALSE;
return false;
}
return Internal::SaveLevel();
@ -2063,7 +2065,7 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
GetISystem()->GetISystemEventDispatcher()->OnSystemEvent(ESYSTEM_EVENT_LEVEL_LOAD_END, 0, 0);
GetIEditor()->Notify(eNotify_OnEndNewScene);
SetModifiedFlag(FALSE);
SetModifiedFlag(false);
SetLevelExported(false);
SetModifiedModules(eModifiedNothing);
@ -2077,13 +2079,13 @@ void CCryEditDoc::CreateDefaultLevelAssets([[maybe_unused]] int resolution, [[ma
void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
{
if (pVar == NULL)
if (pVar == nullptr)
{
return;
}
XmlNodeRef node = GetEnvironmentTemplate();
if (node == NULL)
if (node == nullptr)
{
return;
}
@ -2101,7 +2103,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
XmlNodeRef groupNode = node->getChild(nGroup);
if (groupNode == NULL)
if (groupNode == nullptr)
{
return;
}
@ -2112,7 +2114,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
}
XmlNodeRef childNode = groupNode->getChild(nChild);
if (childNode == NULL)
if (childNode == nullptr)
{
return;
}
@ -2139,7 +2141,7 @@ QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath) const
return Path::AddPathSlash(levelPath + levelName + "_editor");
}
BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath)
bool CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath)
{
auto pIPak = GetIEditor()->GetSystem()->GetIPak();
@ -2148,7 +2150,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
CXmlArchive* pXmlAr = new CXmlArchive();
if (!pXmlAr)
{
return FALSE;
return false;
}
CXmlArchive& xmlAr = *pXmlAr;
@ -2159,7 +2161,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
bool openLevelPakFileSuccess = pIPak->OpenPack(levelPath.toUtf8().data(), absoluteLevelPath.toUtf8().data());
if (!openLevelPakFileSuccess)
{
return FALSE;
return false;
}
CPakFile pakFile;
@ -2167,13 +2169,13 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
pIPak->ClosePack(absoluteLevelPath.toUtf8().data());
if (!loadFromPakSuccess)
{
return FALSE;
return false;
}
FillXmlArArray(arrXmlAr, &xmlAr);
}
return TRUE;
return true;
}
void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)

@ -82,7 +82,7 @@ public: // Create from serialization only
bool DoSave(const QString& pathName, bool replace);
SANDBOX_API bool Save();
virtual BOOL DoFileSave();
virtual bool DoFileSave();
bool SaveModified();
virtual bool BackupBeforeSave(bool bForce = false);
@ -102,7 +102,7 @@ public: // Create from serialization only
bool IsLevelExported() const;
void SetLevelExported(bool boExported = true);
BOOL CanCloseFrame();
bool CanCloseFrame();
enum class FetchPolicy
{
@ -144,7 +144,7 @@ protected:
};
bool BeforeOpenDocument(const QString& lpszPathName, TOpenDocContext& context);
bool DoOpenDocument(TOpenDocContext& context);
virtual BOOL LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath);
virtual bool LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString& absoluteLevelPath, const QString& levelPath);
virtual void ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr);
virtual void Load(TDocMultiArchive& arrXmlAr, const QString& szFilename);

@ -359,7 +359,7 @@ namespace
{
AZ::TickBus::Handler::BusConnect();
}
~Ticker()
~Ticker() override
{
AZ::TickBus::Handler::BusDisconnect();
}

@ -22,7 +22,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
#define MIN_ASPECT 1
#define MAX_ASPECT 16384
CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=NULL*/)
CCustomAspectRatioDlg::CCustomAspectRatioDlg(int x, int y, QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_xDefault(x)
, m_yDefault(y)

@ -25,7 +25,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
#define MIN_RES 64
#define MAX_RES 8192
CCustomResolutionDlg::CCustomResolutionDlg(int w, int h, QWidget* pParent /*=NULL*/)
CCustomResolutionDlg::CCustomResolutionDlg(int w, int h, QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_wDefault(w)
, m_hDefault(h)

@ -87,7 +87,7 @@ public:
: QAbstractListModel(parent)
{
}
virtual ~MenuActionsModel() {}
~MenuActionsModel() override {}
int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
{
@ -134,7 +134,7 @@ public:
, m_action(nullptr)
{
}
virtual ~ActionShortcutsModel() {}
~ActionShortcutsModel() override {}
int rowCount([[maybe_unused]] const QModelIndex& parent = QModelIndex()) const override
{

@ -37,7 +37,6 @@
#pragma warning (disable : 4786) // identifier was truncated to 'number' characters in the debug information.
#pragma warning (disable : 4244) // conversion from 'long' to 'float', possible loss of data
#pragma warning (disable : 4018) // signed/unsigned mismatch
#pragma warning (disable : 4800) // BOOL bool conversion
// Disable warning when a function returns a value inside an __asm block
#pragma warning (disable : 4035)
@ -85,17 +84,17 @@
#endif
#ifndef SAFE_DELETE
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = NULL; } \
#define SAFE_DELETE(p) { if (p) { delete (p); (p) = nullptr; } \
}
#endif
#ifndef SAFE_DELETE_ARRAY
#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p) = NULL; } \
#define SAFE_DELETE_ARRAY(p) { if (p) { delete[] (p); (p) = nullptr; } \
}
#endif
#ifndef SAFE_RELEASE
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = NULL; } \
#define SAFE_RELEASE(p) { if (p) { (p)->Release(); (p) = nullptr; } \
}
#endif

@ -162,7 +162,7 @@ QString RemoveGameName(const QString &filename)
void CEditorFileMonitor::OnFileMonitorChange(const SFileChangeInfo& rChange)
{
CCryEditApp* app = CCryEditApp::instance();
if (app == NULL || app->IsExiting())
if (app == nullptr || app->IsExiting())
{
return;
}

@ -42,7 +42,7 @@ private:
QString extension;
SFileChangeCallback()
: pListener(NULL)
: pListener(nullptr)
{}
SFileChangeCallback(IFileChangeListener* pListener, const char* item, const char* extension)

@ -49,7 +49,7 @@ class CEditorPanelUtils_Impl
{
#pragma region Drag & Drop
public:
virtual void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
void SetViewportDragOperation(void(* dropCallback)(CViewport* viewport, int dragPointX, int dragPointY, void* custom), void* custom) override
{
for (int i = 0; i < GetIEditor()->GetViewManager()->GetViewCount(); i++)
{
@ -60,13 +60,13 @@ public:
#pragma region Preview Window
public:
virtual int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings)
int PreviewWindow_GetDisplaySettingsDebugFlags(CDisplaySettings* settings) override
{
CRY_ASSERT(settings);
return settings->GetDebugFlags();
}
virtual void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags)
void PreviewWindow_SetDisplaySettingsDebugFlags(CDisplaySettings* settings, int flags) override
{
CRY_ASSERT(settings);
settings->SetDebugFlags(flags);
@ -79,7 +79,7 @@ protected:
bool m_hotkeysAreEnabled;
public:
virtual bool HotKey_Import() override
bool HotKey_Import() override
{
QVector<QPair<QString, QString> > keys;
QString filepath = QFileDialog::getOpenFileName(nullptr, "Select shortcut configuration to load",
@ -143,7 +143,7 @@ public:
return result;
}
virtual void HotKey_Export() override
void HotKey_Export() override
{
auto settingDir = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Editor" / "Plugins" / "ParticleEditorPlugin" / "settings";
QString filepath = QFileDialog::getSaveFileName(nullptr, "Select shortcut configuration to load", settingDir.c_str(), "HotKey Config Files (*.hkxml)");
@ -170,7 +170,7 @@ public:
file.close();
}
virtual QKeySequence HotKey_GetShortcut(const char* path) override
QKeySequence HotKey_GetShortcut(const char* path) override
{
for (HotKey combo : hotkeys)
{
@ -182,7 +182,7 @@ public:
return QKeySequence();
}
virtual bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
bool HotKey_IsPressed(const QKeyEvent* event, const char* path) override
{
if (!m_hotkeysAreEnabled)
{
@ -221,7 +221,7 @@ public:
return false;
}
virtual bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
bool HotKey_IsPressed(const QShortcutEvent* event, const char* path) override
{
if (!m_hotkeysAreEnabled)
{
@ -239,7 +239,7 @@ public:
return false;
}
virtual bool HotKey_LoadExisting() override
bool HotKey_LoadExisting() override
{
QSettings settings("O3DE", "O3DE");
QString group = "Hotkeys/";
@ -275,7 +275,7 @@ public:
return true;
}
virtual void HotKey_SaveCurrent() override
void HotKey_SaveCurrent() override
{
QSettings settings("O3DE", "O3DE");
QString group = "Hotkeys/";
@ -296,7 +296,7 @@ public:
settings.sync();
}
virtual void HotKey_BuildDefaults() override
void HotKey_BuildDefaults() override
{
m_hotkeysAreEnabled = true;
QVector<QPair<QString, QString> > keys;
@ -356,17 +356,17 @@ public:
}
}
virtual void HotKey_SetKeys(QVector<HotKey> keys) override
void HotKey_SetKeys(QVector<HotKey> keys) override
{
hotkeys = keys;
}
virtual QVector<HotKey> HotKey_GetKeys() override
QVector<HotKey> HotKey_GetKeys() override
{
return hotkeys;
}
virtual QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
QString HotKey_GetPressedHotkey(const QKeyEvent* event) override
{
if (!m_hotkeysAreEnabled)
{
@ -381,7 +381,7 @@ public:
}
return "";
}
virtual QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
QString HotKey_GetPressedHotkey(const QShortcutEvent* event) override
{
if (!m_hotkeysAreEnabled)
{
@ -398,12 +398,12 @@ public:
}
//building the default hotkey list re-enables hotkeys
//do not use this when rebuilding the default list is a possibility.
virtual void HotKey_SetEnabled(bool val) override
void HotKey_SetEnabled(bool val) override
{
m_hotkeysAreEnabled = val;
}
virtual bool HotKey_IsEnabled() const override
bool HotKey_IsEnabled() const override
{
return m_hotkeysAreEnabled;
}
@ -457,13 +457,13 @@ protected:
}
public:
virtual void ToolTip_LoadConfigXML(QString filepath) override
void ToolTip_LoadConfigXML(QString filepath) override
{
XmlNodeRef node = GetIEditor()->GetSystem()->LoadXmlFromFile(filepath.toStdString().c_str());
ToolTip_ParseNode(node);
}
virtual void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true)
void ToolTip_BuildFromConfig(IQToolTip* tooltip, QString path, QString option, QString optionalData = "", bool isEnabled = true) override
{
AZ_Assert(tooltip, "tooltip cannot be null");
@ -488,7 +488,7 @@ public:
}
}
virtual QString ToolTip_GetTitle(QString path, QString option) override
QString ToolTip_GetTitle(QString path, QString option) override
{
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
{
@ -501,7 +501,7 @@ public:
return GetToolTip(path).title;
}
virtual QString ToolTip_GetContent(QString path, QString option) override
QString ToolTip_GetContent(QString path, QString option) override
{
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
{
@ -514,7 +514,7 @@ public:
return GetToolTip(path).content;
}
virtual QString ToolTip_GetSpecialContentType(QString path, QString option) override
QString ToolTip_GetSpecialContentType(QString path, QString option) override
{
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
{
@ -527,7 +527,7 @@ public:
return GetToolTip(path).specialContent;
}
virtual QString ToolTip_GetDisabledContent(QString path, QString option) override
QString ToolTip_GetDisabledContent(QString path, QString option) override
{
if (!option.isEmpty() && GetToolTip(path + "." + option).isValid)
{

@ -282,7 +282,7 @@ void EditorPreferencesDialog::CreatePages()
{
auto pUnknown = classes[i];
IPreferencesPageCreator* pPageCreator = 0;
IPreferencesPageCreator* pPageCreator = nullptr;
if (FAILED(pUnknown->QueryInterface(&pPageCreator)))
{
continue;

@ -43,11 +43,16 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->Field("MaxCount", &AutoBackup::m_maxCount)
->Field("RemindTime", &AutoBackup::m_remindTime);
serialize.Class<AssetBrowserSearch>()
->Version(1)
->Field("Max number of items displayed", &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch);
serialize.Class<CEditorPreferencesPage_Files>()
->Version(1)
->Field("Files", &CEditorPreferencesPage_Files::m_files)
->Field("Editors", &CEditorPreferencesPage_Files::m_editors)
->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup);
->Field("AutoBackup", &CEditorPreferencesPage_Files::m_autoBackup)
->Field("AssetBrowserSearch", &CEditorPreferencesPage_Files::m_assetBrowserSearch);
AZ::EditContext* editContext = serialize.GetEditContext();
@ -80,12 +85,19 @@ void CEditorPreferencesPage_Files::Reflect(AZ::SerializeContext& serialize)
->Attribute(AZ::Edit::Attributes::Max, 100)
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AutoBackup::m_remindTime, "Remind Time", "Auto Remind Every (Minutes)");
editContext->Class<AssetBrowserSearch>("Asset Browser Search View", "Asset Browser Search View")
->DataElement(AZ::Edit::UIHandlers::SpinBox, &AssetBrowserSearch::m_maxNumberOfItemsShownInSearch, "Maximum number of displayed items",
"Maximum number of displayed items displayed in the Search View")
->Attribute(AZ::Edit::Attributes::Min, 50)
->Attribute(AZ::Edit::Attributes::Max, 5000);
editContext->Class<CEditorPreferencesPage_Files>("File Preferences", "Class for handling File Preferences")
->ClassElement(AZ::Edit::ClassElements::EditorData, "")
->Attribute(AZ::Edit::Attributes::Visibility, AZ_CRC("PropertyVisibility_ShowChildrenOnly", 0xef428f20))
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_files, "Files", "File Preferences")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_editors, "External Editors", "External Editors")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup");
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_autoBackup, "Auto Backup", "Auto Backup")
->DataElement(AZ::Edit::UIHandlers::Default, &CEditorPreferencesPage_Files::m_assetBrowserSearch, "Asset Browser Search", "Asset Browser Search");
}
}
@ -124,6 +136,8 @@ void CEditorPreferencesPage_Files::OnApply()
gSettings.autoBackupTime = m_autoBackup.m_timeInterval;
gSettings.autoBackupMaxCount = m_autoBackup.m_maxCount;
gSettings.autoRemindTime = m_autoBackup.m_remindTime;
gSettings.maxNumberOfItemsShownInSearch = m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch;
}
void CEditorPreferencesPage_Files::InitializeSettings()
@ -148,4 +162,6 @@ void CEditorPreferencesPage_Files::InitializeSettings()
m_autoBackup.m_timeInterval = gSettings.autoBackupTime;
m_autoBackup.m_maxCount = gSettings.autoBackupMaxCount;
m_autoBackup.m_remindTime = gSettings.autoRemindTime;
m_assetBrowserSearch.m_maxNumberOfItemsShownInSearch = gSettings.maxNumberOfItemsShownInSearch;
}

@ -69,10 +69,17 @@ private:
int m_remindTime;
};
struct AssetBrowserSearch
{
AZ_TYPE_INFO(AssetBrowserSearch, "{9FBFCD24-9452-49DF-99F4-2711443CEAAE}")
int m_maxNumberOfItemsShownInSearch;
};
Files m_files;
ExternalEditors m_editors;
AutoBackup m_autoBackup;
AssetBrowserSearch m_assetBrowserSearch;
QIcon m_icon;
};

File diff suppressed because it is too large Load Diff

@ -8,8 +8,6 @@
#pragma once
// RenderViewport.h : header file
//
#if !defined(Q_MOC_RUN)
#include <Cry_Camera.h>
@ -34,6 +32,7 @@
#include <MathConversion.h>
#include <Atom/RPI.Public/ViewportContext.h>
#include <Atom/RPI.Public/SceneBus.h>
#include <AzFramework/Components/CameraBus.h>
#endif
#include <AzFramework/Windowing/WindowBus.h>
@ -65,130 +64,120 @@ namespace AzToolsFramework
// EditorViewportWidget window
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
class SANDBOX_API EditorViewportWidget
class SANDBOX_API EditorViewportWidget final
: public QtViewport
, public IEditorNotifyListener
, public IUndoManagerListener
, public Camera::EditorCameraRequestBus::Handler
, public AzFramework::InputSystemCursorConstraintRequestBus::Handler
, public AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
, public AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
, public AzFramework::AssetCatalogEventBus::Handler
, public AZ::RPI::SceneNotificationBus::Handler
, private IEditorNotifyListener
, private IUndoManagerListener
, private Camera::EditorCameraRequestBus::Handler
, private Camera::CameraNotificationBus::Handler
, private AzFramework::InputSystemCursorConstraintRequestBus::Handler
, private AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
, private AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
, private AzFramework::AssetCatalogEventBus::Handler
, private AZ::RPI::SceneNotificationBus::Handler
{
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
Q_OBJECT
public:
struct SResolution
{
SResolution()
: width(0)
, height(0)
{
}
SResolution(int w, int h)
: width(w)
, height(h)
{
}
int width;
int height;
};
public:
EditorViewportWidget(const QString& name, QWidget* parent = nullptr);
~EditorViewportWidget() override;
static const GUID& GetClassID()
{
return QtViewport::GetClassID<EditorViewportWidget>();
}
/** Get type of this viewport.
*/
virtual EViewportType GetType() const { return ET_ViewportCamera; }
virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportCamera); };
virtual ~EditorViewportWidget();
Q_INVOKABLE void InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons);
// Replacement for still used CRenderer methods
void UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const;
void ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const;
static EditorViewportWidget* GetPrimaryViewport();
public:
virtual void Update();
// Used by ViewPan in some circumstances
void ConnectViewportInteractionRequestBus();
void DisconnectViewportInteractionRequestBus();
virtual void ResetContent();
virtual void UpdateContent(int flags);
// QtViewport/IDisplayViewport/CViewport
// These methods are made public in the derived class because they are called with an object whose static type is known to be this class type.
void SetFOV(float fov) override;
float GetFOV() const override;
void OnTitleMenu(QMenu* menu) override;
private:
////////////////////////////////////////////////////////////////////////
// Private types ...
void SetCamera(const CCamera& camera);
const CCamera& GetCamera() const { return m_Camera; };
virtual void SetViewTM(const Matrix34& tm)
enum class ViewSourceType
{
if (m_viewSourceType == ViewSourceType::None)
None,
CameraComponent,
ViewSourceTypesCount,
};
enum class PlayInEditorState
{
m_defaultViewTM = tm;
}
SetViewTM(tm, false);
}
Editor, Starting, Started
};
enum class KeyPressedState
{
AllUp,
PressedThisFrame,
PressedInPreviousFrame,
};
//! Map world space position to viewport position.
virtual QPoint WorldToView(const Vec3& wp) const;
virtual QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const;
virtual Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const;
//! Map viewport position to world space position.
virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
virtual float GetScreenScaleFactor(const Vec3& worldPoint) const;
virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position);
virtual float GetAspectRatio() const;
virtual bool HitTest(const QPoint& point, HitContext& hitInfo);
virtual bool IsBoundsVisible(const AABB& box) const;
virtual void CenterOnSelection();
virtual void CenterOnAABB(const AABB& aabb);
void CenterOnSliceInstance() override;
////////////////////////////////////////////////////////////////////////
// Method overrides ...
// QWidget
void focusOutEvent(QFocusEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
bool event(QEvent* event) override;
void resizeEvent(QResizeEvent* event) override;
void paintEvent(QPaintEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void SetFOV(float fov);
float GetFOV() const;
// QtViewport/IDisplayViewport/CViewport
EViewportType GetType() const override { return ET_ViewportCamera; }
void SetType([[maybe_unused]] EViewportType type) override { assert(type == ET_ViewportCamera); };
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void SetViewportId(int id) override;
QPoint WorldToView(const Vec3& wp) const override;
QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const override;
Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const override;
Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
float GetScreenScaleFactor(const Vec3& worldPoint) const override;
float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position) override;
float GetAspectRatio() const override;
bool HitTest(const QPoint& point, HitContext& hitInfo) override;
bool IsBoundsVisible(const AABB& box) const override;
void CenterOnSelection() override;
void CenterOnAABB(const AABB& aabb) override;
void CenterOnSliceInstance() override;
void OnTitleMenu(QMenu* menu) override;
void SetViewTM(const Matrix34& tm) override;
const Matrix34& GetViewTM() const override;
void Update() override;
void UpdateContent(int flags) override;
void SetDefaultCamera();
bool IsDefaultCamera() const;
void SetSequenceCamera();
bool IsSequenceCamera() const { return m_viewSourceType == ViewSourceType::SequenceCamera; }
void SetSelectedCamera();
bool IsSelectedCamera() const;
void SetComponentCamera(const AZ::EntityId& entityId);
void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
void SetFirstComponentCamera();
void SetViewEntity(const AZ::EntityId& cameraEntityId, bool lockCameraMovement = false);
void PostCameraSet();
// This switches the active camera to the next one in the list of (default, all custom cams).
void CycleCamera();
// SceneNotificationBus
void OnBeginPrepareRender() override;
// Camera::EditorCameraRequestBus
void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
AZ::EntityId GetCurrentViewEntityId() override { return m_viewEntityId; }
bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
// Camera::CameraNotificationBus
void OnActiveViewChanged(const AZ::EntityId&) override;
// IEditorEventListener
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
// AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
virtual void OnStartPlayInEditor();
virtual void OnStopPlayInEditor();
void OnStartPlayInEditor();
void OnStopPlayInEditor();
void OnStartPlayInEditorBegin();
AzFramework::CameraState GetCameraState();
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
// IUndoManagerListener
void BeginUndoTransaction() override;
void EndUndoTransaction() override;
// AzFramework::InputSystemCursorConstraintRequestBus
void* GetSystemCursorConstraintWindow() const override;
// AzToolsFramework::ViewportFreezeRequestBus
bool IsViewportInputFrozen() override;
@ -204,142 +193,19 @@ public:
void BeginWidgetContext() override;
void EndWidgetContext() override;
// CViewport...
void SetViewportId(int id) override;
void ConnectViewportInteractionRequestBus();
void DisconnectViewportInteractionRequestBus();
void LockCameraMovement(bool bLock) { m_bLockCameraMovement = bLock; }
bool IsCameraMovementLocked() const { return m_bLockCameraMovement; }
void EnableCameraObjectMove(bool bMove) { m_bMoveCameraObject = bMove; }
bool IsCameraObjectMove() const { return m_bMoveCameraObject; }
void SetPlayerControl(uint32 i) { m_PlayerControl = i; };
uint32 GetPlayerControl() { return m_PlayerControl; };
const DisplayContext& GetDisplayContext() const { return m_displayContext; }
CBaseObject* GetCameraObject() const;
QPoint WidgetToViewport(const QPoint& point) const;
QPoint ViewportToWidget(const QPoint& point) const;
QSize WidgetToViewport(const QSize& size) const;
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void SetPlayerPos()
{
Matrix34 m = GetViewTM();
m.SetTranslation(m.GetTranslation() - m_PhysicalLocation.t);
SetViewTM(m);
m_AverageFrameTime = 0.14f;
m_PhysicalLocation.SetIdentity();
m_LocalEntityMat.SetIdentity();
m_PrevLocalEntityMat.SetIdentity();
m_absCameraHigh = 2.0f;
m_absCameraPos = Vec3(0, 3, 2);
m_absCameraPosVP = Vec3(0, -3, 1.5);
m_absCurrentSlope = 0.0f;
m_absLookDirectionXY = Vec2(0, 1);
m_LookAt = Vec3(ZERO);
m_LookAtRate = Vec3(ZERO);
m_vCamPos = Vec3(ZERO);
m_vCamPosRate = Vec3(ZERO);
m_relCameraRotX = 0;
m_relCameraRotZ = 0;
uint32 numSample6 = static_cast<uint32>(m_arrAnimatedCharacterPath.size());
for (uint32 i = 0; i < numSample6; i++)
{
m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
}
numSample6 = static_cast<uint32>(m_arrSmoothEntityPath.size());
for (uint32 i = 0; i < numSample6; i++)
{
m_arrSmoothEntityPath[i] = Vec3(ZERO);
}
uint32 numSample7 = static_cast<uint32>(m_arrRunStrafeSmoothing.size());
for (uint32 i = 0; i < numSample7; i++)
{
m_arrRunStrafeSmoothing[i] = 0;
}
m_vWorldDesiredBodyDirection = Vec2(0, 1);
m_vWorldDesiredBodyDirectionSmooth = Vec2(0, 1);
m_vWorldDesiredBodyDirectionSmoothRate = Vec2(0, 1);
m_vWorldDesiredBodyDirection2 = Vec2(0, 1);
m_vWorldDesiredMoveDirection = Vec2(0, 1);
m_vWorldDesiredMoveDirectionSmooth = Vec2(0, 1);
m_vWorldDesiredMoveDirectionSmoothRate = Vec2(0, 1);
m_vLocalDesiredMoveDirection = Vec2(0, 1);
m_vLocalDesiredMoveDirectionSmooth = Vec2(0, 1);
m_vLocalDesiredMoveDirectionSmoothRate = Vec2(0, 1);
m_vWorldAimBodyDirection = Vec2(0, 1);
m_MoveSpeedMSec = 5.0f;
m_key_W = 0;
m_keyrcr_W = 0;
m_key_S = 0;
m_keyrcr_S = 0;
m_key_A = 0;
m_keyrcr_A = 0;
m_key_D = 0;
m_keyrcr_D = 0;
m_key_SPACE = 0;
m_keyrcr_SPACE = 0;
m_ControllMode = 0;
m_State = -1;
m_Stance = 1; //combat
m_udGround = 0.0f;
m_lrGround = 0.0f;
AABB aabb = AABB(Vec3(-40.0f, -40.0f, -0.25f), Vec3(+40.0f, +40.0f, +0.0f));
m_GroundOBB = OBB::CreateOBBfromAABB(Matrix33(IDENTITY), aabb);
m_GroundOBBPos = Vec3(0, 0, -0.01f);
};
static EditorViewportWidget* GetPrimaryViewport();
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
CCamera m_Camera;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
protected:
struct SScopedCurrentContext;
// Camera::EditorCameraRequestBus
void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
AZ::EntityId GetCurrentViewEntityId() override;
bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
////////////////////////////////////////////////////////////////////////
// Private helpers...
void SetViewTM(const Matrix34& tm, bool bMoveOnly);
// Called to render stuff.
virtual void OnRender();
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
//! Get currently active camera object.
void ToggleCameraObject();
void RenderConstructionPlane();
void RenderSnapMarker();
void RenderAll();
void OnBeginPrepareRender() override;
// Update the safe frame, safe action, safe title, and borders rectangles based on
// viewport size and target aspect ratio.
void UpdateSafeFrame();
@ -353,242 +219,173 @@ protected:
// Draw a selected region if it has been selected
void RenderSelectedRegion();
virtual bool CreateRenderContext();
virtual void DestroyRenderContext();
void OnMenuCommandChangeAspectRatio(unsigned int commandId);
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);
void ResizeView(int width, int height);
void OnCameraFOVVariableChanged(IVariable* var);
void HideCursor();
void ShowCursor();
bool IsKeyDown(Qt::Key key) const;
enum class ViewSourceType
{
None,
SequenceCamera,
LegacyCamera,
CameraComponent,
AZ_Entity,
ViewSourceTypesCount,
};
void ResetToViewSourceType(const ViewSourceType& viewSourType);
double WidgetToViewportFactor() const;
bool ShouldPreviewFullscreen() const;
void StartFullscreenPreview();
void StopFullscreenPreview();
bool m_inFullscreenPreview = false;
bool m_bRenderContextCreated = false;
bool m_bInRotateMode = false;
bool m_bInMoveMode = false;
bool m_bInOrbitMode = false;
bool m_bInZoomMode = false;
QPoint m_mousePos = QPoint(0, 0);
QPoint m_prevMousePos = QPoint(0, 0); // for tablets, you can't use SetCursorPos and need to remember the prior point and delta with that.
float m_moveSpeed = 1;
float m_orbitDistance = 10.0f;
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
Vec3 m_orbitTarget;
void OnMenuResolutionCustom();
void OnMenuCreateCameraEntityFromCurrentView();
void OnMenuSelectCurrentCamera();
//-------------------------------------------
//--- player-control in CharEdit ---
//-------------------------------------------
f32 m_MoveSpeedMSec;
// From a series of input primitives, compose a complete mouse interaction.
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
AzToolsFramework::ViewportInteraction::MouseButtons buttons,
AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
uint32 m_key_W, m_keyrcr_W;
uint32 m_key_S, m_keyrcr_S;
uint32 m_key_A, m_keyrcr_A;
uint32 m_key_D, m_keyrcr_D;
// Given a point in the viewport, return the pick ray into the scene.
// note: The argument passed to parameter **point**, originating
// from a Qt event, must first be passed to WidgetToViewport before being
// passed to BuildMousePick.
AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
uint32 m_key_SPACE, m_keyrcr_SPACE;
uint32 m_ControllMode;
bool CheckRespondToInput() const;
int32 m_Stance;
int32 m_State;
f32 m_AverageFrameTime;
void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
uint32 m_PlayerControl = 0;
void SetAsActiveViewport();
void PushDisableRendering();
void PopDisableRendering();
bool IsRenderingDisabled() const;
AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(const QPoint& point) const;
f32 m_absCameraHigh;
Vec3 m_absCameraPos;
Vec3 m_absCameraPosVP;
void RestoreViewportAfterGameMode();
f32 m_absCurrentSlope; //in radiants
void UpdateScene();
Vec2 m_absLookDirectionXY;
void SetDefaultCamera();
void SetSelectedCamera();
bool IsSelectedCamera() const;
void SetComponentCamera(const AZ::EntityId& entityId);
void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
void SetFirstComponentCamera();
void PostCameraSet();
// This switches the active camera to the next one in the list of (default, all custom cams).
void CycleCamera();
Vec3 m_LookAt;
Vec3 m_LookAtRate;
Vec3 m_vCamPos;
Vec3 m_vCamPosRate;
float m_camFOV;
AzFramework::CameraState GetCameraState();
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
f32 m_relCameraRotX;
f32 m_relCameraRotZ;
QPoint WidgetToViewport(const QPoint& point) const;
QPoint ViewportToWidget(const QPoint& point) const;
QSize WidgetToViewport(const QSize& size) const;
QuatTS m_PhysicalLocation;
const DisplayContext& GetDisplayContext() const { return m_displayContext; }
CBaseObject* GetCameraObject() const;
Matrix34 m_AnimatedCharacterMat;
void UnProjectFromScreen(float sx, float sy, float sz, float* px, float* py, float* pz) const;
void ProjectToScreen(float ptx, float pty, float ptz, float* sx, float* sy, float* sz) const;
Matrix34 m_LocalEntityMat; //this is used for data-driven animations where the character is running on the spot
Matrix34 m_PrevLocalEntityMat;
AZ::RPI::ViewPtr GetCurrentAtomView() const;
std::vector<Vec3> m_arrVerticesHF;
std::vector<vtx_idx> m_arrIndicesHF;
////////////////////////////////////////////////////////////////////////
// Members ...
friend class AZ::ViewportHelpers::EditorEntityNotifications;
std::vector<Vec3> m_arrAnimatedCharacterPath;
std::vector<Vec3> m_arrSmoothEntityPath;
std::vector<f32> m_arrRunStrafeSmoothing;
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
Vec2 m_vWorldDesiredBodyDirection;
Vec2 m_vWorldDesiredBodyDirectionSmooth;
Vec2 m_vWorldDesiredBodyDirectionSmoothRate;
// Singleton for the primary viewport
static EditorViewportWidget* m_pPrimaryViewport;
Vec2 m_vWorldDesiredBodyDirection2;
// The simulation (play-game in editor) state
PlayInEditorState m_playInEditorState = PlayInEditorState::Editor;
// Whether we are doing a full screen game preview (play-game in editor) or a regular one
bool m_inFullscreenPreview = false;
Vec2 m_vWorldDesiredMoveDirection;
Vec2 m_vWorldDesiredMoveDirectionSmooth;
Vec2 m_vWorldDesiredMoveDirectionSmoothRate;
Vec2 m_vLocalDesiredMoveDirection;
Vec2 m_vLocalDesiredMoveDirectionSmooth;
Vec2 m_vLocalDesiredMoveDirectionSmoothRate;
Vec2 m_vWorldAimBodyDirection;
// The entity ID of the current camera for this viewport, or invalid if the default editor camera
AZ::EntityId m_viewEntityId;
f32 m_udGround;
f32 m_lrGround;
OBB m_GroundOBB;
Vec3 m_GroundOBBPos;
// Determines also if the current camera for this viewport is default editor camera
ViewSourceType m_viewSourceType = ViewSourceType::None;
// Index of camera objects.
mutable GUID m_cameraObjectId;
mutable AZ::EntityId m_viewEntityId;
mutable ViewSourceType m_viewSourceType = ViewSourceType::None;
// During play game in editor, holds the editor entity ID of the last
AZ::EntityId m_viewEntityIdCachedForEditMode;
// The editor camera TM before switching to game mode
Matrix34 m_preGameModeViewTM;
// Disables rendering during some periods of time, e.g. undo/redo, resize events
uint m_disableRenderingCount = 0;
bool m_bLockCameraMovement;
// Determines if the viewport needs updating (false when out of focus for example)
bool m_bUpdateViewport = false;
bool m_bMoveCameraObject = true;
enum class KeyPressedState
{
AllUp,
PressedThisFrame,
PressedInPreviousFrame,
};
// Avoid re-entering PostCameraSet->OnActiveViewChanged->PostCameraSet
bool m_sendingOnActiveChanged = false;
// Legacy...
KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
// The last camera matrix of the default editor camera, used when switching back to editor camera to restore the right TM
Matrix34 m_defaultViewTM;
// The name to use for the default editor camera
const QString m_defaultViewName;
// Note that any attempts to draw anything with this object will crash. Exists here for legacy "reasons"
DisplayContext m_displayContext;
// Re-entrency guard for on paint events
bool m_isOnPaint = false;
static EditorViewportWidget* m_pPrimaryViewport;
// Shapes of various safe frame helpers which can be displayed in the editor
QRect m_safeFrame;
QRect m_safeAction;
QRect m_safeTitle;
// Aspect ratios available in the title bar
CPredefinedAspectRatios m_predefinedAspectRatios;
// Is the cursor hidden or displayed?
bool m_bCursorHidden = false;
void OnMenuResolutionCustom();
void OnMenuCreateCameraEntityFromCurrentView();
void OnMenuSelectCurrentCamera();
int OnCreate();
void resizeEvent(QResizeEvent* event) override;
void paintEvent(QPaintEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
// From a series of input primitives, compose a complete mouse interaction.
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
AzToolsFramework::ViewportInteraction::MouseButtons buttons,
AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
// Given a point in the viewport, return the pick ray into the scene.
// note: The argument passed to parameter **point**, originating
// from a Qt event, must first be passed to WidgetToViewport before being
// passed to BuildMousePick.
AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
bool event(QEvent* event) override;
void OnDestroy();
bool CheckRespondToInput() const;
// AzFramework::InputSystemCursorConstraintRequestBus
void* GetSystemCursorConstraintWindow() const override;
void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
private:
void SetAsActiveViewport();
void PushDisableRendering();
void PopDisableRendering();
bool IsRenderingDisabled() const;
AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(const QPoint& point) const;
void RestoreViewportAfterGameMode();
void UpdateCameraFromViewportContext();
double WidgetToViewportFactor() const
{
#if defined(AZ_PLATFORM_WINDOWS)
// Needed for high DPI mode on windows
return devicePixelRatioF();
#else
return 1.0f;
#endif
}
void BeginUndoTransaction() override;
void EndUndoTransaction() override;
void UpdateCurrentMousePos(const QPoint& newPosition);
void UpdateScene();
// Shim for QtViewport, which used to be responsible for visibility queries in the editor,
// these are now forwarded to EntityVisibilityQuery
AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
// Handlers for grid snapping/editor event callbacks
SandboxEditor::GridSnappingChangedEvent::Handler m_gridSnappingHandler;
AZStd::unique_ptr<SandboxEditor::EditorViewportSettingsCallbacks> m_editorViewportSettingsCallbacks;
// Used for some legacy logic which lets the widget release a grabbed keyboard at the right times
// Unclear if it's still necessary.
QSet<int> m_keyDown;
// State for ViewportFreezeRequestBus, currently does nothing
bool m_freezeViewportInput = false;
// This widget holds a reference to the manipulator manage because its responsible for drawing manipulators
AZStd::shared_ptr<AzToolsFramework::ManipulatorManager> m_manipulatorManager;
// Used to prevent circular set camera events
bool m_ignoreSetViewFromEntityPerspective = false;
bool m_windowResizedEvent = false;
// Helper for getting EditorEntityNotificationBus events
AZStd::unique_ptr<AZ::ViewportHelpers::EditorEntityNotifications> m_editorEntityNotifications;
// The widget to which Atom will actually render
AtomToolsFramework::RenderViewportWidget* m_renderViewport = nullptr;
bool m_updateCameraPositionNextTick = false;
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraViewMatrixChangeHandler;
AZ::RPI::ViewportContext::MatrixChangedEvent::Handler m_cameraProjectionMatrixChangeHandler;
// Atom debug display
AzFramework::DebugDisplayRequests* m_debugDisplay = nullptr;
// The default view created for the viewport context, which is used as the "Editor Camera"
AZ::RPI::ViewPtr m_defaultView;
// The name to set on the viewport context when this viewport widget is set as the active one
AZ::Name m_defaultViewportContextName;
// DO NOT USE THIS! It exists only to satisfy the signature of the base class method GetViewTm
mutable Matrix34 m_viewTmStorage;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};

@ -136,11 +136,11 @@ void CErrorReport::ReportError(CErrorRecord& err)
}
else
{
if (err.pObject == NULL && m_pObject != NULL)
if (err.pObject == nullptr && m_pObject != nullptr)
{
err.pObject = m_pObject;
}
else if (err.pItem == NULL && m_pItem != NULL)
else if (err.pItem == nullptr && m_pItem != nullptr)
{
err.pItem = m_pItem;
}

@ -39,7 +39,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
//////////////////////////////////////////////////////////////////////////
CErrorReportDialog* CErrorReportDialog::m_instance = 0;
CErrorReportDialog* CErrorReportDialog::m_instance = nullptr;
// CErrorReportDialog dialog
@ -88,12 +88,12 @@ CErrorReportDialog::CErrorReportDialog(QWidget* parent)
m_instance = this;
//CErrorReport *report,
//m_pErrorReport = report;
m_pErrorReport = 0;
m_pErrorReport = nullptr;
}
CErrorReportDialog::~CErrorReportDialog()
{
m_instance = 0;
m_instance = nullptr;
}
//////////////////////////////////////////////////////////////////////////
@ -141,7 +141,7 @@ void CErrorReportDialog::Clear()
{
if (m_instance)
{
m_instance->SetReport(0);
m_instance->SetReport(nullptr);
m_instance->UpdateErrors();
}
}
@ -500,7 +500,7 @@ void CErrorReportDialog::OnReportItemDblClick(const QModelIndex& index)
{
bool bDone = false;
const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
if (pError && pError->pObject != NULL)
if (pError && pError->pObject != nullptr)
{
CUndo undo("Select Object(s)");
// Clear other selection.
@ -563,7 +563,7 @@ void CErrorReportDialog::OnReportHyperlink(const QModelIndex& index)
{
const CErrorRecord* pError = index.data(Qt::UserRole).value<const CErrorRecord*>();
bool bDone = false;
if (pError && pError->pObject != NULL)
if (pError && pError->pObject != nullptr)
{
CUndo undo("Select Object(s)");
// Clear other selection.
@ -593,8 +593,8 @@ void CErrorReportDialog::OnShowFieldChooser()
CMainFrm* pMainFrm = (CMainFrame*)AfxGetMainWnd();
if (pMainFrm)
{
BOOL bShow = !pMainFrm->m_wndFieldChooser.IsVisible();
pMainFrm->ShowControlBar(&pMainFrm->m_wndFieldChooser, bShow, FALSE);
bool bShow = !pMainFrm->m_wndFieldChooser.IsVisible();
pMainFrm->ShowControlBar(&pMainFrm->m_wndFieldChooser, bShow, false);
}
}
*/

@ -105,7 +105,7 @@ void CErrorReportTableModel::setErrorReport(CErrorReport* report)
{
m_errorRecords.clear();
}
if (report != 0)
if (report != nullptr)
{
const int count = report->GetErrorCount();
m_errorRecords.reserve(count);

@ -22,7 +22,6 @@
#include "OBJExporter.h"
#include "OCMExporter.h"
#include "FBXExporterDialog.h"
#include "RenderViewport.h"
#include "TrackViewExportKeyTimeDlg.h"
#include "AnimationContext.h"
#include "TrackView/DirectorNodeAnimator.h"
@ -662,12 +661,6 @@ bool CExportManager::ProcessObjectsForExport()
GetIEditor()->GetAnimation()->SetRecording(false);
GetIEditor()->GetAnimation()->SetPlaying(false);
CViewport* vp = GetIEditor()->GetViewManager()->GetSelectedViewport();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
{
rvp->SetSequenceCamera();
}
int startFrame = 0;
timeValue = startFrame * fpsTimeInterval;

@ -57,12 +57,12 @@ struct SSystemUserCallback
: public ISystemUserCallback
{
SSystemUserCallback(IInitializeUIInfo* logo) : m_threadErrorHandler(this) { m_pLogo = logo; };
virtual void OnSystemConnect(ISystem* pSystem)
void OnSystemConnect(ISystem* pSystem) override
{
ModuleInitISystem(pSystem, "Editor");
}
virtual bool OnError(const char* szErrorString)
bool OnError(const char* szErrorString) override
{
// since we show a message box, we have to use the GUI thread
if (QThread::currentThread() != qApp->thread())
@ -95,7 +95,7 @@ struct SSystemUserCallback
int res = IDNO;
ICVar* pCVar = gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : NULL;
ICVar* pCVar = gEnv->pConsole ? gEnv->pConsole->GetCVar("sys_no_crash_dialog") : nullptr;
if (!pCVar || pCVar->GetIVal() == 0)
{
@ -116,7 +116,7 @@ struct SSystemUserCallback
return true;
}
virtual bool OnSaveDocument()
bool OnSaveDocument() override
{
bool success = false;
@ -133,7 +133,7 @@ struct SSystemUserCallback
return success;
}
virtual bool OnBackupDocument()
bool OnBackupDocument() override
{
CCryEditDoc* level = GetIEditor() ? GetIEditor()->GetDocument() : nullptr;
if (level)
@ -144,7 +144,7 @@ struct SSystemUserCallback
return false;
}
virtual void OnProcessSwitch()
void OnProcessSwitch() override
{
if (GetIEditor()->IsInGameMode())
{
@ -152,7 +152,7 @@ struct SSystemUserCallback
}
}
virtual void OnInitProgress(const char* sProgressMsg)
void OnInitProgress(const char* sProgressMsg) override
{
if (m_pLogo)
{
@ -160,7 +160,7 @@ struct SSystemUserCallback
}
}
virtual int ShowMessage(const char* text, const char* caption, unsigned int uType)
int ShowMessage(const char* text, const char* caption, unsigned int uType) override
{
if (CCryEditApp::instance()->IsInAutotestMode())
{
@ -176,7 +176,7 @@ struct SSystemUserCallback
return CryMessageBox(text, caption, uType);
}
virtual void GetMemoryUsage(ICrySizer* pSizer)
void GetMemoryUsage(ICrySizer* pSizer) override
{
GetIEditor()->GetMemoryUsage(pSizer);
}
@ -215,7 +215,7 @@ public:
{
AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusConnect();
};
~AssetProcessConnectionStatus()
~AssetProcessConnectionStatus() override
{
AzFramework::AssetSystemConnectionNotificationsBus::Handler::BusDisconnect();
}
@ -247,18 +247,18 @@ private:
AZ_PUSH_DISABLE_WARNING(4273, "-Wunknown-warning-option")
CGameEngine::CGameEngine()
: m_gameDll(0)
: m_gameDll(nullptr)
, m_bIgnoreUpdates(false)
, m_ePendingGameMode(ePGM_NotPending)
, m_modalWindowDismisser(nullptr)
AZ_POP_DISABLE_WARNING
{
m_pISystem = NULL;
m_pISystem = nullptr;
m_bLevelLoaded = false;
m_bInGameMode = false;
m_bSimulationMode = false;
m_bSyncPlayerPosition = true;
m_hSystemHandle = 0;
m_hSystemHandle = nullptr;
m_bJustCreated = false;
m_levelName = "Untitled";
m_levelExtension = EditorUtils::LevelFile::GetDefaultFileExtension();
@ -271,7 +271,7 @@ CGameEngine::~CGameEngine()
{
AZ_POP_DISABLE_WARNING
GetIEditor()->UnregisterNotifyListener(this);
m_pISystem->GetIMovieSystem()->SetCallback(NULL);
m_pISystem->GetIMovieSystem()->SetCallback(nullptr);
if (m_gameDll)
{
@ -279,7 +279,7 @@ AZ_POP_DISABLE_WARNING
}
delete m_pISystem;
m_pISystem = NULL;
m_pISystem = nullptr;
if (m_hSystemHandle)
{
@ -572,8 +572,6 @@ void CGameEngine::SwitchToInGame()
m_pISystem->GetIMovieSystem()->EnablePhysicsEvents(true);
m_bInGameMode = true;
gEnv->pSystem->GetViewCamera().SetMatrix(m_playerViewTM);
// Disable accelerators.
GetIEditor()->EnableAcceleratos(false);
//! Send event to switch into game.
@ -627,13 +625,6 @@ void CGameEngine::SwitchToInEditor()
m_bInGameMode = false;
// save the current gameView matrix for editor
if (pGameViewport)
{
Matrix34 gameView = gEnv->pSystem->GetViewCamera().GetMatrix();
pGameViewport->SetGameTM(gameView);
}
// Out of game in Editor mode.
if (pGameViewport)
{
@ -875,7 +866,7 @@ void CGameEngine::OnEditorNotifyEvent(EEditorNotifyEvent event)
{
case eNotify_OnSplashScreenDestroyed:
{
if (m_pSystemUserCallback != NULL)
if (m_pSystemUserCallback != nullptr)
{
m_pSystemUserCallback->OnSplashScreenDone();
}

@ -63,7 +63,7 @@ void SGameExporterSettings::SetHiQuality()
nApplySS = 1;
}
CGameExporter* CGameExporter::m_pCurrentExporter = NULL;
CGameExporter* CGameExporter::m_pCurrentExporter = nullptr;
//////////////////////////////////////////////////////////////////////////
// CGameExporter
@ -76,7 +76,7 @@ CGameExporter::CGameExporter()
CGameExporter::~CGameExporter()
{
m_pCurrentExporter = NULL;
m_pCurrentExporter = nullptr;
}
//////////////////////////////////////////////////////////////////////////

@ -17,7 +17,7 @@ AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
// CGenericSelectItemDialog dialog
CGenericSelectItemDialog::CGenericSelectItemDialog(QWidget* pParent /*=NULL*/)
CGenericSelectItemDialog::CGenericSelectItemDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, ui(new Ui::CGenericSelectItemDialog)
, m_initialized(false)

@ -570,7 +570,7 @@ struct IEditor
//////////////////////////////////////////////////////////////////////////
virtual class CLevelIndependentFileMan* GetLevelIndependentFileMan() = 0;
//! Notify all views that data is changed.
virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = NULL) = 0;
virtual void UpdateViews(int flags = 0xFFFFFFFF, const AABB* updateRegion = nullptr) = 0;
virtual void ResetViews() = 0;
//! Update information in track view dialog.
virtual void ReloadTrackView() = 0;
@ -589,7 +589,7 @@ struct IEditor
//! if bShow is true also returns a valid ITransformManipulator pointer.
virtual ITransformManipulator* ShowTransformManipulator(bool bShow) = 0;
//! Return a pointer to a ITransformManipulator pointer if shown.
//! NULL is manipulator is not shown.
//! nullptr if manipulator is not shown.
virtual ITransformManipulator* GetTransformManipulator() = 0;
//! Set constrain on specified axis for objects construction and modifications.
//! @param axis one of AxisConstrains enumerations.

@ -415,7 +415,7 @@ void CEditorImpl::Update()
}
if (IsInPreviewMode())
{
SetModifiedFlag(FALSE);
SetModifiedFlag(false);
SetModifiedModule(eModifiedNothing);
}
@ -550,7 +550,7 @@ QString CEditorImpl::GetResolvedUserFolder()
void CEditorImpl::SetDataModified()
{
GetDocument()->SetModifiedFlag(TRUE);
GetDocument()->SetModifiedFlag(true);
}
void CEditorImpl::SetStatusText(const QString& pszString)
@ -597,9 +597,9 @@ ITransformManipulator* CEditorImpl::ShowTransformManipulator(bool bShow)
GetObjectManager()->GetGizmoManager()->RemoveGizmo(m_pAxisGizmo);
m_pAxisGizmo->Release();
}
m_pAxisGizmo = 0;
m_pAxisGizmo = nullptr;
}
return 0;
return nullptr;
}
ITransformManipulator* CEditorImpl::GetTransformManipulator()
@ -614,7 +614,7 @@ void CEditorImpl::SetAxisConstraints(AxisConstrains axisFlags)
SetTerrainAxisIgnoreObjects(false);
// Update all views.
UpdateViews(eUpdateObjects, NULL);
UpdateViews(eUpdateObjects, nullptr);
}
AxisConstrains CEditorImpl::GetAxisConstrains()
@ -637,7 +637,7 @@ void CEditorImpl::SetReferenceCoordSys(RefCoordSys refCoords)
m_refCoordsSys = refCoords;
// Update all views.
UpdateViews(eUpdateObjects, NULL);
UpdateViews(eUpdateObjects, nullptr);
// Update the construction plane infos.
CViewport* pViewport = GetActiveView();
@ -671,7 +671,7 @@ CBaseObject* CEditorImpl::NewObject(const char* typeName, const char* fileName,
editor->SetModifiedFlag();
editor->SetModifiedModule(eModifiedBrushes);
}
CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, 0, fileName, name);
CBaseObject* object = editor->GetObjectManager()->NewObject(typeName, nullptr, fileName, name);
if (!object)
{
return nullptr;
@ -932,7 +932,7 @@ void CEditorImpl::CloseView(const GUID& classId)
IDataBaseManager* CEditorImpl::GetDBItemManager([[maybe_unused]] EDataBaseItemType itemType)
{
return 0;
return nullptr;
}
bool CEditorImpl::SelectColor(QColor& color, QWidget* parent)
@ -1109,7 +1109,7 @@ void CEditorImpl::DetectVersion()
char ver[1024 * 8];
GetModuleFileName(NULL, exe, _MAX_PATH);
GetModuleFileName(nullptr, exe, _MAX_PATH);
int verSize = GetFileVersionInfoSize(exe, &dwHandle);
if (verSize > 0)
@ -1431,7 +1431,7 @@ void CEditorImpl::NotifyExcept(EEditorNotifyEvent event, IEditorNotifyListener*
{
m_pAxisGizmo->Release();
}
m_pAxisGizmo = 0;
m_pAxisGizmo = nullptr;
}
if (event == eNotify_OnInit)
@ -1472,7 +1472,7 @@ ISourceControl* CEditorImpl::GetSourceControl()
for (int i = 0; i < classes.size(); i++)
{
IClassDesc* pClass = classes[i];
ISourceControl* pSCM = NULL;
ISourceControl* pSCM = nullptr;
HRESULT hRes = pClass->QueryInterface(__uuidof(ISourceControl), (void**)&pSCM);
if (!FAILED(hRes) && pSCM)
{
@ -1482,7 +1482,7 @@ ISourceControl* CEditorImpl::GetSourceControl()
}
}
return 0;
return nullptr;
}
bool CEditorImpl::IsSourceControlAvailable()

@ -176,7 +176,7 @@ public:
{
return m_pSystem->GetIMovieSystem();
}
return NULL;
return nullptr;
};
CPluginManager* GetPluginManager() { return m_pPluginManager; }

@ -81,7 +81,7 @@ void CIconManager::Reset()
{
m_objects[i]->Release();
}
m_objects[i] = 0;
m_objects[i] = nullptr;
}
for (i = 0; i < eIcon_COUNT; i++)
{
@ -135,7 +135,7 @@ IStatObj* CIconManager::GetObject(EStatObject)
//////////////////////////////////////////////////////////////////////////
QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint32 effects /*=0*/)
{
QImage* pBitmap = 0;
QImage* pBitmap = nullptr;
QString iconFilename = filename;
@ -160,11 +160,11 @@ QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint
return pBitmap;
}
BOOL bAlphaBitmap = FALSE;
bool bAlphaBitmap = false;
QPixmap pm(iconFilename);
bAlphaBitmap = pm.hasAlpha();
bHaveAlpha = (bAlphaBitmap == TRUE);
bHaveAlpha = (bAlphaBitmap == true);
if (!pm.isNull())
{
pBitmap = new QImage;
@ -252,5 +252,5 @@ QImage* CIconManager::GetIconBitmap(const char* filename, bool& bHaveAlpha, uint
return pBitmap;
}
return NULL;
return nullptr;
}

@ -68,7 +68,7 @@ QVariant LayoutConfigModel::data(const QModelIndex& index, int role) const
// CLayoutConfigDialog dialog
CLayoutConfigDialog::CLayoutConfigDialog(QWidget* pParent /*=NULL*/)
CLayoutConfigDialog::CLayoutConfigDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_model(new LayoutConfigModel(this))
, ui(new Ui::CLayoutConfigDialog)

@ -98,7 +98,7 @@ CLayoutWnd::CLayoutWnd(QSettings* settings, QWidget* parent)
, m_settings(settings)
{
m_bMaximized = false;
m_maximizedView = 0;
m_maximizedView = nullptr;
m_layout = (EViewLayout) - 1;
m_maximizedViewId = 0;
@ -729,7 +729,7 @@ void CLayoutWnd::OnDestroy()
if (m_maximizedView)
{
delete m_maximizedView;
m_maximizedView = 0;
m_maximizedView = nullptr;
}
}

@ -23,12 +23,12 @@ namespace EditorUtilsTest
BusConnect();
}
~WarningDetector()
~WarningDetector() override
{
BusDisconnect();
}
virtual bool OnWarning(const char* /*window*/, const char* /*message*/) override
bool OnWarning(const char* /*window*/, const char* /*message*/) override
{
m_gotWarning = true;
return true;

@ -17,7 +17,7 @@ class EditorLibTestEnvironment
: public AZ::Test::ITestEnvironment
{
public:
virtual ~EditorLibTestEnvironment() {}
~EditorLibTestEnvironment() override = default;
protected:
void SetupEnvironment() override

@ -57,12 +57,12 @@ public:
CUndoBaseObject(CBaseObject* pObj, const char* undoDescription);
protected:
virtual int GetSize() { return sizeof(*this); }
virtual QString GetDescription() { return m_undoDescription; };
virtual QString GetObjectName();
int GetSize() override { return sizeof(*this); }
QString GetDescription() override { return m_undoDescription; };
QString GetObjectName() override;
virtual void Undo(bool bUndo);
virtual void Redo();
void Undo(bool bUndo) override;
void Redo() override;
protected:
QString m_undoDescription;
@ -81,12 +81,12 @@ public:
CUndoBaseObjectMinimal(CBaseObject* obj, const char* undoDescription, int flags);
protected:
virtual int GetSize() { return sizeof(*this); }
virtual QString GetDescription() { return m_undoDescription; };
virtual QString GetObjectName();
int GetSize() override { return sizeof(*this); }
QString GetDescription() override { return m_undoDescription; };
QString GetObjectName() override;
virtual void Undo(bool bUndo);
virtual void Redo();
void Undo(bool bUndo) override;
void Redo() override;
private:
struct StateStruct
@ -119,7 +119,7 @@ public:
, m_bKeepPos(bKeepPos)
, m_bAttach(bAttach) {}
virtual void Undo([[maybe_unused]] bool bUndo) override
void Undo([[maybe_unused]] bool bUndo) override
{
if (m_bAttach)
{
@ -131,7 +131,7 @@ public:
}
}
virtual void Redo() override
void Redo() override
{
if (m_bAttach)
{
@ -167,8 +167,8 @@ private:
}
}
virtual int GetSize() { return sizeof(CUndoAttachBaseObject); }
virtual QString GetDescription() { return "Attachment Changed"; }
int GetSize() override { return sizeof(CUndoAttachBaseObject); }
QString GetDescription() override { return "Attachment Changed"; }
GUID m_attachedObjectGUID;
GUID m_parentObjectGUID;
@ -184,7 +184,7 @@ CUndoBaseObject::CUndoBaseObject(CBaseObject* obj, const char* undoDescription)
m_undoDescription = undoDescription;
m_guid = obj->GetId();
m_redo = 0;
m_redo = nullptr;
m_undo = XmlHelpers::CreateXmlNode("Undo");
CObjectArchive ar(GetIEditor()->GetObjectManager(), m_undo, false);
ar.bUndo = true;
@ -355,7 +355,7 @@ void CObjectCloneContext::AddClone(CBaseObject* pFromObject, CBaseObject* pToObj
//////////////////////////////////////////////////////////////////////////
CBaseObject* CObjectCloneContext::FindClone(CBaseObject* pFromObject)
{
CBaseObject* pTarget = stl::find_in_map(m_objectsMap, pFromObject, (CBaseObject*) NULL);
CBaseObject* pTarget = stl::find_in_map(m_objectsMap, pFromObject, (CBaseObject*) nullptr);
return pTarget;
}
@ -426,7 +426,7 @@ bool CBaseObject::Init([[maybe_unused]] IEditor* ie, CBaseObject* prev, [[maybe_
{
SetFlags(m_flags & (~OBJFLAG_DELETED));
if (prev != 0)
if (prev != nullptr)
{
SetUniqueName(prev->GetName());
SetLocalTM(prev->GetPos(), prev->GetRotation(), prev->GetScale());
@ -457,7 +457,7 @@ CBaseObject::~CBaseObject()
for (Childs::iterator c = m_childs.begin(); c != m_childs.end(); c++)
{
CBaseObject* child = *c;
child->m_parent = 0;
child->m_parent = nullptr;
}
m_childs.clear();
}
@ -470,10 +470,10 @@ void CBaseObject::Done()
// From children
DetachAll();
SetLookAt(0);
SetLookAt(nullptr);
if (m_lookatSource)
{
m_lookatSource->SetLookAt(0);
m_lookatSource->SetLookAt(nullptr);
}
SetFlags(m_flags | OBJFLAG_DELETED);
@ -1730,7 +1730,7 @@ bool CBaseObject::IntersectRayBounds(const Ray& ray)
//////////////////////////////////////////////////////////////////////////
namespace
{
typedef std::pair<Vec2, Vec2> Edge2D;
using Edge2D = std::pair<Vec2, Vec2>;
}
bool IsIncludePointsInConvexHull(Edge2D* pEdgeArray0, int nEdgeArray0Size, Edge2D* pEdgeArray1, int nEdgeArray1Size)
{
@ -2065,7 +2065,7 @@ void CBaseObject::GetAllChildren(TBaseObjects& outAllChildren, CBaseObject* pObj
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == NULL)
if (pChild == nullptr)
{
continue;
}
@ -2081,7 +2081,7 @@ void CBaseObject::GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChil
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == NULL)
if (pChild == nullptr)
{
continue;
}
@ -2097,7 +2097,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p
for (int i = 0, iChildCount(pBaseObj->GetChildCount()); i < iChildCount; ++i)
{
CBaseObject* pChild = pBaseObj->GetChild(i);
if (pChild == NULL)
if (pChild == nullptr)
{
continue;
}
@ -2109,7 +2109,7 @@ void CBaseObject::GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* p
//////////////////////////////////////////////////////////////////////////
void CBaseObject::CloneChildren(CBaseObject* pFromObject)
{
if (pFromObject == NULL)
if (pFromObject == nullptr)
{
return;
}
@ -2119,7 +2119,7 @@ void CBaseObject::CloneChildren(CBaseObject* pFromObject)
CBaseObject* pFromChildObject = pFromObject->GetChild(i);
CBaseObject* pChildClone = GetObjectManager()->CloneObject(pFromChildObject);
if (pChildClone == NULL)
if (pChildClone == nullptr)
{
continue;
}
@ -2248,7 +2248,7 @@ void CBaseObject::DetachThis(bool bKeepPos)
// Copy parent to temp var, erasing child from parent may delete this node if child referenced only from parent.
CBaseObject* parent = m_parent;
m_parent = 0;
m_parent = nullptr;
parent->RemoveChild(this);
if (bKeepPos)
@ -2389,7 +2389,7 @@ void CBaseObject::InvalidateTM([[maybe_unused]] int flags)
// Invalidate matrices off all child objects.
for (int i = 0; i < m_childs.size(); i++)
{
if (m_childs[i] != 0 && m_childs[i]->m_bMatrixValid)
if (m_childs[i] != nullptr && m_childs[i]->m_bMatrixValid)
{
m_childs[i]->InvalidateTM(eObjectUpdateFlags_ParentChanged);
}
@ -2538,7 +2538,7 @@ void CBaseObject::SetLookAt(CBaseObject* target)
//////////////////////////////////////////////////////////////////////////
bool CBaseObject::IsLookAtTarget() const
{
return m_lookatSource != 0;
return m_lookatSource != nullptr;
}
//////////////////////////////////////////////////////////////////////////
@ -2806,7 +2806,7 @@ bool CBaseObject::IntersectRayMesh(const Vec3& raySrc, const Vec3& rayDir, SRayH
outHitInfo.bInFirstHit = false;
outHitInfo.bUseCache = false;
return pStatObj->RayIntersection(outHitInfo, 0);
return pStatObj->RayIntersection(outHitInfo, nullptr);
}
//////////////////////////////////////////////////////////////////////////

@ -321,7 +321,7 @@ public:
//! Set object selected status.
virtual void SetSelected(bool bSelect);
//! Return associated 3DEngine render node
virtual IRenderNode* GetEngineNode() const { return NULL; };
virtual IRenderNode* GetEngineNode() const { return nullptr; };
//! Set object highlighted (Note: not selected)
virtual void SetHighlight(bool bHighlight);
//! Check if object is highlighted.
@ -410,9 +410,9 @@ public:
//! 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 = NULL) const;
void GetAllChildren(DynArray< _smart_ptr<CBaseObject> >& outAllChildren, CBaseObject* pObj = NULL) const;
void GetAllChildren(CSelectionGroup& outAllChildren, CBaseObject* pObj = NULL) const;
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.
@ -468,8 +468,8 @@ public:
//! Called when object is being created (use GetMouseCreateCallback for more advanced mouse creation callback).
virtual int MouseCreateCallback(CViewport* view, EMouseEvent event, QPoint& point, int flags);
// Return pointer to the callback object used when creating object by the mouse.
// If this function return NULL MouseCreateCallback method will be used instead.
virtual IMouseCreateCallback* GetMouseCreateCallback() { return 0; };
// If this function return nullptr MouseCreateCallback method will be used instead.
virtual IMouseCreateCallback* GetMouseCreateCallback() { return nullptr; };
//! Draw object to specified viewport.
virtual void Display([[maybe_unused]] DisplayContext& disp) {}
@ -598,7 +598,7 @@ public:
bool CanBeHightlighted() const;
bool IsSkipSelectionHelper() const;
virtual IStatObj* GetIStatObj() { return NULL; }
virtual IStatObj* GetIStatObj() { return nullptr; }
// Invalidates cached transformation matrix.
// nWhyFlags - Flags that indicate the reason for matrix invalidation.
@ -672,7 +672,7 @@ protected:
//! Draw warning icons
virtual void DrawWarningIcons(DisplayContext& dc, const Vec3& pos);
//! Check if dimension's figures can be displayed before draw them.
virtual void DrawDimensions(DisplayContext& dc, AABB* pMergedBoundBox = NULL);
virtual void DrawDimensions(DisplayContext& dc, AABB* pMergedBoundBox = nullptr);
//! Draw highlight.
virtual void DrawHighlight(DisplayContext& dc);

@ -56,18 +56,18 @@ public:
}
protected:
virtual void Release() { delete this; };
virtual int GetSize() { return sizeof(*this); }; // Return size of xml state.
virtual QString GetDescription() { return "Entity Link"; };
virtual QString GetObjectName(){ return ""; };
void Release() override { delete this; };
int GetSize() override { return sizeof(*this); }; // Return size of xml state.
QString GetDescription() override { return "Entity Link"; };
QString GetObjectName() override{ return ""; };
virtual void Undo([[maybe_unused]] bool bUndo)
void Undo([[maybe_unused]] bool bUndo) override
{
for (int i = 0, iLinkSize(m_Links.size()); i < iLinkSize; ++i)
{
SLink& link = m_Links[i];
CBaseObject* pObj = GetIEditor()->GetObjectManager()->FindObject(link.entityID);
if (pObj == NULL)
if (pObj == nullptr)
{
continue;
}
@ -83,7 +83,7 @@ protected:
pEntity->LoadLink(link.linkXmlNode->getChild(0));
}
}
virtual void Redo(){}
void Redo() override{}
private:
@ -109,7 +109,7 @@ public:
, m_bAttach(bAttach)
{}
virtual void Undo([[maybe_unused]] bool bUndo) override
void Undo([[maybe_unused]] bool bUndo) override
{
if (!m_bAttach)
{
@ -117,7 +117,7 @@ public:
}
}
virtual void Redo() override
void Redo() override
{
if (m_bAttach)
{
@ -138,8 +138,8 @@ private:
}
}
virtual int GetSize() { return sizeof(CUndoAttachEntity); }
virtual QString GetDescription() { return "Attachment Changed"; }
int GetSize() override { return sizeof(CUndoAttachEntity); }
QString GetDescription() override { return "Attachment Changed"; }
GUID m_attachedEntityGUID;
CEntityObject::EAttachmentType m_attachmentType;
@ -167,7 +167,7 @@ CEntityObject::CEntityObject()
{
m_bLoadFailed = false;
m_visualObject = 0;
m_visualObject = nullptr;
m_box.min.Set(0, 0, 0);
m_box.max.Set(0, 0, 0);
@ -225,7 +225,7 @@ CEntityObject::CEntityObject()
mv_ratioLOD.SetLimits(0, 255);
mv_viewDistanceMultiplier.SetLimits(0.0f, IRenderNode::VIEW_DISTANCE_MULTIPLIER_MAX);
m_physicsState = 0;
m_physicsState = nullptr;
m_attachmentType = eAT_Pivot;
@ -540,7 +540,7 @@ IVariable* CEntityObject::FindVariableInSubBlock(CVarBlockPtr& properties, IVari
//////////////////////////////////////////////////////////////////////////
void CEntityObject::AdjustLightProperties(CVarBlockPtr& properties, const char* pSubBlock)
{
IVariable* pSubBlockVar = pSubBlock ? properties->FindVariable(pSubBlock) : NULL;
IVariable* pSubBlockVar = pSubBlock ? properties->FindVariable(pSubBlock) : nullptr;
if (IVariable* pRadius = FindVariableInSubBlock(properties, pSubBlockVar, "Radius"))
{
@ -933,7 +933,7 @@ void CEntityObject::Serialize(CObjectArchive& ar)
{
XmlNodeRef eventTarget = eventTargets->getChild(i);
CEntityEventTarget et;
et.target = 0;
et.target = nullptr;
GUID targetId = GUID_NULL;
eventTarget->getAttr("TargetId", targetId);
eventTarget->getAttr("Event", et.event);
@ -1029,7 +1029,7 @@ void CEntityObject::Serialize(CObjectArchive& ar)
{
CEntityEventTarget& et = m_eventTargets[i];
GUID targetId = GUID_NULL;
if (et.target != 0)
if (et.target != nullptr)
{
targetId = et.target->GetId();
}
@ -1060,7 +1060,7 @@ XmlNodeRef CEntityObject::Export([[maybe_unused]] const QString& levelPath, XmlN
{
if (m_bLoadFailed)
{
return 0;
return nullptr;
}
// Do not export entity with bad id.
@ -1268,7 +1268,7 @@ void CEntityObject::OnEvent(ObjectEvent event)
IObjectManager* objMan = GetIEditor()->GetObjectManager();
if (objMan && objMan->IsLightClass(this))
{
OnPropertyChange(NULL);
OnPropertyChange(nullptr);
}
break;
}
@ -1314,7 +1314,7 @@ IVariable* CEntityObject::GetLightVariable(const char* name0) const
{
IVariable* pChild = pLightProperties->GetVariable(i);
if (pChild == NULL)
if (pChild == nullptr)
{
continue;
}
@ -1341,7 +1341,7 @@ QString CEntityObject::GetLightAnimation() const
{
IVariable* pChild = pStyleGroup->GetVariable(i);
if (pChild == NULL)
if (pChild == nullptr)
{
continue;
}
@ -1617,7 +1617,7 @@ void CEntityObject::RemoveEventTarget(int index, [[maybe_unused]] bool bUpdateSc
//////////////////////////////////////////////////////////////////////////
int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
{
CEntityObject* target = 0;
CEntityObject* target = nullptr;
if (targetEntityId != GUID_NULL)
{
CBaseObject* pObject = FindObject(targetEntityId);
@ -1635,7 +1635,7 @@ int CEntityObject::AddEntityLink(const QString& name, GUID targetEntityId)
StoreUndo("Add EntityLink");
CLineGizmo* pLineGizmo = 0;
CLineGizmo* pLineGizmo = nullptr;
// Assign event target.
if (target)
@ -1968,7 +1968,7 @@ void CEntityObject::ResetCallbacks()
//@FIXME Hack to display radii of properties.
// wires properties from param block, to this entity internal variables.
IVariable* var = 0;
IVariable* var = nullptr;
var = pProperties->FindVariable("Radius", false);
if (var && (var->GetType() == IVariable::FLOAT || var->GetType() == IVariable::INT))
{
@ -2194,7 +2194,7 @@ template <typename T>
T CEntityObject::GetEntityProperty(const char* pName, T defaultvalue) const
{
CVarBlock* pProperties = GetProperties2();
IVariable* pVariable = NULL;
IVariable* pVariable = nullptr;
if (pProperties)
{
pVariable = pProperties->FindVariable(pName);
@ -2228,7 +2228,7 @@ template <typename T>
void CEntityObject::SetEntityProperty(const char* pName, T value)
{
CVarBlock* pProperties = GetProperties2();
IVariable* pVariable = NULL;
IVariable* pVariable = nullptr;
if (pProperties)
{
pVariable = pProperties->FindVariable(pName);

@ -185,7 +185,7 @@ public:
void RemoveAllEntityLinks();
virtual void EntityLinked([[maybe_unused]] const QString& name, [[maybe_unused]] GUID targetEntityId){}
virtual void EntityUnlinked([[maybe_unused]] const QString& name, [[maybe_unused]] GUID targetEntityId) {}
void LoadLink(XmlNodeRef xmlNode, CObjectArchive* pArchive = NULL);
void LoadLink(XmlNodeRef xmlNode, CObjectArchive* pArchive = nullptr);
void SaveLink(XmlNodeRef xmlNode);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////

@ -67,7 +67,7 @@ public:
//! Set this gizmo to be deleted.
void DeleteThis();
virtual CBaseObjectPtr GetBaseObject() const { return NULL; }
virtual CBaseObjectPtr GetBaseObject() const { return nullptr; }
protected:

@ -79,7 +79,7 @@ CGizmo* CGizmoManager::GetGizmoByIndex(int nIndex) const
return *ii;
}
}
return NULL;
return nullptr;
}
//////////////////////////////////////////////////////////////////////////

@ -37,8 +37,8 @@ CLineGizmo::~CLineGizmo()
{
m_object[1]->RemoveEventListener(this);
}
m_object[0] = 0;
m_object[1] = 0;
m_object[0] = nullptr;
m_object[1] = nullptr;
}
//////////////////////////////////////////////////////////////////////////
@ -164,7 +164,7 @@ void CLineGizmo::SetName(const char* sName)
//////////////////////////////////////////////////////////////////////////
bool CLineGizmo::HitTest([[maybe_unused]] HitContext& hc)
{
return 0;
return false;
/*
if (hc.distanceTollerance != 0)
return 0;

@ -28,8 +28,8 @@ CObjectArchive::CObjectArchive(IObjectManager* objMan, XmlNodeRef xmlRoot, bool
m_nFlags = 0;
node = xmlRoot;
m_pCurrentErrorReport = GetIEditor()->GetErrorReport();
m_pGeometryPak = NULL;
m_pCurrentObject = NULL;
m_pGeometryPak = nullptr;
m_pCurrentObject = nullptr;
m_bNeedResolveObjects = false;
m_bProgressBarEnabled = true;
}
@ -145,7 +145,7 @@ void CObjectArchive::ResolveObjects()
// Objects can be added to the list here (from Groups).
numObj = m_loadedObjects.size();
}
m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
//////////////////////////////////////////////////////////////////////////
GetIEditor()->ResumeUndo();
}
@ -238,7 +238,7 @@ void CObjectArchive::ResolveObjects()
// might generate unrelated errors
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
}
m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
//////////////////////////////////////////////////////////////////////////
}
@ -257,7 +257,7 @@ void CObjectArchive::ResolveObjects()
}
m_bNeedResolveObjects = false;
m_pCurrentErrorReport->SetCurrentValidatorObject(NULL);
m_pCurrentErrorReport->SetCurrentValidatorObject(nullptr);
m_sequenceIdRemap.clear();
m_pendingIds.clear();
}
@ -314,7 +314,7 @@ void CObjectArchive::LoadObjects(XmlNodeRef& rootObjectsNode)
for (int i = 0; i < numObjects; i++)
{
XmlNodeRef objNode = rootObjectsNode->getChild(i);
LoadObject(objNode, NULL);
LoadObject(objNode, nullptr);
}
}
@ -401,7 +401,7 @@ void CObjectArchive::AddSequenceIdMapping(uint32 oldId, uint32 newId)
{
assert(oldId != newId);
assert(GetIEditor()->GetMovieSystem()->FindSequenceById(oldId) || stl::find(m_pendingIds, oldId));
assert(GetIEditor()->GetMovieSystem()->FindSequenceById(newId) == NULL);
assert(GetIEditor()->GetMovieSystem()->FindSequenceById(newId) == nullptr);
assert(stl::find(m_pendingIds, newId) == false);
m_sequenceIdRemap[oldId] = newId;
m_pendingIds.push_back(newId);

@ -67,7 +67,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
void LoadObjects(XmlNodeRef& rootObjectsNode);
//! Load one object from archive.
CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = NULL);
CBaseObject* LoadObject(const XmlNodeRef& objNode, CBaseObject* pPrevObject = nullptr);
//////////////////////////////////////////////////////////////////////////
int GetLoadedObjectsCount() { return static_cast<int>(m_loadedObjects.size()); }

@ -32,7 +32,11 @@
#include <AzCore/Console/Console.h>
AZ_CVAR_EXTERNED(bool, ed_visibility_logTiming);
AZ_CVAR_EXTERNED(bool, ed_visibility_use);
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.
@ -49,16 +53,16 @@ public:
GUID guid;
public:
REFGUID ClassID()
REFGUID ClassID() override
{
return guid;
}
ObjectType GetObjectType() { return superType->GetObjectType(); };
QString ClassName() { return type; };
QString Category() { return category; };
ObjectType GetObjectType() override { return superType->GetObjectType(); };
QString ClassName() override { return type; };
QString Category() override { return category; };
QObject* CreateQObject() const override { return superType->CreateQObject(); }
QString GetTextureIcon() { return superType->GetTextureIcon(); };
QString GetFileSpec()
QString GetTextureIcon() override { return superType->GetTextureIcon(); };
QString GetFileSpec() override
{
if (!fileSpec.isEmpty())
{
@ -69,7 +73,7 @@ public:
return superType->GetFileSpec();
}
};
virtual int GameCreationOrder() { return superType->GameCreationOrder(); };
int GameCreationOrder() override { return superType->GameCreationOrder(); };
};
void CBaseObjectsCache::AddObject(CBaseObject* object)
@ -86,7 +90,7 @@ void CBaseObjectsCache::AddObject(CBaseObject* object)
//////////////////////////////////////////////////////////////////////////
// CObjectManager implementation.
//////////////////////////////////////////////////////////////////////////
CObjectManager* g_pObjectManager = 0;
CObjectManager* g_pObjectManager = nullptr;
//////////////////////////////////////////////////////////////////////////
CObjectManager::CObjectManager()
@ -182,19 +186,19 @@ CBaseObject* CObjectManager::NewObject(CObjectClassDesc* cls, CBaseObject* prev,
if (!AddObject(obj))
{
obj = 0;
obj = nullptr;
}
}
else
{
obj = 0;
obj = nullptr;
}
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
}
GetIEditor()->ResumeUndo();
if (obj != 0 && GetIEditor()->IsUndoRecording())
if (obj != nullptr && GetIEditor()->IsUndoRecording())
{
// AZ entity creations are handled through the AZ undo system.
if (obj->GetType() != OBJTYPE_AZENTITY)
@ -228,7 +232,7 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
if (!objNode->getAttr("Type", typeName))
{
return 0;
return nullptr;
}
if (!objNode->getAttr("Id", id))
@ -268,7 +272,7 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
if (!cls)
{
CryWarning(VALIDATOR_MODULE_EDITOR, VALIDATOR_ERROR, "RuntimeClass %s not registered", typeName.toUtf8().data());
return 0;
return nullptr;
}
pObject = qobject_cast<CBaseObject*>(cls->CreateQObject());
@ -301,29 +305,29 @@ CBaseObject* CObjectManager::NewObject(CObjectArchive& ar, CBaseObject* pUndoObj
GetIEditor()->GetErrorReport()->ReportError(errorRecord);
}
return 0;
return nullptr;
//CoCreateGuid( &pObject->m_guid ); // generate uniq GUID for this object.
}
}
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(pObject);
if (!pObject->Init(GetIEditor(), 0, ""))
if (!pObject->Init(GetIEditor(), nullptr, ""))
{
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
return 0;
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
return nullptr;
}
if (!AddObject(pObject))
{
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
return 0;
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
return nullptr;
}
//pObject->Serialize( ar );
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(NULL);
GetIEditor()->GetErrorReport()->SetCurrentValidatorObject(nullptr);
if (pObject != 0 && pUndoObject == 0)
if (pObject != nullptr && pUndoObject == nullptr)
{
// If new object with no undo, record it.
if (CUndo::IsRecording())
@ -355,7 +359,7 @@ CBaseObject* CObjectManager::NewObject(const QString& typeName, CBaseObject* pre
if (!cls)
{
GetIEditor()->GetSystem()->GetILog()->Log("Warning: RuntimeClass %s (as well as %s) not registered", typeName.toUtf8().data(), fullName.toUtf8().data());
return 0;
return nullptr;
}
CBaseObject* pObject = NewObject(cls, prev, file, newObjectName);
return pObject;
@ -411,7 +415,7 @@ void CObjectManager::DeleteObject(CBaseObject* obj)
void CObjectManager::DeleteSelection(CSelectionGroup* pSelection)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
if (pSelection == NULL)
if (pSelection == nullptr)
{
return;
}
@ -527,7 +531,7 @@ CBaseObject* CObjectManager::CloneObject(CBaseObject* obj)
//////////////////////////////////////////////////////////////////////////
CBaseObject* CObjectManager::FindObject(REFGUID guid) const
{
CBaseObject* result = stl::find_in_map(m_objects, guid, (CBaseObject*)0);
CBaseObject* result = stl::find_in_map(m_objects, guid, (CBaseObject*)nullptr);
return result;
}
@ -603,7 +607,7 @@ void CObjectManager::FindObjectsInAABB(const AABB& aabb, std::vector<CBaseObject
//////////////////////////////////////////////////////////////////////////
bool CObjectManager::AddObject(CBaseObject* obj)
{
CBaseObjectPtr p = stl::find_in_map(m_objects, obj->GetId(), 0);
CBaseObjectPtr p = stl::find_in_map(m_objects, obj->GetId(), nullptr);
if (p)
{
CErrorRecord err;
@ -908,7 +912,7 @@ void CObjectManager::UnfreezeAll()
bool CObjectManager::SelectObject(CBaseObject* obj, bool bUseMask)
{
assert(obj);
if (obj == NULL)
if (obj == nullptr)
{
return false;
}
@ -974,7 +978,7 @@ void CObjectManager::UnselectObject(CBaseObject* obj)
CSelectionGroup* CObjectManager::GetSelection(const QString& name) const
{
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
return selection;
}
@ -993,7 +997,7 @@ void CObjectManager::NameSelection(const QString& name)
return;
}
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
if (selection)
{
assert(selection != 0);
@ -1020,7 +1024,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading)
return;
}
_smart_ptr<CSelectionGroup> tmpGroup(0);
_smart_ptr<CSelectionGroup> tmpGroup(nullptr);
QString selRootStr("NameSelection");
QString selNodeStr("NameSelectionNode");
@ -1075,7 +1079,7 @@ void CObjectManager::SerializeNameSelection(XmlNodeRef& rootNode, bool bLoading)
else
{
startNode = rootNode->newChild(selRootStr.toUtf8().data());
CSelectionGroup* objSelection = 0;
CSelectionGroup* objSelection = nullptr;
for (TNameSelectionMap::iterator it = m_selections.begin(); it != m_selections.end(); ++it)
{
@ -1186,7 +1190,7 @@ int CObjectManager::InvertSelection()
void CObjectManager::SetSelection(const QString& name)
{
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
if (selection)
{
UnselectCurrent();
@ -1201,7 +1205,7 @@ void CObjectManager::RemoveSelection(const QString& name)
AZ_PROFILE_FUNCTION(AZ::Debug::ProfileCategory::Editor);
QString selName = name;
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)0);
CSelectionGroup* selection = stl::find_in_map(m_selections, name, (CSelectionGroup*)nullptr);
if (selection)
{
if (selection == m_currSelection)
@ -1327,7 +1331,6 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
pDispayedViewObjects->SetSerialNumber(m_visibilitySerialNumber); // update viewport to be latest serial number
const CCamera& camera = GetIEditor()->GetSystem()->GetViewCamera();
AABB bbox;
bbox.min.zero();
bbox.max.zero();
@ -1359,7 +1362,7 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
for (int i = 0, iCount(pSelection->GetCount()); i < iCount; ++i)
{
CBaseObject* pObj(pSelection->GetObject(i));
if (pObj == NULL)
if (pObj == nullptr)
{
continue;
}
@ -1376,11 +1379,9 @@ void CObjectManager::FindDisplayableObjects(DisplayContext& dc, [[maybe_unused]]
{
CBaseObject* obj = m_visibleObjects[i];
if (obj && obj->IsInCameraView(camera))
if (obj)
{
// Check if object is too far.
float visRatio = obj->GetCameraVisRatio(camera);
if (visRatio > m_maxObjectViewDistRatio || (dc.flags & DISPLAY_SELECTION_HELPERS) || obj->IsSelected())
if ((dc.flags & DISPLAY_SELECTION_HELPERS) || obj->IsSelected())
{
pDispayedViewObjects->AddObject(obj);
}
@ -1443,7 +1444,7 @@ void CObjectManager::BeginEditParams(CBaseObject* obj, int flags)
void CObjectManager::EndEditParams([[maybe_unused]] int flags)
{
m_bSingleSelection = false;
m_currEditObject = 0;
m_currEditObject = nullptr;
//m_bSelectionChanged = false; // don't need to clear for ungroup
}
@ -1657,7 +1658,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo)
HitContext hcOrg = hitInfo;
if (hcOrg.view)
{
hcOrg.view->GetPerpendicularAxis(0, &hcOrg.b2DViewport);
hcOrg.view->GetPerpendicularAxis(nullptr, &hcOrg.b2DViewport);
}
hcOrg.rayDir = hcOrg.rayDir.GetNormalized();
@ -1692,7 +1693,7 @@ bool CObjectManager::HitTest(HitContext& hitInfo)
const bool iconsPrioritized = true; // Force icons to always be prioritized over other things you hit. Can change to be a configurable option in the future.
CBaseObject* selected = 0;
CBaseObject* selected = nullptr;
const char* name = nullptr;
bool iconHit = false;
int numVis = pDispayedViewObjects->GetObjectCount();
@ -1993,11 +1994,11 @@ bool CObjectManager::EnableUniqObjectNames(bool bEnable)
CObjectClassDesc* CObjectManager::FindClass(const QString& className)
{
IClassDesc* cls = CClassFactory::Instance()->FindClass(className.toUtf8().data());
if (cls != NULL && cls->SystemClassID() == ESYSTEM_CLASS_OBJECT)
if (cls != nullptr && cls->SystemClassID() == ESYSTEM_CLASS_OBJECT)
{
return (CObjectClassDesc*)cls;
}
return 0;
return nullptr;
}
//////////////////////////////////////////////////////////////////////////
@ -2101,7 +2102,7 @@ void CObjectManager::LoadClassTemplates(const QString& path)
{
// Construct the full filepath of the current file
XmlNodeRef node = XmlHelpers::LoadXmlFromFile((dir + files[k].filename).toUtf8().data());
if (node != 0 && node->isTag("ObjectTemplates"))
if (node != nullptr && node->isTag("ObjectTemplates"))
{
QString name;
for (int i = 0; i < node->getChildCount(); i++)
@ -2449,7 +2450,7 @@ void CObjectManager::EndObjectsLoading()
{
delete m_pLoadProgress;
}
m_pLoadProgress = 0;
m_pLoadProgress = nullptr;
}
//////////////////////////////////////////////////////////////////////////
@ -2481,20 +2482,20 @@ bool CObjectManager::IsLightClass(CBaseObject* pObject)
{
if (pEntity->GetEntityClass().compare(CLASS_LIGHT) == 0)
{
return TRUE;
return true;
}
if (pEntity->GetEntityClass().compare(CLASS_RIGIDBODY_LIGHT) == 0)
{
return TRUE;
return true;
}
if (pEntity->GetEntityClass().compare(CLASS_DESTROYABLE_LIGHT) == 0)
{
return TRUE;
return true;
}
}
}
return FALSE;
return false;
}
void CObjectManager::FindAndRenameProperty2(const char* property2Name, const QString& oldValue, const QString& newValue)

@ -636,7 +636,7 @@ void CSelectionGroup::FinishChanges()
for (int i = 0; i < iObjectSize; ++i)
{
CBaseObject* pObject = selectedObjects[i];
if (pObject == NULL)
if (pObject == nullptr)
{
continue;
}

@ -34,7 +34,7 @@ namespace {
//////////////////////////////////////////////////////////////////////////
CTrackGizmo::CTrackGizmo()
{
m_pAnimNode = 0;
m_pAnimNode = nullptr;
m_worldBbox.min = Vec3(-10000, -10000, -10000);
m_worldBbox.max = Vec3(10000, 10000, 10000);

@ -13,3 +13,27 @@ set_target_properties(Editor PROPERTIES
RESOURCE ${CMAKE_CURRENT_LIST_DIR}/Images.xcassets
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME EditorAppIcon
)
# We cannot use ly_add_target here because we're already including this file from inside ly_add_target
# So we need to setup target, dependencies and install logic manually.
add_executable(EditorDummy Platform/Mac/main_dummy.cpp)
add_executable(AZ::EditorDummy ALIAS EditorDummy)
ly_target_link_libraries(EditorDummy
PRIVATE
AZ::AzCore
AZ::AzFramework)
ly_add_dependencies(Editor EditorDummy)
# Store the aliased target into a DIRECTORY property
set_property(DIRECTORY APPEND PROPERTY LY_DIRECTORY_TARGETS AZ::EditorDummy)
# Store the directory path in a GLOBAL property so that it can be accessed
# in the layout install logic. Skip if the directory has already been added
get_property(ly_all_target_directories GLOBAL PROPERTY LY_ALL_TARGET_DIRECTORIES)
if(NOT CMAKE_CURRENT_SOURCE_DIR IN_LIST ly_all_target_directories)
set_property(GLOBAL APPEND PROPERTY LY_ALL_TARGET_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR})
endif()
ly_install_add_install_path_setreg(Editor)

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>Editor</string>
<string>EditorDummy</string>
<key>CFBundleIdentifier</key>
<string>org.O3DE.Editor</string>
<key>CFBundlePackageType</key>

@ -0,0 +1,75 @@
/*
* 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 <AzCore/Component/ComponentApplication.h>
#include <AzCore/Memory/SystemAllocator.h>
#include <AzCore/Settings/SettingsRegistryMergeUtils.h>
#include <AzCore/Utils/Utils.h>
#include <AzFramework/Process/ProcessWatcher.h>
#include <cstdlib>
int main(int argc, char* argv[])
{
// Create a ComponentApplication to initialize the AZ::SystemAllocator and initialize the SettingsRegistry
AZ::ComponentApplication::Descriptor desc;
AZ::ComponentApplication application;
application.Create(desc);
AZStd::vector<AZStd::string> envVars;
const char* homePath = std::getenv("HOME");
envVars.push_back(AZStd::string::format("HOME=%s", homePath));
if (auto settingsRegistry = AZ::SettingsRegistry::Get(); settingsRegistry != nullptr)
{
const char* dyldLibPathOrig = std::getenv("DYLD_LIBRARY_PATH");
AZStd::string dyldSearchPath = AZStd::string::format("DYLD_LIBRARY_PATH=%s", dyldLibPathOrig);
if (AZ::IO::FixedMaxPath projectModulePath;
settingsRegistry->Get(projectModulePath.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_ProjectConfigurationBinPath))
{
dyldSearchPath.append(":");
dyldSearchPath.append(projectModulePath.c_str());
}
if (AZ::IO::FixedMaxPath installedBinariesFolder;
settingsRegistry->Get(installedBinariesFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_InstalledBinaryFolder))
{
if (AZ::IO::FixedMaxPath engineRootFolder;
settingsRegistry->Get(engineRootFolder.Native(), AZ::SettingsRegistryMergeUtils::FilePathKey_EngineRootFolder))
{
installedBinariesFolder = engineRootFolder / installedBinariesFolder;
dyldSearchPath.append(":");
dyldSearchPath.append(installedBinariesFolder.c_str());
}
}
envVars.push_back(dyldSearchPath);
}
AZStd::string commandArgs;
for (int i = 1; i < argc; i++)
{
commandArgs.append(argv[i]);
commandArgs.append(" ");
}
AzFramework::ProcessLauncher::ProcessLaunchInfo processLaunchInfo;
AZ::IO::Path processPath{ AZ::IO::PathView(AZ::Utils::GetExecutableDirectory()) };
processPath /= "Editor";
processLaunchInfo.m_processExecutableString = AZStd::move(processPath.Native());
processLaunchInfo.m_commandlineParameters = commandArgs;
processLaunchInfo.m_environmentVariables = &envVars;
processLaunchInfo.m_showWindow = true;
AzFramework::ProcessWatcher* processWatcher = AzFramework::ProcessWatcher::LaunchProcess(processLaunchInfo, AzFramework::ProcessCommunicationType::COMMUNICATOR_TYPE_NONE);
application.Destroy();
return 0;
}

@ -51,8 +51,8 @@ bool CMailer::SendMail(const char* subject,
attachments[i].flFlags = 0;
attachments[i].nPosition = (ULONG)-1;
attachments[i].lpszPathName = (char*)(const char*)_attachments[k];
attachments[i].lpszFileName = NULL;
attachments[i].lpFileType = NULL;
attachments[i].lpszFileName = nullptr;
attachments[i].lpFileType = nullptr;
i++;
}
int numAttachments = i;
@ -74,14 +74,14 @@ bool CMailer::SendMail(const char* subject,
recipients[i].lpszName = (char*)(const char*)_recipients[i];
recipients[i].lpszAddress = (char*)addresses[i].c_str();
recipients[i].ulEIDSize = 0;
recipients[i].lpEntryID = NULL;
recipients[i].lpEntryID = nullptr;
}
MapiMessage message;
memset(&message, 0, sizeof(message));
message.lpszSubject = (char*)(const char*)subject;
message.lpszNoteText = (char*)(const char*)messageBody;
message.lpszMessageType = NULL;
message.lpszMessageType = nullptr;
message.nRecipCount = numRecipients;
message.lpRecips = recipients;

@ -84,6 +84,7 @@
#include <Editor/Util/PathUtil.h>
#include <IResourceSelectorHost.h>
#include "CryEdit.h"
#include "Undo/Undo.h"
#include <QMenu>
#include <QAction>
@ -1815,7 +1816,7 @@ void SandboxIntegrationManager::ContextMenu_PushEntitiesToSlice(AzToolsFramework
(void)targetAncestorId;
(void)affectEntireHierarchy;
AZ::SerializeContext* serializeContext = NULL;
AZ::SerializeContext* serializeContext = nullptr;
EBUS_EVENT_RESULT(serializeContext, AZ::ComponentApplicationBus, GetSerializeContext);
AZ_Assert(serializeContext, "No serialize context");

@ -42,7 +42,7 @@ void ComponentPaletteWindow::Init()
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
QHBoxLayout* gridLayout = new QHBoxLayout(NULL);
QHBoxLayout* gridLayout = new QHBoxLayout(nullptr);
gridLayout->setSizeConstraint(QLayout::SetMaximumSize);
gridLayout->setContentsMargins(0, 0, 0, 0);
gridLayout->setSpacing(0);

@ -30,13 +30,13 @@ class CDockWidgetTitleButton
public:
CDockWidgetTitleButton(QWidget* parent);
QSize sizeHint() const;
QSize minimumSizeHint() const { return sizeHint(); }
QSize sizeHint() const override;
QSize minimumSizeHint() const override { return sizeHint(); }
protected:
void enterEvent(QEvent* ev);
void leaveEvent(QEvent* ev);
void paintEvent(QPaintEvent* ev);
void enterEvent(QEvent* ev) override;
void leaveEvent(QEvent* ev) override;
void paintEvent(QPaintEvent* ev) override;
};
class CTitleBarText
@ -85,10 +85,10 @@ QSize CDockWidgetTitleButton::sizeHint() const
{
ensurePolished();
int size = 2 * style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, 0, this);
int size = 2 * style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin, nullptr, this);
if (!icon().isNull())
{
int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
int iconSize = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
QSize sz = icon().actualSize(QSize(iconSize, iconSize));
size += qMax(sz.width(), sz.height());
}
@ -145,7 +145,7 @@ void CDockWidgetTitleButton::paintEvent([[maybe_unused]] QPaintEvent* ev)
opt.activeSubControls = QStyle::SubControls();
opt.features = QStyleOptionToolButton::None;
opt.arrowType = Qt::NoArrow;
int size = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
int size = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
opt.iconSize = QSize(size, size);
style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &painter, this);
}

@ -15,7 +15,7 @@ PLUGIN_API IPlugin* CreatePluginInstance(PLUGIN_INIT_PARAM* pInitParam)
if (pInitParam->pluginVersion != SANDBOX_PLUGIN_SYSTEM_VERSION)
{
pInitParam->outErrorCode = IPlugin::eError_VersionMismatch;
return 0;
return nullptr;
}
ModuleInitISystem(GetIEditor()->GetSystem(), "FFMPEGPlugin");

@ -56,7 +56,7 @@ void CPerforceSourceControl::ShowSettings()
void CPerforceSourceControl::SetSourceControlState(SourceControlState state)
{
AUTO_LOCK(g_cPerforceValues);
CryAutoLock<CryCriticalSection> lock(g_cPerforceValues);
switch (state)
{

@ -165,8 +165,8 @@ namespace ProjectSettingsTool
if (editContext)
{
editContext->Class<AndroidSplashscreens>("Splashscreens", "All splashscreen overrides for Android.")
->DataElement(0, &AndroidSplashscreens::m_landscapeSplashscreens)
->DataElement(0, &AndroidSplashscreens::m_portraitSplashscreens)
->DataElement(AZ::Edit::UIHandlers::Default, &AndroidSplashscreens::m_landscapeSplashscreens)
->DataElement(AZ::Edit::UIHandlers::Default, &AndroidSplashscreens::m_portraitSplashscreens)
;
}
}

@ -16,7 +16,7 @@
namespace
{
typedef ProjectSettingsTool::FunctorValidator::ReturnType RetType;
using RetType = ProjectSettingsTool::FunctorValidator::ReturnType;
static const int noMaxLength = -1;
static const int maxIosVersionLength = 18;

File diff suppressed because it is too large Load Diff

@ -1,649 +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
*
*/
#ifndef CRYINCLUDE_EDITOR_RENDERVIEWPORT_H
#define CRYINCLUDE_EDITOR_RENDERVIEWPORT_H
#pragma once
// RenderViewport.h : header file
//
#if !defined(Q_MOC_RUN)
#include <Cry_Camera.h>
#include <QSet>
#include "Viewport.h"
#include "Objects/DisplayContext.h"
#include "Undo/Undo.h"
#include "Util/PredefinedAspectRatios.h"
#include <AzCore/Component/EntityId.h>
#include <AzCore/std/optional.h>
#include <AzFramework/Input/Buses/Requests/InputSystemCursorRequestBus.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
#include <AzToolsFramework/API/EditorCameraBus.h>
#include <AzToolsFramework/Entity/EditorEntityContextBus.h>
#include <AzToolsFramework/Viewport/ViewportMessages.h>
#include <MathConversion.h>
#endif
#include <AzFramework/Windowing/WindowBus.h>
#include <AzFramework/Visibility/EntityVisibilityQuery.h>
// forward declarations.
class CBaseObject;
class QMenu;
class QKeyEvent;
class EditorEntityNotifications;
struct ray_hit;
struct IRenderMesh;
struct IVariable;
namespace AzToolsFramework
{
class ManipulatorManager;
}
// CRenderViewport window
AZ_PUSH_DISABLE_DLL_EXPORT_BASECLASS_WARNING
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
class SANDBOX_API CRenderViewport
: public QtViewport
, public IEditorNotifyListener
, public IUndoManagerListener
, public Camera::EditorCameraRequestBus::Handler
, public AzFramework::InputSystemCursorConstraintRequestBus::Handler
, public AzToolsFramework::ViewportInteraction::ViewportFreezeRequestBus::Handler
, public AzToolsFramework::ViewportInteraction::ViewportInteractionRequestBus::Handler
, public AzToolsFramework::ViewportInteraction::MainEditorViewportInteractionRequestBus::Handler
, public AzFramework::WindowRequestBus::Handler
{
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
Q_OBJECT
public:
struct SResolution
{
SResolution()
: width(0)
, height(0)
{
}
SResolution(int w, int h)
: width(w)
, height(h)
{
}
int width;
int height;
};
public:
CRenderViewport(const QString& name, QWidget* parent = nullptr);
static const GUID& GetClassID()
{
return QtViewport::GetClassID<CRenderViewport>();
}
/** Get type of this viewport.
*/
virtual EViewportType GetType() const { return ET_ViewportCamera; }
virtual void SetType([[maybe_unused]] EViewportType type) { assert(type == ET_ViewportCamera); };
// Implementation
public:
virtual ~CRenderViewport();
Q_INVOKABLE void InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons);
public:
virtual void Update();
virtual void ResetContent();
virtual void UpdateContent(int flags);
void OnTitleMenu(QMenu* menu) override;
void SetCamera(const CCamera& camera);
const CCamera& GetCamera() const { return m_Camera; };
virtual void SetViewTM(const Matrix34& tm)
{
if (m_viewSourceType == ViewSourceType::None)
{
m_defaultViewTM = tm;
}
SetViewTM(tm, false);
}
//! Map world space position to viewport position.
virtual QPoint WorldToView(const Vec3& wp) const;
virtual QPoint WorldToViewParticleEditor(const Vec3& wp, int width, int height) const;
virtual Vec3 WorldToView3D(const Vec3& wp, int nFlags = 0) const;
//! Map viewport position to world space position.
virtual Vec3 ViewToWorld(const QPoint& vp, bool* collideWithTerrain = nullptr, bool onlyTerrain = false, bool bSkipVegetation = false, bool bTestRenderMesh = false, bool* collideWithObject = nullptr) const override;
virtual void ViewToWorldRay(const QPoint& vp, Vec3& raySrc, Vec3& rayDir) const override;
virtual Vec3 ViewToWorldNormal(const QPoint& vp, bool onlyTerrain, bool bTestRenderMesh = false) override;
virtual float GetScreenScaleFactor(const Vec3& worldPoint) const;
virtual float GetScreenScaleFactor(const CCamera& camera, const Vec3& object_position);
virtual float GetAspectRatio() const;
virtual bool HitTest(const QPoint& point, HitContext& hitInfo);
virtual bool IsBoundsVisible(const AABB& box) const;
virtual void CenterOnSelection();
virtual void CenterOnAABB(const AABB& aabb);
void CenterOnSliceInstance() override;
void focusOutEvent(QFocusEvent* event) override;
void keyPressEvent(QKeyEvent* event) override;
void keyReleaseEvent(QKeyEvent* event) override;
void SetFOV(float fov);
float GetFOV() const;
void SetDefaultCamera();
bool IsDefaultCamera() const;
void SetSequenceCamera();
bool IsSequenceCamera() const { return m_viewSourceType == ViewSourceType::SequenceCamera; }
void SetSelectedCamera();
bool IsSelectedCamera() const;
void SetComponentCamera(const AZ::EntityId& entityId);
void SetEntityAsCamera(const AZ::EntityId& entityId, bool lockCameraMovement = false);
void SetFirstComponentCamera();
void SetViewEntity(const AZ::EntityId& cameraEntityId, bool lockCameraMovement = false);
void PostCameraSet();
// This switches the active camera to the next one in the list of (default, all custom cams).
void CycleCamera();
// Camera::EditorCameraRequestBus
void SetViewFromEntityPerspective(const AZ::EntityId& entityId) override;
void SetViewAndMovementLockFromEntityPerspective(const AZ::EntityId& entityId, bool lockCameraMovement) override;
AZ::EntityId GetCurrentViewEntityId() override { return m_viewEntityId; }
bool GetActiveCameraPosition(AZ::Vector3& cameraPos) override;
bool GetActiveCameraState(AzFramework::CameraState& cameraState) override;
// AzToolsFramework::EditorEntityContextNotificationBus (handler moved to cpp to resolve link issues in unity builds)
virtual void OnStartPlayInEditor();
virtual void OnStopPlayInEditor();
// AzToolsFramework::EditorContextMenu::Bus (handler moved to cpp to resolve link issues in unity builds)
// We use this to determine when the viewport context menu is being displayed so we can exit move mode
void PopulateEditorGlobalContextMenu(QMenu* /*menu*/, const AZ::Vector2& /*point*/, int /*flags*/);
// AzToolsFramework::ViewportInteractionRequestBus
AzFramework::CameraState GetCameraState() override;
bool GridSnappingEnabled() override;
float GridSize() override;
bool ShowGrid() override;
bool AngleSnappingEnabled() override;
float AngleStep() override;
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition) override;
AZStd::optional<AZ::Vector3> ViewportScreenToWorld(const AzFramework::ScreenPoint&, float) override
{
return {};
}
AZStd::optional<AzToolsFramework::ViewportInteraction::ProjectedViewportRay> ViewportScreenToWorldRay(
const AzFramework::ScreenPoint&) override
{
return {};
}
float DeviceScalingFactor() override { return 1.0f; }
// AzToolsFramework::ViewportFreezeRequestBus
bool IsViewportInputFrozen() override;
void FreezeViewportInput(bool freeze) override;
// AzToolsFramework::MainEditorViewportInteractionRequestBus
AZ::EntityId PickEntity(const AzFramework::ScreenPoint& point) override;
AZ::Vector3 PickTerrain(const AzFramework::ScreenPoint& point) override;
float TerrainHeight(const AZ::Vector2& position) override;
void FindVisibleEntities(AZStd::vector<AZ::EntityId>& visibleEntitiesOut) override;
bool ShowingWorldSpace() override;
QWidget* GetWidgetForViewportContextMenu() override;
void BeginWidgetContext() override;
void EndWidgetContext() override;
// WindowRequestBus::Handler...
void SetWindowTitle(const AZStd::string& title) override;
AzFramework::WindowSize GetClientAreaSize() const override;
void ResizeClientArea(AzFramework::WindowSize) override;
bool GetFullScreenState() const override;
void SetFullScreenState(bool fullScreenState) override;
bool CanToggleFullScreenState() const override;
void ToggleFullScreenState() override;
float GetDpiScaleFactor() const override { return 1.0f; };
void ConnectViewportInteractionRequestBus();
void DisconnectViewportInteractionRequestBus();
void ActivateWindowAndSetFocus();
void LockCameraMovement(bool bLock) { m_bLockCameraMovement = bLock; }
bool IsCameraMovementLocked() const { return m_bLockCameraMovement; }
void EnableCameraObjectMove(bool bMove) { m_bMoveCameraObject = bMove; }
bool IsCameraObjectMove() const { return m_bMoveCameraObject; }
void SetPlayerControl(uint32 i) { m_PlayerControl = i; };
uint32 GetPlayerControl() { return m_PlayerControl; };
const DisplayContext& GetDisplayContext() const { return m_displayContext; }
CBaseObject* GetCameraObject() const;
QPoint WidgetToViewport(const QPoint& point) const;
QPoint ViewportToWidget(const QPoint& point) const;
QSize WidgetToViewport(const QSize& size) const;
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteraction(
Qt::MouseButtons buttons, Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void SetPlayerPos()
{
Matrix34 m = GetViewTM();
m.SetTranslation(m.GetTranslation() - m_PhysicalLocation.t);
SetViewTM(m);
m_AverageFrameTime = 0.14f;
m_PhysicalLocation.SetIdentity();
m_LocalEntityMat.SetIdentity();
m_PrevLocalEntityMat.SetIdentity();
m_absCameraHigh = 2.0f;
m_absCameraPos = Vec3(0, 3, 2);
m_absCameraPosVP = Vec3(0, -3, 1.5);
m_absCurrentSlope = 0.0f;
m_absLookDirectionXY = Vec2(0, 1);
m_LookAt = Vec3(ZERO);
m_LookAtRate = Vec3(ZERO);
m_vCamPos = Vec3(ZERO);
m_vCamPosRate = Vec3(ZERO);
m_relCameraRotX = 0;
m_relCameraRotZ = 0;
uint32 numSample6 = static_cast<uint32>(m_arrAnimatedCharacterPath.size());
for (uint32 i = 0; i < numSample6; i++)
{
m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
}
numSample6 = static_cast<uint32>(m_arrSmoothEntityPath.size());
for (uint32 i = 0; i < numSample6; i++)
{
m_arrSmoothEntityPath[i] = Vec3(ZERO);
}
uint32 numSample7 = static_cast<uint32>(m_arrRunStrafeSmoothing.size());
for (uint32 i = 0; i < numSample7; i++)
{
m_arrRunStrafeSmoothing[i] = 0;
}
m_vWorldDesiredBodyDirection = Vec2(0, 1);
m_vWorldDesiredBodyDirectionSmooth = Vec2(0, 1);
m_vWorldDesiredBodyDirectionSmoothRate = Vec2(0, 1);
m_vWorldDesiredBodyDirection2 = Vec2(0, 1);
m_vWorldDesiredMoveDirection = Vec2(0, 1);
m_vWorldDesiredMoveDirectionSmooth = Vec2(0, 1);
m_vWorldDesiredMoveDirectionSmoothRate = Vec2(0, 1);
m_vLocalDesiredMoveDirection = Vec2(0, 1);
m_vLocalDesiredMoveDirectionSmooth = Vec2(0, 1);
m_vLocalDesiredMoveDirectionSmoothRate = Vec2(0, 1);
m_vWorldAimBodyDirection = Vec2(0, 1);
m_MoveSpeedMSec = 5.0f;
m_key_W = 0;
m_keyrcr_W = 0;
m_key_S = 0;
m_keyrcr_S = 0;
m_key_A = 0;
m_keyrcr_A = 0;
m_key_D = 0;
m_keyrcr_D = 0;
m_key_SPACE = 0;
m_keyrcr_SPACE = 0;
m_ControllMode = 0;
m_State = -1;
m_Stance = 1; //combat
m_udGround = 0.0f;
m_lrGround = 0.0f;
AABB aabb = AABB(Vec3(-40.0f, -40.0f, -0.25f), Vec3(+40.0f, +40.0f, +0.0f));
m_GroundOBB = OBB::CreateOBBfromAABB(Matrix33(IDENTITY), aabb);
m_GroundOBBPos = Vec3(0, 0, -0.01f);
};
static CRenderViewport* GetPrimaryViewport();
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
CCamera m_Camera;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
protected:
struct SScopedCurrentContext;
void SetViewTM(const Matrix34& tm, bool bMoveOnly);
virtual float GetCameraMoveSpeed() const;
virtual float GetCameraRotateSpeed() const;
virtual bool GetCameraInvertYRotation() const;
virtual float GetCameraInvertPan() const;
// Called to render stuff.
virtual void OnRender();
virtual void OnEditorNotifyEvent(EEditorNotifyEvent event);
//! Get currently active camera object.
void ToggleCameraObject();
void RenderConstructionPlane();
void RenderSnapMarker();
void RenderCursorString();
void RenderSnappingGrid();
void ProcessMouse();
void ProcessKeys();
void RenderAll();
void DrawAxis();
void DrawBackground();
void InitDisplayContext();
void ResetCursor();
struct SPreviousContext
{
CCamera rendererCamera;
HWND window;
int width;
int height;
bool mainViewport;
};
SPreviousContext m_preWidgetContext;
// Create an auto-sized render context that is sized based on the Editor's current
// viewport.
SPreviousContext SetCurrentContext() const;
SPreviousContext SetCurrentContext(int newWidth, int newHeight) const;
void RestorePreviousContext(const SPreviousContext& x) const;
void PreWidgetRendering() override;
void PostWidgetRendering() override;
// Update the safe frame, safe action, safe title, and borders rectangles based on
// viewport size and target aspect ratio.
void UpdateSafeFrame();
// Draw safe frame, safe action, safe title rectangles and borders.
void RenderSafeFrame();
// Draw one of the safe frame rectangles with the desired color.
void RenderSafeFrame(const QRect& frame, float r, float g, float b, float a);
// Draw the selection rectangle.
void RenderSelectionRectangle();
// Draw a selected region if it has been selected
void RenderSelectedRegion();
virtual bool CreateRenderContext();
virtual void DestroyRenderContext();
void OnMenuCommandChangeAspectRatio(unsigned int commandId);
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);
void ResizeView(int width, int height);
void OnCameraFOVVariableChanged(IVariable* var);
void HideCursor();
void ShowCursor();
bool IsKeyDown(Qt::Key key) const;
enum class ViewSourceType
{
None,
SequenceCamera,
LegacyCamera,
CameraComponent,
AZ_Entity,
ViewSourceTypesCount,
};
void ResetToViewSourceType(const ViewSourceType& viewSourType);
//! Assigned renderer.
IRenderer* m_renderer = nullptr;
bool m_bRenderContextCreated = false;
bool m_bInRotateMode = false;
bool m_bInMoveMode = false;
bool m_bInOrbitMode = false;
bool m_bInZoomMode = false;
QPoint m_mousePos = QPoint(0, 0);
QPoint m_prevMousePos = QPoint(0, 0); // for tablets, you can't use SetCursorPos and need to remember the prior point and delta with that.
float m_moveSpeed = 1;
float m_orbitDistance = 10.0f;
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
Vec3 m_orbitTarget;
//-------------------------------------------
//--- player-control in CharEdit ---
//-------------------------------------------
f32 m_MoveSpeedMSec;
uint32 m_key_W, m_keyrcr_W;
uint32 m_key_S, m_keyrcr_S;
uint32 m_key_A, m_keyrcr_A;
uint32 m_key_D, m_keyrcr_D;
uint32 m_key_SPACE, m_keyrcr_SPACE;
uint32 m_ControllMode;
int32 m_Stance;
int32 m_State;
f32 m_AverageFrameTime;
uint32 m_PlayerControl = 0;
f32 m_absCameraHigh;
Vec3 m_absCameraPos;
Vec3 m_absCameraPosVP;
f32 m_absCurrentSlope; //in radiants
Vec2 m_absLookDirectionXY;
Vec3 m_LookAt;
Vec3 m_LookAtRate;
Vec3 m_vCamPos;
Vec3 m_vCamPosRate;
float m_camFOV;
f32 m_relCameraRotX;
f32 m_relCameraRotZ;
QuatTS m_PhysicalLocation;
Matrix34 m_AnimatedCharacterMat;
Matrix34 m_LocalEntityMat; //this is used for data-driven animations where the character is running on the spot
Matrix34 m_PrevLocalEntityMat;
std::vector<Vec3> m_arrVerticesHF;
std::vector<vtx_idx> m_arrIndicesHF;
std::vector<Vec3> m_arrAnimatedCharacterPath;
std::vector<Vec3> m_arrSmoothEntityPath;
std::vector<f32> m_arrRunStrafeSmoothing;
Vec2 m_vWorldDesiredBodyDirection;
Vec2 m_vWorldDesiredBodyDirectionSmooth;
Vec2 m_vWorldDesiredBodyDirectionSmoothRate;
Vec2 m_vWorldDesiredBodyDirection2;
Vec2 m_vWorldDesiredMoveDirection;
Vec2 m_vWorldDesiredMoveDirectionSmooth;
Vec2 m_vWorldDesiredMoveDirectionSmoothRate;
Vec2 m_vLocalDesiredMoveDirection;
Vec2 m_vLocalDesiredMoveDirectionSmooth;
Vec2 m_vLocalDesiredMoveDirectionSmoothRate;
Vec2 m_vWorldAimBodyDirection;
f32 m_udGround;
f32 m_lrGround;
OBB m_GroundOBB;
Vec3 m_GroundOBBPos;
// Index of camera objects.
mutable GUID m_cameraObjectId = GUID_NULL;
mutable AZ::EntityId m_viewEntityId;
mutable ViewSourceType m_viewSourceType = ViewSourceType::None;
AZ::EntityId m_viewEntityIdCachedForEditMode;
Matrix34 m_preGameModeViewTM;
uint m_disableRenderingCount = 0;
bool m_bLockCameraMovement;
bool m_bUpdateViewport = false;
bool m_bMoveCameraObject = true;
enum class KeyPressedState
{
AllUp,
PressedThisFrame,
PressedInPreviousFrame,
};
KeyPressedState m_pressedKeyState = KeyPressedState::AllUp;
Matrix34 m_defaultViewTM;
const QString m_defaultViewName;
DisplayContext m_displayContext;
bool m_isOnPaint = false;
static CRenderViewport* m_pPrimaryViewport;
QRect m_safeFrame;
QRect m_safeAction;
QRect m_safeTitle;
CPredefinedAspectRatios m_predefinedAspectRatios;
IVariable* m_pCameraFOVVariable = nullptr;
bool m_bCursorHidden = false;
void OnMenuResolutionCustom();
void OnMenuCreateCameraEntityFromCurrentView();
void OnMenuSelectCurrentCamera();
int OnCreate();
void resizeEvent(QResizeEvent* event) override;
void paintEvent(QPaintEvent* event) override;
void mousePressEvent(QMouseEvent* event) override;
void OnLButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void OnLButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void OnLButtonDblClk(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void OnMButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void OnMButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void OnRButtonDown(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void OnRButtonUp(Qt::KeyboardModifiers modifiers, const QPoint& point) override;
void OnMouseMove(Qt::KeyboardModifiers modifiers, Qt::MouseButtons buttons, const QPoint& point) override;
void OnMouseWheel(Qt::KeyboardModifiers modifiers, short zDelta, const QPoint& pt) override;
// From a series of input primitives, compose a complete mouse interaction.
AzToolsFramework::ViewportInteraction::MouseInteraction BuildMouseInteractionInternal(
AzToolsFramework::ViewportInteraction::MouseButtons buttons,
AzToolsFramework::ViewportInteraction::KeyboardModifiers modifiers,
const AzToolsFramework::ViewportInteraction::MousePick& mousePick) const;
// Given a point in the viewport, return the pick ray into the scene.
// note: The argument passed to parameter **point**, originating
// from a Qt event, must first be passed to WidgetToViewport before being
// passed to BuildMousePick.
AzToolsFramework::ViewportInteraction::MousePick BuildMousePick(const QPoint& point);
bool event(QEvent* event) override;
void OnDestroy();
bool CheckRespondToInput() const;
// AzFramework::InputSystemCursorConstraintRequestBus
void* GetSystemCursorConstraintWindow() const override;
void BuildDragDropContext(AzQtComponents::ViewportDragContext& context, const QPoint& pt) override;
private:
void ProcessKeyRelease(QKeyEvent* event);
void PushDisableRendering();
void PopDisableRendering();
bool IsRenderingDisabled() const;
AzToolsFramework::ViewportInteraction::MousePick BuildMousePickInternal(
const QPoint& point) const;
void RestoreViewportAfterGameMode();
double WidgetToViewportFactor() const
{
#if defined(AZ_PLATFORM_WINDOWS)
// Needed for high DPI mode on windows
return devicePixelRatioF();
#else
return 1.0f;
#endif
}
void BeginUndoTransaction() override;
void EndUndoTransaction() override;
void UpdateCurrentMousePos(const QPoint& newPosition);
AzFramework::EntityVisibilityQuery m_entityVisibilityQuery;
SPreviousContext m_previousContext;
QSet<int> m_keyDown;
bool m_freezeViewportInput = false;
size_t m_cameraSetForWidgetRenderingCount = 0; ///< How many calls to PreWidgetRendering happened before
///< subsequent calls to PostWidetRendering.
AZStd::shared_ptr<AzToolsFramework::ManipulatorManager> m_manipulatorManager;
// Used to prevent circular set camera events
bool m_ignoreSetViewFromEntityPerspective = false;
bool m_windowResizedEvent = false;
// Cache hwnd value for teardown to avoid infinite loops in retrieving it from destroyed widgets.
HWND m_hwnd;
AZStd::unique_ptr<EditorEntityNotifications> m_editorEntityNotifications;
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
};
#endif // CRYINCLUDE_EDITOR_RENDERVIEWPORT_H

@ -26,6 +26,7 @@
// AzFramework
#include <AzFramework/API/ApplicationAPI.h>
#include <AzToolsFramework/API/ToolsApplicationAPI.h>
// AzToolsFramework
#include <AzToolsFramework/SourceControl/SourceControlAPI.h>
@ -500,6 +501,7 @@ void SEditorSettings::Save()
SaveValue("Settings", "AutoBackupTime", autoBackupTime);
SaveValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
SaveValue("Settings", "AutoRemindTime", autoRemindTime);
SaveValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
SaveValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
SaveValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
SaveValue("Settings", "StylusMode", stylusMode);
@ -714,6 +716,7 @@ void SEditorSettings::Load()
LoadValue("Settings", "AutoBackupTime", autoBackupTime);
LoadValue("Settings", "AutoBackupMaxCount", autoBackupMaxCount);
LoadValue("Settings", "AutoRemindTime", autoRemindTime);
LoadValue("Settings", "MaxDisplayedItemsNumInSearch", maxNumberOfItemsShownInSearch);
LoadValue("Settings", "CameraMoveSpeed", cameraMoveSpeed);
LoadValue("Settings", "CameraRotateSpeed", cameraRotateSpeed);
LoadValue("Settings", "StylusMode", stylusMode);
@ -1209,3 +1212,8 @@ AzToolsFramework::ConsoleColorTheme SEditorSettings::GetConsoleColorTheme() cons
{
return consoleBackgroundColorTheme;
}
int SEditorSettings::GetMaxNumberOfItemsShownInSearchView() const
{
return SEditorSettings::maxNumberOfItemsShownInSearch;
}

@ -289,6 +289,7 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
SettingOutcome GetValue(const AZStd::string_view path) override;
SettingOutcome SetValue(const AZStd::string_view path, const AZStd::any& value) override;
AzToolsFramework::ConsoleColorTheme GetConsoleColorTheme() const override;
int GetMaxNumberOfItemsShownInSearchView() const override;
void ConvertPath(const AZStd::string_view sourcePath, AZStd::string& category, AZStd::string& attribute);
@ -364,6 +365,13 @@ AZ_POP_DISABLE_DLL_EXPORT_BASECLASS_WARNING
int autoRemindTime;
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Asset Browser Search View.
//////////////////////////////////////////////////////////////////////////
//! Current maximum number of items that can be displayed in the AssetBrowser Search View.
int maxNumberOfItemsShownInSearch;
//////////////////////////////////////////////////////////////////////////
//! If true preview windows is displayed when browsing geometries.
bool bPreviewGeometryWindow;

@ -159,18 +159,10 @@ void CCommentNodeAnimator::Render(CTrackViewAnimNode* pNode, [[maybe_unused]] co
}
}
Vec2 CCommentNodeAnimator::GetScreenPosFromNormalizedPos(const Vec2& unitPos)
Vec2 CCommentNodeAnimator::GetScreenPosFromNormalizedPos(const Vec2&)
{
const CCamera& cam = gEnv->pSystem->GetViewCamera();
float width = (float)cam.GetViewSurfaceX();
int height = cam.GetViewSurfaceZ();
float fAspectRatio = gSettings.viewports.fDefaultAspectRatio;
float camWidth = height * fAspectRatio;
float x = 0.5f * width + 0.5f * camWidth * unitPos.x;
float y = 0.5f * height * (1.f - unitPos.y);
return Vec2(x, y);
AZ_Error("CryLegacy", false, "CCommentNodeAnimator::GetScreenPosFromNormalizedPos not supported");
return Vec2(0, 0);
}
void CCommentNodeAnimator::DrawText(const char* szFontName, float fSize, const Vec2& unitPos, const ColorF col, const char* szText, int align)

@ -44,7 +44,12 @@ namespace
{
const int g_useActiveViewportResolution = -1; // reserved value to indicate the use of the active viewport resolution
int resolutions[][2] = {
{ 1280, 720 }, { 1920, 1080 }, { 1998, 1080 }, { 2048, 858 }, { 2560, 1440 },
{1280, 720},
{1920, 1080},
{1998, 1080},
{2048, 858},
{2560, 1440},
{3840, 2160},
{ g_useActiveViewportResolution, g_useActiveViewportResolution } // active viewport res must be the last element of the resolution array
};
@ -1066,6 +1071,10 @@ void CSequenceBatchRenderDialog::OnUpdateEnd(IAnimSequence* sequence)
{
GetIEditor()->GetMovieSystem()->DisableFixedStepForCapture();
// Important: End batch render mode BEFORE leaving Game Mode.
// Otherwise track view will set the active camera based on the directors in the current sequence while leaving game mode
GetIEditor()->GetMovieSystem()->EnableBatchRenderMode(false);
GetIEditor()->GetMovieSystem()->RemoveMovieListener(sequence, this);
GetIEditor()->SetInGameMode(false);
GetIEditor()->GetGameEngine()->Update(); // Update is needed because SetInGameMode() queues game mode, Update() executes it.
@ -1185,7 +1194,6 @@ void CSequenceBatchRenderDialog::OnUpdateFinalize()
m_ui->m_pGoBtn->setText(tr("Start"));
m_ui->m_pGoBtn->setIcon(QPixmap(":/Trackview/clapperboard_ready.png"));
GetIEditor()->GetMovieSystem()->EnableBatchRenderMode(false);
m_renderContext.currentItemIndex = -1;
m_ui->BATCH_RENDER_PRESS_ESC_TO_CANCEL->setText(m_ffmpegPluginStatusMsg);

@ -27,13 +27,13 @@
#include <CryCommon/Maestro/Types/AnimNodeType.h>
#include <CryCommon/Maestro/Types/AnimValueType.h>
#include <CryCommon/Maestro/Types/AnimParamType.h>
#include <CryCommon/MathConversion.h>
// Editor
#include "AnimationContext.h"
#include "Clipboard.h"
#include "CommentNodeAnimator.h"
#include "DirectorNodeAnimator.h"
#include "RenderViewport.h"
#include "ViewManager.h"
#include "Include/IObjectManager.h"
#include "Objects/GizmoManager.h"

@ -17,10 +17,27 @@
// Editor
#include "ViewManager.h"
#include <AzCore/Math/Matrix3x3.h>
#include <AzCore/Math/Matrix3x4.h>
#include <AzFramework/Components/CameraBus.h>
#include <MathConversion.h>
Ang3 CUndoViewRotation::GetActiveCameraRotation()
{
AZ::Transform activeCameraTm = AZ::Transform::CreateIdentity();
Camera::ActiveCameraRequestBus::BroadcastResult(
activeCameraTm,
&Camera::ActiveCameraRequestBus::Events::GetActiveCameraTransform
);
const AZ::Matrix3x4 cameraMatrix = AZ::Matrix3x4::CreateFromTransform(activeCameraTm);
const Matrix33 cameraMatrixCry = AZMatrix3x3ToLYMatrix3x3(AZ::Matrix3x3::CreateFromMatrix3x4(cameraMatrix));
return RAD2DEG(Ang3::GetAnglesXYZ(cameraMatrixCry));
}
CUndoViewRotation::CUndoViewRotation(const QString& pUndoDescription)
{
m_undoDescription = pUndoDescription;
m_undo = RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(GetIEditor()->GetSystem()->GetViewCamera().GetMatrix())));
m_undo = GetActiveCameraRotation();
}
int CUndoViewRotation::GetSize()
@ -40,7 +57,7 @@ void CUndoViewRotation::Undo(bool bUndo)
{
if (bUndo)
{
m_redo = RAD2DEG(Ang3::GetAnglesXYZ(Matrix33(GetIEditor()->GetSystem()->GetViewCamera().GetMatrix())));
m_redo = GetActiveCameraRotation();
}
Matrix34 tm = pRenderViewport->GetViewTM();

@ -29,6 +29,8 @@ protected:
void Redo();
private:
static Ang3 GetActiveCameraRotation();
Ang3 m_undo;
Ang3 m_redo;
QString m_undoDescription;

@ -1,202 +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 : Tagged files database for 'SmartFileOpen' dialog
#include "EditorDefs.h"
#include "IndexedFiles.h"
volatile TIntAtomic CIndexedFiles::s_bIndexingDone;
CIndexedFiles* CIndexedFiles::s_pIndexedFiles = nullptr;
bool CIndexedFiles::m_startedFileIndexing = false;
void CIndexedFiles::Initialize(const QString& path, IFileUtil::ScanDirectoryUpdateCallBack updateCB)
{
m_files.clear();
m_pathToIndex.clear();
m_tags.clear();
m_rootPath = path;
bool anyFiles = CFileUtil::ScanDirectory(path, "*.*", m_files, true, true, updateCB);
if (anyFiles == false)
{
m_files.clear();
return;
}
if (updateCB)
{
updateCB("Parsing & tagging...");
}
for (int i = 0; i < m_files.size(); ++i)
{
m_pathToIndex[m_files[i].filename] = i;
}
PrepareTagTable();
InvokeUpdateCallbacks();
}
void CIndexedFiles::AddFile(const IFileUtil::FileDesc& path)
{
assert(m_pathToIndex.find(path.filename) == m_pathToIndex.end());
m_files.push_back(path);
m_pathToIndex[path.filename] = m_files.size() - 1;
QStringList tags;
GetTags(tags, path.filename);
for (int k = 0; k < tags.size(); ++k)
{
m_tags[tags[k]].insert(m_files.size() - 1);
}
}
void CIndexedFiles::RemoveFile(const QString& path)
{
if (m_pathToIndex.find(path) == m_pathToIndex.end())
{
return;
}
std::map<QString, int>::iterator itr = m_pathToIndex.find(path);
int index = itr->second;
m_pathToIndex.erase(itr);
m_files.erase(m_files.begin() + index);
QStringList tags;
GetTags(tags, path);
for (int k = 0; k < tags.size(); ++k)
{
m_tags[tags[k]].erase(index);
}
}
void CIndexedFiles::Refresh(const QString& path, bool recursive)
{
IFileUtil::FileArray files;
bool anyFiles = CFileUtil::ScanDirectory(m_rootPath, Path::Make(path, "*.*"), files, recursive, recursive ? true : false);
if (anyFiles == false)
{
return;
}
for (int i = 0; i < files.size(); ++i)
{
if (m_pathToIndex.find(files[i].filename) == m_pathToIndex.end())
{
AddFile(files[i]);
}
}
InvokeUpdateCallbacks();
}
void CIndexedFiles::GetFilesWithTags(IFileUtil::FileArray& files, const QStringList& tags) const
{
files.clear();
if (tags.empty())
{
return;
}
int_set candidates;
TagTable::const_iterator i;
// Gets candidate files from the first tag.
for (i = m_tags.begin(); i != m_tags.end(); ++i)
{
if (i->first.startsWith(tags[0]))
{
candidates.insert(i->second.begin(), i->second.end());
}
}
// Reduces the candidates further using additional tags, if any.
for (int k = 1; k < tags.size(); ++k)
{
// Gathers the filter set.
int_set filter;
for (i = m_tags.begin(); i != m_tags.end(); ++i)
{
if (i->first.startsWith(tags[k]))
{
filter.insert(i->second.begin(), i->second.end());
}
}
// Filters the candidates using it.
for (int_set::iterator m = candidates.begin(); m != candidates.end(); )
{
if (filter.find(*m) == filter.end())
{
int_set::iterator target = m;
++m;
candidates.erase(target);
}
else
{
++m;
}
}
}
// Outputs the result.
files.reserve(candidates.size());
for (int_set::const_iterator m = candidates.begin(); m != candidates.end(); ++m)
{
files.push_back(m_files[*m]);
}
}
void CIndexedFiles::GetTags(QStringList& tags, const QString& path) const
{
tags = path.split(QRegularExpression(QStringLiteral(R"([\\/.])")), Qt::SkipEmptyParts);
}
void CIndexedFiles::GetTagsOfPrefix(QStringList& tags, const QString& prefix) const
{
tags.clear();
TagTable::const_iterator i;
for (i = m_tags.begin(); i != m_tags.end(); ++i)
{
if (i->first.startsWith(prefix))
{
tags.push_back(i->first);
}
}
}
void CIndexedFiles::PrepareTagTable()
{
QStringList tags;
for (int i = 0; i < m_files.size(); ++i)
{
GetTags(tags, m_files[i].filename);
for (int k = 0; k < tags.size(); ++k)
{
m_tags[tags[k]].insert(i);
}
}
}
void CIndexedFiles::AddUpdateCallback(std::function<void()> updateCallback)
{
CryAutoLock<CryMutex> lock(m_updateCallbackMutex);
m_updateCallbacks.push_back(updateCallback);
}
void CIndexedFiles::InvokeUpdateCallbacks()
{
CryAutoLock<CryMutex> lock(m_updateCallbackMutex);
for (auto updateCallback : m_updateCallbacks)
{
updateCallback();
}
}

@ -1,176 +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 : Tagged files database for 'SmartFileOpen' dialog
//
// Notice : Refer SmartFileOpenDialog h
#ifndef CRYINCLUDE_EDITOR_UTIL_INDEXEDFILES_H
#define CRYINCLUDE_EDITOR_UTIL_INDEXEDFILES_H
#pragma once
#include "FileUtil.h"
#include <functional>
class CIndexedFiles
{
friend class CFileIndexingThread;
public:
static CIndexedFiles& GetDB()
{
if (!s_pIndexedFiles)
{
assert(!"CIndexedFiles not created! Make sure you use CIndexedFiles::GetDB() after CIndexedFiles::StartFileIndexing() is called.");
}
assert(s_pIndexedFiles);
return *s_pIndexedFiles;
}
static bool HasFileIndexingDone()
{ return s_bIndexingDone > 0; }
static void Create()
{
assert(!s_pIndexedFiles);
s_pIndexedFiles = new CIndexedFiles;
}
static void Destroy()
{
SAFE_DELETE(s_pIndexedFiles);
}
static void StartFileIndexing()
{
assert(s_bIndexingDone == 0);
assert(s_pIndexedFiles);
if (!s_pIndexedFiles)
{
return;
}
GetFileIndexingThread().Start(-1, "FileIndexing");
m_startedFileIndexing = true;
}
static void AbortFileIndexing()
{
if (!m_startedFileIndexing)
{
return;
}
if (HasFileIndexingDone() == false)
{
GetFileIndexingThread().Abort();
}
m_startedFileIndexing = false;
}
static void RegisterCallback(std::function<void()> callback)
{
assert(s_pIndexedFiles);
if (!s_pIndexedFiles)
{
return;
}
s_pIndexedFiles->AddUpdateCallback(callback);
}
public:
void Initialize(const QString& path, IFileUtil::ScanDirectoryUpdateCallBack updateCB = nullptr);
// Adds a new file to the database.
void AddFile(const IFileUtil::FileDesc& path);
// Removes a no-longer-existing file from the database.
void RemoveFile(const QString& path);
// Refreshes this database for the subdirectory.
void Refresh(const QString& path, bool recursive = true);
void GetFilesWithTags(IFileUtil::FileArray& files, const QStringList& tags) const;
//! This method returns all the tags which start with a given prefix.
//! It is useful for the tag auto-completion.
void GetTagsOfPrefix(QStringList& tags, const QString& prefix) const;
uint32 GetTotalCount() const
{ return (uint32)m_files.size(); }
private:
static bool m_startedFileIndexing;
std::vector <std::function<void()> > m_updateCallbacks;
IFileUtil::FileArray m_files;
std::map<QString, int> m_pathToIndex;
typedef std::set<int, std::less<int> > int_set;
typedef std::map<QString, int_set, std::less<QString> > TagTable;
TagTable m_tags;
QString m_rootPath;
void GetTags(QStringList& tags, const QString& path) const;
void PrepareTagTable();
CryMutex m_updateCallbackMutex;
void AddUpdateCallback(std::function<void()> updateCallback);
void InvokeUpdateCallbacks();
// A done flag for the background file indexing
static volatile TIntAtomic s_bIndexingDone;
// A thread for the background file indexing
class CFileIndexingThread
: public CryThread<CFileIndexingThread>
{
public:
virtual void Run()
{
CIndexedFiles::GetDB().Initialize("@assets@", CallBack);
CryInterlockedAdd(CIndexedFiles::s_bIndexingDone.Addr(), 1);
}
CFileIndexingThread()
: m_abort(false) {}
void Abort()
{
m_abort = true;
WaitForThread();
}
virtual ~CFileIndexingThread()
{
Abort();
}
private:
bool m_abort;
static bool CallBack([[maybe_unused]] const QString& msg)
{
if (CIndexedFiles::GetFileIndexingThread().m_abort)
{
return false;
}
return true;
}
};
static CFileIndexingThread& GetFileIndexingThread()
{
static CFileIndexingThread s_fileIndexingThread;
return s_fileIndexingThread;
}
// A global database for tagged files
static CIndexedFiles* s_pIndexedFiles;
};
#endif // CRYINCLUDE_EDITOR_UTIL_INDEXEDFILES_H

@ -26,18 +26,15 @@
#include "LayoutWnd.h"
#include "2DViewport.h"
#include "TopRendererWnd.h"
#include "RenderViewport.h"
#include "EditorViewportWidget.h"
#include "CryEditDoc.h"
#include <AzCore/Console/IConsole.h>
AZ_CVAR(bool, ed_useAtomNativeViewport, true, nullptr, AZ::ConsoleFunctorFlags::Null, "Use the new Atom-native Editor viewport (experimental, not yet stable");
bool CViewManager::IsMultiViewportEnabled()
{
// Enable multi-viewport for legacy renderer, or if we're using the new fully Atom-native viewport
return ed_useAtomNativeViewport;
return true;
}
//////////////////////////////////////////////////////////////////////
@ -74,14 +71,7 @@ CViewManager::CViewManager()
RegisterQtViewPane<C2DViewport_YZ>(GetIEditor(), "Left", LyViewPane::CategoryViewport, viewportOptions);
viewportOptions.viewportType = ET_ViewportCamera;
if (ed_useAtomNativeViewport)
{
RegisterQtViewPaneWithName<EditorViewportWidget>(GetIEditor(), "Perspective", LyViewPane::CategoryViewport, viewportOptions);
}
else
{
RegisterQtViewPaneWithName<CRenderViewport>(GetIEditor(), "Perspective", LyViewPane::CategoryViewport, viewportOptions);
}
viewportOptions.viewportType = ET_ViewportMap;
RegisterQtViewPane<QTopRendererWnd>(GetIEditor(), "Map", LyViewPane::CategoryViewport, viewportOptions);
@ -251,11 +241,6 @@ void CViewManager::SelectViewport(CViewport* pViewport)
//////////////////////////////////////////////////////////////////////////
CViewport* CViewManager::GetGameViewport() const
{
if (CRenderViewport::GetPrimaryViewport())
{
return CRenderViewport::GetPrimaryViewport();
}
return GetViewport(ET_ViewportCamera);;
}

@ -305,10 +305,6 @@ void CLayoutViewPane::AttachViewport(QWidget* pViewport)
{
vp->SetViewportId(GetId());
vp->SetViewPane(this);
if (CRenderViewport* renderViewport = viewport_cast<CRenderViewport*>(vp))
{
renderViewport->ConnectViewportInteractionRequestBus();
}
if (EditorViewportWidget* renderViewport = viewport_cast<EditorViewportWidget*>(vp))
{
renderViewport->ConnectViewportInteractionRequestBus();
@ -356,10 +352,6 @@ void CLayoutViewPane::DisconnectRenderViewportInteractionRequestBus()
{
if (QtViewport* vp = qobject_cast<QtViewport*>(m_viewport))
{
if (CRenderViewport* renderViewport = viewport_cast<CRenderViewport*>(vp))
{
renderViewport->DisconnectViewportInteractionRequestBus();
}
if (EditorViewportWidget* renderViewport = viewport_cast<EditorViewportWidget*>(vp))
{
renderViewport->DisconnectViewportInteractionRequestBus();
@ -469,16 +461,6 @@ void CLayoutViewPane::SetAspectRatio(unsigned int x, unsigned int y)
//////////////////////////////////////////////////////////////////////////
void CLayoutViewPane::SetViewportFOV(float fov)
{
if (CRenderViewport* pRenderViewport = qobject_cast<CRenderViewport*>(m_viewport))
{
pRenderViewport->SetFOV(DEG2RAD(fov));
// if viewport camera is active, make selected fov new default
if (pRenderViewport->GetViewManager()->GetCameraObjectId() == GUID_NULL)
{
gSettings.viewports.fDefaultFov = DEG2RAD(fov);
}
}
if (EditorViewportWidget* pRenderViewport = qobject_cast<EditorViewportWidget*>(m_viewport))
{
pRenderViewport->SetFOV(DEG2RAD(fov));

@ -189,7 +189,6 @@ QtViewport::QtViewport(QWidget* parent)
{
m_constructionMatrix[i].SetIdentity();
}
m_viewTM.SetIdentity();
m_screenTM.SetIdentity();
m_pMouseOverObject = nullptr;

@ -165,11 +165,19 @@ public:
//////////////////////////////////////////////////////////////////////////
//! Set current view matrix,
//! This is a matrix that transforms from world to view space.
virtual void SetViewTM(const Matrix34& tm) { m_viewTM = tm; };
virtual void SetViewTM([[maybe_unused]] const Matrix34& tm)
{
AZ_Error("CryLegacy", false, "QtViewport::SetViewTM not implemented");
}
//! Get current view matrix.
//! This is a matrix that transforms from world space to view space.
virtual const Matrix34& GetViewTM() const { return m_viewTM; };
virtual const Matrix34& GetViewTM() const
{
AZ_Error("CryLegacy", false, "QtViewport::GetViewTM not implemented");
static const Matrix34 m;
return m;
};
//////////////////////////////////////////////////////////////////////////
//! Get current screen matrix.
@ -277,8 +285,6 @@ protected:
CLayoutViewPane* m_viewPane = nullptr;
CViewManager* m_viewManager;
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
// Viewport matrix.
Matrix34 m_viewTM;
// Screen Matrix
Matrix34 m_screenTM;
int m_nCurViewportID;

@ -644,13 +644,31 @@ void CViewportTitleDlg::CreateViewportInformationMenu()
void CViewportTitleDlg::AddResolutionMenus(QMenu* menu, std::function<void(int, int)> callback, const QStringList& customPresets)
{
static const CRenderViewport::SResolution resolutions[] = {
CRenderViewport::SResolution(1280, 720),
CRenderViewport::SResolution(1920, 1080),
CRenderViewport::SResolution(2560, 1440),
CRenderViewport::SResolution(2048, 858),
CRenderViewport::SResolution(1998, 1080),
CRenderViewport::SResolution(3840, 2160)
struct SResolution
{
SResolution()
: width(0)
, height(0)
{
}
SResolution(int w, int h)
: width(w)
, height(h)
{
}
int width;
int height;
};
static const SResolution resolutions[] = {
SResolution(1280, 720),
SResolution(1920, 1080),
SResolution(2560, 1440),
SResolution(2048, 858),
SResolution(1998, 1080),
SResolution(3840, 2160)
};
static const size_t resolutionCount = sizeof(resolutions) / sizeof(resolutions[0]);

@ -12,7 +12,6 @@
#pragma once
#if !defined(Q_MOC_RUN)
#include "RenderViewport.h"
#include <AzCore/Component/Component.h>
#include <IAudioSystem.h>

@ -724,8 +724,6 @@ set(FILES
Util/GuidUtil.cpp
Util/GuidUtil.h
Util/IObservable.h
Util/IndexedFiles.cpp
Util/IndexedFiles.h
Util/KDTree.cpp
Util/Mailer.h
Util/NamedData.cpp
@ -807,8 +805,6 @@ set(FILES
ViewportManipulatorController.h
LegacyViewportCameraController.cpp
LegacyViewportCameraController.h
RenderViewport.cpp
RenderViewport.h
TopRendererWnd.cpp
TopRendererWnd.h
ViewManager.cpp

@ -44,6 +44,22 @@ namespace AZ
return &out;
}
void SetPerspectiveMatrixFOV(Matrix4x4& out, float fovY, float aspectRatio)
{
float sinFov, cosFov;
SinCos(0.5f * fovY, sinFov, cosFov);
float yScale = cosFov / sinFov; //cot(fovY/2)
float xScale = yScale / aspectRatio;
out.SetElement(0, 0, xScale);
out.SetElement(1, 1, yScale);
}
float GetPerspectiveMatrixFOV(const Matrix4x4& m)
{
return 2.0 * AZStd::atan(1.0f / m.GetElement(1, 1));
}
Matrix4x4* MakeFrustumMatrixRH(Matrix4x4& out, float left, float right, float bottom, float top, float nearDist, float farDist, bool reverseDepth)
{
AZ_Assert(right > left, "right should be greater than left");

@ -64,4 +64,8 @@ namespace AZ
//! Transforms a position by a matrix. This function can be used with any generic cases which include projection matrices.
Vector3 MatrixTransformPosition(const Matrix4x4& matrix, const Vector3& inPosition);
void SetPerspectiveMatrixFOV(Matrix4x4& out, float fovY, float aspectRatio);
float GetPerspectiveMatrixFOV(const Matrix4x4& m);
} // namespace AZ

@ -27,11 +27,10 @@ namespace AZ
struct AllocationInfo
{
size_t m_byteSize{};
unsigned int m_alignment{};
const char* m_name{};
const char* m_fileName{};
int m_lineNum{};
unsigned int m_alignment{};
void* m_namesBlock{}; ///< Memory block if m_name and m_fileName have been allocated specifically for this allocation record
size_t m_namesBlockSize{};
@ -41,7 +40,7 @@ namespace AZ
};
// We use OSAllocator which uses system calls to allocate memory, they are not recorded or tracked!
typedef AZStd::unordered_map<void*, AllocationInfo, AZStd::hash<void*>, AZStd::equal_to<void*>, OSStdAllocator> AllocationRecordsType;
using AllocationRecordsType = AZStd::unordered_map<void*, AllocationInfo, AZStd::hash<void*>, AZStd::equal_to<void*>, OSStdAllocator>;
/**
* Records enumeration callback
@ -50,7 +49,7 @@ namespace AZ
* \param unsigned char number of stack records/levels, if AllocationInfo::m_stackFrames != NULL.
* \returns true if you want to continue traverse of the records and false if you want to stop.
*/
typedef AZStd::function<bool (void*, const AllocationInfo&, unsigned char)> AllocationInfoCBType;
using AllocationInfoCBType = AZStd::function<bool (void*, const AllocationInfo&, unsigned char)>;
/**
* Example of records enumeration callback.
*/

@ -31,7 +31,6 @@ namespace AZ
ScriptPropertyGenericClassArray::Reflect(reflection);
ScriptPropertyAsset::Reflect(reflection);
ScriptPropertyEntityRef::Reflect(reflection);
}
template<class Iterator>
@ -1358,53 +1357,4 @@ namespace AZ
m_value = assetProperty->m_value;
}
}
////////////////////////////
// ScriptPropertyEntityRef
////////////////////////////
void ScriptPropertyEntityRef::Reflect(AZ::ReflectContext* reflection)
{
AZ::SerializeContext* serializeContext = azrtti_cast<AZ::SerializeContext*>(reflection);
if (serializeContext)
{
serializeContext->Class<AZ::ScriptPropertyEntityRef, AZ::ScriptProperty>()->
Version(1)->
Field("value", &AZ::ScriptPropertyEntityRef::m_value);
}
}
const AZ::Uuid& ScriptPropertyEntityRef::GetDataTypeUuid() const
{
return AZ::SerializeTypeInfo<AZ::EntityId>::GetUuid();
}
bool ScriptPropertyEntityRef::DoesTypeMatch(AZ::ScriptDataContext& context, int valueIndex) const
{
return context.IsRegisteredClass(valueIndex);
}
AZ::ScriptPropertyEntityRef* ScriptPropertyEntityRef::Clone(const char* name) const
{
AZ::ScriptPropertyEntityRef* clonedValue = aznew AZ::ScriptPropertyEntityRef(name ? name : m_name.c_str());
clonedValue->m_value = m_value;
return clonedValue;
}
bool ScriptPropertyEntityRef::Write(AZ::ScriptContext& context)
{
AZ::ScriptValue<AZ::EntityId>::StackPush(context.NativeContext(), m_value);
return true;
}
void ScriptPropertyEntityRef::CloneDataFrom(const AZ::ScriptProperty* scriptProperty)
{
const AZ::ScriptPropertyEntityRef* entityProperty = azrtti_cast<const AZ::ScriptPropertyEntityRef*>(scriptProperty);
AZ_Error("ScriptPropertyEntityRef", entityProperty, "Invalid call to CloneData. Types must match before clone attempt is made.\n");
if (entityProperty)
{
m_value = entityProperty->m_value;
}
}
}

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

Loading…
Cancel
Save