Skip to content

Commit 2d6bf1f

Browse files
authored
Feat/physics inspector (#437)
2 parents 7632fe6 + 94b9284 commit 2d6bf1f

401 files changed

Lines changed: 23683 additions & 18410 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ jobs:
113113
libxcb-icccm4-dev libxcb-keysyms1-dev libxcb-dri2-0-dev libxcb-dri3-dev
114114
libxcb-glx0-dev libx11-xcb-dev libglu1-mesa-dev
115115
libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
116-
libegl1-mesa-dev mono-complete
117-
version: 1.0
116+
libegl1-mesa-dev mono-complete libxtst-dev libltdl-dev
117+
version: 1.1
118118
execute_install_scripts: true
119119

120120
- name: Install .NET SDK 9.0

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ jobs:
6666
libxcb-icccm4-dev libxcb-keysyms1-dev libxcb-dri2-0-dev libxcb-dri3-dev
6767
libxcb-glx0-dev libx11-xcb-dev libglu1-mesa-dev
6868
libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
69-
libegl1-mesa-dev mono-complete
70-
version: 1.0
69+
libegl1-mesa-dev mono-complete libxtst-dev libltdl-dev
70+
version: 1.1
7171
execute_install_scripts: true
7272

7373
- name: Install .NET SDK 9.0

common/Logger.hpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,16 @@ namespace nexo {
5454

5555
inline std::string toString(const LogLevel level)
5656
{
57+
using enum LogLevel;
5758
switch (level)
5859
{
59-
case LogLevel::FATAL: return "FATAL";
60-
case LogLevel::ERR: return "ERROR";
61-
case LogLevel::WARN: return "WARN";
62-
case LogLevel::INFO: return "INFO";
63-
case LogLevel::USER: return "USER";
64-
case LogLevel::DEBUG: return "DEBUG";
65-
case LogLevel::DEV: return "DEV";
60+
case FATAL: return "FATAL";
61+
case ERR: return "ERROR";
62+
case WARN: return "WARN";
63+
case INFO: return "INFO";
64+
case USER: return "USER";
65+
case DEBUG: return "DEBUG";
66+
case DEV: return "DEV";
6667
}
6768
return "UNKNOWN";
6869
}

editor/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ set(SRCS
4848
editor/src/DocumentWindows/EditorScene/Shortcuts.cpp
4949
editor/src/DocumentWindows/EditorScene/Show.cpp
5050
editor/src/DocumentWindows/EditorScene/Shutdown.cpp
51+
editor/src/DocumentWindows/EditorScene/Timecode.cpp
5152
editor/src/DocumentWindows/EditorScene/Toolbar.cpp
5253
editor/src/DocumentWindows/EditorScene/Update.cpp
5354
editor/src/DocumentWindows/EditorScene/DragDrop.cpp

editor/main.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,51 +16,51 @@
1616
//
1717
///////////////////////////////////////////////////////////////////////////////
1818

19-
#include "src/Editor.hpp"
19+
#include "src/DocumentWindows/AssetManager/AssetManagerWindow.hpp"
2020
#include "src/DocumentWindows/ConsoleWindow/ConsoleWindow.hpp"
2121
#include "src/DocumentWindows/EditorScene/EditorScene.hpp"
22-
#include "src/DocumentWindows/SceneTreeWindow/SceneTreeWindow.hpp"
2322
#include "src/DocumentWindows/InspectorWindow/InspectorWindow.hpp"
24-
#include "src/DocumentWindows/AssetManager/AssetManagerWindow.hpp"
2523
#include "src/DocumentWindows/MaterialInspector/MaterialInspector.hpp"
2624
#include "src/DocumentWindows/PrimitiveWindow/PrimitiveWindow.hpp"
27-
#include "src/DocumentWindows/GameWindow/GameWindow.hpp"
25+
#include "src/DocumentWindows/SceneTreeWindow/SceneTreeWindow.hpp"
26+
#include "src/Editor.hpp"
2827

29-
#include <thread>
30-
#include <loguru.hpp>
3128
#include <core/exceptions/Exceptions.hpp>
29+
#include <loguru.hpp>
30+
#include <thread>
3231

3332
#include "scripting/native/ManagedTypedef.hpp"
3433
#include "scripting/native/Scripting.hpp"
3534

3635
int main(int argc, char **argv)
3736
try {
3837
loguru::init(argc, argv);
39-
loguru::g_stderr_verbosity = loguru::Verbosity_3;
38+
loguru::g_stderr_verbosity = loguru::Verbosity_3;
4039
nexo::editor::Editor &editor = nexo::editor::Editor::getInstance();
4140

4241
editor.registerWindow<nexo::editor::EditorScene>(
43-
std::format("Default Scene{}{}", NEXO_WND_USTRID_DEFAULT_SCENE, 0)
44-
);
42+
std::format("Default Scene{}{}", NEXO_WND_USTRID_DEFAULT_SCENE, 0));
4543
editor.registerWindow<nexo::editor::SceneTreeWindow>(NEXO_WND_USTRID_SCENE_TREE);
4644
editor.registerWindow<nexo::editor::InspectorWindow>(NEXO_WND_USTRID_INSPECTOR);
4745
editor.registerWindow<nexo::editor::ConsoleWindow>(NEXO_WND_USTRID_CONSOLE);
4846
editor.registerWindow<nexo::editor::MaterialInspector>(NEXO_WND_USTRID_MATERIAL_INSPECTOR);
4947
editor.registerWindow<nexo::editor::PrimitiveWindow>(NEXO_WND_USTRID_PRIMITIVE_WINDOW);
5048
editor.registerWindow<nexo::editor::AssetManagerWindow>(NEXO_WND_USTRID_ASSET_MANAGER);
5149

52-
if (const auto defaultScene = editor.getWindow<nexo::editor::EditorScene>(std::format("Default Scene{}{}", NEXO_WND_USTRID_DEFAULT_SCENE, 0)).lock())
50+
if (const auto defaultScene = editor
51+
.getWindow<nexo::editor::EditorScene>(
52+
std::format("Default Scene{}{}", NEXO_WND_USTRID_DEFAULT_SCENE, 0))
53+
.lock())
5354
defaultScene->setDefault();
5455

5556
editor.init();
5657

57-
while (editor.isOpen())
58-
{
58+
while (editor.isOpen()) {
5959
auto start = std::chrono::high_resolution_clock::now();
6060
editor.render();
6161
editor.update();
6262

63-
auto end = std::chrono::high_resolution_clock::now();
63+
auto end = std::chrono::high_resolution_clock::now();
6464
std::chrono::duration<double, std::milli> elapsed = end - start;
6565

6666
std::this_thread::sleep_for(std::chrono::milliseconds(16) - elapsed);

editor/src/ADocumentWindow.cpp

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,51 +21,48 @@
2121

2222
namespace nexo::editor {
2323

24-
void ADocumentWindow::beginRender(const std::string &windowName)
24+
void ADocumentWindow::beginRender(const std::string& windowName)
2525
{
2626
dockingUpdate(windowName);
2727
visibilityUpdate();
2828
sizeUpdate();
2929
}
3030

31-
void ADocumentWindow::dockingUpdate(const std::string &windowName)
31+
void ADocumentWindow::dockingUpdate(const std::string& windowName)
3232
{
33-
if (const ImGuiWindow* currentWindow = ImGui::GetCurrentWindow(); currentWindow)
34-
{
35-
const bool isDocked = currentWindow->DockIsActive;
33+
if (const ImGuiWindow* currentWindow = ImGui::GetCurrentWindow(); currentWindow) {
34+
const bool isDocked = currentWindow->DockIsActive;
3635
const ImGuiID currentDockID = currentWindow->DockId;
37-
const auto dockId = m_windowRegistry.getDockId(windowName);
36+
const auto dockId = m_windowRegistry.getDockId(windowName);
3837

39-
// If it's the first time opening the window and we have a dock id saved in the registry, then we force set it
38+
// If it's the first time opening the window and we have a dock id saved in the registry, then we force set
39+
// it
4040
if (m_firstOpened && (dockId && currentDockID != *dockId))
4141
ImGui::DockBuilderDockWindow(windowName.c_str(), *dockId);
4242
// If the docks ids differ, it means the window got rearranged in the global layout
43-
// If we are docked but we dont have a dock id saved in the registry, it means the user moved the window
43+
// If we are docked, but we don't have a dock id saved in the registry, it means the user moved the window
4444
// In both cases, we update our docking registry with the new dock id
4545
else if ((dockId && currentDockID != *dockId) || (isDocked && !dockId))
4646
m_windowRegistry.setDockId(windowName, currentDockID);
4747

48-
4948
// If it is not docked anymore, we have a floating window without docking node,
5049
// So we erase it from the docking registry
51-
if (!m_firstOpened && !isDocked)
52-
m_windowRegistry.resetDockId(windowName);
50+
if (!m_firstOpened && !isDocked) m_windowRegistry.resetDockId(windowName);
5351
m_firstOpened = false;
5452
}
5553
}
5654

5755
void ADocumentWindow::visibilityUpdate()
5856
{
59-
m_focused = ImGui::IsWindowFocused();
60-
const bool isDocked = ImGui::IsWindowDocked();
57+
m_focused = ImGui::IsWindowFocused();
58+
const bool isDocked = ImGui::IsWindowDocked();
6159
const ImGuiWindow* window = ImGui::GetCurrentWindow();
6260

6361
if (isDocked) {
6462
// If the window is currently being rendered with normal content,
6563
// and not hidden or set to skip items, then it is visible
6664
m_isVisibleInDock = !window->Hidden && !window->SkipItems && window->Active;
67-
}
68-
else {
65+
} else {
6966
// Not docked windows are visible if we've reached this point
7067
m_isVisibleInDock = true;
7168
}
@@ -75,10 +72,10 @@ namespace nexo::editor {
7572
void ADocumentWindow::sizeUpdate()
7673
{
7774
const ImGuiWindow* window = ImGui::GetCurrentWindow();
78-
m_windowPos = window->Pos;
79-
m_windowSize = window->Size;
80-
m_contentSizeMin = ImGui::GetWindowContentRegionMin();
81-
m_contentSizeMax = ImGui::GetWindowContentRegionMax();
82-
m_contentSize = ImGui::GetContentRegionAvail();
75+
m_windowPos = window->Pos;
76+
m_windowSize = window->Size;
77+
m_contentSizeMin = ImGui::GetWindowContentRegionMin();
78+
m_contentSizeMax = ImGui::GetWindowContentRegionMax();
79+
m_contentSize = ImGui::GetContentRegionAvail();
8380
}
84-
}
81+
} // namespace nexo::editor

0 commit comments

Comments
 (0)