From 1ba99110366b2f07da1507281d334a17f018d712 Mon Sep 17 00:00:00 2001 From: maelstrom Date: Thu, 24 Apr 2025 00:58:36 +0200 Subject: [PATCH] refactor(editor): turned main view into its own document --- core/src/objects/meta.cpp | 2 + core/src/objects/script.cpp | 19 +++++ core/src/objects/script.h | 16 ++++ editor/CMakeLists.txt | 2 + editor/mainglwidget.cpp | 1 + editor/mainglwidget.h | 2 +- editor/mainwindow.cpp | 137 +++++++--------------------------- editor/mainwindow.h | 4 +- editor/mainwindow.ui | 20 +++-- editor/panes/explorerview.cpp | 1 + editor/placedocument.cpp | 116 ++++++++++++++++++++++++++++ editor/placedocument.h | 29 +++++++ 12 files changed, 232 insertions(+), 117 deletions(-) create mode 100644 core/src/objects/script.cpp create mode 100644 core/src/objects/script.h create mode 100644 editor/placedocument.cpp create mode 100644 editor/placedocument.h diff --git a/core/src/objects/meta.cpp b/core/src/objects/meta.cpp index 2a170b5..a74fd78 100644 --- a/core/src/objects/meta.cpp +++ b/core/src/objects/meta.cpp @@ -3,6 +3,7 @@ #include "objects/jointsservice.h" #include "objects/part.h" #include "objects/joint/snap.h" +#include "objects/script.h" #include "objects/workspace.h" std::map INSTANCE_MAP = { @@ -13,4 +14,5 @@ std::map INSTANCE_MAP = { { "Snap", &Snap::TYPE }, { "JointInstance", &JointInstance::TYPE }, { "JointsService", &JointsService::TYPE }, + { "Script", &Script::TYPE }, }; \ No newline at end of file diff --git a/core/src/objects/script.cpp b/core/src/objects/script.cpp new file mode 100644 index 0000000..9fe121f --- /dev/null +++ b/core/src/objects/script.cpp @@ -0,0 +1,19 @@ +#include "script.h" +#include "objects/base/instance.h" + +const InstanceType Script::TYPE = { + .super = &Instance::TYPE, + .className = "Script", + .constructor = &Script::Create, + .explorerIcon = "script", +}; + +const InstanceType* Script::GetClass() { + return &TYPE; +} + +Script::Script(): Instance(&TYPE) { +} + +Script::~Script() { +} \ No newline at end of file diff --git a/core/src/objects/script.h b/core/src/objects/script.h new file mode 100644 index 0000000..e1c982a --- /dev/null +++ b/core/src/objects/script.h @@ -0,0 +1,16 @@ +#pragma once + +#include "objects/base/instance.h" +#include + +class Script : public Instance { +public: + const static InstanceType TYPE; + + Script(); + ~Script(); + + static inline std::shared_ptr