Merge branch 'development' into Atom/dmcdiar/ATOM-15995

This commit is contained in:
dmcdiar
2021-08-10 11:51:04 -07:00
1548 changed files with 36893 additions and 47054 deletions
+3 -3
View File
@@ -212,10 +212,10 @@
"Configuration": {
"ModelAsset": {
"assetId": {
"guid": "{935F694A-8639-515B-8133-81CDC7948E5B}",
"subId": 277333723
"guid": "{0CD745C0-6AA8-569A-A68A-73A3270986C4}",
"subId": 277889906
},
"assetHint": "objects/groudplane/groundplane_521x521m.azmodel"
"assetHint": "objects/groudplane/groundplane_512x512m.azmodel"
}
}
}
@@ -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}"
+1 -1
View File
@@ -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)
+2 -1
View File
@@ -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;
+1 -1
View File
@@ -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)
{
+1 -1
View File
@@ -63,7 +63,7 @@ int32 CHierarchy::FindNodeIndexByName(const char* name) const
const CHierarchy::SNode* CHierarchy::FindNode(const char* name) const
{
int32 index = FindNodeIndexByName(name);
return index < 0 ? NULL : &m_nodes[index];
return index < 0 ? nullptr : &m_nodes[index];
}
void CHierarchy::CreateFrom(IDefaultSkeleton* pIDefaultSkeleton)
+4 -4
View File
@@ -56,8 +56,8 @@ void CMapper::ClearLocations()
uint32 count = uint32(m_nodes.size());
for (uint32 i = 0; i < count; ++i)
{
m_nodes[i].position = NULL;
m_nodes[i].orientation = NULL;
m_nodes[i].position = nullptr;
m_nodes[i].orientation = nullptr;
}
m_locations.clear();
@@ -141,7 +141,7 @@ void CMapper::Map(QuatT* pResult)
}
CHierarchy::SNode* pParent = pNode->parent < 0 ?
NULL : m_hierarchy.GetNode(pNode->parent);
nullptr : m_hierarchy.GetNode(pNode->parent);
if (pParent)
{
pResult[i].t =
@@ -173,7 +173,7 @@ void CMapper::Map(QuatT* pResult)
}
CHierarchy::SNode* pParent = pNode->parent < 0 ?
NULL : m_hierarchy.GetNode(pNode->parent);
nullptr : m_hierarchy.GetNode(pNode->parent);
if (!pParent)
{
pResult[i].q = absolutes[i];
@@ -37,8 +37,8 @@ CMapperOperatorDesc::CMapperOperatorDesc(const char* name)
CMapperOperator::CMapperOperator(const char* className, uint32 positionCount, uint32 orientationCount)
{
m_className = className;
m_position.resize(positionCount, NULL);
m_orientation.resize(orientationCount, NULL);
m_position.resize(positionCount, nullptr);
m_orientation.resize(orientationCount, nullptr);
}
CMapperOperator::~CMapperOperator()
+7 -17
View File
@@ -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;
@@ -231,7 +221,7 @@ void CAnimationContext::SetSequence(CTrackViewSequence* sequence, bool force, bo
m_pSequence->UnBindFromEditorObjects();
}
m_pSequence = sequence;
// Notify a new sequence was just selected.
Maestro::EditorSequenceNotificationBus::Broadcast(&Maestro::EditorSequenceNotificationBus::Events::OnSequenceSelected, m_pSequence ? m_pSequence->GetSequenceComponentEntityId() : AZ::EntityId());
@@ -347,7 +337,7 @@ void CAnimationContext::OnSequenceActivated(AZ::EntityId entityId)
{
// Hang onto this because SetSequence() will reset it.
float lastTime = m_mostRecentSequenceTime;
SetSequence(sequence, false, false);
// Restore the current time.
-11
View File
@@ -1,11 +0,0 @@
--- Editor/AnimationContext.cpp
+++ Editor/AnimationContext.cpp
@@ -612,7 +612,7 @@ void CAnimationContext::UpdateAnimatedLights()
return;
std::vector<CBaseObject*> entityObjects;
- GetIEditor()->GetObjectManager()->FindObjectsOfType<CEntityObject*>(entityObjects);
+ GetIEditor()->GetObjectManager()->FindObjectsOfType(&CEntityObject::staticMetaObject, entityObjects);
std::for_each(std::begin(entityObjects), std::end(entityObjects),
[this](CBaseObject *pBaseObject)
{
@@ -260,9 +260,7 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
return;
}
AZStd::string fullFileDirectory;
AZStd::string fullFilePath;
AZStd::string fileName;
AZStd::string extension;
switch (entry->GetEntryType())
@@ -281,8 +279,6 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
{
AZ::Uuid sourceID = azrtti_cast<SourceAssetBrowserEntry*>(entry)->GetSourceUuid();
fullFilePath = entry->GetFullPath();
fullFileDirectory = fullFilePath.substr(0, fullFilePath.find_last_of(AZ_CORRECT_DATABASE_SEPARATOR));
fileName = entry->GetName();
AzFramework::StringFunc::Path::GetExtension(fullFilePath.c_str(), extension);
// Add the "Open" menu item.
@@ -369,19 +365,19 @@ void AzAssetBrowserRequestHandler::AddContextMenuActions(QWidget* caller, QMenu*
{
if (entry->GetEntryType() == AssetBrowserEntry::AssetEntryType::Source)
{
CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
}
return;
}
CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
}
break;
case AssetBrowserEntry::AssetEntryType::Folder:
{
fullFileDirectory = entry->GetFullPath();
// we are sending an empty filename to indicate that it is a folder and not a file
CFileUtil::PopulateQMenu(caller, menu, fileName.c_str(), fullFileDirectory.c_str());
fullFilePath = entry->GetFullPath();
CFileUtil::PopulateQMenu(caller, menu, fullFilePath);
}
break;
default:
@@ -42,7 +42,7 @@ public:
AzToolsFramework::EditorEvents::Bus::Handler::BusConnect();
}
~ListenerForShowAssetEditorEvent()
~ListenerForShowAssetEditorEvent() override
{
AzToolsFramework::EditorEvents::Bus::Handler::BusDisconnect();
}
@@ -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);
+11 -11
View File
@@ -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;
+10 -10
View File
@@ -16,7 +16,7 @@
#include <AzCore/Math/Uuid.h>
//undo object for multi-changes inside library item. such as set all variables to default values.
//undo object for multi-changes inside library item. such as set all variables to default values.
//For example: change particle emitter shape will lead to multiple variable changes
class CUndoBaseLibraryItem
: public IUndoObject
@@ -54,24 +54,24 @@ public:
}
protected:
virtual int GetSize()
{
int GetSize() override
{
return m_size;
}
QString GetDescription() override
{
return m_description;
{
return m_description;
}
virtual void Undo(bool bUndo)
void Undo(bool bUndo) override
{
//find the libItem
IDataBaseItem *libItem = m_libMgr->FindItemByName(m_itemPath);
if (libItem == nullptr)
{
//the undo stack is not reliable any more..
assert(false);
assert(false);
return;
}
@@ -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);
}
+21 -21
View File
@@ -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);
@@ -84,7 +84,7 @@ private:
for (int i = 0; i < m_pMngr->GetLibraryCount(); i++)
{
IDataBaseLibrary* library = m_pMngr->GetLibrary(i);
const char* tag = library->IsLevelLibrary() ? LEVEL_LIBRARY_TAG : LIBRARY_TAG;
XmlNodeRef node = GetIEditor()->GetSystem()->CreateXmlNode(tag);
QString file = library->GetFilename().isEmpty() ? library->GetFilename() : library->GetName();
@@ -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);
}
//////////////////////////////////////////////////////////////////////////
@@ -398,7 +398,7 @@ void CBaseLibraryManager::DeleteLibrary(const QString& library, bool forceDelete
UnregisterItem((CBaseLibraryItem*)pLibrary->GetItem(j));
}
pLibrary->RemoveAllItems();
if (pLibrary->IsLevelLibrary())
{
m_pLevelLibrary = 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,9 +531,9 @@ 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.
//Check if the item is in the target library first.
IDataBaseLibrary* itemLibrary = pItem->GetLibrary();
QString itemLibraryName;
if (itemLibrary)
@@ -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;
}
@@ -913,7 +913,7 @@ void CBaseLibraryManager::ChangeLibraryOrder(IDataBaseLibrary* lib, unsigned int
{
return;
}
for (int i = 0; i < m_libs.size(); i++)
{
if (lib == m_libs[i])
+1 -1
View File
@@ -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
+3 -3
View File
@@ -20,8 +20,8 @@
// AzToolsFramework
#include <AzToolsFramework/PythonTerminal/ScriptTermDialog.h>
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pFirst = 0;
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pLast = 0;
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pFirst = nullptr;
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::s_pLast = nullptr;
CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::GetFirst()
{
@@ -31,7 +31,7 @@ CAutoRegisterCommandHelper* CAutoRegisterCommandHelper::GetFirst()
CAutoRegisterCommandHelper::CAutoRegisterCommandHelper(void(*registerFunc)(CEditorCommandManager &))
{
m_registerFunc = registerFunc;
m_pNext = 0;
m_pNext = nullptr;
if (!s_pLast)
{
+1 -1
View File
@@ -38,7 +38,7 @@ public:
void RegisterAutoCommands();
bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = NULL);
bool AddCommand(CCommand* pCommand, TPfnDeleter deleter = nullptr);
bool UnregisterCommand(const char* module, const char* name);
bool RegisterUICommand(
const char* module,
+6 -6
View File
@@ -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))
+2 -2
View File
@@ -37,11 +37,11 @@ namespace Config
, m_description(szDescription)
, m_type(varType)
, m_flags(flags)
, m_ptr(NULL)
, m_ptr(nullptr)
{};
virtual ~IConfigVar() = default;
ILINE EType GetType() const
{
return m_type;
+5 -5
View File
@@ -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);
}
}
+1 -1
View File
@@ -42,7 +42,7 @@ public:
CBitmapToolTip(QWidget* parent = nullptr);
virtual ~CBitmapToolTip();
BOOL Create(const RECT& rect);
bool Create(const RECT& rect);
// Attributes
public:
+3 -3
View File
@@ -29,7 +29,7 @@ CColorGradientCtrl::CColorGradientCtrl(QWidget* parent)
m_nHitKeyIndex = -1;
m_nKeyDrawRadius = 3;
m_bTracking = false;
m_pSpline = 0;
m_pSpline = nullptr;
m_fMinTime = -1;
m_fMaxTime = 1;
m_fMinValue = -1;
@@ -474,7 +474,7 @@ void CColorGradientCtrl::SetActiveKey(int nIndex)
}
/////////////////////////////////////////////////////////////////////////////
void CColorGradientCtrl::SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw)
void CColorGradientCtrl::SetSpline(ISplineInterpolator* pSpline, bool bRedraw)
{
if (pSpline != m_pSpline)
{
@@ -501,7 +501,7 @@ ISplineInterpolator* CColorGradientCtrl::GetSpline()
/////////////////////////////////////////////////////////////////////////////
void CColorGradientCtrl::keyPressEvent(QKeyEvent* event)
{
BOOL bProcessed = false;
bool bProcessed = false;
if (m_nActiveKey != -1 && m_pSpline)
{
+1 -1
View File
@@ -54,7 +54,7 @@ public:
// Lock value of first and last key to be the same.
void LockFirstAndLastKeys(bool bLock) { m_bLockFirstLastKey = bLock; }
void SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw = FALSE);
void SetSpline(ISplineInterpolator* pSpline, bool bRedraw = false);
ISplineInterpolator* GetSpline();
void SetTimeMarker(float fTime);
+22 -3
View File
@@ -62,14 +62,14 @@ public:
}
protected:
void highlightBlock(const QString &text)
void highlightBlock(const QString &text) override
{
auto pos = -1;
QTextCharFormat myClassFormat;
myClassFormat.setFontWeight(QFont::Bold);
myClassFormat.setBackground(Qt::yellow);
while (1)
while (true)
{
pos = text.indexOf(m_searchTerm, pos+1, Qt::CaseInsensitive);
@@ -338,6 +338,8 @@ CConsoleSCB::CConsoleSCB(QWidget* parent)
connect(findPreviousAction, &QAction::triggered, this, &CConsoleSCB::findPrevious);
ui->findPrevButton->addAction(findPreviousAction);
GetIEditor()->RegisterNotifyListener(this);
connect(ui->button, &QPushButton::clicked, this, &CConsoleSCB::showVariableEditor);
connect(ui->findButton, &QPushButton::clicked, this, &CConsoleSCB::toggleConsoleSearch);
connect(ui->textEdit, &ConsoleTextEdit::searchBarRequested, this, [this]
@@ -376,6 +378,8 @@ CConsoleSCB::~CConsoleSCB()
{
AzToolsFramework::EditorPreferencesNotificationBus::Handler::BusDisconnect();
GetIEditor()->UnregisterNotifyListener(this);
s_consoleSCB = nullptr;
CLogFile::AttachEditBox(nullptr);
}
@@ -567,7 +571,7 @@ static CVarBlock* VarBlockFromConsoleVars()
size_t cmdCount = console->GetSortedVars(&cmds[0], cmds.size());
CVarBlock* vb = new CVarBlock;
IVariable* pVariable = 0;
IVariable* pVariable = nullptr;
for (int i = 0; i < cmdCount; i++)
{
ICVar* pCVar = console->GetCVar(cmds[i]);
@@ -1352,4 +1356,19 @@ CConsoleSCB* CConsoleSCB::GetCreatedInstance()
return s_consoleSCB;
}
void CConsoleSCB::OnEditorNotifyEvent(EEditorNotifyEvent event)
{
switch (event)
{
case eNotify_OnBeginGameMode:
if (gSettings.clearConsoleOnGameModeStart)
{
ui->textEdit->clear();
}
break;
default:
break;
}
}
#include <Controls/moc_ConsoleSCB.cpp>
+3
View File
@@ -159,6 +159,7 @@ private:
class CConsoleSCB
: public QWidget
, private AzToolsFramework::EditorPreferencesNotificationBus::Handler
, public IEditorNotifyListener
{
Q_OBJECT
public:
@@ -187,6 +188,8 @@ private Q_SLOTS:
void findNext();
private:
void OnEditorNotifyEvent(EEditorNotifyEvent event) override;
QScopedPointer<Ui::Console> ui;
int m_richEditTextLength;
+4 -4
View File
@@ -19,22 +19,22 @@ CHotTrackingTreeCtrl::CHotTrackingTreeCtrl(QWidget* parent)
: QTreeWidget(parent)
{
setMouseTracking(true);
m_hHoverItem = NULL;
m_hHoverItem = nullptr;
}
void CHotTrackingTreeCtrl::mouseMoveEvent(QMouseEvent* event)
{
QTreeWidgetItem* hItem = itemAt(event->pos());
if (m_hHoverItem != NULL)
if (m_hHoverItem != nullptr)
{
QFont font = m_hHoverItem->font(0);
font.setBold(false);
m_hHoverItem->setFont(0, font);
m_hHoverItem = NULL;
m_hHoverItem = nullptr;
}
if (hItem != NULL)
if (hItem != nullptr)
{
QFont font = hItem->font(0);
font.setBold(true);
@@ -27,7 +27,7 @@ void ReflectedPropertiesPanel::DeleteVars()
{
ClearVarBlock();
m_updateCallbacks.clear();
m_varBlock = 0;
m_varBlock = nullptr;
}
//////////////////////////////////////////////////////////////////////////
@@ -198,7 +198,7 @@ void ReflectedPropertyControl::CreateItems(XmlNodeRef node)
void ReflectedPropertyControl::CreateItems(XmlNodeRef node, CVarBlockPtr& outBlockPtr, IVariable::OnSetCallback* func, bool splitCamelCaseIntoWords)
{
SelectItem(0);
SelectItem(nullptr);
outBlockPtr = new CVarBlock;
for (size_t i = 0, iGroupCount(node->getChildCount()); i < iGroupCount; ++i)
@@ -505,7 +505,7 @@ void ReflectedPropertyControl::RemoveAllItems()
void ReflectedPropertyControl::ClearVarBlock()
{
RemoveAllItems();
m_pVarBlock = 0;
m_pVarBlock = nullptr;
}
void ReflectedPropertyControl::RecreateAllItems()
@@ -688,11 +688,11 @@ void ReflectedPropertyControl::OnItemChange(ReflectedPropertyItem *item, bool de
// callback until after the current event queue is processed, so that we aren't changing other widgets
// as a ton of them are still being created.
Qt::ConnectionType connectionType = deferCallbacks ? Qt::QueuedConnection : Qt::DirectConnection;
if (m_updateVarFunc != 0 && m_bEnableCallback)
if (m_updateVarFunc && m_bEnableCallback)
{
QMetaObject::invokeMethod(this, "DoUpdateCallback", connectionType, Q_ARG(IVariable*, item->GetVariable()));
}
if (m_updateObjectFunc != 0 && m_bEnableCallback)
if (m_updateObjectFunc && m_bEnableCallback)
{
// KDAB: This callback has same signature as DoUpdateCallback. I think the only reason there are 2 is because some
// EntityObject registers callback and some derived objects want to register their own callback. the normal UpdateCallback
@@ -709,7 +709,7 @@ void ReflectedPropertyControl::DoUpdateCallback(IVariable *var)
const bool variableStillExists = FindVariable(var);
AZ_Assert(variableStillExists, "This variable and the item containing it were destroyed during a deferred callback. Change to non-deferred callback.");
if (m_updateVarFunc == 0 || !variableStillExists)
if (!m_updateVarFunc || !variableStillExists)
{
return;
}
@@ -724,7 +724,7 @@ void ReflectedPropertyControl::DoUpdateObjectCallback(IVariable *var)
const bool variableStillExists = FindVariable(var);
AZ_Assert(variableStillExists, "This variable and the item containing it were destroyed during a deferred callback. Change to non-deferred callback.");
if (m_updateVarFunc == 0 || !variableStillExists)
if ( !m_updateVarFunc || !variableStillExists)
{
return;
}
@@ -904,7 +904,7 @@ void ReflectedPropertyControl::SetUndoCallback(UndoCallback &callback)
void ReflectedPropertyControl::ClearUndoCallback()
{
m_undoFunc = 0;
m_undoFunc = nullptr;
}
bool ReflectedPropertyControl::FindVariable(IVariable *categoryItem) const
@@ -82,7 +82,7 @@ public:
}
//helps implement ReflectedPropertyControl::ReplaceVarBlock
void ReplaceVarBlock(CVarBlock *varBlock)
void ReplaceVarBlock(CVarBlock *varBlock) override
{
m_containerVar->Clear();
UpdateCommon(m_item->GetVariable(), varBlock);
@@ -207,7 +207,7 @@ void ReflectedPropertyItem::SetVariable(IVariable *var)
ReleaseVariable();
m_pVariable = pInputVar;
assert(m_pVariable != NULL);
assert(m_pVariable != nullptr);
m_pVariable->AddOnSetCallback(&m_onSetCallback);
m_pVariable->AddOnSetEnumCallback(&m_onSetEnumCallback);
@@ -332,7 +332,7 @@ void ReflectedPropertyItem::RemoveAllChildren()
{
for (int i = 0; i < m_childs.size(); i++)
{
m_childs[i]->m_parent = 0;
m_childs[i]->m_parent = nullptr;
}
m_childs.clear();
@@ -473,7 +473,7 @@ void ReflectedPropertyItem::ReleaseVariable()
m_pVariable->RemoveOnSetCallback(&m_onSetCallback);
m_pVariable->RemoveOnSetEnumCallback(&m_onSetEnumCallback);
}
m_pVariable = 0;
m_pVariable = nullptr;
delete m_reflectedVarAdapter;
m_reflectedVarAdapter = nullptr;
}
@@ -122,7 +122,7 @@ protected:
public:
//! Get number of child nodes.
int GetChildCount() const { return m_childs.size(); };
int GetChildCount() const { return static_cast<int>(m_childs.size()); };
//! Get Child by id.
ReflectedPropertyItem* GetChild(int index) const { return m_childs[index]; }
PropertyType GetType() const { return m_type; }
@@ -473,7 +473,7 @@ void ReflectedVarUserAdapter::SyncReflectedVarToIVar(IVariable *pVariable)
//extract the list of custom items from the IVariable user data
IVariable::IGetCustomItems* pGetCustomItems = static_cast<IVariable::IGetCustomItems*> (pVariable->GetUserData().value<void *>());
if (pGetCustomItems != 0)
if (pGetCustomItems != nullptr)
{
std::vector<IVariable::IGetCustomItems::SItem> items;
QString dlgTitle;
+5 -5
View File
@@ -30,7 +30,7 @@ CSplineCtrl::CSplineCtrl(QWidget* parent)
m_nHitKeyIndex = -1;
m_nKeyDrawRadius = 3;
m_bTracking = false;
m_pSpline = 0;
m_pSpline = nullptr;
m_gridX = 10;
m_gridY = 10;
m_fMinTime = -1;
@@ -40,7 +40,7 @@ CSplineCtrl::CSplineCtrl(QWidget* parent)
m_fTooltipScaleX = 1;
m_fTooltipScaleY = 1;
m_bLockFirstLastKey = false;
m_pTimelineCtrl = 0;
m_pTimelineCtrl = nullptr;
m_bSelectedKeys.reserve(0);
@@ -417,7 +417,7 @@ void CSplineCtrl::SetActiveKey(int nIndex)
}
/////////////////////////////////////////////////////////////////////////////
void CSplineCtrl::SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw)
void CSplineCtrl::SetSpline(ISplineInterpolator* pSpline, bool bRedraw)
{
if (pSpline != m_pSpline)
{
@@ -596,7 +596,7 @@ CSplineCtrl::EHitCode CSplineCtrl::HitTest(const QPoint& point)
///////////////////////////////////////////////////////////////////////////////
void CSplineCtrl::StartTracking()
{
m_bTracking = TRUE;
m_bTracking = true;
GetIEditor()->BeginUndo();
@@ -674,7 +674,7 @@ void CSplineCtrl::StopTracking()
GetIEditor()->AcceptUndo("Spline Move");
m_bTracking = FALSE;
m_bTracking = false;
}
//////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -59,7 +59,7 @@ public:
// Lock value of first and last key to be the same.
void LockFirstAndLastKeys(bool bLock) { m_bLockFirstLastKey = bLock; }
void SetSpline(ISplineInterpolator* pSpline, BOOL bRedraw = FALSE);
void SetSpline(ISplineInterpolator* pSpline, bool bRedraw = false);
ISplineInterpolator* GetSpline();
void SetTimeMarker(float fTime);
+38 -38
View File
@@ -69,8 +69,8 @@ protected:
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
m_splineEntries.resize(m_splineEntries.size() + 1);
SplineEntry& entry = m_splineEntries.back();
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : 0);
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
entry.id = (pSplineSet ? pSplineSet->GetIDFromSpline(pSpline) : nullptr);
entry.pSpline = pSpline;
const int numKeys = pSpline->GetKeyCount();
@@ -81,10 +81,10 @@ protected:
}
}
virtual int GetSize() { return sizeof(*this); }
virtual QString GetDescription() { return "UndoSplineCtrlEx"; };
int GetSize() override { return sizeof(*this); }
QString GetDescription() override { return "UndoSplineCtrlEx"; };
virtual void Undo(bool bUndo)
void Undo(bool bUndo) override
{
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
if (pCtrl)
@@ -104,7 +104,7 @@ protected:
}
}
virtual void Redo()
void Redo() override
{
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
if (pCtrl)
@@ -134,7 +134,7 @@ private:
void SerializeSplines(_smart_ptr<ISplineBackup> SplineEntry::* backup, bool bLoading)
{
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
for (auto it = m_splineEntries.begin(); it != m_splineEntries.end(); ++it)
{
SplineEntry& entry = *it;
@@ -157,19 +157,19 @@ private:
}
public:
typedef std::list<AbstractSplineWidget*> CSplineCtrls;
using CSplineCtrls = std::list<AbstractSplineWidget *>;
static AbstractSplineWidget* FindControl(AbstractSplineWidget* pCtrl)
{
if (!pCtrl)
{
return 0;
return nullptr;
}
auto iter = std::find(s_activeCtrls.begin(), s_activeCtrls.end(), pCtrl);
if (iter == s_activeCtrls.end())
{
return 0;
return nullptr;
}
return *iter;
@@ -193,10 +193,10 @@ public:
static CSplineCtrls s_activeCtrls;
virtual bool IsSelectionChanged() const
bool IsSelectionChanged() const override
{
AbstractSplineWidget* pCtrl = FindControl(m_pCtrl);
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : 0);
ISplineSet* pSplineSet = (pCtrl ? pCtrl->m_pSplineSet : nullptr);
for (auto it = m_splineEntries.begin(); it != m_splineEntries.end(); ++it)
{
@@ -256,11 +256,11 @@ SplineWidget::~SplineWidget()
AbstractSplineWidget::AbstractSplineWidget()
: m_defaultKeyTangentType(SPLINE_KEY_TANGENT_NONE)
{
m_pTimelineCtrl = 0;
m_pTimelineCtrl = nullptr;
m_totalSplineCount = 0;
m_pHitSpline = 0;
m_pHitDetailSpline = 0;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
m_bHitIncomingHandle = true;
@@ -301,7 +301,7 @@ AbstractSplineWidget::AbstractSplineWidget()
m_boLeftMouseButtonDown = false;
m_pSplineSet = 0;
m_pSplineSet = nullptr;
m_controlAmplitude = false;
@@ -1633,7 +1633,7 @@ void SplineWidget::wheelEvent(QWheelEvent* event)
void SplineWidget::keyPressEvent(QKeyEvent* e)
{
BOOL bProcessed = false;
bool bProcessed = false;
switch (e->key())
{
@@ -1780,7 +1780,7 @@ void AbstractSplineWidget::SetHorizontalExtent([[maybe_unused]] int min, [[maybe
//si.nPage = max(0,m_rcClient.Width() - m_leftOffset*2);
//si.nPage = 1;
//si.nPage = 1;
SetScrollInfo( SB_HORZ,&si,TRUE );
SetScrollInfo( SB_HORZ,&si,true );
*/
}
@@ -1792,7 +1792,7 @@ ISplineInterpolator* AbstractSplineWidget::HitSpline(const QPoint& point)
return m_pHitSpline;
}
return NULL;
return nullptr;
}
//////////////////////////////////////////////////////////////////////////////
@@ -1806,8 +1806,8 @@ AbstractSplineWidget::EHitCode AbstractSplineWidget::HitTest(const QPoint& point
PointToTimeValue(point, time, val);
m_hitCode = HIT_NOTHING;
m_pHitSpline = NULL;
m_pHitDetailSpline = NULL;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
m_bHitIncomingHandle = true;
@@ -1968,8 +1968,8 @@ void AbstractSplineWidget::StopTracking()
void AbstractSplineWidget::ScaleAmplitudeKeys(float time, float startValue, float offset)
{
//TODO: Test it in the facial animation pane and fix it...
m_pHitSpline = 0;
m_pHitDetailSpline = 0;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
@@ -2071,8 +2071,8 @@ void AbstractSplineWidget::TimeScaleKeys(float time, float startTime, float endT
float timeScaleC = endTime - startTime * timeScaleM;
// Loop through all keys that are selected.
m_pHitSpline = 0;
m_pHitDetailSpline = 0;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
float affectedRangeMin = FLT_MAX;
@@ -2179,8 +2179,8 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue)
}
// Loop through all keys that are selected.
m_pHitSpline = 0;
m_pHitDetailSpline = 0;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
@@ -2212,8 +2212,8 @@ void AbstractSplineWidget::ValueScaleKeys(float startValue, float endValue)
//////////////////////////////////////////////////////////////////////////
void AbstractSplineWidget::MoveSelectedKeys(Vec2 offset, bool copyKeys)
{
m_pHitSpline = 0;
m_pHitDetailSpline = 0;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
m_nHitDimension = -1;
@@ -2275,8 +2275,8 @@ void AbstractSplineWidget::RemoveKey(ISplineInterpolator* pSpline, int nKey)
SendNotifyEvent(SPLN_BEFORE_CHANGE);
m_pHitSpline = 0;
m_pHitDetailSpline = 0;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
if (nKey != -1)
{
@@ -2294,8 +2294,8 @@ void AbstractSplineWidget::RemoveSelectedKeys()
SendNotifyEvent(SPLN_BEFORE_CHANGE);
m_pHitSpline = 0;
m_pHitDetailSpline = 0;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
@@ -2558,11 +2558,11 @@ public:
};
void AbstractSplineWidget::DuplicateSelectedKeys()
{
m_pHitSpline = 0;
m_pHitDetailSpline = 0;
m_pHitSpline = nullptr;
m_pHitDetailSpline = nullptr;
m_nHitKeyIndex = -1;
typedef std::vector<CKeyCopyInfo> KeysToAddContainer;
using KeysToAddContainer = std::vector<CKeyCopyInfo>;
KeysToAddContainer keysToInsert;
for (int splineIndex = 0, splineCount = m_splines.size(); splineIndex < splineCount; ++splineIndex)
{
@@ -2600,7 +2600,7 @@ void AbstractSplineWidget::ZeroAll()
{
GetIEditor()->BeginUndo();
typedef std::vector<ISplineInterpolator*> SplineContainer;
using SplineContainer = std::vector<ISplineInterpolator *>;
SplineContainer splines;
for (int splineIndex = 0; splineIndex < int(m_splines.size()); ++splineIndex)
{
@@ -2632,7 +2632,7 @@ void AbstractSplineWidget::KeyAll()
{
GetIEditor()->BeginUndo();
typedef std::vector<ISplineInterpolator*> SplineContainer;
using SplineContainer = std::vector<ISplineInterpolator *>;
SplineContainer splines;
for (int splineIndex = 0; splineIndex < int(m_splines.size()); ++splineIndex)
{
+1 -1
View File
@@ -58,7 +58,7 @@ TimelineWidget::TimelineWidget(QWidget* parent /* = nullptr */)
m_bIgnoreSetTime = false;
m_pKeyTimeSet = 0;
m_pKeyTimeSet = nullptr;
m_markerStyle = MARKER_STYLE_SECONDS;
m_fps = 30.0f;
+6 -6
View File
@@ -80,12 +80,12 @@ namespace
, m_trigger(trigger)
{}
virtual ~EditorListener()
~EditorListener() override
{
GetIEditor()->UnregisterNotifyListener(this);
}
void OnEditorNotifyEvent(EEditorNotifyEvent event)
void OnEditorNotifyEvent(EEditorNotifyEvent event) override
{
m_trigger(event);
}
@@ -544,12 +544,12 @@ void LevelEditorMenuHandler::PopulateEditMenu(ActionManager::MenuWrapper& editMe
auto snapMenu = modifyMenu.AddMenu(tr("Snap"));
snapMenu.AddAction(ID_SNAPANGLE);
snapMenu.AddAction(AzToolsFramework::SnapAngle);
auto transformModeMenu = modifyMenu.AddMenu(tr("Transform Mode"));
transformModeMenu.AddAction(ID_EDITMODE_MOVE);
transformModeMenu.AddAction(ID_EDITMODE_ROTATE);
transformModeMenu.AddAction(ID_EDITMODE_SCALE);
transformModeMenu.AddAction(AzToolsFramework::EditModeMove);
transformModeMenu.AddAction(AzToolsFramework::EditModeRotate);
transformModeMenu.AddAction(AzToolsFramework::EditModeScale);
editMenu.AddSeparator();
+1 -1
View File
@@ -423,7 +423,7 @@ namespace Editor
{
UINT rawInputSize;
const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER);
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize);
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, nullptr, &rawInputSize, rawInputHeaderSize);
AZStd::array<BYTE, sizeof(RAWINPUT)> rawInputBytesArray;
LPBYTE rawInputBytes = rawInputBytesArray.data();
+1 -1
View File
@@ -26,7 +26,7 @@ class EditorCoreTestEnvironment
public:
AZ_TEST_CLASS_ALLOCATOR(EditorCoreTestEnvironment);
virtual ~EditorCoreTestEnvironment()
~EditorCoreTestEnvironment() override
{
}
+1 -1
View File
@@ -62,7 +62,7 @@ int crtAllocHook(int nAllocType, void* pvData,
{
if (nBlockUse == _CRT_BLOCK)
{
return(TRUE);
return TRUE;
}
static int total_cnt = 0;
+39 -195
View File
@@ -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);
}
//////////////////////////////////////////////////////////////////////////////
@@ -375,9 +374,6 @@ void CCryEditApp::RegisterActionHandlers()
});
ON_COMMAND(ID_MOVE_OBJECT, OnMoveObject)
ON_COMMAND(ID_RENAME_OBJ, OnRenameObj)
ON_COMMAND(ID_EDITMODE_MOVE, OnEditmodeMove)
ON_COMMAND(ID_EDITMODE_ROTATE, OnEditmodeRotate)
ON_COMMAND(ID_EDITMODE_SCALE, OnEditmodeScale)
ON_COMMAND(ID_UNDO, OnUndo)
ON_COMMAND(ID_TOOLBAR_WIDGET_REDO, OnUndo) // Can't use the same ID, because for the menu we can't have a QWidgetAction, while for the toolbar we want one
ON_COMMAND(ID_IMPORT_ASSET, OnOpenAssetImporter)
@@ -464,7 +460,7 @@ void CCryEditApp::RegisterActionHandlers()
ON_COMMAND(ID_FILE_SAVE_LEVEL, OnFileSave)
ON_COMMAND(ID_FILE_EXPORTOCCLUSIONMESH, OnFileExportOcclusionMesh)
// Project Manager
// Project Manager
ON_COMMAND(ID_FILE_PROJECT_MANAGER_SETTINGS, OnOpenProjectManagerSettings)
ON_COMMAND(ID_FILE_PROJECT_MANAGER_NEW, OnOpenProjectManagerNew)
ON_COMMAND(ID_FILE_PROJECT_MANAGER_OPEN, OnOpenProjectManager)
@@ -657,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();
@@ -805,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();
@@ -851,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();
@@ -1059,7 +1055,7 @@ AZ::Outcome<void, AZStd::string> CCryEditApp::InitGameSystem(HWND hwndForInputSy
}
/////////////////////////////////////////////////////////////////////////////
BOOL CCryEditApp::CheckIfAlreadyRunning()
bool CCryEditApp::CheckIfAlreadyRunning()
{
bool bForceNewInstance = false;
@@ -1303,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())
@@ -1435,7 +1431,7 @@ struct CCryEditApp::PythonOutputHandler
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusConnect();
}
virtual ~PythonOutputHandler()
~PythonOutputHandler() override
{
AzToolsFramework::EditorPythonConsoleNotificationBus::Handler::BusDisconnect();
}
@@ -1467,7 +1463,7 @@ struct PythonTestOutputHandler final
: public CCryEditApp::PythonOutputHandler
{
PythonTestOutputHandler() = default;
virtual ~PythonTestOutputHandler() = default;
~PythonTestOutputHandler() override = default;
void OnTraceMessage(AZStd::string_view message) override
{
@@ -1593,7 +1589,7 @@ void CCryEditApp::RunInitPythonScript(CEditCommandLineInfo& cmdInfo)
/////////////////////////////////////////////////////////////////////////////
// CCryEditApp initialization
BOOL CCryEditApp::InitInstance()
bool CCryEditApp::InitInstance()
{
QElapsedTimer startupTimer;
startupTimer.start();
@@ -1620,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...
@@ -1630,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
@@ -1718,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;
@@ -1775,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();
@@ -1860,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)
{
@@ -1874,7 +1855,7 @@ void CCryEditApp::UnregisterEventLoopHook(IEventLoopHook* pHookToRemove)
m_pEventLoopHook = pHookToRemove->pNextHook;
}
pHookToRemove->pNextHook = 0;
pHookToRemove->pNextHook = nullptr;
return;
}
}
@@ -1897,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);
@@ -1938,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" );
}
@@ -2166,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
@@ -2281,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)
{
@@ -2289,7 +2264,7 @@ BOOL CCryEditApp::OnIdle([[maybe_unused]] LONG lCount)
}
else
{
return 0;
return false;
}
}
@@ -2579,75 +2554,6 @@ void CCryEditApp::OnRenameObj()
{
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeMove()
{
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Translation);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeRotate()
{
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Rotation);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnEditmodeScale()
{
using namespace AzToolsFramework;
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(),
&EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Scale);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateEditmodeMove(QAction* action)
{
Q_ASSERT(action->isCheckable());
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateEditmodeRotate(QAction* action)
{
Q_ASSERT(action->isCheckable());
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
}
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnUpdateEditmodeScale(QAction* action)
{
Q_ASSERT(action->isCheckable());
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
}
void CCryEditApp::OnViewSwitchToGame()
{
if (IsInPreviewMode())
@@ -3233,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());
@@ -3321,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);
@@ -3735,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);
}
@@ -3761,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);
}
@@ -3802,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);
}
@@ -3835,11 +3683,7 @@ void CCryEditApp::OnUpdateSwitchToSelectedCamera(QAction* action)
//////////////////////////////////////////////////////////////////////////
void CCryEditApp::OnSwitchcameraNext()
{
CViewport* vp = GetIEditor()->GetActiveView();
if (CRenderViewport* rvp = viewport_cast<CRenderViewport*>(vp))
{
rvp->CycleCamera();
}
}
//////////////////////////////////////////////////////////////////////////
@@ -3912,7 +3756,7 @@ bool CCryEditApp::IsInRegularEditorMode()
void CCryEditApp::OnOpenQuickAccessBar()
{
if (m_pQuickAccessBar == NULL)
if (m_pQuickAccessBar == nullptr)
{
return;
}
@@ -4260,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.");
+12 -18
View File
@@ -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; }
@@ -208,12 +208,6 @@ public:
void DeleteSelectedEntities(bool includeDescendants);
void OnMoveObject();
void OnRenameObj();
void OnEditmodeMove();
void OnEditmodeRotate();
void OnEditmodeScale();
void OnUpdateEditmodeMove(QAction* action);
void OnUpdateEditmodeRotate(QAction* action);
void OnUpdateEditmodeScale(QAction* action);
void OnUndo();
void OnOpenAssetImporter();
void OnUpdateSelected(QAction* action);
@@ -353,7 +347,7 @@ private:
// Disable warning for dll export since this member won't be used outside this class
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ::IO::FileDescriptorRedirector m_stdoutRedirection = AZ::IO::FileDescriptorRedirector(1); // < 1 for STDOUT
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
private:
static inline constexpr const char* DefaultLevelTemplateName = "Prefabs/Default_Level.prefab";
@@ -426,7 +420,7 @@ public:
};
//////////////////////////////////////////////////////////////////////////
class CCrySingleDocTemplate
class CCrySingleDocTemplate
: public QObject
{
private:
@@ -454,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:
@@ -471,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;
};
+98 -117
View File
@@ -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;
}
@@ -108,21 +110,12 @@ namespace Internal
// CCryEditDoc construction/destruction
CCryEditDoc::CCryEditDoc()
: doc_validate_surface_types(0)
: doc_validate_surface_types(nullptr)
, m_modifiedModuleFlags(eModifiedNothing)
// It assumes loaded levels have already been exported. Can be a big fat lie, though.
// The right way would require us to save to the level folder the export status of the
// level.
, m_boLevelExported(true)
, m_modified(false)
, m_envProbeHeight(200.0f)
, m_envProbeSliceRelativePath("EngineAssets/Slices/DefaultLevelSetup.slice")
{
////////////////////////////////////////////////////////////////////////
// Set member variables to initial values
////////////////////////////////////////////////////////////////////////
m_bLoadFailed = false;
m_waterColor = QColor(0, 0, 255);
m_fogTemplate = GetIEditor()->FindTemplate("Fog");
m_environmentTemplate = GetIEditor()->FindTemplate("Environment");
@@ -136,7 +129,6 @@ CCryEditDoc::CCryEditDoc()
m_environmentTemplate = XmlHelpers::CreateXmlNode("Environment");
}
m_bDocumentReady = false;
GetIEditor()->SetDocument(this);
CLogFile::WriteLine("Document created");
RegisterConsoleVariables();
@@ -195,7 +187,7 @@ CCryEditDoc::DocumentEditingMode CCryEditDoc::GetEditMode() const
QString CCryEditDoc::GetActivePathName() const
{
return DocumentEditingMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
return GetEditMode() == CCryEditDoc::DocumentEditingMode::SliceEdit ? GetSlicePathName() : GetLevelPathName();
}
QString CCryEditDoc::GetTitle() const
@@ -260,9 +252,9 @@ void CCryEditDoc::DeleteContents()
GetIEditor()->FlushUndo();
// Notify listeners.
for (std::list<IDocListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
for (IDocListener* listener : m_listeners)
{
(*it)->OnCloseDocument();
listener->OnCloseDocument();
}
GetIEditor()->ResetViews();
@@ -271,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();
@@ -313,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);
@@ -458,7 +450,7 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
//////////////////////////////////////////////////////////////////////////
// Load water color.
//////////////////////////////////////////////////////////////////////////
(*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
(*arrXmlAr[DMAS_GENERAL]).root->getAttr("WaterColor", m_waterColor);
//////////////////////////////////////////////////////////////////////////
// Load View Settings
@@ -491,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);
}
}
}
@@ -507,9 +499,9 @@ void CCryEditDoc::Load(TDocMultiArchive& arrXmlAr, const QString& szFilename)
CAutoLogTime logtime("Post Load");
// Notify listeners.
for (std::list<IDocListener*>::iterator it = m_listeners.begin(); it != m_listeners.end(); ++it)
for (IDocListener* listener : m_listeners)
{
(*it)->OnLoadDocument();
listener->OnLoadDocument();
}
}
@@ -675,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
@@ -684,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()
@@ -708,7 +700,8 @@ bool CCryEditDoc::SaveModified()
return true;
}
auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()), QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
auto button = QMessageBox::question(AzToolsFramework::GetActiveWindow(), QString(), tr("Save changes to %1?").arg(GetTitle()),
QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
switch (button)
{
case QMessageBox::Cancel:
@@ -742,7 +735,7 @@ bool CCryEditDoc::OnOpenDocument(const QString& lpszPathName)
TOpenDocContext context;
if (!BeforeOpenDocument(lpszPathName, context))
{
return FALSE;
return false;
}
return DoOpenDocument(context);
}
@@ -785,7 +778,7 @@ bool CCryEditDoc::BeforeOpenDocument(const QString& lpszPathName, TOpenDocContex
context.absoluteLevelPath = absolutePath;
context.absoluteSlicePath = "";
}
return TRUE;
return true;
}
bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
@@ -822,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))
@@ -834,7 +827,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
if (m_bLoadFailed)
{
return FALSE;
return false;
}
// Load AZ entities for the editor.
@@ -855,7 +848,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
if (m_bLoadFailed)
{
return FALSE;
return false;
}
StartStreamingLoad();
@@ -872,7 +865,7 @@ bool CCryEditDoc::DoOpenDocument(TOpenDocContext& context)
// level.
SetLevelExported(true);
return TRUE;
return true;
}
bool CCryEditDoc::OnNewDocument()
@@ -933,8 +926,7 @@ bool CCryEditDoc::OnSaveDocument(const QString& lpszPathName)
}
TSaveDocContext context;
if (shouldSaveLevel &&
BeforeSaveDocument(lpszPathName, context))
if (shouldSaveLevel && BeforeSaveDocument(lpszPathName, context))
{
DoSaveDocument(lpszPathName, context);
saveSuccess = AfterSaveDocument(lpszPathName, context);
@@ -969,10 +961,10 @@ bool CCryEditDoc::BeforeSaveDocument(const QString& lpszPathName, TSaveDocContex
bool bSaved(true);
context.bSaved = bSaved;
return TRUE;
return true;
}
bool CCryEditDoc::HasLayerNameConflicts()
bool CCryEditDoc::HasLayerNameConflicts() const
{
AZStd::vector<AZ::Entity*> editorEntities;
AzToolsFramework::EditorEntityContextRequestBus::Broadcast(
@@ -1004,43 +996,42 @@ bool CCryEditDoc::HasLayerNameConflicts()
bool CCryEditDoc::DoSaveDocument(const QString& filename, TSaveDocContext& context)
{
bool& bSaved = context.bSaved;
if (bSaved)
if (!bSaved)
{
// Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath)
// If nothing is loaded, we don't need to save anything
if (filename.isEmpty())
{
bSaved = false;
}
else
{
// Save Tag Point locations to file if auto save of tag points disabled
if (!gSettings.bAutoSaveTagPoints)
{
CCryEditApp::instance()->SaveTagLocations();
}
QString normalizedPath = Path::ToUnixPath(filename);
if (IsSliceFile(normalizedPath))
{
bSaved = SaveSlice(normalizedPath);
}
else
{
bSaved = SaveLevel(normalizedPath);
}
// Changes filename for this document.
SetPathName(normalizedPath);
}
return false;
}
// Paranoia - we shouldn't get this far into the save routine without a level loaded (empty levelPath)
// If nothing is loaded, we don't need to save anything
if (filename.isEmpty())
{
bSaved = false;
return false;
}
// Save Tag Point locations to file if auto save of tag points disabled
if (!gSettings.bAutoSaveTagPoints)
{
CCryEditApp::instance()->SaveTagLocations();
}
QString normalizedPath = Path::ToUnixPath(filename);
if (IsSliceFile(normalizedPath))
{
bSaved = SaveSlice(normalizedPath);
}
else
{
bSaved = SaveLevel(normalizedPath);
}
// Changes filename for this document.
SetPathName(normalizedPath);
return bSaved;
}
bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt)
{
bool& bSaved = context.bSaved;
bool bSaved = context.bSaved;
GetIEditor()->Notify(eNotify_OnEndSceneSave);
@@ -1055,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();
}
@@ -1067,8 +1058,7 @@ bool CCryEditDoc::AfterSaveDocument([[maybe_unused]] const QString& lpszPathName
static void GetUserSettingsFile(const QString& levelFolder, QString& userSettings)
{
const char* pUserName = GetISystem()->GetUserName();
QString fileName;
fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
QString fileName = QStringLiteral("%1_usersettings.editor_xml").arg(pUserName);
userSettings = Path::Make(levelFolder, fileName);
}
@@ -1182,9 +1172,9 @@ bool CCryEditDoc::SaveLevel(const QString& filename)
}
QString oldFilePath = QDir(oldLevelFolder).absoluteFilePath(sourceName);
QString newFilePath = QDir(newLevelFolder).absoluteFilePath(sourceName);
QString newFilePath = QDir(newLevelFolder).absoluteFilePath(destName);
CFileUtil::CopyFile(oldFilePath, newFilePath);
} while (findHandle = pIPak->FindNext(findHandle));
} while ((findHandle = pIPak->FindNext(findHandle)));
pIPak->FindClose(findHandle);
}
@@ -1506,7 +1496,7 @@ bool CCryEditDoc::LoadEntitiesFromLevel(const QString& levelPakFile)
{
AZStd::vector<char> fileBuffer;
fileBuffer.resize(entitiesFile.GetLength());
if (fileBuffer.size() > 0)
if (!fileBuffer.empty())
{
if (fileBuffer.size() == entitiesFile.ReadRaw(fileBuffer.begin(), fileBuffer.size()))
{
@@ -1608,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);
@@ -1618,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);
@@ -1910,7 +1900,7 @@ void CCryEditDoc::UnregisterListener(IDocListener* listener)
m_listeners.remove(listener);
}
void CCryEditDoc::LogLoadTime(int time)
void CCryEditDoc::LogLoadTime(int time) const
{
QString appFilePath = QDir::toNativeSeparators(QCoreApplication::applicationFilePath());
QString exePath = Path::GetPath(appFilePath);
@@ -1922,21 +1912,18 @@ void CCryEditDoc::LogLoadTime(int time)
SetFileAttributes(filename.toUtf8().data(), FILE_ATTRIBUTE_ARCHIVE);
#endif
FILE* file = nullptr;
azfopen(&file, filename.toUtf8().data(), "at");
if (file)
QFile file(filename);
if (!file.open(QFile::Append | QFile::Text))
{
char version[50];
GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version));
QString text;
time = time / 1000;
text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time);
fwrite(text.toUtf8().data(), text.toUtf8().length(), 1, file);
fclose(file);
return;
}
char version[50];
GetIEditor()->GetFileVersion().ToShortString(version, AZ_ARRAY_SIZE(version));
time = time / 1000;
QString text = QStringLiteral("\n[%1] Level %2 loaded in %3 seconds").arg(version, level).arg(time);
file.write(text.toUtf8());
}
void CCryEditDoc::SetDocumentReady(bool bReady)
@@ -1944,7 +1931,7 @@ void CCryEditDoc::SetDocumentReady(bool bReady)
m_bDocumentReady = bReady;
}
void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer)
void CCryEditDoc::GetMemoryUsage(ICrySizer* pSizer) const
{
{
SIZER_COMPONENT_NAME(pSizer, "UndoManager(estimate)");
@@ -1997,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)
{
@@ -2015,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();
@@ -2068,12 +2055,9 @@ void CCryEditDoc::InitEmptyLevel(int /*resolution*/, int /*unitSize*/, bool /*bU
{
// Notify listeners.
std::list<IDocListener*> listeners = m_listeners;
std::list<IDocListener*>::iterator it, next;
for (it = listeners.begin(); it != listeners.end(); it = next)
for (IDocListener* listener : listeners)
{
next = it;
next++;
(*it)->OnNewDocument();
listener->OnNewDocument();
}
}
@@ -2081,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);
@@ -2095,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;
}
@@ -2119,7 +2103,7 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
XmlNodeRef groupNode = node->getChild(nGroup);
if (groupNode == NULL)
if (groupNode == nullptr)
{
return;
}
@@ -2130,36 +2114,34 @@ void CCryEditDoc::OnEnvironmentPropertyChanged(IVariable* pVar)
}
XmlNodeRef childNode = groupNode->getChild(nChild);
if (childNode == NULL)
if (childNode == nullptr)
{
return;
}
QString childValue;
if (pVar->GetDataType() == IVariable::DT_COLOR)
{
Vec3 value;
pVar->Get(value);
QString buff;
QColor gammaColor = ColorLinearToGamma(ColorF(value.x, value.y, value.z));
buff = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue());
childNode->setAttr("value", buff.toUtf8().data());
childValue = QStringLiteral("%1,%2,%3").arg(gammaColor.red()).arg(gammaColor.green()).arg(gammaColor.blue());
}
else
{
QString value;
pVar->Get(value);
childNode->setAttr("value", value.toUtf8().data());
pVar->Get(childValue);
}
childNode->setAttr("value", childValue.toUtf8().data());
}
QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath)
QString CCryEditDoc::GetCryIndexPath(const LPCTSTR levelFilePath) const
{
QString levelPath = Path::GetPath(levelFilePath);
QString levelName = Path::GetFileName(levelFilePath);
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();
@@ -2168,7 +2150,7 @@ BOOL CCryEditDoc::LoadXmlArchiveArray(TDocMultiArchive& arrXmlAr, const QString&
CXmlArchive* pXmlAr = new CXmlArchive();
if (!pXmlAr)
{
return FALSE;
return false;
}
CXmlArchive& xmlAr = *pXmlAr;
@@ -2179,22 +2161,21 @@ 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;
bool loadFromPakSuccess;
loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile);
bool loadFromPakSuccess = xmlAr.LoadFromPak(levelPath, pakFile);
pIPak->ClosePack(absoluteLevelPath.toUtf8().data());
if (!loadFromPakSuccess)
{
return FALSE;
return false;
}
FillXmlArArray(arrXmlAr, &xmlAr);
}
return TRUE;
return true;
}
void CCryEditDoc::ReleaseXmlArchiveArray(TDocMultiArchive& arrXmlAr)
+21 -19
View File
@@ -26,7 +26,7 @@ struct ICVar;
// Filename of the temporary file used for the hold / fetch operation
// conform to the "$tmp[0-9]_" naming convention
#define HOLD_FETCH_FILE "$tmp_hold"
#define HOLD_FETCH_FILE "$tmp_hold"
class CCryEditDoc
: public QObject
@@ -36,7 +36,7 @@ class CCryEditDoc
Q_PROPERTY(bool modified READ IsModified WRITE SetModifiedFlag);
Q_PROPERTY(QString pathName READ GetLevelPathName WRITE SetPathName);
Q_PROPERTY(QString title READ GetTitle WRITE SetTitle);
public: // Create from serialization only
enum DocumentEditingMode
{
@@ -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);
@@ -91,7 +91,7 @@ public: // Create from serialization only
// ClassWizard generated virtual function overrides
virtual bool OnOpenDocument(const QString& lpszPathName);
const bool IsLevelLoadFailed() const { return m_bLoadFailed; }
bool IsLevelLoadFailed() const { return m_bLoadFailed; }
//! Marks this document as having errors.
void SetHasErrors() { m_hasErrors = true; }
@@ -102,7 +102,7 @@ public: // Create from serialization only
bool IsLevelExported() const;
void SetLevelExported(bool boExported = true);
BOOL CanCloseFrame();
bool CanCloseFrame();
enum class FetchPolicy
{
@@ -121,7 +121,7 @@ public: // Create from serialization only
CClouds* GetClouds() { return m_pClouds; }
void SetWaterColor(const QColor& col) { m_waterColor = col; }
QColor GetWaterColor() { return m_waterColor; }
QColor GetWaterColor() const { return m_waterColor; }
XmlNodeRef& GetFogTemplate() { return m_fogTemplate; }
XmlNodeRef& GetEnvironmentTemplate() { return m_environmentTemplate; }
void OnEnvironmentPropertyChanged(IVariable* pVar);
@@ -129,7 +129,7 @@ public: // Create from serialization only
void RegisterListener(IDocListener* listener);
void UnregisterListener(IDocListener* listener);
void GetMemoryUsage(ICrySizer* pSizer);
void GetMemoryUsage(ICrySizer* pSizer) const;
static bool IsBackupOrTempLevelSubdirectory(const QString& folderName);
protected:
@@ -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);
@@ -161,14 +161,14 @@ protected:
void SerializeFogSettings(CXmlArchive& xmlAr);
virtual void SerializeViewSettings(CXmlArchive& xmlAr);
void SerializeNameSelection(CXmlArchive& xmlAr);
void LogLoadTime(int time);
void LogLoadTime(int time) const;
struct TSaveDocContext
{
bool bSaved;
};
bool BeforeSaveDocument(const QString& lpszPathName, TSaveDocContext& context);
bool HasLayerNameConflicts();
bool HasLayerNameConflicts() const;
bool DoSaveDocument(const QString& lpszPathName, TSaveDocContext& context);
bool AfterSaveDocument(const QString& lpszPathName, TSaveDocContext& context, bool bShowPrompt = true);
@@ -180,7 +180,7 @@ protected:
void OnStartLevelResourceList();
static void OnValidateSurfaceTypesChanged(ICVar*);
QString GetCryIndexPath(const LPCTSTR levelFilePath);
QString GetCryIndexPath(const LPCTSTR levelFilePath) const;
//////////////////////////////////////////////////////////////////////////
// SliceEditorEntityOwnershipServiceNotificationBus::Handler
@@ -188,24 +188,26 @@ protected:
void OnSliceInstantiationFailed(const AZ::Data::AssetId& sliceAssetId, const AzFramework::SliceInstantiationTicket& /*ticket*/) override;
//////////////////////////////////////////////////////////////////////////
bool m_bLoadFailed;
QColor m_waterColor;
bool m_bLoadFailed = false;
QColor m_waterColor = QColor(0, 0, 255);
XmlNodeRef m_fogTemplate;
XmlNodeRef m_environmentTemplate;
CClouds* m_pClouds;
std::list<IDocListener*> m_listeners;
bool m_bDocumentReady;
ICVar* doc_validate_surface_types;
bool m_bDocumentReady = false;
ICVar* doc_validate_surface_types = nullptr;
int m_modifiedModuleFlags;
bool m_boLevelExported;
bool m_modified;
// On construction, it assumes loaded levels have already been exported. Can be a big fat lie, though.
// The right way would require us to save to the level folder the export status of the level.
bool m_boLevelExported = true;
bool m_modified = false;
QString m_pathName;
QString m_slicePathName;
QString m_title;
AZ::Data::AssetId m_envProbeSliceAssetId;
float m_terrainSize;
const char* m_envProbeSliceRelativePath;
const float m_envProbeHeight;
const char* m_envProbeSliceRelativePath = "EngineAssets/Slices/DefaultLevelSetup.slice";
const float m_envProbeHeight = 200.0f;
bool m_hasErrors = false; ///< This is used to warn the user that they may lose work when they go to save.
};
+1 -1
View File
@@ -359,7 +359,7 @@ namespace
{
AZ::TickBus::Handler::BusConnect();
}
~Ticker()
~Ticker() override
{
AZ::TickBus::Handler::BusDisconnect();
}
+1 -1
View File
@@ -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)
+4 -4
View File
@@ -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)
@@ -50,12 +50,12 @@ void CCustomResolutionDlg::OnInitDialog()
m_ui->m_height->setValue(m_hDefault);
QString maxDimensionString;
QTextStream(&maxDimensionString)
<< "Maximum Dimension: " << MAX_RES << Qt::endl
QTextStream(&maxDimensionString)
<< "Maximum Dimension: " << MAX_RES << Qt::endl
<< Qt::endl
<< "Note: Dimensions over 8K may be" << Qt::endl
<< "unstable depending on hardware.";
m_ui->m_maxDimension->setText(maxDimensionString);
}
+2 -2
View File
@@ -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
{
+1 -1
View File
@@ -20,7 +20,7 @@ AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
AZ_POP_DISABLE_DLL_EXPORT_MEMBER_WARNING
CErrorsDlg::CErrorsDlg(QWidget* pParent /*=NULL*/)
CErrorsDlg::CErrorsDlg(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, ui(new Ui::CErrorsDlg)
{
+1 -1
View File
@@ -159,7 +159,7 @@ void CPythonScriptsDialog::OnExecute()
QList<QStandardItem*> selectedItems = ui->treeView->GetSelectedItems();
QStandardItem* selectedItem = selectedItems.empty() ? nullptr : selectedItems.first();
if (selectedItem == NULL)
if (selectedItem == nullptr)
{
return;
}
+3 -4
View File
@@ -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
+1 -1
View File
@@ -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;
}
+1 -1
View File
@@ -42,7 +42,7 @@ private:
QString extension;
SFileChangeCallback()
: pListener(NULL)
: pListener(nullptr)
{}
SFileChangeCallback(IFileChangeListener* pListener, const char* item, const char* extension)
+23 -23
View File
@@ -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)
{
+1 -1
View File
@@ -282,7 +282,7 @@ void EditorPreferencesDialog::CreatePages()
{
auto pUnknown = classes[i];
IPreferencesPageCreator* pPageCreator = 0;
IPreferencesPageCreator* pPageCreator = nullptr;
if (FAILED(pUnknown->QueryInterface(&pPageCreator)))
{
continue;
+18 -2
View File
@@ -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;
}
+7
View File
@@ -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;
};
@@ -32,6 +32,7 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->Field("PreviewPanel", &GeneralSettings::m_previewPanel)
->Field("ApplyConfigSpec", &GeneralSettings::m_applyConfigSpec)
->Field("EnableSourceControl", &GeneralSettings::m_enableSourceControl)
->Field("ClearConsole", &GeneralSettings::m_clearConsoleOnGameModeStart)
->Field("ConsoleBackgroundColorTheme", &GeneralSettings::m_consoleBackgroundColorTheme)
->Field("AutoloadLastLevel", &GeneralSettings::m_autoLoadLastLevel)
->Field("ShowTimeInConsole", &GeneralSettings::m_bShowTimeInConsole)
@@ -77,6 +78,8 @@ void CEditorPreferencesPage_General::Reflect(AZ::SerializeContext& serialize)
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_previewPanel, "Show Geometry Preview Panel", "Show Geometry Preview Panel")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_applyConfigSpec, "Hide objects by config spec", "Hide objects by config spec")
->DataElement(AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_enableSourceControl, "Enable Source Control", "Enable Source Control")
->DataElement(
AZ::Edit::UIHandlers::CheckBox, &GeneralSettings::m_clearConsoleOnGameModeStart, "Clear Console at game startup", "Clear Console when game mode starts")
->DataElement(AZ::Edit::UIHandlers::ComboBox, &GeneralSettings::m_consoleBackgroundColorTheme, "Console Background", "Console Background")
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Light, "Light")
->EnumAttribute(AzToolsFramework::ConsoleColorTheme::Dark, "Dark")
@@ -142,6 +145,7 @@ void CEditorPreferencesPage_General::OnApply()
gSettings.bPreviewGeometryWindow = m_generalSettings.m_previewPanel;
gSettings.bApplyConfigSpecInEditor = m_generalSettings.m_applyConfigSpec;
gSettings.enableSourceControl = m_generalSettings.m_enableSourceControl;
gSettings.clearConsoleOnGameModeStart = m_generalSettings.m_clearConsoleOnGameModeStart;
gSettings.consoleBackgroundColorTheme = m_generalSettings.m_consoleBackgroundColorTheme;
gSettings.bShowTimeInConsole = m_generalSettings.m_bShowTimeInConsole;
gSettings.bShowDashboardAtStartup = m_messaging.m_showDashboard;
@@ -176,6 +180,7 @@ void CEditorPreferencesPage_General::InitializeSettings()
m_generalSettings.m_previewPanel = gSettings.bPreviewGeometryWindow;
m_generalSettings.m_applyConfigSpec = gSettings.bApplyConfigSpecInEditor;
m_generalSettings.m_enableSourceControl = gSettings.enableSourceControl;
m_generalSettings.m_clearConsoleOnGameModeStart = gSettings.clearConsoleOnGameModeStart;
m_generalSettings.m_consoleBackgroundColorTheme = gSettings.consoleBackgroundColorTheme;
m_generalSettings.m_bShowTimeInConsole = gSettings.bShowTimeInConsole;
m_generalSettings.m_autoLoadLastLevel = gSettings.bAutoloadLastLevelAtStartup;
@@ -46,6 +46,7 @@ private:
bool m_previewPanel;
bool m_applyConfigSpec;
bool m_enableSourceControl;
bool m_clearConsoleOnGameModeStart;
AzToolsFramework::ConsoleColorTheme m_consoleBackgroundColorTheme;
bool m_autoLoadLastLevel;
bool m_bShowTimeInConsole;
File diff suppressed because it is too large Load Diff
+201 -404
View File
@@ -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); };
static EditorViewportWidget* GetPrimaryViewport();
virtual ~EditorViewportWidget();
// Used by ViewPan in some circumstances
void ConnectViewportInteractionRequestBus();
void DisconnectViewportInteractionRequestBus();
Q_INVOKABLE void InjectFakeMouseMove(int deltaX, int deltaY, Qt::MouseButtons buttons);
// 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;
// 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;
private:
////////////////////////////////////////////////////////////////////////
// Private types ...
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)
enum class ViewSourceType
{
if (m_viewSourceType == ViewSourceType::None)
{
m_defaultViewTM = tm;
}
SetViewTM(tm, false);
}
None,
CameraComponent,
ViewSourceTypesCount,
};
enum class PlayInEditorState
{
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 = m_arrAnimatedCharacterPath.size();
for (uint32 i = 0; i < numSample6; i++)
{
m_arrAnimatedCharacterPath[i] = Vec3(ZERO);
}
numSample6 = m_arrSmoothEntityPath.size();
for (uint32 i = 0; i < numSample6; i++)
{
m_arrSmoothEntityPath[i] = Vec3(ZERO);
}
uint32 numSample7 = 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,193 +219,41 @@ 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;
//-------------------------------------------
//--- 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;
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 EditorViewportWidget* m_pPrimaryViewport;
QRect m_safeFrame;
QRect m_safeAction;
QRect m_safeTitle;
CPredefinedAspectRatios m_predefinedAspectRatios;
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();
@@ -547,48 +261,131 @@ private:
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();
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();
AzFramework::CameraState GetCameraState();
AzFramework::ScreenPoint ViewportWorldToScreen(const AZ::Vector3& worldPosition);
QPoint WidgetToViewport(const QPoint& point) const;
QPoint ViewportToWidget(const QPoint& point) const;
QSize WidgetToViewport(const QSize& size) const;
const DisplayContext& GetDisplayContext() const { return m_displayContext; }
CBaseObject* GetCameraObject() const;
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;
AZ::RPI::ViewPtr GetCurrentAtomView() const;
////////////////////////////////////////////////////////////////////////
// Members ...
friend class AZ::ViewportHelpers::EditorEntityNotifications;
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
// Singleton for the primary viewport
static EditorViewportWidget* m_pPrimaryViewport;
// 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;
// The entity ID of the current camera for this viewport, or invalid if the default editor camera
AZ::EntityId m_viewEntityId;
// Determines also if the current camera for this viewport is default editor camera
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;
// Determines if the viewport needs updating (false when out of focus for example)
bool m_bUpdateViewport = false;
// 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;
// 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;
// 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
};
+2 -2
View File
@@ -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;
}
+1 -1
View File
@@ -105,7 +105,7 @@ public:
bool IsEmpty() const;
//! Get number of contained error records.
int GetErrorCount() const { return m_errors.size(); };
int GetErrorCount() const { return static_cast<int>(m_errors.size()); };
//! Get access to indexed error record.
CErrorRecord& GetError(int i);
//! Clear all error records.
+8 -8
View File
@@ -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);
}
}
*/
+1 -1
View File
@@ -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);
+11 -18
View File
@@ -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"
@@ -96,7 +95,7 @@ Export::CObject::CObject(const char* pName)
cameraTargetNodeName[0] = '\0';
m_pLastObject = 0;
m_pLastObject = nullptr;
}
@@ -116,14 +115,14 @@ void Export::CData::Clear()
// CExportManager
CExportManager::CExportManager()
: m_isPrecaching(false)
, m_pBaseObj(0)
, m_pBaseObj(nullptr)
, m_FBXBakedExportFPS(0.0f)
, m_fScale(100.0f)
, // this scale is used by CryEngine RC
m_bAnimationExport(false)
, m_bExportLocalCoords(false)
, m_numberOfExportFrames(0)
, m_pivotEntityObject(0)
, m_pivotEntityObject(nullptr)
, m_bBakedKeysSequenceExport(true)
, m_animTimeExportPrimarySequenceCurrentTime(0.0f)
, m_animKeyTimeExport(true)
@@ -290,7 +289,7 @@ void CExportManager::ProcessEntityAnimationTrack(
const AZ::EntityId entityId, Export::CObject* pObj, AnimParamType entityTrackParamType)
{
CTrackViewAnimNode* pEntityNode = GetIEditor()->GetSequenceManager()->GetActiveAnimNode(entityId);
CTrackViewTrack* pEntityTrack = (pEntityNode ? pEntityNode->GetTrackForParameter(entityTrackParamType) : 0);
CTrackViewTrack* pEntityTrack = (pEntityNode ? pEntityNode->GetTrackForParameter(entityTrackParamType) : nullptr);
if (!pEntityTrack)
{
@@ -397,7 +396,7 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh
else
{
Export::CMesh* pMesh = new Export::CMesh();
if (meshDesc.m_nFaceCount == 0 && meshDesc.m_nIndexCount != 0 && meshDesc.m_pIndices != 0)
if (meshDesc.m_nFaceCount == 0 && meshDesc.m_nIndexCount != 0 && meshDesc.m_pIndices != nullptr)
{
const vtx_idx* pIndices = &meshDesc.m_pIndices[0];
int nTris = meshDesc.m_nIndexCount / 3;
@@ -431,7 +430,7 @@ void CExportManager::AddMesh(Export::CObject* pObj, const IIndexedMesh* pIndMesh
bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matrix34A* pTm)
{
IIndexedMesh* pIndMesh = 0;
IIndexedMesh* pIndMesh = nullptr;
if (pStatObj->GetSubObjectCount())
{
@@ -440,7 +439,7 @@ bool CExportManager::AddStatObj(Export::CObject* pObj, IStatObj* pStatObj, Matri
IStatObj::SSubObject* pSubObj = pStatObj->GetSubObject(i);
if (pSubObj && pSubObj->nType == STATIC_SUB_OBJECT_MESH && pSubObj->pStatObj)
{
pIndMesh = 0;
pIndMesh = nullptr;
if (m_isOccluder)
{
if (pSubObj->pStatObj->GetLodObject(2))
@@ -542,7 +541,7 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj)
if (m_isPrecaching)
{
AddMeshes(0);
AddMeshes(nullptr);
return true;
}
@@ -554,7 +553,7 @@ bool CExportManager::AddObject(CBaseObject* pBaseObj)
m_objectMap[pBaseObj] = int(m_data.m_objects.size() - 1);
AddMeshes(pObj);
m_pBaseObj = 0;
m_pBaseObj = nullptr;
return true;
}
@@ -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;
@@ -678,7 +671,7 @@ bool CExportManager::ProcessObjectsForExport()
for (size_t objectID = 0; objectID < m_data.m_objects.size(); ++objectID)
{
Export::CObject* pObj2 = m_data.m_objects[objectID];
CBaseObject* pObject = 0;
CBaseObject* pObject = nullptr;
if (QString::compare(pObj2->name, kPrimaryCameraName) == 0)
{
@@ -983,7 +976,7 @@ bool CExportManager::AddObjectsFromSequence(CTrackViewSequence* pSequence, XmlNo
{
if (pSubSequence && !pSubSequence->IsDisabled())
{
XmlNodeRef subSeqNode = 0;
XmlNodeRef subSeqNode = nullptr;
if (!seqNode)
{
+1 -1
View File
@@ -67,7 +67,7 @@ bool COBJExporter::ExportToFile(const char* filename, const Export::IData* pExpo
while (nParent >= 0 && nParent < pExportData->GetObjectCount())
{
const Export::Object* pParentObj = pExportData->GetObject(nParent);
assert(NULL != pParentObj);
assert(nullptr != pParentObj);
Vec3 pos2(pParentObj->pos.x, pParentObj->pos.y, pParentObj->pos.z);
Quat rot2(pParentObj->rot.w, pParentObj->rot.v.x, pParentObj->rot.v.y, pParentObj->rot.v.z);
+17 -26
View File
@@ -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)
{
@@ -566,14 +566,12 @@ void CGameEngine::SwitchToInGame()
streamer->QueueRequest(flush);
wait.acquire();
}
GetIEditor()->Notify(eNotify_OnBeginGameMode);
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();
}
+2 -2
View File
@@ -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;
}
//////////////////////////////////////////////////////////////////////////
+1 -1
View File
@@ -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)
+11 -11
View File
@@ -19,13 +19,13 @@
//////////////////////////////////////////////////////////////////////////
CTriMesh::CTriMesh()
{
pFaces = NULL;
pVertices = NULL;
pWSVertices = NULL;
pUV = NULL;
pColors = NULL;
pEdges = NULL;
pWeights = NULL;
pFaces = nullptr;
pVertices = nullptr;
pWSVertices = nullptr;
pUV = nullptr;
pColors = nullptr;
pEdges = nullptr;
pWeights = nullptr;
nFacesCount = 0;
nVertCount = 0;
@@ -67,7 +67,7 @@ void CTriMesh::ReallocStream(int stream, int nNewCount)
{
return; // Stream already have required size.
}
void* pStream = 0;
void* pStream = nullptr;
int nElementSize = 0;
GetStreamInfo(stream, pStream, nElementSize);
pStream = ReAllocElements(pStream, nNewCount, nElementSize);
@@ -256,7 +256,7 @@ void CTriMesh::SharePositions()
std::vector<int> arrHashTable[256];
CTriVertex* pNewVerts = new CTriVertex[GetVertexCount()];
SMeshColor* pNewColors = 0;
SMeshColor* pNewColors = nullptr;
if (pColors)
{
pNewColors = new SMeshColor[GetVertexCount()];
@@ -433,8 +433,8 @@ void CTriMesh::UpdateIndexedMesh(IIndexedMesh* pIndexedMesh) const
//////////////////////////////////////////////////////////////////////////
void CTriMesh::CopyStream(CTriMesh& fromMesh, int stream)
{
void* pTrgStream = 0;
void* pSrcStream = 0;
void* pTrgStream = nullptr;
void* pSrcStream = nullptr;
int nElemSize = 0;
fromMesh.GetStreamInfo(stream, pSrcStream, nElemSize);
if (pSrcStream)
+2 -2
View File
@@ -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.
+14 -14
View File
@@ -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,15 +637,15 @@ 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();
if (pViewport)
{
//Pre and Post widget rendering calls are made here to make sure that the proper camera state is set.
//MakeConstructionPlane will make a call to ViewToWorldRay which needs the correct camera state
//in the CRenderViewport to be set.
//MakeConstructionPlane will make a call to ViewToWorldRay which needs the correct camera state
//in the CRenderViewport to be set.
pViewport->PreWidgetRendering();
pViewport->MakeConstructionPlane(GetIEditor()->GetAxisConstrains());
@@ -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()
+4 -4
View File
@@ -22,7 +22,7 @@
#include <AzToolsFramework/Thumbnails/ThumbnailerBus.h>
#include <AzCore/std/string/string.h>
#include "Commands/CommandManager.h"
#include "Commands/CommandManager.h"
#include "Include/IErrorReport.h"
#include "ErrorReport.h"
@@ -63,7 +63,7 @@ namespace AssetDatabase
class AssetDatabaseLocationListener;
}
class CEditorImpl
class CEditorImpl
: public IEditor
{
Q_DECLARE_TR_FUNCTIONS(CEditorImpl)
@@ -176,7 +176,7 @@ public:
{
return m_pSystem->GetIMovieSystem();
}
return NULL;
return nullptr;
};
CPluginManager* GetPluginManager() { return m_pPluginManager; }
@@ -210,7 +210,7 @@ public:
RefCoordSys GetReferenceCoordSys();
XmlNodeRef FindTemplate(const QString& templateName);
void AddTemplate(const QString& templateName, XmlNodeRef& tmpl);
const QtViewPane* OpenView(QString sViewClassName, bool reuseOpened = true) override;
/**
+5 -5
View File
@@ -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;
}
+3 -3
View File
@@ -334,12 +334,12 @@ struct IAssetItem
virtual void OnEndPreview() = 0;
// Description:
// If the asset has a special preview panel with utility controls, to be placed at the top of the Preview window, it can return an child dialog window
// otherwise it can return NULL, if no panel is available
// otherwise it can return nullptr, if no panel is available
// Arguments:
// pParentWnd - a valid CDialog*, or NULL
// pParentWnd - a valid CDialog*, or nullptr
// Return Value:
// A valid child dialog window handle, if this asset wants to have a custom panel in the top side of the Asset Preview window,
// otherwise it can return NULL, if no panel is available
// otherwise it can return nullptr, if no panel is available
// See Also:
// OnBeginPreview(), OnEndPreview()
virtual QWidget* GetCustomPreviewPanelHeader(QWidget* pParentWnd) = 0;
+9 -2
View File
@@ -186,8 +186,15 @@ struct IFileUtil
virtual ECopyTreeResult CopyTree(const QString& strSourceDirectory, const QString& strTargetDirectory, bool boRecurse = true, bool boConfirmOverwrite = false) = 0;
//////////////////////////////////////////////////////////////////////////
// @param LPPROGRESS_ROUTINE pfnProgress - called by the system to notify of file copy progress
// @param LPBOOL pbCancel - when the contents of this BOOL are set to TRUE, the system cancels the copy operation
/**
* @brief CopyFile
* @param strSourceFile
* @param strTargetFile
* @param boConfirmOverwrite
* @param pfnProgress - called by the system to notify of file copy progress
* @param pbCancel - when the contents of this bool are set to true, the system cancels the copy operation
* @return
*/
virtual ECopyTreeResult CopyFile(const QString& strSourceFile, const QString& strTargetFile, bool boConfirmOverwrite = false, ProgressRoutine pfnProgress = nullptr, bool* pbCancel = nullptr) = 0;
// As we don't have a FileUtil interface here, we have to duplicate some code :-( in order to keep
+1 -1
View File
@@ -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)
+2 -2
View File
@@ -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;
}
}
+1 -1
View File
@@ -103,7 +103,7 @@ public:
static const char* GetConfigGroupName();
CLayoutViewPane* FindViewByClass(const QString& viewClassName);
void BindViewport(CLayoutViewPane* vp, const QString& viewClassName, QWidget* pViewport = NULL);
void BindViewport(CLayoutViewPane* vp, const QString& viewClassName, QWidget* pViewport = nullptr);
QString ViewportTypeToClassName(EViewportType viewType);
//! Switch 2D viewports.
+1 -1
View File
@@ -93,7 +93,7 @@ void CLevelInfo::ValidateObjects()
pObject->Validate(m_pReport);
m_pReport->SetCurrentValidatorObject(NULL);
m_pReport->SetCurrentValidatorObject(nullptr);
}
CLogFile::WriteLine("Validating Duplicate Objects...");
+2 -2
View File
@@ -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;
+1 -1
View File
@@ -17,7 +17,7 @@ class EditorLibTestEnvironment
: public AZ::Test::ITestEnvironment
{
public:
virtual ~EditorLibTestEnvironment() {}
~EditorLibTestEnvironment() override = default;
protected:
void SetupEnvironment() override
+1 -1
View File
@@ -380,7 +380,7 @@ AZ_POP_DISABLE_WARNING
//////////////////////////////////////////////////////////////////////
#if defined(AZ_PLATFORM_WINDOWS)
EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &DisplayConfig);
EnumDisplaySettings(nullptr, ENUM_CURRENT_SETTINGS, &DisplayConfig);
GetPrivateProfileString("boot.description", "display.drv",
"(Unknown graphics card)", szProfileBuffer, sizeof(szProfileBuffer),
"system.ini");
+80 -27
View File
@@ -46,6 +46,7 @@ AZ_POP_DISABLE_WARNING
#include <AzToolsFramework/API/EditorAnimationSystemRequestBus.h>
#include <AzToolsFramework/SourceControl/QtSourceControlNotificationHandler.h>
#include <AzToolsFramework/PythonTerminal/ScriptTermDialog.h>
#include <AzToolsFramework/ViewportSelection/EditorTransformComponentSelectionRequestBus.h>
// AzQtComponents
#include <AzQtComponents/Buses/ShortcutDispatch.h>
@@ -160,45 +161,45 @@ public:
}
}
~EngineConnectionListener()
~EngineConnectionListener() override
{
AzFramework::AssetSystemInfoBus::Handler::BusDisconnect();
AzFramework::EngineConnectionEvents::Bus::Handler::BusDisconnect();
}
public:
virtual void Connected([[maybe_unused]] AzFramework::SocketConnection* connection)
void Connected([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Connected;
}
virtual void Connecting([[maybe_unused]] AzFramework::SocketConnection* connection)
void Connecting([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Connecting;
}
virtual void Listening([[maybe_unused]] AzFramework::SocketConnection* connection)
void Listening([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Listening;
}
virtual void Disconnecting([[maybe_unused]] AzFramework::SocketConnection* connection)
void Disconnecting([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Disconnecting;
}
virtual void Disconnected([[maybe_unused]] AzFramework::SocketConnection* connection)
void Disconnected([[maybe_unused]] AzFramework::SocketConnection* connection) override
{
m_state = EConnectionState::Disconnected;
}
virtual void AssetCompilationSuccess(const AZStd::string& assetPath) override
void AssetCompilationSuccess(const AZStd::string& assetPath) override
{
m_lastAssetProcessorTask = assetPath;
}
virtual void AssetCompilationFailed(const AZStd::string& assetPath) override
void AssetCompilationFailed(const AZStd::string& assetPath) override
{
m_failedJobs.insert(assetPath);
}
virtual void CountOfAssetsInQueue(const int& count) override
void CountOfAssetsInQueue(const int& count) override
{
m_pendingJobsCount = count;
}
@@ -298,7 +299,7 @@ MainWindow::MainWindow(QWidget* parent)
, m_undoStateAdapter(new UndoStackStateAdapter(this))
, m_keyboardCustomization(nullptr)
, m_activeView(nullptr)
, m_settings("O3DE", "O3DE")
, m_settings("O3DE", "O3DE")
, m_toolbarManager(new ToolbarManager(m_actionManager, this))
, m_assetImporterManager(new AssetImporterManager(this))
, m_levelEditorMenuHandler(new LevelEditorMenuHandler(this, m_viewPaneManager, m_settings))
@@ -573,7 +574,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
if (GetIEditor()->GetDocument())
{
GetIEditor()->GetDocument()->SetModifiedFlag(FALSE);
GetIEditor()->GetDocument()->SetModifiedFlag(false);
GetIEditor()->GetDocument()->SetModifiedModules(eModifiedNothing);
}
// Close all edit panels.
@@ -581,7 +582,7 @@ void MainWindow::closeEvent(QCloseEvent* event)
GetIEditor()->GetObjectManager()->EndEditParams();
// force clean up of all deferred deletes, so that we don't have any issues with windows from plugins not being deleted yet
qApp->sendPostedEvents(0, QEvent::DeferredDelete);
qApp->sendPostedEvents(nullptr, QEvent::DeferredDelete);
QMainWindow::closeEvent(event);
}
@@ -731,32 +732,84 @@ void MainWindow::InitActions()
.SetStatusTip(tr("Restore saved state (Fetch)"));
// Modify actions
am->AddAction(ID_EDITMODE_MOVE, tr("Move"))
am->AddAction(AzToolsFramework::EditModeMove, tr("Move"))
.SetIcon(Style::icon("Move"))
.SetApplyHoverEffect()
.SetShortcut(tr("1"))
.SetToolTip(tr("Move (1)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and move selected object(s)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeMove);
am->AddAction(ID_EDITMODE_ROTATE, tr("Rotate"))
.RegisterUpdateCallback([](QAction* action)
{
Q_ASSERT(action->isCheckable());
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Translation);
})
.Connect(
&QAction::triggered,
[]()
{
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Translation);
});
am->AddAction(AzToolsFramework::EditModeRotate, tr("Rotate"))
.SetIcon(Style::icon("Translate"))
.SetApplyHoverEffect()
.SetShortcut(tr("2"))
.SetToolTip(tr("Rotate (2)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and rotate selected object(s)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeRotate);
am->AddAction(ID_EDITMODE_SCALE, tr("Scale"))
.RegisterUpdateCallback([](QAction* action)
{
Q_ASSERT(action->isCheckable());
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Rotation);
})
.Connect(
&QAction::triggered,
[]()
{
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Rotation);
});
am->AddAction(AzToolsFramework::EditModeScale, tr("Scale"))
.SetIcon(Style::icon("Scale"))
.SetApplyHoverEffect()
.SetShortcut(tr("3"))
.SetToolTip(tr("Scale (3)"))
.SetCheckable(true)
.SetStatusTip(tr("Select and scale selected object(s)"))
.RegisterUpdateCallback(cryEdit, &CCryEditApp::OnUpdateEditmodeScale);
.RegisterUpdateCallback([](QAction* action)
{
Q_ASSERT(action->isCheckable());
am->AddAction(ID_SNAP_TO_GRID, tr("Snap to grid"))
AzToolsFramework::EditorTransformComponentSelectionRequests::Mode mode;
AzToolsFramework::EditorTransformComponentSelectionRequestBus::EventResult(
mode, AzToolsFramework::GetEntityContextId(),
&AzToolsFramework::EditorTransformComponentSelectionRequests::GetTransformMode);
action->setChecked(mode == AzToolsFramework::EditorTransformComponentSelectionRequests::Mode::Scale);
})
.Connect( &QAction::triggered,[]()
{
EditorTransformComponentSelectionRequestBus::Event(
GetEntityContextId(), &EditorTransformComponentSelectionRequests::SetTransformMode,
EditorTransformComponentSelectionRequests::Mode::Scale);
});
am->AddAction(AzToolsFramework::SnapToGrid, tr("Snap to grid"))
.SetIcon(Style::icon("Grid"))
.SetApplyHoverEffect()
.SetShortcut(tr("G"))
@@ -769,7 +822,7 @@ void MainWindow::InitActions()
})
.Connect(&QAction::triggered, []() { SandboxEditor::SetGridSnapping(!SandboxEditor::GridSnappingEnabled()); });
am->AddAction(ID_SNAPANGLE, tr("Snap angle"))
am->AddAction(AzToolsFramework::SnapAngle, tr("Snap angle"))
.SetIcon(Style::icon("Angle"))
.SetApplyHoverEffect()
.SetStatusTip(tr("Snap angle"))
@@ -1243,7 +1296,7 @@ void MainWindow::OnEditorNotifyEvent(EEditorNotifyEvent ev)
auto cryEdit = CCryEditApp::instance();
if (cryEdit)
{
cryEdit->SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
cryEdit->SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), GetIEditor()->GetGameEngine()->GetLevelName());
}
}
break;
@@ -1252,7 +1305,7 @@ void MainWindow::OnEditorNotifyEvent(EEditorNotifyEvent ev)
auto cryEdit = CCryEditApp::instance();
if (cryEdit)
{
cryEdit->SetEditorWindowTitle(0, AZ::Utils::GetProjectName().c_str(), 0);
cryEdit->SetEditorWindowTitle(nullptr, AZ::Utils::GetProjectName().c_str(), nullptr);
}
}
break;
@@ -1351,8 +1404,8 @@ void MainWindow::ResetAutoSaveTimers(bool bForceInit)
{
delete m_autoRemindTimer;
}
m_autoSaveTimer = 0;
m_autoRemindTimer = 0;
m_autoSaveTimer = nullptr;
m_autoRemindTimer = nullptr;
if (bForceInit)
{
@@ -1389,7 +1442,7 @@ void MainWindow::ResetBackgroundUpdateTimer()
if (m_backgroundUpdateTimer)
{
delete m_backgroundUpdateTimer;
m_backgroundUpdateTimer = 0;
m_backgroundUpdateTimer = nullptr;
}
ICVar* pBackgroundUpdatePeriod = gEnv->pConsole->GetCVar("ed_backgroundUpdatePeriod");
@@ -1435,7 +1488,7 @@ void MainWindow::OnRefreshAudioSystem()
if (QString::compare(sLevelName, "Untitled", Qt::CaseInsensitive) == 0)
{
// Rather pass NULL to indicate that no level is loaded!
// Rather pass nullptr to indicate that no level is loaded!
sLevelName = QString();
}
@@ -1868,7 +1921,7 @@ QWidget* MainWindow::CreateToolbarWidget(int actionId)
break;
case ID_TOOLBAR_WIDGET_SPACER_RIGHT:
w = CreateSpacerRightWidget();
break;
break;
default:
qWarning() << Q_FUNC_INFO << "Unknown id " << actionId;
return nullptr;
+10 -4
View File
@@ -59,11 +59,17 @@ namespace AzQtComponents
namespace AzToolsFramework
{
class Ticker;
}
namespace AzToolsFramework
{
class QtSourceControlNotificationHandler;
//! @name Reverse URLs.
//! Used to identify common actions and override them when necessary.
//@{
constexpr inline AZ::Crc32 EditModeMove = AZ_CRC_CE("com.o3de.action.editor.editmode.move");
constexpr inline AZ::Crc32 EditModeRotate = AZ_CRC_CE("com.o3de.action.editor.editmode.rotate");
constexpr inline AZ::Crc32 EditModeScale = AZ_CRC_CE("com.o3de.action.editor.editmode.scale");
constexpr inline AZ::Crc32 SnapToGrid = AZ_CRC_CE("com.o3de.action.editor.snaptogrid");
constexpr inline AZ::Crc32 SnapAngle = AZ_CRC_CE("com.o3de.action.editor.snapangle");
//@}
}
#define MAINFRM_LAYOUT_NORMAL "NormalLayout"
+4 -4
View File
@@ -19,7 +19,7 @@
#include <QToolButton>
// Editor
#include "NewTerrainDialog.h"
#include "NewTerrainDialog.h"
AZ_PUSH_DISABLE_DLL_EXPORT_MEMBER_WARNING
#include <ui_NewLevelDialog.h>
@@ -54,7 +54,7 @@ private:
// CNewLevelDialog dialog
CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/)
CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_bUpdate(false)
, ui(new Ui::CNewLevelDialog)
@@ -69,7 +69,7 @@ CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/)
m_bIsResize = false;
ui->TITLE->setText(tr("Assign a name and location to the new level."));
ui->STATIC1->setText(tr("Location:"));
ui->STATIC2->setText(tr("Name:"));
@@ -98,7 +98,7 @@ CNewLevelDialog::CNewLevelDialog(QWidget* pParent /*=NULL*/)
m_levelFolders = GetLevelsFolder();
m_level = "";
// First of all, keyboard focus is related to widget tab order, and the default tab order is based on the order in which
// First of all, keyboard focus is related to widget tab order, and the default tab order is based on the order in which
// widgets are constructed. Therefore, creating more widgets changes the keyboard focus. That is why setFocus() is called last.
// Secondly, using singleShot() allows setFocus() slot of the QLineEdit instance to be invoked right after the event system
// is ready to do so. Therefore, it is better to use singleShot() than directly call setFocus().
+1 -1
View File
@@ -19,7 +19,7 @@ AZ_POP_DISABLE_WARNING
CNewTerrainDialog::CNewTerrainDialog(QWidget* pParent /*=NULL*/)
CNewTerrainDialog::CNewTerrainDialog(QWidget* pParent /*=nullptr*/)
: QDialog(pParent)
, m_terrainResolutionIndex(0)
, m_terrainUnitsIndex(0)
+30 -30
View File
@@ -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);
}
//////////////////////////////////////////////////////////////////////////
+8 -8
View File
@@ -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);
+5 -5
View File
@@ -74,12 +74,12 @@ void DisplayContext::DrawTri(const Vec3& p1, const Vec3& p2, const Vec3& p3)
void DisplayContext::DrawTriangles(const AZStd::vector<Vec3>& vertices, const ColorB& color)
{
pRenderAuxGeom->DrawTriangles(vertices.begin(), vertices.size(), color);
pRenderAuxGeom->DrawTriangles(vertices.begin(), static_cast<uint32>(vertices.size()), color);
}
void DisplayContext::DrawTrianglesIndexed(const AZStd::vector<Vec3>& vertices, const AZStd::vector<vtx_idx>& indices, const ColorB& color)
{
pRenderAuxGeom->DrawTriangles(vertices.begin(), vertices.size(), indices.begin(), indices.size(), color);
pRenderAuxGeom->DrawTriangles(vertices.begin(), static_cast<uint32>(vertices.size()), indices.begin(), static_cast<uint32_t>(indices.size()), color);
}
//////////////////////////////////////////////////////////////////////////
@@ -862,7 +862,7 @@ void DisplayContext::DrawLine(const Vec3& p1, const Vec3& p2, const QColor& rgb1
//////////////////////////////////////////////////////////////////////////
void DisplayContext::DrawLines(const AZStd::vector<Vec3>& points, const ColorF& color)
{
pRenderAuxGeom->DrawLines(points.begin(), points.size(), color, m_thickness);
pRenderAuxGeom->DrawLines(points.begin(), static_cast<uint32>(points.size()), color, m_thickness);
}
//////////////////////////////////////////////////////////////////////////
@@ -1287,8 +1287,8 @@ void DisplayContext::Flush2D()
uvs[3] = 0;
uvt[3] = 0;
int nLabels = m_textureLabels.size();
for (int i = 0; i < nLabels; i++)
const size_t nLabels = m_textureLabels.size();
for (size_t i = 0; i < nLabels; i++)
{
STextureLabel& t = m_textureLabels[i];
float w2 = t.w * 0.5f;
+25 -25
View File
@@ -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);

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