Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Keep the UI clear of laptop camera notches; add a fullscreen toggle

islandmed0733dfe83b08
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9a1cd569..73d7e866 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,11 @@ All notable changes to SculptForge are listed here. The format follows
## [Unreleased]
### A ZBrush-style interface
+- Laptop camera notches: when SculptForge fills the screen, the interface stays below the camera notch of
+ MacBooks (macOS reports the safe area; on Linux a notched MacBook display is recognised), with a plain band
+ beside the notch. Preferences > Interface > Camera notch: Automatic / Always reserve / Off.
+- Fullscreen toggle (F11, Render palette; `--fullscreen` on the command line), and minimise / close buttons at
+ the far right of the title strip (close asks to save changes; Ctrl+Q quits).
- The canvas is framed by shelves, as in ZBrush: a top shelf (LightBox, Sculpt/Paint, Zadd/Zsub, Draw Size,
Strength, symmetry, pressure), a left shelf of Brush / Stroke / Alpha / Material pickers with the colour picker,
a right shelf of navigation (drag Move / Zoom / Rotate) and display toggles, and a bottom shelf of your most-used
diff --git a/src/app/App.cpp b/src/app/App.cpp
index 74be3332..945303f9 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -92,7 +92,8 @@ bool App::init(const AppOptions& options) {
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 4);
const SDL_WindowFlags flags = SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIGH_PIXEL_DENSITY |
- (headless ? SDL_WINDOW_HIDDEN : 0);
+ (headless ? SDL_WINDOW_HIDDEN : 0) |
+ (options.fullscreen && !headless ? SDL_WINDOW_FULLSCREEN : 0);
const int winW = recording ? options.width : 1600, winH = recording ? options.height : 960;
window_ = SDL_CreateWindow("SculptForge", winW, winH, flags);
if (!window_) {
diff --git a/src/app/App.h b/src/app/App.h
index f7be229e..ba5fa724 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -54,6 +54,7 @@ struct AppOptions {
int fps = 30;
std::string uiTest; // run this .sfui UI test script headless and exit (see UiTest.cpp)
std::string uiOutDir; // where UI tests save screenshots
+ bool fullscreen = false; // start fullscreen (F11 toggles)
};
class Demo;
@@ -432,6 +433,7 @@ private:
std::unique_ptr<struct BrushGalleryState, void (*)(struct BrushGalleryState*)> gallery_{nullptr, &destroyBrushGallery};
// ---- Shell (A): layout, shelves, palettes, trays, theme ----
+ float topInset() const; // window px kept clear at the top (camera notch)
float fpsShown_ = -1.0f; // title-strip frame rate, refreshed twice a second
double fpsShownAt_ = 0.0;
public:
diff --git a/src/app/Config.cpp b/src/app/Config.cpp
index c3ac8ac9..60069eb8 100644
--- a/src/app/Config.cpp
+++ b/src/app/Config.cpp
@@ -42,6 +42,7 @@ Json toJson(const UiPrefs& p) {
j.set("uiScale", double(p.uiScale));
j.set("lightboxAtStartup", p.lightboxAtStartup);
j.set("libraryFolder", p.libraryFolder);
+ j.set("cameraNotch", double(p.cameraNotch));
return j;
}
@@ -56,6 +57,7 @@ void fromJson(const Json& j, UiPrefs& p) {
p.uiScale = std::clamp(float(j["uiScale"].asNumber(p.uiScale)), 0.0f, 3.0f);
p.lightboxAtStartup = j["lightboxAtStartup"].asBool(p.lightboxAtStartup);
if (j["libraryFolder"].isString()) p.libraryFolder = j["libraryFolder"].asString();
+ p.cameraNotch = std::clamp(int(j["cameraNotch"].asNumber(p.cameraNotch)), 0, 2);
}
namespace {
@@ -704,6 +706,17 @@ void drawInterfaceSection(App& app) {
"Size of text and controls. Automatic follows the display. Takes effect the next time SculptForge starts "
"(Store Config to keep it).",
"Preferences > Interface");
+ static const char* kNotch[] = {"Automatic", "Always reserve", "Off"};
+ ImGui::SetNextItemWidth(-FLT_MIN);
+ if (ImGui::BeginCombo("##camera_notch", (std::string("Camera notch: ") + kNotch[std::clamp(p.cameraNotch, 0, 2)]).c_str())) {
+ for (int i = 0; i < 3; ++i)
+ if (ImGui::Selectable(kNotch[i], i == p.cameraNotch)) p.cameraNotch = i;
+ ImGui::EndCombo();
+ }
+ ui::HelpText("Camera notch", nullptr,
+ "Keeps the interface below the camera notch of MacBooks (and other laptops) when SculptForge fills the "
+ "screen. Automatic asks the system (macOS) or recognises a notched MacBook display (Linux).",
+ "Preferences > Interface");
}
void drawHotkeysSection(App& app) {
diff --git a/src/app/Config.h b/src/app/Config.h
index 26924acd..0319dc23 100644
--- a/src/app/Config.h
+++ b/src/app/Config.h
@@ -25,6 +25,7 @@ struct UiPrefs {
float uiScale = 0.0f; // 0 = follow the display; otherwise applied at the next start
bool lightboxAtStartup = true;
std::string libraryFolder; // "" = Documents/SculptForge
+ int cameraNotch = 0; // keep the UI out of a laptop's camera notch: 0 automatic, 1 always, 2 never
};
Json toJson(const UiPrefs& prefs);
diff --git a/src/app/Palettes.cpp b/src/app/Palettes.cpp
index 34ab6564..aab70ba1 100644
--- a/src/app/Palettes.cpp
+++ b/src/app/Palettes.cpp
@@ -315,7 +315,7 @@ void App::drawPalette_Render() {
ImGui::Checkbox("Show Splats", &renderSettings_.showSplats);
ImGui::EndDisabled();
ui::HelpAction(*this, "view.splats");
- actionRow(*this, {"view.frame"});
+ actionRow(*this, {"view.frame", "view.fullscreen"});
}
void App::drawPalette_Script() {
diff --git a/src/app/Shell.cpp b/src/app/Shell.cpp
index 29e226ae..6ec14bed 100644
--- a/src/app/Shell.cpp
+++ b/src/app/Shell.cpp
@@ -24,6 +24,8 @@
#include <cstdio>
#include <cstring>
#include <filesystem>
+#include <fstream>
+#include <iterator>
namespace sf {
@@ -329,6 +331,10 @@ void App::registerShellActions() {
flag("view.polypaint", "Paint", ICON_LC_PALETTE, "Render", "", &renderSettings_.showPolypaint,
"Show polypaint colours (off: plain material).");
flag("view.mesh", "Show Mesh", ICON_LC_BOX, "Render", "", &renderSettings_.showMesh, "Draw the sculpt.");
+ add({"view.fullscreen", "Fullscreen", ICON_LC_MAXIMIZE, "Fill the screen with SculptForge (again: back to a window).",
+ "Render", "F11", "",
+ [this] { SDL_SetWindowFullscreen(window_, !(SDL_GetWindowFlags(window_) & SDL_WINDOW_FULLSCREEN)); },
+ [this] { return (SDL_GetWindowFlags(window_) & SDL_WINDOW_FULLSCREEN) != 0; }, nullptr});
add({"view.splats", "Splats", ICON_LC_SPARKLE, "Show the Gaussian splat capture.", "Render", "", "",
[this] { renderSettings_.showSplats = !renderSettings_.showSplats; },
[this] { return renderSettings_.showSplats; }, [this] { return !doc_.splats.empty(); }});
@@ -447,17 +453,42 @@ void App::registerShellActions() {
// Layout
// ---------------------------------------------------------------------------
+float App::topInset() const {
+ // Laptop camera notches cover the top of a window that fills the screen (MacBooks since 2021).
+ if (uiPrefs_.cameraNotch == 2 || hideUi_ || !options_.uiTest.empty() || !options_.recordPath.empty()) return 0.0f;
+ // macOS (and any platform that knows) reports the safe area itself.
+ SDL_Rect safe{};
+ if (SDL_GetWindowSafeArea(window_, &safe) && safe.y > 0) return float(safe.y);
+ // Linux on Apple laptops (Asahi): notched MacBooks are 16:10 plus the band beside the notch, so a display
+ // taller than 16:10 has that band at its top. Only a window covering the whole display reaches it.
+ static const bool appleLaptop = [] {
+ std::ifstream f("/proc/device-tree/model", std::ios::binary);
+ std::string model((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>());
+ return model.find("MacBook") != std::string::npos;
+ }();
+ SDL_Rect bounds{};
+ int ww = 0, wh = 0;
+ const SDL_DisplayID display = SDL_GetDisplayForWindow(window_);
+ if (!display || !SDL_GetDisplayBounds(display, &bounds)) return 0.0f;
+ SDL_GetWindowSize(window_, &ww, &wh);
+ const float band = float(bounds.h) - float(bounds.w) * 10.0f / 16.0f;
+ const bool coversDisplay = ww >= bounds.w && wh >= bounds.h;
+ const bool notched = band > bounds.h * 0.02f && band < bounds.h * 0.06f;
+ if (uiPrefs_.cameraNotch == 1) return notched ? band : 32.0f * uiScale_;
+ return appleLaptop && notched && coversDisplay ? band : 0.0f;
+}
+
ShellGeometry App::shellGeometry() const {
int w = 0, h = 0;
SDL_GetWindowSize(window_, &w, &h);
- return computeShell(layout_, float(w), float(h), uiScale_);
+ return computeShell(layout_, float(w), float(h), uiScale_, topInset());
}
CanvasRect App::canvasRect() const {
int w = 0, h = 0;
SDL_GetWindowSize(window_, &w, &h);
if (hideUi_) return {0.0f, 0.0f, float(std::max(w, 1)), float(std::max(h, 1))};
- return computeShell(layout_, float(w), float(h), uiScale_).canvas;
+ return computeShell(layout_, float(w), float(h), uiScale_, topInset()).canvas;
}
void App::canvasRay(float x, float y, glm::vec3& origin, glm::vec3& dir) const {
@@ -554,7 +585,10 @@ void App::drawCanvasFrame() {
void App::drawShell() {
const ImGuiViewport* vp = ImGui::GetMainViewport();
- shell_ = computeShell(layout_, vp->Size.x, vp->Size.y, uiScale_);
+ shell_ = computeShell(layout_, vp->Size.x, vp->Size.y, uiScale_, topInset());
+ if (shell_.notchBand.h > 0.0f) // the band beside the camera: plain shell colour, so it reads as part of the bezel
+ ImGui::GetBackgroundDrawList()->AddRectFilled(ImVec2(0, 0), ImVec2(shell_.notchBand.w, shell_.notchBand.h),
+ theme::u32(theme::shellBg));
// Splats arriving (file, command or AI agent) bring their palette into the right tray.
if (doc_.splatsVersion != seenSplatsVersion_) {
seenSplatsVersion_ = doc_.splatsVersion;
diff --git a/src/app/ShellGeometry.cpp b/src/app/ShellGeometry.cpp
index 7c95f5a5..df4b403f 100644
--- a/src/app/ShellGeometry.cpp
+++ b/src/app/ShellGeometry.cpp
@@ -13,17 +13,19 @@ float trayWidth(float stored, float logicalWindowWidth) {
return std::clamp(stored, kTrayMinW, kTrayMaxW);
}
-ShellGeometry computeShell(const UiLayout& l, float W, float H, float s) {
+ShellGeometry computeShell(const UiLayout& l, float W, float H, float s, float topInset) {
ShellGeometry g;
g.scale = s;
const float logicalW = s > 0.0f ? W / s : W;
g.narrow = logicalW < kNarrowWidth;
g.shelves = l.shelvesVisible;
- g.title = {0, 0, W, kTitleH * s};
+ const float inset = std::clamp(topInset, 0.0f, H * 0.25f);
+ g.notchBand = {0, 0, W, inset};
+ g.title = {0, inset, W, kTitleH * s};
const float barH = l.paletteBarVisible ? kPaletteBarH * s : 0.0f;
- g.paletteBar = {0, g.title.h, W, barH};
- const float top = g.title.h + barH;
+ g.paletteBar = {0, inset + g.title.h, W, barH};
+ const float top = inset + g.title.h + barH;
float left = 0.0f, right = W; // the span between the dividers
if (g.shelves) {
diff --git a/src/app/ShellGeometry.h b/src/app/ShellGeometry.h
index be642245..3297aef2 100644
--- a/src/app/ShellGeometry.h
+++ b/src/app/ShellGeometry.h
@@ -12,6 +12,7 @@
namespace sf {
struct ShellGeometry {
+ CanvasRect notchBand; // h 0 unless the top of the window is unsafe (camera notch)
CanvasRect title, paletteBar;
CanvasRect topShelf, leftShelf, rightShelf, bottomShelf;
CanvasRect console; // h 0 when closed
@@ -34,6 +35,7 @@ constexpr float kConsoleMinH = 100, kConsoleMaxH = 400, kNarrowWidth = 1280, kWi
// windows 1920 logical px wide or more.
float trayWidth(float stored, float logicalWindowWidth);
-ShellGeometry computeShell(const UiLayout& layout, float width, float height, float scale);
+// `topInset` (window px) keeps everything below a camera notch or other unsafe band at the top.
+ShellGeometry computeShell(const UiLayout& layout, float width, float height, float scale, float topInset = 0.0f);
} // namespace sf
diff --git a/src/app/main.cpp b/src/app/main.cpp
index 3216c18d..62fa6bd6 100644
--- a/src/app/main.cpp
+++ b/src/app/main.cpp
@@ -32,7 +32,8 @@ void usage() {
" --demo-output FILE Save the demo's result (e.g. creature.glb)\n"
" --fps N Recording frame rate (default 30)\n"
" --ui-test FILE.sfui Run a UI test script headless and exit (0 = pass); settings are isolated\n"
- " --ui-out DIR Where UI tests save screenshots");
+ " --ui-out DIR Where UI tests save screenshots\n"
+ " --fullscreen Start filling the screen (F11 toggles)");
}
// UI tests must never read or change the user's real settings, recent files or
@@ -84,6 +85,7 @@ int main(int argc, char** argv) {
else if (a == "--demo-output") options.demoOutput = next();
else if (a == "--fps") options.fps = std::atoi(next().c_str());
else if (a == "--ui-test") options.uiTest = next();
+ else if (a == "--fullscreen") options.fullscreen = true;
else if (a == "--ui-out") options.uiOutDir = next();
else if (a == "-h" || a == "--help") {
usage();
diff --git a/tests/test_shell_layout.cpp b/tests/test_shell_layout.cpp
index 172f5d8d..775904d3 100644
--- a/tests/test_shell_layout.cpp
+++ b/tests/test_shell_layout.cpp
@@ -107,3 +107,16 @@ TEST(shell_tray_width_and_layout_json) {
CHECK(back.bottomShelf == l.bottomShelf);
CHECK(back.topShelf == l.topShelf);
}
+
+TEST(shell_camera_notch_inset) {
+ // A 16-inch MacBook Pro filled edge to edge: 1728x1117 logical, a 37 px band beside the notch.
+ const UiLayout l = standardLayout();
+ const ShellGeometry plain = computeShell(l, 1728, 1117, 1.0f);
+ const ShellGeometry g = computeShell(l, 1728, 1117, 1.0f, 37.0f);
+ CHECK(plain.notchBand.h == 0.0f && plain.title.y == 0.0f);
+ CHECK(g.notchBand.h == 37.0f && g.title.y == 37.0f);
+ CHECK(g.paletteBar.y == 37.0f + g.title.h);
+ CHECK(g.canvas.y == plain.canvas.y + 37.0f && g.canvas.h == plain.canvas.h - 37.0f);
+ CHECK(g.rightTray.y == plain.rightTray.y + 37.0f);
+ CHECK(computeShell(l, 1728, 1117, 1.0f, 5000.0f).notchBand.h <= 1117.0f * 0.25f); // never eats the window
+}