From d6dc1f99985081d46130d0600736964c5624f988 Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Sun, 3 Dec 2023 14:09:23 +0100 Subject: [PATCH] Various minor tweaks --- Source/Engine/ContentImporters/CreateJson.cpp | 2 +- Source/Engine/Level/SceneInfo.cpp | 23 ------------------- Source/Engine/Threading/MainThreadTask.h | 4 ++-- Source/Engine/Threading/Task.cpp | 10 ++++---- Source/Engine/Threading/Task.h | 8 +++---- Source/Engine/Threading/ThreadPoolTask.h | 4 ++-- 6 files changed, 14 insertions(+), 37 deletions(-) diff --git a/Source/Engine/ContentImporters/CreateJson.cpp b/Source/Engine/ContentImporters/CreateJson.cpp index 3ca21601c..96a10ab27 100644 --- a/Source/Engine/ContentImporters/CreateJson.cpp +++ b/Source/Engine/ContentImporters/CreateJson.cpp @@ -53,7 +53,7 @@ bool CreateJson::Create(const StringView& path, const StringAnsiView& data, cons { if (FileSystem::CreateDirectory(directory)) { - LOG(Warning, "Failed to create directory"); + LOG(Warning, "Failed to create directory '{}'", directory); return true; } } diff --git a/Source/Engine/Level/SceneInfo.cpp b/Source/Engine/Level/SceneInfo.cpp index 65e4aa462..9c504bad7 100644 --- a/Source/Engine/Level/SceneInfo.cpp +++ b/Source/Engine/Level/SceneInfo.cpp @@ -11,29 +11,6 @@ String SceneInfo::ToString() const return TEXT("SceneInfo"); } -const int32 lightmapAtlasSizes[] = -{ - 32, - 64, - 128, - 256, - 512, - 1024, - 2048, - 4096 -}; -DECLARE_ENUM_8(LightmapAtlasSize, _32, _64, _128, _256, _512, _1024, _2048, _4096); - -LightmapAtlasSize getLightmapAtlasSize(int32 size) -{ - for (int32 i = 0; i < LightmapAtlasSize_Count; i++) - { - if (lightmapAtlasSizes[i] == size) - return (LightmapAtlasSize)i; - } - return LightmapAtlasSize::_1024; -} - void SceneInfo::Serialize(SerializeStream& stream, const void* otherObj) { SERIALIZE_GET_OTHER_OBJ(SceneInfo); diff --git a/Source/Engine/Threading/MainThreadTask.h b/Source/Engine/Threading/MainThreadTask.h index 36e66bfb0..fc5b9fe2d 100644 --- a/Source/Engine/Threading/MainThreadTask.h +++ b/Source/Engine/Threading/MainThreadTask.h @@ -66,7 +66,7 @@ public: /// /// The action. /// The target object. - MainThreadActionTask(Function& action, Object* target = nullptr) + MainThreadActionTask(const Function& action, Object* target = nullptr) : MainThreadTask() , _action1(action) , _target(target) @@ -90,7 +90,7 @@ public: /// /// The action. /// The target object. - MainThreadActionTask(Function& action, Object* target = nullptr) + MainThreadActionTask(const Function& action, Object* target = nullptr) : MainThreadTask() , _action2(action) , _target(target) diff --git a/Source/Engine/Threading/Task.cpp b/Source/Engine/Threading/Task.cpp index a516c31c7..84737a71b 100644 --- a/Source/Engine/Threading/Task.cpp +++ b/Source/Engine/Threading/Task.cpp @@ -96,13 +96,13 @@ Task* Task::ContinueWith(const Action& action, Object* target) return result; } -Task* Task::ContinueWith(Function action, Object* target) +Task* Task::ContinueWith(const Function& action, Object* target) { ASSERT(action.IsBinded()); return ContinueWith(New(action, target)); } -Task* Task::ContinueWith(Function action, Object* target) +Task* Task::ContinueWith(const Function& action, Object* target) { ASSERT(action.IsBinded()); return ContinueWith(New(action, target)); @@ -116,17 +116,17 @@ Task* Task::StartNew(Task* task) return task; } -Task* Task::StartNew(Function& action, Object* target) +Task* Task::StartNew(const Function& action, Object* target) { return StartNew(New(action, target)); } -Task* Task::StartNew(Function::Signature action, Object* target) +Task* Task::StartNew(const Function::Signature action, Object* target) { return StartNew(New(action, target)); } -Task* Task::StartNew(Function& action, Object* target) +Task* Task::StartNew(const Function& action, Object* target) { return StartNew(New(action, target)); } diff --git a/Source/Engine/Threading/Task.h b/Source/Engine/Threading/Task.h index 4a17de727..12b131d1b 100644 --- a/Source/Engine/Threading/Task.h +++ b/Source/Engine/Threading/Task.h @@ -221,7 +221,7 @@ public: /// Action to run. /// The action target object. /// Enqueued task. - Task* ContinueWith(Function action, Object* target = nullptr); + Task* ContinueWith(const Function& action, Object* target = nullptr); /// /// Continues that task execution with a given action (will spawn new async action). @@ -229,7 +229,7 @@ public: /// Action to run. /// The action target object. /// Enqueued task. - Task* ContinueWith(Function action, Object* target = nullptr); + Task* ContinueWith(const Function& action, Object* target = nullptr); public: @@ -246,7 +246,7 @@ public: /// The action. /// The action target object. /// Task - static Task* StartNew(Function& action, Object* target = nullptr); + static Task* StartNew(const Function& action, Object* target = nullptr); /// /// Starts the new task. @@ -275,7 +275,7 @@ public: /// The action. /// The action target object. /// Task - static Task* StartNew(Function& action, Object* target = nullptr); + static Task* StartNew(const Function& action, Object* target = nullptr); /// /// Starts the new task. diff --git a/Source/Engine/Threading/ThreadPoolTask.h b/Source/Engine/Threading/ThreadPoolTask.h index 9e1cc6fac..6378f3ee4 100644 --- a/Source/Engine/Threading/ThreadPoolTask.h +++ b/Source/Engine/Threading/ThreadPoolTask.h @@ -55,7 +55,7 @@ public: /// /// The action. /// The target object. - ThreadPoolActionTask(Function& action, Object* target = nullptr) + ThreadPoolActionTask(const Function& action, Object* target = nullptr) : ThreadPoolTask() , _action1(action) , _target(target) @@ -79,7 +79,7 @@ public: /// /// The action. /// The target object. - ThreadPoolActionTask(Function& action, Object* target = nullptr) + ThreadPoolActionTask(const Function& action, Object* target = nullptr) : ThreadPoolTask() , _action2(action) , _target(target)