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.

Ways to support SculptForge that only open sculptforge.app/donate.html in the browser

islandmedc086388ef7cc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 85467228..9958320e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -218,7 +218,8 @@ if(SCULPTFORGE_BUILD_APP)
fontRegular ${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/Inter-Regular.ttf
fontSemiBold ${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/Inter-SemiBold.ttf
fontLucide ${CMAKE_CURRENT_SOURCE_DIR}/assets/fonts/lucide.ttf
- appIcon ${CMAKE_CURRENT_SOURCE_DIR}/assets/branding/sculptforge-256.png)
+ appIcon ${CMAKE_CURRENT_SOURCE_DIR}/assets/branding/sculptforge-256.png
+ supporters ${CMAKE_CURRENT_SOURCE_DIR}/docs/supporters.txt) # Help > About (never empty: it starts with comments)
include(cmake/EmbedGuide.cmake)
embed_guide(${CMAKE_CURRENT_BINARY_DIR}/EmbeddedGuide.cpp ${CMAKE_CURRENT_SOURCE_DIR}/docs/guide)
add_executable(sculptforge
@@ -275,6 +276,7 @@ if(SCULPTFORGE_BUILD_APP)
src/app/PanelPhone.cpp
src/app/PanelProject.cpp
src/app/PanelSubTools.cpp
+ src/app/PanelSupport.cpp
src/app/PanelExtract.cpp
src/app/PanelTimeline.cpp
src/app/ProofMode.cpp
diff --git a/docs/supporters.txt b/docs/supporters.txt
new file mode 100644
index 00000000..f1ece6c5
--- /dev/null
+++ b/docs/supporters.txt
@@ -0,0 +1,2 @@
+# SculptForge supporters, shown in Help > About (one name per line, plain text).
+# Lines starting with # are ignored. Names are cut to 40 characters; control characters are removed.
diff --git a/src/app/App.cpp b/src/app/App.cpp
index fc762650..c87b485f 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -1999,9 +1999,12 @@ void App::drawUi() {
ImGui::SameLine();
if (ImGui::Button("AI services & privacy"))
SDL_OpenURL("https://github.com/islandmed/SculptForge/blob/main/docs/ai-services.md");
+ ImGui::Spacing();
+ drawSupportersSection(); // PanelSupport.cpp
}
ImGui::End();
}
+ drawSupportUi(); // the first-run welcome, the one support reminder (PanelSupport.cpp)
guide_.draw(*this); // Help > User Guide
drawHelpConsoleUi(); // console, command palette, Controls (F1), Ctrl-hover help: last, on top
}
diff --git a/src/app/App.h b/src/app/App.h
index c5d5f854..c5fd9b43 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -12,6 +12,7 @@
#include "app/LightBox.h"
#include "app/Pickers.h"
#include "app/ShellGeometry.h"
+#include "app/Support.h"
#include "app/SubtoolThumbnails.h"
#include "app/Thumbnails.h"
#include "app/UiLayout.h"
@@ -327,6 +328,15 @@ private:
bool lastCommandOk_ = true; // result of the last runCommand (UI tests check it)
bool showHelp_ = false;
bool showAbout_ = false;
+ // Supporting SculptForge (Support.h): the app only ever opens kSupportUrl in the browser; nothing else changes.
+ void openSupportPage();
+ void drawSupportUi(); // the first-run welcome and the one reminder note
+ void drawSupportersSection(); // Help > About: the names from docs/supporters.txt, as plain text
+ bool showWelcome_ = false; // the first start (no project.json yet), or Help > Welcome
+ double sculptSeconds_ = 0.0; // cumulative time in strokes (project.json)
+ bool supportReminderDone_ = false; // the reminder was shown (or turned off) once: never again (project.json)
+ bool supportReminderOpen_ = false;
+ int supportPageRequests_ = 0; // UI tests: how often the page was asked for (only opened when interactive)
// Results from asynchronous native file dialogs (called off the main thread).
struct PendingFile {
diff --git a/src/app/Config.cpp b/src/app/Config.cpp
index 31662fd3..1bee3ab9 100644
--- a/src/app/Config.cpp
+++ b/src/app/Config.cpp
@@ -430,6 +430,12 @@ void App::initActions() {
"(Preferences > Updates).");
add("help.about", "About SculptForge", "Help", nullptr, [this] { showAbout_ = true; }, ICON_LC_INFO, nullptr, nullptr, nullptr,
"Version, licence and the open-source components SculptForge is built with.");
+ add("help.support", "Support SculptForge...", "Help", nullptr, [this] { openSupportPage(); }, ICON_LC_HEART, nullptr,
+ nullptr, nullptr,
+ "SculptForge is free and stays free. If it helps your work, you can support its development: opens "
+ "sculptforge.app/donate.html in your browser. Nothing in the app changes either way.");
+ add("help.welcome", "Welcome", "Help", nullptr, [this] { showWelcome_ = true; }, ICON_LC_SPARKLES, nullptr, nullptr,
+ nullptr, "The welcome note shown the first time SculptForge starts.");
add("help.website", "Website & documentation", "Help", nullptr, [] { SDL_OpenURL("https://sculptforge.app/"); },
ICON_LC_BOOK_OPEN, nullptr, nullptr, nullptr, "Open the SculptForge website and user guide in your browser.");
add("help.report", "Report a problem", "Help", nullptr, [] { SDL_OpenURL("https://github.com/islandmed/SculptForge/issues"); },
diff --git a/src/app/Palettes.cpp b/src/app/Palettes.cpp
index 58c24740..68345ef1 100644
--- a/src/app/Palettes.cpp
+++ b/src/app/Palettes.cpp
@@ -418,6 +418,7 @@ void App::drawPalette_Help() {
menuAction(*this, "help.feedback");
menuAction(*this, "help.benchmark");
ImGui::Separator();
+ menuAction(*this, "help.support");
menuAction(*this, "help.about");
}
diff --git a/src/app/PanelProject.cpp b/src/app/PanelProject.cpp
index 47554d17..bf56e45e 100644
--- a/src/app/PanelProject.cpp
+++ b/src/app/PanelProject.cpp
@@ -18,6 +18,7 @@
#include <imgui.h>
#include <algorithm>
+#include <cmath>
#include <cctype>
#include <chrono>
#include <cstdlib>
@@ -97,6 +98,10 @@ void App::initProject() {
checkUpdates_ = prefs["check_updates"].asBool(checkUpdates_);
updateCheckedAt_ = int64_t(prefs["update_checked_at"].asNumber(0));
if (prefs["update_skipped"].isString()) updateSkipped_ = prefs["update_skipped"].asString();
+ sculptSeconds_ = addSculptTime(prefs["sculpt_seconds"].asNumber(0.0), 0.0);
+ supportReminderDone_ = prefs["support_reminder_done"].asBool(false);
+ } else {
+ showWelcome_ = options_.uiTest.empty() && options_.demo.empty(); // the first start: no prefs yet
}
recentFiles_ = pruneRecentFiles(std::move(recentFiles_), fileExists);
saveProjectPrefs(); // records this version, so What's New shows once
@@ -134,6 +139,8 @@ void App::saveProjectPrefs() {
prefs.set("check_updates", checkUpdates_);
prefs.set("update_checked_at", double(updateCheckedAt_));
if (!updateSkipped_.empty()) prefs.set("update_skipped", updateSkipped_);
+ prefs.set("sculpt_seconds", std::floor(sculptSeconds_)); // for the one support reminder (Support.h); stays here
+ prefs.set("support_reminder_done", supportReminderDone_);
std::ofstream(fsPath(prefDir_ + "project.json"), std::ios::binary | std::ios::trunc) << prefs.dump(true);
}
@@ -150,6 +157,15 @@ void App::rememberRecent(const std::string& path) {
void App::tickProject(float dt) {
updateTitle();
if (!interactive() || prefDir_.empty()) return;
+ // Sculpting time, for the one optional support reminder (Support.h): counted here, kept in project.json.
+ const bool stroking = doc_.sculptor.strokeActive();
+ if (stroking) sculptSeconds_ = addSculptTime(sculptSeconds_, double(dt));
+ if (supportReminderDue(sculptSeconds_, double(SDL_GetTicks()) * 1e-3, stroking, supportReminderDone_)) {
+ supportReminderDone_ = true; // once only
+ supportReminderOpen_ = true;
+ saveProjectPrefs();
+ redrawAt_ = double(SDL_GetTicksNS()) * 1e-9; // (a frame to show it, asleep or not)
+ }
if (!doc_.dirty()) {
autosaveTimer_ = 0.0f;
if (autosaveWritten_) { // nothing left to recover
diff --git a/src/app/PanelSupport.cpp b/src/app/PanelSupport.cpp
new file mode 100644
index 00000000..de879107
--- /dev/null
+++ b/src/app/PanelSupport.cpp
@@ -0,0 +1,113 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// Supporting SculptForge: Help > Support SculptForge..., the first-run welcome, the supporters in Help > About and
+// the one optional reminder after ten hours of sculpting. Each only opens kSupportUrl in the browser (Support.h);
+// the app is the same for everyone, so nothing here checks, sends or stores anything else.
+#include "app/App.h"
+#include "app/Theme.h"
+
+#include <imgui.h>
+
+#include <algorithm>
+#include <string>
+#include <string_view>
+#include <vector>
+
+namespace sf {
+
+namespace assets {
+extern const unsigned char supporters[]; // docs/supporters.txt (CMakeLists.txt)
+extern const unsigned long long supporters_size;
+} // namespace assets
+
+namespace {
+
+const std::vector<std::string>& supporterNames() {
+ static const std::vector<std::string> names =
+ parseSupporters(std::string_view(reinterpret_cast<const char*>(assets::supporters), size_t(assets::supporters_size)));
+ return names;
+}
+
+} // namespace
+
+void App::openSupportPage() {
+ ++supportPageRequests_;
+ if (!interactive()) { // UI tests, renders and demos never start a browser
+ status_ = std::string("Support SculptForge: ") + kSupportUrl;
+ return;
+ }
+ status_ = SDL_OpenURL(kSupportUrl) ? std::string("Opened sculptforge.app/donate.html in your browser")
+ : std::string("Couldn't open ") + kSupportUrl + ": " + SDL_GetError();
+}
+
+void App::drawSupportersSection() {
+ ImGui::SeparatorText("Supporters");
+ const std::vector<std::string>& names = supporterNames();
+ if (names.empty()) {
+ ImGui::TextDisabled("Be the first: sculptforge.app/donate.html");
+ } else {
+ ImGui::TextWrapped("Thank you to everyone who supports SculptForge:");
+ // Plain text only (TextUnformatted: no format strings, markup or links), sanitised by parseSupporters.
+ const float rows = float(std::min<size_t>(names.size(), 8));
+ if (ImGui::BeginChild("##supporters", ImVec2(0, rows * ImGui::GetTextLineHeightWithSpacing() + 4.0f * uiScale_),
+ ImGuiChildFlags_Borders)) {
+ ImGuiListClipper clipper;
+ clipper.Begin(int(names.size()));
+ while (clipper.Step())
+ for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; ++i) ImGui::TextUnformatted(names[size_t(i)].c_str());
+ }
+ ImGui::EndChild();
+ }
+ if (ImGui::Button("Support SculptForge##about")) openSupportPage();
+}
+
+void App::drawSupportUi() {
+ const float s = uiScale_;
+ const CanvasRect c = canvasRect();
+ if (showWelcome_) {
+ // Not modal: the app works around it, and it doesn't come back once closed.
+ ImGui::SetNextWindowPos(ImVec2(c.x + c.w * 0.5f, c.y + c.h * 0.3f), ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
+ ImGui::SetNextWindowSize(ImVec2(440.0f * s, 0.0f), ImGuiCond_Appearing);
+ const ImGuiWindowFlags flags = ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize;
+ if (ImGui::Begin("Welcome to SculptForge", &showWelcome_, flags)) {
+ ImGui::TextWrapped("Hold Ctrl over any control to see what it does. The User Guide (Shift+F1) explains every "
+ "tool, and Coming from ZBrush lists what is where.");
+ if (ImGui::Button("Open the User Guide##welcome")) {
+ guide_.open();
+ showWelcome_ = false;
+ }
+ ImGui::Spacing();
+ ImGui::Separator();
+ ImGui::Spacing();
+ ImGui::TextWrapped("SculptForge is free. If it helps your work, consider supporting it.");
+ if (ImGui::Button("Support SculptForge##welcome")) openSupportPage();
+ ImGui::SameLine();
+ if (ImGui::Button("Close##welcome")) showWelcome_ = false;
+ }
+ ImGui::End();
+ }
+ if (supportReminderOpen_) {
+ // The one reminder: a small note along the bottom of the canvas, no focus taken, closed for good by any button.
+ ImGui::SetNextWindowPos(ImVec2(c.x + c.w * 0.5f, c.y + c.h - 12.0f * s), ImGuiCond_Always, ImVec2(0.5f, 1.0f));
+ ImGui::SetNextWindowBgAlpha(0.94f);
+ const ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
+ ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing |
+ ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoMove;
+ if (ImGui::Begin("##support_reminder", nullptr, flags)) {
+ ImGui::AlignTextToFramePadding();
+ ImGui::TextUnformatted("You've sculpted over ten hours in SculptForge. It's free; if it helps your work, "
+ "consider supporting it.");
+ ImGui::SameLine();
+ if (ImGui::SmallButton("Support...##reminder")) {
+ openSupportPage();
+ supportReminderOpen_ = false;
+ }
+ ImGui::SameLine();
+ if (ImGui::SmallButton("Don't show again##reminder")) supportReminderOpen_ = false;
+ }
+ ImGui::End();
+ }
+}
+
+} // namespace sf
diff --git a/src/app/Support.h b/src/app/Support.h
new file mode 100644
index 00000000..1441b51b
--- /dev/null
+++ b/src/app/Support.h
@@ -0,0 +1,101 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// Supporting SculptForge (memberships on the website; the app stays free and behaves the same for everyone). The
+// app only ever opens kSupportUrl in the browser: no payment code, no network, no tracking, no licence checks.
+// Pure helpers, unit tested: the supporters list compiled in from docs/supporters.txt (shown as plain text in
+// Help > About) and when the one optional reminder may show.
+#pragma once
+
+#include <algorithm>
+#include <cstddef>
+#include <cstdint>
+#include <string>
+#include <string_view>
+#include <vector>
+
+namespace sf {
+
+inline constexpr const char* kSupportUrl = "https://sculptforge.app/donate.html";
+
+inline constexpr size_t kSupporterNameMax = 40; // characters (code points) per name; longer ones are cut
+inline constexpr size_t kSupportersMax = 2000; // names kept
+
+// One line of docs/supporters.txt as it may be shown: valid UTF-8 only (invalid bytes dropped), no control or
+// invisible formatting characters (C0, DEL, C1, zero-width, bidi overrides and isolates, BOM), spaces trimmed,
+// at most kSupporterNameMax characters.
+inline std::string sanitizeSupporterName(std::string_view line) {
+ std::string out;
+ size_t chars = 0;
+ for (size_t i = 0; i < line.size() && chars < kSupporterNameMax;) {
+ const auto b = static_cast<unsigned char>(line[i]);
+ uint32_t cp = 0;
+ size_t len = 0;
+ if (b < 0x80) cp = b, len = 1;
+ else if ((b & 0xE0) == 0xC0) cp = b & 0x1F, len = 2;
+ else if ((b & 0xF0) == 0xE0) cp = b & 0x0F, len = 3;
+ else if ((b & 0xF8) == 0xF0) cp = b & 0x07, len = 4;
+ bool ok = len > 0 && i + len <= line.size();
+ for (size_t k = 1; ok && k < len; ++k) {
+ const auto c = static_cast<unsigned char>(line[i + k]);
+ ok = (c & 0xC0) == 0x80;
+ cp = (cp << 6) | (c & 0x3F);
+ }
+ // overlong forms, surrogates and values past U+10FFFF are invalid too
+ static constexpr uint32_t kMinForLength[5] = {0, 0, 0x80, 0x800, 0x10000};
+ ok = ok && cp >= kMinForLength[len] && cp <= 0x10FFFF && !(cp >= 0xD800 && cp <= 0xDFFF);
+ if (!ok) {
+ ++i; // drop one byte and resynchronise
+ continue;
+ }
+ const bool hidden = cp < 0x20 || (cp >= 0x7F && cp <= 0x9F) || (cp >= 0x200B && cp <= 0x200F) ||
+ (cp >= 0x2028 && cp <= 0x202E) || (cp >= 0x2060 && cp <= 0x2069) || cp == 0xFEFF;
+ if (!hidden) {
+ out.append(line.substr(i, len));
+ ++chars;
+ }
+ i += len;
+ }
+ const size_t first = out.find_first_not_of(' ');
+ if (first == std::string::npos) return {};
+ return out.substr(first, out.find_last_not_of(' ') - first + 1);
+}
+
+// docs/supporters.txt: one name per line; empty lines and lines starting with '#' are skipped. At most
+// kSupportersMax names, each sanitised (sanitizeSupporterName); names that sanitise to nothing are skipped.
+inline std::vector<std::string> parseSupporters(std::string_view text) {
+ std::vector<std::string> names;
+ size_t start = 0;
+ while (start < text.size() && names.size() < kSupportersMax) {
+ size_t end = text.find('\n', start);
+ if (end == std::string_view::npos) end = text.size();
+ const std::string_view line = text.substr(start, end - start);
+ start = end + 1;
+ const size_t first = line.find_first_not_of(" \t\r");
+ if (first == std::string_view::npos || line[first] == '#') continue;
+ std::string name = sanitizeSupporterName(line);
+ if (!name.empty()) names.push_back(std::move(name));
+ }
+ return names;
+}
+
+// --- The one optional reminder (a dismissible note, never a modal, never at launch) ---
+inline constexpr double kSupportReminderSculptSeconds = 10.0 * 3600.0; // cumulative stroke time first
+inline constexpr double kSupportReminderSessionSeconds = 10.0 * 60.0; // and this long into the session
+inline constexpr double kSculptTimeMaxStep = 0.25; // one frame's share at most (a stall or a clock jump adds little)
+
+// Adds one frame's `dt` seconds spent in a stroke to the cumulative sculpting time.
+inline double addSculptTime(double total, double dt) {
+ if (!(total >= 0.0) || total > 1e9) total = 0.0; // (a damaged prefs value)
+ if (!(dt > 0.0)) return total;
+ return total + std::min(dt, kSculptTimeMaxStep);
+}
+
+// Whether the reminder shows now: after kSupportReminderSculptSeconds of sculpting, at least
+// kSupportReminderSessionSeconds into this session, between strokes, and only if it was never shown or dismissed.
+inline bool supportReminderDue(double sculptSeconds, double sessionSeconds, bool stroking, bool alreadyShown) {
+ return !alreadyShown && !stroking && sculptSeconds >= kSupportReminderSculptSeconds &&
+ sessionSeconds >= kSupportReminderSessionSeconds;
+}
+
+} // namespace sf
diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cpp
index 7b734d45..ea9d9edd 100644
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@ -59,6 +59,8 @@
// background_r / background_g / background_b (the flat colour, 0-255), subtool_shading (0 Scene, 1 Smooth, 2 Flat),
// custom_matcaps (MatCaps loaded from images), material_custom (1 when the view uses
// one), matcap_files (images in the library's MatCaps folder),
+// support_requests (times Support SculptForge was clicked; never opens a browser in tests),
+// welcome_open (the first-run welcome shown),
// subtools (count), subtool_thumbnails (SubTool panel thumbnails rendered), active_subtool (index, 0 = top), visible_subtools,
// extract_preview (1 while an Extract preview waits for Accept), open_edges (edges of
// the active SubTool with one triangle: 0 = watertight),
@@ -525,6 +527,8 @@ double Demo::query(const std::string& name, bool& known) const {
if (name == "guide_hits") return double(app_.guide_.searchHits());
const Document& doc = app_.doc_;
if (name == "subtools") return double(doc.subtoolCount());
+ if (name == "support_requests") return double(app_.supportPageRequests_); // Support SculptForge clicks
+ if (name == "welcome_open") return app_.showWelcome_ ? 1.0 : 0.0;
if (name == "subtool_thumbnails") { // SubTool panel thumbnails rendered (#43)
double n = 0.0;
for (const auto& [id, tex] : app_.subtoolThumbs_) n += tex ? 1.0 : 0.0;
diff --git a/src/app/UserGuide.cpp b/src/app/UserGuide.cpp
index ed92121b..d01a8d41 100644
--- a/src/app/UserGuide.cpp
+++ b/src/app/UserGuide.cpp
@@ -991,6 +991,23 @@ void UserGuide::drawPage(App& app) {
else if (b.kind == BlockKind::Image || b.kind == BlockKind::Table || b.kind == BlockKind::Code) gap = 16.0f * s;
y += h + gap;
}
+ if (place_.chapter == page && currentFile() == "whats-new.md") {
+ // The end of What's New: a quiet line about supporting SculptForge (it only opens the website's page).
+ const float y0 = origin.y + y + 8.0f * s;
+ ImDrawList* dl = ImGui::GetWindowDrawList();
+ dl->AddLine(ImVec2(origin.x, y0), ImVec2(origin.x + width, y0), theme::u32(theme::sectionRule));
+ ImGui::SetCursorScreenPos(ImVec2(origin.x, y0 + 14.0f * s));
+ if (bodyFont()) ImGui::PushFont(bodyFont());
+ ImGui::PushTextWrapPos(origin.x + width);
+ ImGui::TextUnformatted("SculptForge is free and open source, and stays that way. If it helps your work, "
+ "you can support its development.");
+ ImGui::PopTextWrapPos();
+ if (bodyFont()) ImGui::PopFont();
+ ImGui::Spacing();
+ ImGui::SetCursorScreenPos(ImVec2(origin.x, ImGui::GetCursorScreenPos().y));
+ if (ImGui::Button("Support SculptForge##whats_new")) app.openSupportPage();
+ y = ImGui::GetCursorScreenPos().y - origin.y;
+ }
ImGui::SetCursorScreenPos(start);
ImGui::Dummy(ImVec2(avail, y + pad * 2.0f));
// Scroll to where navigation asked (positions are known now).
diff --git a/tests/test_support.cpp b/tests/test_support.cpp
new file mode 100644
index 00000000..87c2a684
--- /dev/null
+++ b/tests/test_support.cpp
@@ -0,0 +1,65 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// Supporting SculptForge: the supporters list (docs/supporters.txt) parsed and sanitised for Help > About, and
+// when the one optional reminder may show.
+#include "TestHarness.h"
+
+#include "app/Support.h"
+
+#include <string>
+
+using namespace sf;
+
+TEST(supporters_parse_skips_comments_and_blanks) {
+ CHECK(parseSupporters("").empty());
+ CHECK(parseSupporters("# one name per line\n\n \n#Not a name\n").empty());
+ const auto names = parseSupporters("# header\nAda Lovelace\r\n Grace Hopper \n\nLinus\n");
+ CHECK(names.size() == 3);
+ CHECK(names[0] == "Ada Lovelace" && names[1] == "Grace Hopper" && names[2] == "Linus");
+ CHECK(std::string(kSupportUrl) == "https://sculptforge.app/donate.html");
+}
+
+TEST(supporters_names_are_sanitised) {
+ // Control characters, escapes and invisible formatting go; the rest stays as plain text.
+ CHECK(sanitizeSupporterName("Bob\x1b[31m\x07") == "Bob[31m");
+ CHECK(sanitizeSupporterName("A\tB\x7f" "C") == "ABC");
+ CHECK(sanitizeSupporterName("\xe2\x80\xae" "evil\xe2\x80\xac") == "evil"); // bidi override (U+202E, U+202C)
+ CHECK(sanitizeSupporterName("zero\xe2\x80\x8bwidth\xef\xbb\xbf") == "zerowidth"); // U+200B, BOM
+ CHECK(sanitizeSupporterName("\xc2\x85" "next") == "next"); // C1 control (U+0085)
+ CHECK(sanitizeSupporterName("Ren\xc3\xa9 \xe5\xb1\xb1\xe7\x94\xb0") == "Ren\xc3\xa9 \xe5\xb1\xb1\xe7\x94\xb0"); // UTF-8 kept
+ CHECK(sanitizeSupporterName("bad\xff\xc0\xafutf8\xed\xa0\x80") == "badutf8"); // invalid, overlong, surrogate
+ CHECK(sanitizeSupporterName("%s%n{{markup}}") == "%s%n{{markup}}"); // shown as text, not interpreted
+ // 40 characters at most, counted in characters, never cutting one in half.
+ CHECK(sanitizeSupporterName(std::string(100, 'x')).size() == kSupporterNameMax);
+ std::string accents;
+ for (int i = 0; i < 50; ++i) accents += "\xc3\xa9";
+ CHECK(sanitizeSupporterName(accents).size() == kSupporterNameMax * 2);
+ CHECK(sanitizeSupporterName(" \x01 \x02 ").empty());
+}
+
+TEST(supporters_count_is_capped) {
+ std::string text;
+ for (int i = 0; i < 2500; ++i) text += "Name " + std::to_string(i) + "\n";
+ const auto names = parseSupporters(text);
+ CHECK(names.size() == kSupportersMax);
+ CHECK(names.back() == "Name 1999");
+}
+
+TEST(support_reminder_timing) {
+ // Sculpting time grows by frames spent in strokes, a stalled frame counting at most a quarter second.
+ double t = 0.0;
+ t = addSculptTime(t, 0.016);
+ CHECK(t > 0.015 && t < 0.017);
+ CHECK(addSculptTime(t, 3600.0) - t <= kSculptTimeMaxStep + 1e-9);
+ CHECK(addSculptTime(t, -5.0) == t);
+ CHECK(addSculptTime(-1.0, 0.1) <= 0.1 + 1e-9); // a damaged stored value starts again
+ const double ten = kSupportReminderSculptSeconds, session = kSupportReminderSessionSeconds;
+ CHECK(!supportReminderDue(ten - 1.0, session, false, false)); // not before ten hours
+ CHECK(!supportReminderDue(ten, 0.0, false, false)); // never at launch
+ CHECK(!supportReminderDue(ten, session - 1.0, false, false));
+ CHECK(!supportReminderDue(ten, session, true, false)); // never mid-stroke
+ CHECK(!supportReminderDue(ten, session, false, true)); // once only (shown or dismissed)
+ CHECK(supportReminderDue(ten, session, false, false));
+ CHECK(supportReminderDue(ten * 3.0, session * 6.0, false, false));
+}
diff --git a/tests/ui/support.sfui b/tests/ui/support.sfui
new file mode 100644
index 00000000..b5ad22f2
--- /dev/null
+++ b/tests/ui/support.sfui
@@ -0,0 +1,33 @@
+# Supporting SculptForge: Help > Support SculptForge..., the first-run welcome and the supporters in Help > About.
+# Every one only asks for sculptforge.app/donate.html (UI tests never start a browser); nothing else changes.
+run new_sphere subdivisions=3
+expect_value welcome_open == 0
+expect_value support_requests == 0
+
+# Help > Support SculptForge...
+click "Help##palette.help"
+expect "Support SculptForge...##help.support"
+click "Support SculptForge...##help.support"
+expect_value support_requests == 1
+expect_status sculptforge.app/donate.html
+
+# The welcome (shown by itself on the first start; Help > Welcome from the command palette here).
+key f3
+type "##Command palette" "welcome"
+key enter
+expect_value welcome_open == 1
+expect_text "SculptForge is free. If it helps your work, consider supporting it."
+shot welcome
+click "Support SculptForge##welcome"
+expect_value support_requests == 2
+click "Close##welcome"
+expect_value welcome_open == 0
+
+# Help > About: the supporters list is empty for now, so it invites the first one.
+click "Help##palette.help"
+click "About SculptForge##help.about"
+expect_text "Supporters"
+expect_text "Be the first: sculptforge.app/donate.html"
+shot about_supporters
+click "Support SculptForge##about"
+expect_value support_requests == 3
diff --git a/tests/ui/whats_new.sfui b/tests/ui/whats_new.sfui
index f97b740f..ef714c76 100644
--- a/tests/ui/whats_new.sfui
+++ b/tests/ui/whats_new.sfui
@@ -23,3 +23,9 @@ expect_text "Version 0.4.2"
# The newest section is on screen.
expect_text "QRemesh 2"
shot whats-new
+
+# The end of the chapter: a quiet line about supporting SculptForge; its button only asks for the website's page
+# (UI tests never start a browser).
+expect_text "If it helps your work, you can support its development."
+expect "Support SculptForge##whats_new"
+expect_value support_requests == 0