Skip to content

Commit 749cc65

Browse files
committed
refactor: organize application sources by ownership
1 parent 2e87524 commit 749cc65

26 files changed

Lines changed: 995 additions & 915 deletions

NEXT.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ session activated `.github/workflows/ci.yml` and added a root editor build
1111
and test job alongside the standalone component matrix. See `plan.md` for
1212
full evidence; older session history remains below and in `docs/history/`._
1313

14+
_Source-layout note (2026-07-25): the editor application implementation is
15+
now at `src/MeshCraft/Application/` and `src/MeshCraft/Application/UI/`,
16+
replacing the former flat `src/MeshCraft/MeshCraftApplication_*.cpp` layout.
17+
Historical references below intentionally retain their then-current paths._
18+
1419
## 1. Project summary
1520

1621
**MeshCraft** is a desktop 3D scene editor (C++23, built on the CNA game

include/MeshCraft/Application/MeshCraftApplication.hpp

Lines changed: 833 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#pragma once
2+
3+
#include <MeshCraft/Mc3/Mc3Validation.hpp>
4+
5+
#include <string>
6+
7+
namespace MeshCraft::Application::UI {
8+
9+
struct ValidationContext {
10+
bool& visible;
11+
const std::string& source;
12+
const Mc3::Mc3Validation& validation;
13+
};
14+
15+
class Validation final {
16+
public:
17+
static void draw(ValidationContext& context);
18+
};
19+
20+
} // namespace MeshCraft::Application::UI

include/MeshCraft/MeshCraftApplication.hpp

Lines changed: 4 additions & 823 deletions
Large diffs are not rendered by default.

plan.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,34 @@ _All items in this workstream are DONE — archived to [`docs/history/plan_20260
557557
invalid count clamping. The focused test and both application source files
558558
that integrate it compiled with one job and ccache disabled to limit local
559559
disk writes. **Resolved:** working tree, pending commit.
560+
**Phase 13 IN PROGRESS (2026-07-25) — application ownership/layout:**
561+
began the structural relocation requested for the remaining application
562+
implementation. The concrete class now lives at
563+
`MeshCraft::Application::MeshCraftApplication`; its public header is
564+
`include/MeshCraft/Application/MeshCraftApplication.hpp`, while the old
565+
`MeshCraft/MeshCraftApplication.hpp` remains a forwarding compatibility
566+
include with a `MeshCraft::MeshCraftApplication` alias. Its implementation
567+
moved from the flat `src/MeshCraft/MeshCraftApplication_*.cpp` naming into
568+
`src/MeshCraft/Application/` (lifecycle/input/commands/etc.) and
569+
`src/MeshCraft/Application/UI/` (Ai, LeftPanel, MenuBar, Overlays,
570+
Properties, Registry, Toolbar, Validation). The application sources now
571+
use the owning `MeshCraft::Application` namespace; member methods cannot
572+
legally be placed in the child `Application::UI` namespace until they are
573+
extracted into real UI components with explicit contexts. The first such
574+
component is now `Application::UI::Validation`: it receives only a
575+
`ValidationContext` (visibility, source label, immutable validation result),
576+
while the application retains ownership and mutation of that state. The
577+
historical audit references retain their former paths as time-accurate
578+
evidence.
579+
Static undo-audit and snapshot-lint path checks pass after their tracked
580+
source lists were updated. A serial, ccache-disabled `-fsyntax-only`
581+
compilation of all 17 relocated application sources plus `main.cpp`, using
582+
the existing Debug configuration's flags, also passes without producing
583+
object files. Full link/runtime verification remains intentionally pending:
584+
the local build directories were removed to reduce SSD writes; do not
585+
recreate a large build tree without explicit approval. The next subphase is
586+
another narrow `Application::UI` component extraction using the same
587+
context boundary.
560588
**SYS-W3-01 roadmap status after this session's investigation round:**
561589
Phases 1–12 done (Keybindings, Preferences, MacroRecorder, UndoManager,
562590
animation-override computation, WalkController, AudioPreview,

src/MeshCraft/MeshCraftApplication_Anim.cpp renamed to src/MeshCraft/Application/Animation.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "MeshCraft/MeshCraftApplication.hpp"
1+
#include "MeshCraft/Application/MeshCraftApplication.hpp"
22
#include "MeshCraft/EditorAlgorithms.hpp"
33

44
#include <imgui.h>
@@ -11,7 +11,7 @@
1111
#include <string>
1212
#include <utility>
1313

14-
namespace MeshCraft {
14+
namespace MeshCraft::Application {
1515

1616
using namespace Microsoft::Xna::Framework;
1717

@@ -936,4 +936,4 @@ void MeshCraftApplication::drawTimelinePanel(int screenW, int screenH) {
936936
ImGui::PopStyleVar();
937937
}
938938

939-
} // namespace MeshCraft
939+
} // namespace MeshCraft::Application
Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
#include "MeshCraft/MeshCraftApplication.hpp"
1+
#include "MeshCraft/Application/MeshCraftApplication.hpp"
22
#include "MeshCraft/EditorAlgorithms.hpp"
33
#include "MeshCraft/GraphicsBackendCheck.hpp"
4-
#include "MeshCraftPrivate.hpp"
4+
#include "MeshCraft/MeshCraftPrivate.hpp"
55

66
#include <imgui.h>
77
#include <imgui_impl_sdl3.h>
@@ -38,12 +38,11 @@
3838
#include <iostream>
3939
#include <numbers>
4040
#include <stdexcept>
41-
#include "MeshCraftPrivate.hpp"
4241
#include <stb_image.h>
4342

44-
namespace MeshCraft {
43+
namespace MeshCraft::Application {
4544

46-
GetTypeNameCPP(MeshCraftApplication, "MeshCraft::MeshCraftApplication")
45+
GetTypeNameCPP(MeshCraftApplication, "MeshCraft::Application::MeshCraftApplication")
4746

4847
using namespace Microsoft::Xna::Framework;
4948
using namespace Microsoft::Xna::Framework::Input;
@@ -1174,9 +1173,9 @@ void main() {
11741173
}
11751174
)";
11761175

1177-
} // anonymous namespace
1176+
} // namespace MeshCraft::Application
11781177

1179-
namespace MeshCraft {
1178+
namespace MeshCraft::Application {
11801179

11811180
void MeshCraftApplication::initBloom(int w, int h)
11821181
{
@@ -1508,4 +1507,4 @@ void MeshCraftApplication::renderMatPreview(float r, float g, float b,
15081507
matPreviewTextureToken_ = imguiRenderer_->registerTexture(*matPreviewRt_);
15091508
}
15101509

1511-
} // namespace MeshCraft
1510+
} // namespace MeshCraft::Application

src/MeshCraft/MeshCraftApplication_Benchmark.cpp renamed to src/MeshCraft/Application/Benchmark.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
// hook inside SceneRenderer's mesh/texture loaders); left as a smaller
2222
// follow-up rather than claiming a false precision this pass doesn't have.
2323

24-
#include "MeshCraft/MeshCraftApplication.hpp"
24+
#include "MeshCraft/Application/MeshCraftApplication.hpp"
2525

2626
#include <chrono>
2727
#include <functional>
2828
#include <iostream>
2929
#include <numeric>
3030

31-
namespace MeshCraft {
31+
namespace MeshCraft::Application {
3232

3333
namespace {
3434
template <typename Fn>
@@ -119,4 +119,4 @@ void MeshCraftApplication::runBenchmarkSuite() {
119119
}
120120
}
121121

122-
} // namespace MeshCraft
122+
} // namespace MeshCraft::Application

src/MeshCraft/MeshCraftApplication_Commands.cpp renamed to src/MeshCraft/Application/Commands.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "MeshCraft/MeshCraftApplication.hpp"
2-
#include "MeshCraftPrivate.hpp"
1+
#include "MeshCraft/Application/MeshCraftApplication.hpp"
2+
#include "MeshCraft/MeshCraftPrivate.hpp"
33
#include "MeshCraft/EditorAlgorithms.hpp"
44

55
#include <imgui.h>
@@ -32,7 +32,7 @@
3232
#include <random>
3333
#include <string>
3434

35-
namespace MeshCraft {
35+
namespace MeshCraft::Application {
3636

3737
using namespace Microsoft::Xna::Framework;
3838
using namespace Microsoft::Xna::Framework::Input;
@@ -881,4 +881,4 @@ void MeshCraftApplication::resetPivot() {
881881
setStatusMsg("Pivot reset to origin", false, 1.5f);
882882
}
883883

884-
} // namespace MeshCraft
884+
} // namespace MeshCraft::Application

src/MeshCraft/MeshCraftApplication_FileOps.cpp renamed to src/MeshCraft/Application/FileOps.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "MeshCraft/MeshCraftApplication.hpp"
2-
#include "MeshCraftPrivate.hpp"
1+
#include "MeshCraft/Application/MeshCraftApplication.hpp"
2+
#include "MeshCraft/MeshCraftPrivate.hpp"
33
#include "MeshCraft/EditorAlgorithms.hpp"
44
#include "MeshCraft/Mc3/Mc3ImportResolver.hpp"
55
#include "MeshCraft/Mcb/McbReader.hpp"
@@ -31,7 +31,7 @@
3131
#include <string>
3232
#include <vector>
3333

34-
namespace MeshCraft {
34+
namespace MeshCraft::Application {
3535

3636
void MeshCraftApplication::newScene() {
3737
document_ = Mc3::Mc3Document{};
@@ -810,4 +810,4 @@ void MeshCraftApplication::savePrefs() {
810810
savePrefsAlg(path, p);
811811
}
812812

813-
} // namespace MeshCraft
813+
} // namespace MeshCraft::Application

0 commit comments

Comments
 (0)