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.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
Membership moments for returning users: milestones, an honest feed line, backoff, a quiet top-bar heart, "Requested by a member"
islandmed59e83e14aa23
diff --git a/CMakeLists.txt b/CMakeLists.txtindex f1ae6aef..a2a83e8a 100644--- a/CMakeLists.txt+++ b/CMakeLists.txt@@ -944,6 +944,9 @@ if(SCULPTFORGE_BUILD_TESTS)sculptforge_ui_test(title_version_1440 title_version --size 1440x900)sculptforge_ui_test(title_version_1024 title_version --size 1024x768)sculptforge_ui_test(timeline_narrow_1024 timeline_narrow --size 1024x768)+ # The membership moments' card and the top bar's heart at 1440 and 1024 px (tests/ui/support/support_shots.sfui).+ sculptforge_ui_test(support_shots_1440 support/support_shots --size 1440x900)+ sculptforge_ui_test(support_shots_1024 support/support_shots --size 1024x768)sculptforge_ui_test(help_console_1080 help_console --size 1920x1080)# The S / U / I / O slider on a UI scaled 1.5x (Windows at 150%, #9): it must still open under the cursor.sculptforge_ui_test(size_popup_scaled size_popup --size 2400x1350)diff --git a/changes/README.md b/changes/README.mdindex bca20796..33af1f98 100644--- a/changes/README.md+++ b/changes/README.md@@ -25,6 +25,8 @@ Anything after the front matter is for reviewers and is not copied anywhere.| `highlight` | the version's feature block and the update feed | optional; 3-5 per release in all, one short line || `added` `changed` `fixed` `removed` `security` (`deprecated`) | `CHANGELOG.md` `[Unreleased]`, that section | the full entry, issue numbers and credits || `testers` | the #testers checklist (`assemble_notes.py X.Y.Z --testers`) | what to try, where, what "good" looks like |+| `member_request` | `true`: the What's New bullets end *Requested by a member*, the highlights "(requested by a member)" | a change a member asked for (Member Requests); `assemble_notes.py X.Y.Z --member-requests` counts them for latest.json's `support.member_requests_this_release` |+| `member_credit` | the member's @handle (or short name) beside that tag | **only if the member opted in to being credited**; never otherwise |Every key may repeat. A value continues on the next lines indented by two spaces; each `testers` item starts with` - `. The version's tagline and feature cards (title, line, image, Try it) stay hand-written in the ```features block ofdiff --git a/changes/feat-support-moments.md b/changes/feat-support-moments.mdnew file mode 100644index 00000000..0595029c--- /dev/null+++ b/changes/feat-support-moments.md@@ -0,0 +1,21 @@+---+whats_new: **Membership moments**: the small membership card can now also come at a milestone (your 10th start,+ 10 hours of sculpting, your 100th save; counted on your computer only, never sent) and says the true number. After+ a third **Not now** it waits a month, after a sixth it only comes with an update. A quiet heart at the right of the+ top bar opens **Help > Support SculptForge...**; members see a small badge there instead.+whats_new: **Requested by a member**: changes members asked for through Member Requests are marked in What's New.+changed: Membership card: milestone moments (10th start, 10 hours of stroke time, 100th save; local counts only,+ nothing sent), an optional honest line from the update feed's `support` block (funded this month, Founding Members+ taken, member requests this release), and a backoff (monthly after the 3rd "Not now", only after an update after+ the 6th). Every existing rule stays: never modal, never mid-stroke or during a job, never in tests, renders or CI,+ never for members, at most once a week.+added: Top bar heart (Help > Support SculptForge); a small badge for verified members. Hidden in studio builds and+ before it would crowd a narrow top bar.+added: Note fragments take `member_request: true` (and `member_credit: @handle` when the member opted in): What's New+ tags the change "Requested by a member".+testers:+ - Any OS, 1440 px wide window: the heart sits left of the 1 2 3 presets in the top bar (Classic and SculptForge+ looks); hover shows a tooltip, click opens the membership page. At 1024 px in the SculptForge look it is gone.+ - Signed in for member builds: the heart is a small badge, no card ever shows.+---+Brief: BRIEF.md (Tony 11-07: "nag people who repeatedly open the app to support us, not in an annoying way").diff --git a/docs/guide/welcome.md b/docs/guide/welcome.mdindex 6ad7bfc9..a94741a5 100644--- a/docs/guide/welcome.md+++ b/docs/guide/welcome.md@@ -22,10 +22,14 @@ early builds (from SculptForge 1.0, each release about two weeks early), a vote(ask for a brush, alpha or material) and your name in the credits (every release stays free for everyone; bug-fix and security releasesgo out to everyone the same day): **Help > Support SculptForge...** opens [sculptforge.app/support.html](https://sculptforge.app/support.html) in your browser, where you can become amember. That is all it does: the app has no payment code, no account and no licence check. Members are thanked-by name in **Help > About**. While SculptForge starts (the first time, after an update, and at most once a week-otherwise) a card shows the memberships; **I'm already a member** hides it for good and **Edit > Preferences > Support**-turns it off. After about ten hours of sculpting, SculptForge also shows one small note about this along the bottom-of the canvas, once, and never again after you close it.+by name in **Help > About**; the small heart at the right of the top bar opens the membership page too (members+see a small badge there instead). The first start shows the memberships once (**Edit > Preferences > Support > Show the+memberships** shows them again). After that, a small card along the bottom of the canvas may come at a good moment:+about 20 minutes of sculpting, a Save Render, the first start after an update, the monthly challenge results, or a+milestone (your 10th start, 10 hours of sculpting, your 100th save, counted on your computer only and never sent).+It comes at most once a week and never mid-stroke. **Not now** waits a week; after the third, a month; after the+sixth, it only comes with an update. **I'm already a member** signs in with GitHub (as member builds do) and hides it+for good.## What you can do with itdiff --git a/docs/releasing.md b/docs/releasing.mdindex 9c877b54..47d831cf 100644--- a/docs/releasing.md+++ b/docs/releasing.md@@ -209,6 +209,14 @@ automatically.`"challenge": {"id": "YYYY-MM", "title": "<theme>"}` to `website/latest.json` (push main; the site deploys). Theapp's daily update check reads it once per id: the small membership card's challenge moment ("The <theme>challenge results are in, on Discord").+- **The membership card's honest line (optional):** `website/latest.json` may carry+ `"support": {"funded_this_month": ["<what members funded>", ...], "founding": {"taken": N, "limit": 100},+ "member_requests_this_release": N}` (any part may be left out). The app's daily update check keeps it, and the small+ card shows one true line from it in turn ("Members funded this month: ...", "Founding Members so far: N of 100...",+ "N changes in this release were members' requests."); without the block the card keeps its usual Founding Members+ line. Only real numbers: `founding` from `website/founding.json`, the requests count from+ `tools/release/assemble_notes.py X.Y.Z --member-requests` before the bump (fragments with `member_request: true`).+ Never anything that reads as urgency.- **Member Requests:** each approved request goes into islandmed/sculptforge-insiders as`requests/YYYY-MM/<slug>/request.json` + its file (+ `preview.png`), `"approved": true` once the requester hasOK'd the preview (format: `tools/member-requests/requests.py`). On the 1st, member-requests.yml packs last month's,diff --git a/src/app/App.h b/src/app/App.hindex c2d83209..86181e97 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -541,6 +541,15 @@ private:bool sculptMomentDone_ = false; // the sculpting moment came this sessionMemberMoment memberMomentPending_ = MemberMoment::None; // allowed, waiting for a calm frameMemberMoment memberCard_ = MemberMoment::None; // the small card showing+ CardLine memberCardMilestone_; // a milestone card's words, numbers as it showed+ CardLine memberCardFeedLine_; // the feed's honest line on this card (none: the usual one)+ void memberMilestoneCheck(); // a milestone due may bring the card (a start, a save, a minute)+ void countMemberSave(); // a project save (the 100th save milestone)+ double milestoneCheckedAt_ = 0.0; // seconds (ImGui clock): the sculpting hours, checked each minute+ // The top bar's heart (Help > Support SculptForge); a member's badge instead. False: no room or a studio build.+ bool drawSupportHeart(ImVec2 at, float size, ImDrawList* dl);+ // A Studio member's build or studio mode (core/StudioProfile.h): no heart, no small cards.+ bool studioMembership() const { return isStudioBuild() || studioMode().active; }bool memberVerifying_ = false; // the card's sign-in runs (shown in the card)bool updatedThisStart_ = false; // this start runs a newer version than the last (the update moment)std::string challengeTitle_; // the monthly challenge whose results came (latest.json)diff --git a/src/app/I18nSimplifiedChinese.cpp b/src/app/I18nSimplifiedChinese.cppindex 239c2c00..94d833f0 100644--- a/src/app/I18nSimplifiedChinese.cpp+++ b/src/app/I18nSimplifiedChinese.cpp@@ -4376,6 +4376,26 @@ constexpr Entry kSimplifiedChinese[] = {"旋转模板,以逆时针度数表示;Ctrl+点击以输入。"},{"Centre the Stencil again, upright, 80% of the view's height.","将模板重新居中、摆正,高度为视图的 80%。"},+ // Membership moments (PanelSupportCard.cpp)+ {"Member", "会员"},+ {"You've opened SculptForge %d times. Members keep it free and growing.",+ "你已打开 SculptForge %d 次。会员让它保持免费并持续成长。"},+ {"You've sculpted %d hours in SculptForge. Members keep it free and growing.",+ "你已在 SculptForge 中雕刻了 %d 小时。会员让它保持免费并持续成长。"},+ {"You've saved your work %d times in SculptForge. Members keep it free and growing.",+ "你已在 SculptForge 中保存作品 %d 次。会员让它保持免费并持续成长。"},+ {"Members funded this month: %s.",+ "本月由会员资助:%s。"},+ {"Founding Members so far: %d of %d. A badge, your name in the credits and your price locked for good.",+ "目前的创始会员:%d / %d。获得徽章、列名于致谢名单,价格永久锁定。"},+ {"%d change in this release was a member's request.",+ "此版本有 %d 项更改来自会员的请求。"},+ {"%d changes in this release were members' requests.",+ "此版本有 %d 项更改来自会员的请求。"},+ {"Thank you for being a member: you keep SculptForge free and growing.",+ "感谢你成为会员:你让 SculptForge 保持免费并持续成长。"},+ {"SculptForge is free and open source. Members keep it free and growing (Help > Support SculptForge).",+ "SculptForge 是免费的开源软件。会员让它保持免费并持续成长(帮助 > 支持 SculptForge)。"},};} // namespacediff --git a/src/app/I18nSpanish.cpp b/src/app/I18nSpanish.cppindex 3dc741f0..d3940eec 100644--- a/src/app/I18nSpanish.cpp+++ b/src/app/I18nSpanish.cpp@@ -4854,6 +4854,26 @@ constexpr Entry kSpanish[] = {"Barra superior"},{"Status bar","Barra de estado"},+ // Membership moments (PanelSupportCard.cpp)+ {"Member", "Miembro"},+ {"You've opened SculptForge %d times. Members keep it free and growing.",+ "Has abierto SculptForge %d veces. Los miembros lo mantienen gratis y en crecimiento."},+ {"You've sculpted %d hours in SculptForge. Members keep it free and growing.",+ "Has esculpido %d horas en SculptForge. Los miembros lo mantienen gratis y en crecimiento."},+ {"You've saved your work %d times in SculptForge. Members keep it free and growing.",+ "Has guardado tu trabajo %d veces en SculptForge. Los miembros lo mantienen gratis y en crecimiento."},+ {"Members funded this month: %s.",+ "Financiado por los miembros este mes: %s."},+ {"Founding Members so far: %d of %d. A badge, your name in the credits and your price locked for good.",+ "Miembros fundadores hasta ahora: %d de %d. Una insignia, tu nombre en los créditos y tu precio fijo para siempre."},+ {"%d change in this release was a member's request.",+ "%d cambio de esta versión fue una petición de un miembro."},+ {"%d changes in this release were members' requests.",+ "%d cambios de esta versión fueron peticiones de miembros."},+ {"Thank you for being a member: you keep SculptForge free and growing.",+ "Gracias por ser miembro: mantienes SculptForge gratis y en crecimiento."},+ {"SculptForge is free and open source. Members keep it free and growing (Help > Support SculptForge).",+ "SculptForge es libre y de código abierto. Los miembros lo mantienen gratis y en crecimiento (Ayuda > Apoya a SculptForge)."},};} // namespacediff --git a/src/app/I18nTraditionalChinese.cpp b/src/app/I18nTraditionalChinese.cppindex 9a588b62..cced77cb 100644--- a/src/app/I18nTraditionalChinese.cpp+++ b/src/app/I18nTraditionalChinese.cpp@@ -4374,6 +4374,26 @@ constexpr Entry kTraditionalChinese[] = {"旋轉模板,以逆時針度數表示;Ctrl+點擊以輸入。"},{"Centre the Stencil again, upright, 80% of the view's height.","將模板重新置中、擺正,高度為視圖的 80%。"},+ // Membership moments (PanelSupportCard.cpp)+ {"Member", "會員"},+ {"You've opened SculptForge %d times. Members keep it free and growing.",+ "你已開啟 SculptForge %d 次。會員讓它保持免費並持續成長。"},+ {"You've sculpted %d hours in SculptForge. Members keep it free and growing.",+ "你已在 SculptForge 中雕刻了 %d 小時。會員讓它保持免費並持續成長。"},+ {"You've saved your work %d times in SculptForge. Members keep it free and growing.",+ "你已在 SculptForge 中儲存作品 %d 次。會員讓它保持免費並持續成長。"},+ {"Members funded this month: %s.",+ "本月由會員資助:%s。"},+ {"Founding Members so far: %d of %d. A badge, your name in the credits and your price locked for good.",+ "目前的創始會員:%d / %d。獲得徽章、列名於致謝名單,價格永久鎖定。"},+ {"%d change in this release was a member's request.",+ "此版本有 %d 項變更來自會員的請求。"},+ {"%d changes in this release were members' requests.",+ "此版本有 %d 項變更來自會員的請求。"},+ {"Thank you for being a member: you keep SculptForge free and growing.",+ "感謝你成為會員:你讓 SculptForge 保持免費並持續成長。"},+ {"SculptForge is free and open source. Members keep it free and growing (Help > Support SculptForge).",+ "SculptForge 是免費的開源軟體。會員讓它保持免費並持續成長(說明 > 支持 SculptForge)。"},};} // namespacediff --git a/src/app/PanelProject.cpp b/src/app/PanelProject.cppindex 8dc77b39..dccc6018 100644--- a/src/app/PanelProject.cpp+++ b/src/app/PanelProject.cpp@@ -123,6 +123,25 @@ void App::initProject() {supportCardPrefs_.hiddenUntil = int64_t(prefs["member_card_hidden_until"].asNumber(0));if (prefs["member_card_challenge"].isString())supportCardPrefs_.challengeSeen = prefs["member_card_challenge"].asString().substr(0, 32);+ { // the backoff and the milestones' counts (this computer only: never sent)+ auto count = [&](const char* key) { return int(std::clamp(prefs[key].asNumber(0), 0.0, 1e8)); };+ supportCardPrefs_.notNow = count("member_card_not_now");+ supportCardPrefs_.shownCount = count("member_card_shown");+ supportCardPrefs_.starts = count("member_card_starts");+ supportCardPrefs_.saves = count("member_card_saves");+ supportCardPrefs_.milestonesShown = unsigned(count("member_card_milestones")) & 7u;+ supportCardPrefs_.sculptSeconds = std::clamp(prefs["member_card_sculpt_seconds"].asNumber(0), 0.0, 1e9);+ // The last update check's "support" block (core/UpdateCheck.h), for the card's honest line.+ if (const Json& f = prefs["member_card_feed"]; f.isObject()) {+ SupportFeed& feed = supportCardPrefs_.feed;+ feed.present = true;+ for (const Json& n : f["funded"].items())+ if (n.isString() && feed.funded.size() < 5) feed.funded.push_back(sanitizeSupporterName(n.asString()));+ feed.foundingTaken = int(std::clamp(f["founding_taken"].asNumber(-1), -1.0, 1e5));+ feed.foundingLimit = int(std::clamp(f["founding_limit"].asNumber(-1), -1.0, 1e5));+ feed.memberRequests = int(std::clamp(f["member_requests"].asNumber(-1), -1.0, 1e5));+ }+ }discordPrefs_.enabled = prefs["discord_presence"].asBool(false); // Preferences > Integrations (PanelIntegrations.cpp)discordPrefs_.showChallenge = prefs["discord_challenge_shown"].asBool(false);discordPrefs_.showFileName = prefs["discord_file_name_shown"].asBool(false);@@ -154,13 +173,17 @@ void App::initProject() {}initSelfUpdate(); // a just-installed version counts its start (PanelUpdate.cpp)recentFiles_ = pruneRecentFiles(std::move(recentFiles_), fileExists);+ // (the starts milestone: counted on this computer only, never sent)+ if (!supportCardTestMode()) supportCardPrefs_.starts = std::min(supportCardPrefs_.starts + 1, 100000000);saveProjectPrefs(); // records this version, so What's New shows onceupdateDiscordPresence(); // on if it was left on (PanelIntegrations.cpp)- // The full membership card on the first start (Support.h); after an update, the small card's moment.+ // The full membership card on the first start (Support.h); after an update, the small card's moment; then a+ // milestone due (the starts are counted above).if (updatedThisStart_) memberMoment(MemberMoment::Updated);launchSupportCard(!hadPrefs,std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count(),supportCardTestMode());+ memberMilestoneCheck();#if SF_UPDATE_CHECKconst int64_t now = std::chrono::duration_cast<std::chrono::seconds>(std::chrono::system_clock::now().time_since_epoch()).count();@@ -207,6 +230,24 @@ void App::saveProjectPrefs() {prefs.set("support_card_shown_at", double(supportCardPrefs_.shownAt));prefs.set("member_card_hidden_until", double(supportCardPrefs_.hiddenUntil));if (!supportCardPrefs_.challengeSeen.empty()) prefs.set("member_card_challenge", supportCardPrefs_.challengeSeen);+ {+ const SupportCardPrefs& c = supportCardPrefs_;+ prefs.set("member_card_not_now", c.notNow);+ prefs.set("member_card_shown", c.shownCount);+ prefs.set("member_card_starts", c.starts);+ prefs.set("member_card_saves", c.saves);+ prefs.set("member_card_milestones", int(c.milestonesShown));+ prefs.set("member_card_sculpt_seconds", std::floor(c.sculptSeconds));+ if (c.feed.present) {+ Json f = Json::object(), funded = Json::array();+ for (const auto& n : c.feed.funded) funded.push(n);+ f.set("funded", std::move(funded));+ f.set("founding_taken", c.feed.foundingTaken);+ f.set("founding_limit", c.feed.foundingLimit);+ f.set("member_requests", c.feed.memberRequests);+ prefs.set("member_card_feed", std::move(f));+ }+ }prefs.set("discord_presence", discordPrefs_.enabled); // Preferences > Integrations (PanelIntegrations.cpp)prefs.set("discord_challenge_shown", discordPrefs_.showChallenge);prefs.set("discord_file_name_shown", discordPrefs_.showFileName);@@ -302,6 +343,7 @@ void App::saveProjectTo(const std::string& path) {return;}runCommand("save_project", {{"path", path}});+ if (lastCommandOk_) countMemberSave(); // (the 100th save milestone: counted on this computer only)if (continueAfterSave_) {continueAfterSave_ = false;auto action = std::move(discardAction_);@@ -843,6 +885,11 @@ void App::pollUpdateCheck() {return;}const UpdateInfo& u = job->info;+ // The feed's "support" block (the card's honest line): kept until the next check, gone when the feed drops it.+ if (u.support.present || supportCardPrefs_.feed.present) {+ supportCardPrefs_.feed = u.support;+ saveProjectPrefs();+ }// The monthly challenge's results (latest.json's `challenge`): once per challenge, the membership card's moment.if (!u.challengeId.empty() && u.challengeId != supportCardPrefs_.challengeSeen) {supportCardPrefs_.challengeSeen = u.challengeId;diff --git a/src/app/PanelSupportCard.cpp b/src/app/PanelSupportCard.cppindex 3d3600af..c5a8f685 100644--- a/src/app/PanelSupportCard.cpp+++ b/src/app/PanelSupportCard.cpp@@ -6,6 +6,7 @@// their perks, in the current look's colours (Theme.h); on the first start only, and from Help > Support. The small// card: one line along the bottom of the canvas at a good moment (memberMoment), at most once a week, until someone// becomes a member. Never mid-stroke or during a job, never for a member, never in tests, renders, demos or CI.+// The top bar's quiet heart opens Help > Support SculptForge (a member sees a small badge instead).// No countdowns, no guilt, nothing pre-selected; Close is always there. Every button only opens one of the fixed// links in Support.h in the browser, except "I'm already a member", which is the member builds' GitHub sign-in.#include "app/App.h"@@ -13,6 +14,7 @@#include "app/Theme.h"#include "app/Ui.h"+#include <IconsLucide.h>#include <imgui.h>#include <imgui_internal.h>#include <imgui_impl_sdl3.h>@@ -521,7 +523,8 @@ void App::drawSupportPrefs() {ImGui::TextWrapped("%s", "Thank you for being a member! No membership cards show.");} else {ImGui::TextWrapped("%s", "A small membership card shows at most once a week, at a good moment (never mid-stroke), "- "until you become a member.");+ "until you become a member. After a third Not now it waits a month; after a sixth it "+ "only comes with an update.");if (ImGui::Button(tr("I'm already a member##prefs.member_verify"), ImVec2(-1, 0))) verifyMember();ui::HelpText("I'm already a member", nullptr,"Signs in with GitHub, as member builds do (Preferences > Updates): no more membership cards, "@@ -538,24 +541,48 @@ int64_t App::memberClock() const { return int64_t(std::time(nullptr)) + memberClvoid App::memberMoment(MemberMoment m) {const bool testMode = supportCardTestMode() && !memberCardTestMode_;if (m == MemberMoment::None || memberCard_ != MemberMoment::None || memberVerifying_) return;- if (!memberMomentAllowed(supportCardPrefs_, memberSignedIn(), memberClock(), testMode)) return;+ if (studioMembership() || !memberMomentAllowed(supportCardPrefs_, memberSignedIn(), memberClock(), testMode, m)) return;memberMomentPending_ = m; // (the latest moment's words)redrawIn(0.0);}+void App::memberMilestoneCheck() {+ if (memberCard_ != MemberMoment::None || memberMomentPending_ != MemberMoment::None || memberVerifying_) return;+ if (const MemberMoment m = milestoneDue(supportCardPrefs_); m != MemberMoment::None) memberMoment(m);+}++void App::countMemberSave() {+ if (supportCardTestMode() && !memberCardTestMode_) return; // (counted on this computer, never sent)+ supportCardPrefs_.saves = std::min(supportCardPrefs_.saves + 1, 100000000);+ memberMilestoneCheck();+}+void App::tickMemberCard(float dt) {const bool stroking = doc_.sculptor.strokeActive();- if (stroking) sessionSculptSeconds_ = addSculptTime(sessionSculptSeconds_, double(dt));+ if (stroking) {+ sessionSculptSeconds_ = addSculptTime(sessionSculptSeconds_, double(dt));+ if (!supportCardTestMode() || memberCardTestMode_)+ supportCardPrefs_.sculptSeconds = addSculptTime(supportCardPrefs_.sculptSeconds, double(dt));+ }if (sculptMomentDue(sessionSculptSeconds_, sculptMomentDone_)) {sculptMomentDone_ = true;memberMoment(MemberMoment::Sculpted);}+ if (!stroking && ImGui::GetTime() - milestoneCheckedAt_ >= 60.0) { // the sculpting hours: once a minute is plenty+ milestoneCheckedAt_ = ImGui::GetTime();+ memberMilestoneCheck();+ }if (memberMomentPending_ == MemberMoment::None) return;const bool otherCard = supportCard_ || showWelcome_ || quickTourOpen_ || whatsNew_ || showWhatsNew_ ||ImGui::GetTopMostPopupModal() != nullptr;if (!memberCardMayOpen(stroking, backgroundBusy(), otherCard)) return; // (it waits)memberCard_ = std::exchange(memberMomentPending_, MemberMoment::None);supportCardPrefs_.shownAt = memberClock();+ // A milestone shows once, with its true number now; the feed's honest lines take turns, card by card.+ supportCardPrefs_.milestonesShown |= milestoneBit(memberCard_);+ memberCardMilestone_ = milestoneLine(memberCard_, supportCardPrefs_);+ memberCardFeedLine_ = supportFeedLine(supportCardPrefs_.feed, supportCardPrefs_.shownCount);+ supportCardPrefs_.shownCount = std::min(supportCardPrefs_.shownCount + 1, 1000000);saveProjectPrefs(); // (recorded as it shows: a crash can't bring it back at once)redrawIn(0.0);}@@ -622,6 +649,9 @@ void App::drawMemberCard() {line = challengeTitle_.empty() ? std::string("The monthly challenge results are in, on Discord."): "The " + challengeTitle_ + " challenge results are in, on Discord.";break;+ case MemberMoment::Starts:+ case MemberMoment::SculptHours:+ case MemberMoment::Saves: line = formatCardLine(memberCardMilestone_, tr(memberCardMilestone_.format)); break;case MemberMoment::None: break;}if (bold) ImGui::PushFont(bold);@@ -631,8 +661,13 @@ void App::drawMemberCard() {ImGui::TextWrapped("%s", "$5 a month or $48 a year: betas early, the feature vote, Member Requests and your ""name in the credits. Nothing in the app is ever paywalled.");ImGui::PopStyleColor();+ // The feed's honest line in turn (latest.json's "support"), else the Founding Members' offer.const FoundingMembers& founding = foundingMembers();- if (founding.open()) {+ if (memberCardFeedLine_.format) {+ ImGui::PushStyleColor(ImGuiCol_Text, theme::accentHover);+ ImGui::TextWrapped("%s", formatCardLine(memberCardFeedLine_, tr(memberCardFeedLine_.format)).c_str());+ ImGui::PopStyleColor();+ } else if (founding.open()) {ImGui::PushStyleColor(ImGuiCol_Text, theme::accentHover);ImGui::TextWrapped(tr("The first %d members are Founding Members: a badge, their name in the credits and ""their price locked for good."), founding.limit);@@ -664,4 +699,32 @@ void App::drawMemberCard() {ImGui::End();}+// --- The top bar's heart ---++bool App::drawSupportHeart(ImVec2 at, float size, ImDrawList* dl) {+ if (studioMembership()) return false; // (a Studio member's own build)+ const bool member = supportCardPrefs_.supporter || memberSignedIn();+ ImGui::SetCursorScreenPos(at);+ const bool clicked = ImGui::InvisibleButton(member ? "Member##topbar.member" : "Support SculptForge##topbar.heart",+ ImVec2(size, size));+ const bool hovered = ImGui::IsItemHovered();+ const ImVec2 b(at.x + size, at.y + size);+ if (hovered && !member) dl->AddRectFilled(at, b, theme::u32(theme::frameHover), theme::rounding(3.0f * uiScale_));+ // Quiet: the dim text colour like the window buttons; the accent only under the pointer (a member's badge: the+ // accent, small and still). No animation, no count.+ const ImU32 col = theme::u32(member ? theme::accent : hovered ? theme::accentHover : theme::textDim, member ? 0.85f : 1.0f);+ ui::CentredGlyph(dl, nullptr, at, b, col, member ? ICON_LC_BADGE_CHECK : ICON_LC_HEART);+ if (member) {+ ui::HelpText("Member", nullptr, "Thank you for being a member: you keep SculptForge free and growing.", "Top bar");+ } else {+ ui::HelpText("Support SculptForge", nullptr,+ "SculptForge is free and open source. Members keep it free and growing (Help > Support SculptForge).",+ "Top bar");+ if (clicked) {+ if (const Action* a = actions_.find("help.support"); a && a->run) a->run();+ }+ }+ return true;+}+} // namespace sfdiff --git a/src/app/Shell.cpp b/src/app/Shell.cppindex ad87321d..bdfd5703 100644--- a/src/app/Shell.cpp+++ b/src/app/Shell.cpp@@ -1032,14 +1032,16 @@ void App::drawTitleStrip(const ShellGeometry& g) {barSpans_.push_back({brandX, ImGui::GetItemRectMax().x});const float nameEnd = ImGui::GetItemRectMax().x - ImGui::GetWindowPos().x; // (the cursor is on the next line)- // Right-aligned controls: QuickSave, layout presets, Menus, search. Measured first. A window too narrow for it- // all (1024 px at 200 % UI scale) never overlaps: things give way in this order: the version, the layout presets,- // Save Snapshot, the search field (to its icon), Send to Maya, then the document name.+ // Right-aligned controls: the support heart, QuickSave, layout presets, Menus, search. Measured first. A window+ // too narrow for it all (1024 px at 200 % UI scale) never overlaps: things give way in this order: the heart, the+ // version, the layout presets, Save Snapshot, the search field (to its icon), Send to Maya, then the document name.const ImGuiStyle& st = ImGui::GetStyle();auto buttonW = [&](const char* label) { return ImGui::CalcTextSize(label, nullptr, true).x + st.FramePadding.x * 2.0f; };bool quickSave = actions_.find("file.quicksave") != nullptr;bool maya = !uiPrefs_.mayaFolder.empty(); // the Maya bridge is on (#42): one click sends backbool presets = true, docName = true;+ bool heart = !studioMembership(); // Help > Support SculptForge (a member's badge); no room needed for it+ const float heartW = buttonH;float searchW = 150.0f * s;const float windowButtonW = buttonH + 6.0f * s; // minimise and close, at the far rightconst bool mayaLink = mayaLink_ != nullptr; // the Maya Live link is on: its ember chip turns it off@@ -1050,12 +1052,21 @@ void App::drawTitleStrip(const ShellGeometry& g) {auto rightWidth = [&] {float w = searchW + buttonW(tr(ICON_LC_MENU " Menus")) + 8.0f * s + 10.0f * s + 2.0f * windowButtonW + 2.0f * s;if (presets) w += 3.0f * (buttonH + 2.0f * s) + 10.0f * s;+ if (heart) w += heartW + 8.0f * s;if (quickSave) w += buttonW(tr("Save Snapshot")) + 8.0f * s;if (maya) w += buttonW((std::string(ICON_LC_SEND " ") + tr("Send to Maya")).c_str()) + 8.0f * s;if (mayaLink) w += buttonW(linkLabel.c_str()) + 8.0f * s;return w;};auto fits = [&] { return nameEnd + (docName ? 16.0f * s + buttonW(name.c_str()) : 0.0f) + 14.0f * s + rightWidth() + 8.0f * s <= g.title.w; };+ { // the heart goes first: before the version beside the name gives way+ const ShownVersion v = appShownVersion();+ if (fontSmall_) ImGui::PushFont(fontSmall_);+ const float versionW = 6.0f * s + ImGui::CalcTextSize(v.number.c_str()).x ++ (v.tag.empty() ? 0.0f : ImGui::CalcTextSize(v.tag.c_str()).x + 4.0f * s);+ if (fontSmall_) ImGui::PopFont();+ if (nameEnd + versionW + 16.0f * s + buttonW(name.c_str()) + 14.0f * s + rightWidth() + 8.0f * s > g.title.w) heart = false;+ }if (!fits()) presets = false;if (!fits()) quickSave = false;if (!fits()) searchW = buttonH + 4.0f * s;@@ -1164,6 +1175,10 @@ void App::drawTitleStrip(const ShellGeometry& g) {ImGui::PushStyleColor(ImGuiCol_Button, theme::toggleOff);ImGui::PushStyleColor(ImGuiCol_ButtonHovered, theme::toggleOffHover);ImGui::PushStyleColor(ImGuiCol_Text, theme::textOff);+ if (heart) {+ drawSupportHeart(ImVec2(ImGui::GetWindowPos().x + rightX, ImGui::GetWindowPos().y + (h - buttonH) * 0.5f), heartW, dl);+ ImGui::SameLine(0.0f, 8.0f * s);+ }if (mayaLink) {ImGui::PushStyleColor(ImGuiCol_Button, theme::accent);ImGui::PushStyleColor(ImGuiCol_ButtonHovered, theme::accentHover);@@ -1650,6 +1665,14 @@ void App::drawStatusBar(const ShellGeometry& g) {if (mayaLink) right = linkX - 10.0f * s;if (maya) barSpans_.push_back({mayaX, mayaX + mayaW});if (mayaLink) barSpans_.push_back({linkX, linkX + linkW});+ // The quiet heart (Help > Support SculptForge; a member's badge), left of the rest: the first thing to give way,+ // while the modules still have their room beside the menus.+ const float heartW = buttonH, heartX = right - heartW;+ const bool heart = !studioMembership() && heartX - menusEnd > 420.0f * s;+ if (heart) {+ right = heartX - 10.0f * s;+ barSpans_.push_back({heartX, heartX + heartW});+ }// Modules: mode, brush, document, triangles, frame rate.std::vector<StatusModule> mods;@@ -1786,6 +1809,8 @@ void App::drawStatusBar(const ShellGeometry& g) {ui::HelpAction(*this, "file.send_maya");}+ if (heart) drawSupportHeart(ImVec2(heartX, o.y + (h - buttonH) * 0.5f), heartW, dl);+// Layout presets 1 2 3, drawn as workspaces.for (int i = 1; i <= 3 && showPresets; ++i) {const std::string id = "ui.preset." + std::to_string(i);diff --git a/src/app/Support.h b/src/app/Support.hindex d4efd287..a6265a1b 100644--- a/src/app/Support.h+++ b/src/app/Support.h@@ -10,8 +10,10 @@#pragma once#include "core/Json.h"+#include "core/UpdateCheck.h"#include <algorithm>+#include <cstdio>#include <cstddef>#include <cstdint>#include <string>@@ -112,16 +114,25 @@ struct FoundingMembers {// --- The membership card at good moments (PanelSupportCard.cpp) ---// A small card along the bottom of the canvas, never a modal, at most once a week, until someone becomes a member.// It waits for the moment: ~20 minutes of active sculpting in this session (stroke time, not idle time), a Save-// Render, the first start after an update, or the monthly challenge's results (website/latest.json's `challenge`).+// Render, the first start after an update, the monthly challenge's results (website/latest.json's `challenge`), or a+// milestone (the 10th start, 10 hours of sculpting, the 100th save: counted on this computer only, never sent).// Never mid-stroke or while a background job runs, never in tests, renders, demos or CI, never for a member signed in-// for member builds (or verified once). Its buttons: Become a member, Not now (a week) and I'm already a member,-// which signs in with GitHub (Preferences > Updates > Member builds' sign-in): access to the member repository hides-// it for good and turns member builds on; no sign-in (cancelled, declined, no access) hides it for three months.+// for member builds (or verified once). Its buttons: Become a member, Not now (a week; after the 3rd a month; after+// the 6th only the first start after an update) and I'm already a member, which signs in with GitHub (Preferences >+// Updates > Member builds' sign-in): access to the member repository hides it for good and turns member builds on;+// no sign-in (cancelled, declined, no access) hides it for three months.// The full card at launch (the memberships side by side) shows on the first start only and from Help > Support.inline constexpr double kMemberCardSculptSeconds = 20.0 * 60.0; // active stroke time in this sessioninline constexpr double kSculptTimeMaxStep = 0.25; // one frame's share at most (a stall or a clock jump adds little)inline constexpr int64_t kMemberCardIntervalSeconds = 7 * 24 * 3600; // at most once a week (and "Not now")inline constexpr int64_t kMemberCardNoSignInSeconds = 90 * 24 * 3600; // "I'm already a member" without a sign-in+inline constexpr int64_t kMemberCardMonthlySeconds = 30 * 24 * 3600; // after the 3rd "Not now"+inline constexpr int kMemberCardMonthlyAfter = 3; // "Not now"s before the card is monthly+inline constexpr int kMemberCardUpdatesOnlyAfter = 6; // "Not now"s before it only comes with an update+// The milestones (once each): the 10th start, 10 hours of sculpting (stroke time, every session), the 100th save.+inline constexpr int kMilestoneStarts = 10;+inline constexpr double kMilestoneSculptSeconds = 10.0 * 3600.0;+inline constexpr int kMilestoneSaves = 100;// Adds one frame's `dt` seconds spent in a stroke to the sculpting time.inline double addSculptTime(double total, double dt) {@@ -135,6 +146,14 @@ struct SupportCardPrefs {int64_t shownAt = 0; // seconds since 1970 when a membership card last showed (0: never)int64_t hiddenUntil = 0; // "Not now" or a sign-in that didn't happen: nothing before this (0: none)std::string challengeSeen; // the last monthly challenge result the card knew of (latest.json's challenge.id)+ int notNow = 0; // "Not now"s so far (the backoff)+ int shownCount = 0; // small cards shown (which honest line comes next)+ // The milestones' counts, on this computer only (project.json; nothing is ever sent).+ int starts = 0; // interactive starts+ double sculptSeconds = 0.0; // stroke time, every session+ int saves = 0; // project saves+ unsigned milestonesShown = 0; // bits: 1 starts, 2 sculpting hours, 4 saves+ SupportFeed feed; // the last update check's "support" block (the card's honest line)};enum class SupportCardReason { None, FirstRun, Manual };@@ -145,16 +164,114 @@ inline SupportCardReason supportCardDue(const SupportCardPrefs& p, bool firstRunreturn SupportCardReason::FirstRun;}-enum class MemberMoment { None, Sculpted, SavedRender, Updated, Challenge };+enum class MemberMoment { None, Sculpted, SavedRender, Updated, Challenge, Starts, SculptHours, Saves };-// Whether a moment may bring the card at all (the weekly limit, the snooze, members): checked when the moment-// happens; a moment that may not is dropped, not saved for later.-inline bool memberMomentAllowed(const SupportCardPrefs& p, bool signedInMember, int64_t now, bool testMode) {+// How long between cards: a week; a month after the 3rd "Not now" (and from then on).+inline int64_t memberCardInterval(int notNow) {+ return notNow >= kMemberCardMonthlyAfter ? kMemberCardMonthlySeconds : kMemberCardIntervalSeconds;+}++// Whether a moment may bring the card at all (the weekly or monthly limit, the snooze, members; after the 6th "Not+// now", only an update's): checked when the moment happens; a moment that may not is dropped, not saved for later+// (a milestone stays due: it is checked again at the next start, save or sculpting minute).+inline bool memberMomentAllowed(const SupportCardPrefs& p, bool signedInMember, int64_t now, bool testMode,+ MemberMoment m = MemberMoment::None) {if (testMode || p.supporter || signedInMember) return false;+ if (p.notNow >= kMemberCardUpdatesOnlyAfter && m != MemberMoment::Updated) return false;// (a clock set back past a snooze, or a snooze longer than it can be, ends it: a damaged value can't hide it for good)if (p.hiddenUntil > now && p.hiddenUntil - now <= kMemberCardNoSignInSeconds) return false;- const int64_t since = now - p.shownAt;- return p.shownAt <= 0 || since >= kMemberCardIntervalSeconds || since <= -kMemberCardIntervalSeconds;+ const int64_t since = now - p.shownAt, interval = memberCardInterval(p.notNow);+ return p.shownAt <= 0 || since >= interval || since <= -interval;+}++inline unsigned milestoneBit(MemberMoment m) {+ return m == MemberMoment::Starts ? 1u : m == MemberMoment::SculptHours ? 2u : m == MemberMoment::Saves ? 4u : 0u;+}++// The milestone reached and not yet shown (starts first, then sculpting hours, then saves); None for none.+inline MemberMoment milestoneDue(const SupportCardPrefs& p) {+ const auto due = [&](MemberMoment m, bool reached) { return reached && !(p.milestonesShown & milestoneBit(m)); };+ if (due(MemberMoment::Starts, p.starts >= kMilestoneStarts)) return MemberMoment::Starts;+ if (due(MemberMoment::SculptHours, p.sculptSeconds >= kMilestoneSculptSeconds)) return MemberMoment::SculptHours;+ if (due(MemberMoment::Saves, p.saves >= kMilestoneSaves)) return MemberMoment::Saves;+ return MemberMoment::None;+}++// One line of the card, translatable: `format` (an English tr() key with at most one %d / %s pair) and its values.+struct CardLine {+ const char* format = nullptr; // nullptr: no line+ int a = 0, b = 0;+ std::string text; // the %s value (a list of names)+ bool textFirst = false; // the format takes %s before the numbers+};++// `format` is line.format or its translation (same placeholders, same order).+inline std::string formatCardLine(const CardLine& line, const char* format) {+ if (!line.format || !format) return {};+ char buf[512];+ if (line.textFirst) std::snprintf(buf, sizeof buf, format, line.text.c_str());+ else std::snprintf(buf, sizeof buf, format, line.a, line.b);+ return buf;+}++// The milestone's words, with the true number at the time it shows (the hours whole, rounded down).+inline CardLine milestoneLine(MemberMoment m, const SupportCardPrefs& p) {+ CardLine l;+ switch (m) {+ case MemberMoment::Starts:+ l.format = "You've opened SculptForge %d times. Members keep it free and growing.";+ l.a = p.starts;+ break;+ case MemberMoment::SculptHours:+ l.format = "You've sculpted %d hours in SculptForge. Members keep it free and growing.";+ l.a = int(std::min(p.sculptSeconds / 3600.0, 1e6));+ break;+ case MemberMoment::Saves:+ l.format = "You've saved your work %d times in SculptForge. Members keep it free and growing.";+ l.a = p.saves;+ break;+ default: break;+ }+ return l;+}++// The honest lines the feed's "support" block allows (none: the card keeps its usual Founding Members line). Only+// what the numbers say: no countdowns, no "only N left", nothing that isn't in the feed.+inline std::vector<CardLine> supportFeedLines(const SupportFeed& f) {+ std::vector<CardLine> out;+ if (!f.funded.empty()) {+ CardLine l;+ l.format = "Members funded this month: %s.";+ l.textFirst = true;+ for (size_t i = 0; i < f.funded.size(); ++i) {+ const std::string name = sanitizeSupporterName(f.funded[i]);+ if (name.empty()) continue;+ if (!l.text.empty()) l.text += ", ";+ l.text += name;+ }+ if (!l.text.empty()) out.push_back(std::move(l));+ }+ if (f.foundingLimit >= 1 && f.foundingTaken >= 0 && f.foundingTaken < f.foundingLimit) {+ CardLine l;+ l.format = "Founding Members so far: %d of %d. A badge, your name in the credits and your price locked for good.";+ l.a = f.foundingTaken, l.b = f.foundingLimit;+ out.push_back(std::move(l));+ }+ if (f.memberRequests > 0) {+ CardLine l;+ l.format = f.memberRequests == 1 ? "%d change in this release was a member's request."+ : "%d changes in this release were members' requests.";+ l.a = f.memberRequests;+ out.push_back(std::move(l));+ }+ return out;+}++// The line for the `shown`th card: the feed's lines in turn; no line (format nullptr) without them.+inline CardLine supportFeedLine(const SupportFeed& f, int shown) {+ const std::vector<CardLine> lines = supportFeedLines(f);+ if (lines.empty()) return {};+ return lines[size_t(std::max(0, shown)) % lines.size()];}// A moment allowed, the card waits for a calm frame: no stroke, no background job, no other card or dialog.@@ -169,12 +286,15 @@ inline bool sculptMomentDue(double sessionSculptSeconds, bool alreadyThisSessionenum class MemberCardChoice { Become, NotNow, SignedIn, NoSignIn };-// What a choice on the card leaves in the preferences. Become a member opens the checkout and counts as "Not now"-// (the card comes back in a week unless they sign in or say they're a member).+// What a choice on the card leaves in the preferences. Become a member opens the checkout and snoozes like "Not now"+// without counting as one (the card comes back in a week unless they sign in or say they're a member).inline void applyMemberCardChoice(SupportCardPrefs& p, MemberCardChoice c, int64_t now) {switch (c) {- case MemberCardChoice::Become:- case MemberCardChoice::NotNow: p.hiddenUntil = now + kMemberCardIntervalSeconds; break;+ case MemberCardChoice::Become: p.hiddenUntil = now + memberCardInterval(p.notNow); break;+ case MemberCardChoice::NotNow:+ p.notNow = std::min(p.notNow + 1, 1000);+ p.hiddenUntil = now + memberCardInterval(p.notNow);+ break;case MemberCardChoice::SignedIn: p.supporter = true; break;case MemberCardChoice::NoSignIn: p.hiddenUntil = now + kMemberCardNoSignInSeconds; break;}diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cppindex b8b4cea9..dd5eccd8 100644--- a/src/app/UiTest.cpp+++ b/src/app/UiTest.cpp@@ -1002,6 +1002,9 @@ double Demo::query(const std::string& name, bool& known) const {if (name == "member_card_open") return app_.memberCard_ != MemberMoment::None ? 1.0 : 0.0;if (name == "member_card_pending") return app_.memberMomentPending_ != MemberMoment::None ? 1.0 : 0.0;if (name == "member_card_verifying") return app_.memberVerifying_ ? 1.0 : 0.0;+ if (name == "member_card_not_now") return double(app_.supportCardPrefs_.notNow);+ if (name == "member_card_saves") return double(app_.supportCardPrefs_.saves);+ if (name == "member_card_milestones") return double(app_.supportCardPrefs_.milestonesShown);if (name == "member_signed_in") return app_.memberSignedIn() ? 1.0 : 0.0;if (name == "part_thumbnails") { // Part panel thumbnails rendered (#43)double n = 0.0;@@ -2348,13 +2351,15 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& e}run([this, firstRun, testMode] { app_.launchSupportCard(firstRun, app_.memberClock(), testMode); });} else if (verb == "member_card") {- // A good moment for the small membership card (Support.h): sculpted | render | updated | challenge | none,- // with `days=N` (the clock N days on from the test's start) and `sculpt_seconds=S` (this session's stroke time- // so far: the next frame decides the sculpting moment). UI tests otherwise never show it (test mode).+ // A good moment for the small membership card (Support.h): sculpted | render | updated | challenge |+ // milestone | none, with `days=N` (the clock N days on from the test's start), `sculpt_seconds=S` (this+ // session's stroke time so far: the next frame decides the sculpting moment), and the milestones' counts+ // `starts=N`, `sculpt_hours=H`, `saves=N` (`milestone` checks them now). UI tests otherwise never show it.if (!need(1)) return false;static const std::pair<const char*, MemberMoment> kMoments[] = {{"sculpted", MemberMoment::Sculpted}, {"render", MemberMoment::SavedRender},- {"updated", MemberMoment::Updated}, {"challenge", MemberMoment::Challenge}, {"none", MemberMoment::None}};+ {"updated", MemberMoment::Updated}, {"challenge", MemberMoment::Challenge}, {"none", MemberMoment::None},+ {"milestone", MemberMoment::None}};MemberMoment moment = MemberMoment::None;bool known = false;for (const auto& [n, m] : kMoments)@@ -2363,21 +2368,30 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& eerror = "member_card: unknown moment '" + w[1] + "'";return false;}- double days = -1.0, sculpt = -1.0;+ const bool milestone = w[1] == "milestone";+ double days = -1.0, sculpt = -1.0, hours = -1.0;+ int starts = -1, saves = -1;for (size_t i = 2; i < w.size(); ++i) {if (w[i].rfind("days=", 0) == 0) days = std::atof(w[i].c_str() + 5);else if (w[i].rfind("sculpt_seconds=", 0) == 0) sculpt = std::atof(w[i].c_str() + 15);+ else if (w[i].rfind("sculpt_hours=", 0) == 0) hours = std::atof(w[i].c_str() + 13);+ else if (w[i].rfind("starts=", 0) == 0) starts = std::atoi(w[i].c_str() + 7);+ else if (w[i].rfind("saves=", 0) == 0) saves = std::atoi(w[i].c_str() + 6);else {error = "member_card: unknown option '" + w[i] + "'";return false;}}- run([this, moment, days, sculpt] {+ run([this, moment, days, sculpt, milestone, hours, starts, saves] {app_.memberCardTestMode_ = true;if (days >= 0.0) app_.memberClockOffset_ = int64_t(days * 86400.0);if (sculpt >= 0.0) app_.sessionSculptSeconds_ = sculpt;+ if (hours >= 0.0) app_.supportCardPrefs_.sculptSeconds = hours * 3600.0;+ if (starts >= 0) app_.supportCardPrefs_.starts = starts;+ if (saves >= 0) app_.supportCardPrefs_.saves = saves;if (moment == MemberMoment::Challenge) app_.challengeTitle_ = "Creatures";- app_.memberMoment(moment);+ if (milestone) app_.memberMilestoneCheck();+ else app_.memberMoment(moment);});} else if (verb == "member_sign_in") {// Ends the GitHub sign-in that is running (UI tests never reach GitHub): `ok` (the account can read thediff --git a/src/core/UpdateCheck.cpp b/src/core/UpdateCheck.cppindex 0f191011..a2aecbb4 100644--- a/src/core/UpdateCheck.cpp+++ b/src/core/UpdateCheck.cpp@@ -74,6 +74,18 @@ bool readRelease(const Json& j, UpdateInfo& info) {return true;}+// Feed text as it may be shown: no control characters, cut to `max` bytes on a UTF-8 boundary.+std::string feedText(const std::string& in, size_t max) {+ std::string out;+ for (char c : in) // (UTF-8 kept whole below)+ if (static_cast<unsigned char>(c) >= 0x20 && c != 0x7f) out += c;+ if (out.size() > max) {+ size_t cut = max;+ while (cut > 0 && (static_cast<unsigned char>(out[cut]) & 0xC0) == 0x80) --cut;+ out.resize(cut);+ }+ return out;+}} // namespacebool parseUpdateFeed(const std::string& json, UpdateInfo& out, std::string& error, UpdateChannel channel) {@@ -102,18 +114,29 @@ bool parseUpdateFeed(const std::string& json, UpdateInfo& out, std::string& erro});if (idOk) {info.challengeId = id;- if (challenge["title"].isString()) {- std::string title;- for (char c : challenge["title"].asString()) // (no control characters; UTF-8 kept whole below)- if (static_cast<unsigned char>(c) >= 0x20 && c != 0x7f) title += c;- if (title.size() > 48) {- size_t cut = 48;- while (cut > 0 && (static_cast<unsigned char>(title[cut]) & 0xC0) == 0x80) --cut;- title.resize(cut);- }- info.challengeTitle = title;+ if (challenge["title"].isString()) info.challengeTitle = feedText(challenge["title"].asString(), 48);+ }+ }+ const Json& support = j["support"];+ if (support.isObject()) {+ SupportFeed& f = info.support;+ f.present = true;+ if (support["funded_this_month"].isArray())+ for (const Json& n : support["funded_this_month"].items()) {+ if (f.funded.size() >= 5) break;+ if (!n.isString()) continue;+ std::string name = feedText(n.asString(), 48);+ if (name.find_first_not_of(' ') != std::string::npos) f.funded.push_back(std::move(name));}+ auto count = [](const Json& v) { // a whole number 0..100000, else -1+ const double d = v.isNumber() ? v.asNumber(-1.0) : -1.0;+ return d >= 0.0 && d <= 100000.0 && d == double(int(d)) ? int(d) : -1;+ };+ if (support["founding"].isObject()) {+ const int taken = count(support["founding"]["taken"]), limit = count(support["founding"]["limit"]);+ if (taken >= 0 && limit >= 1 && taken <= limit) f.foundingTaken = taken, f.foundingLimit = limit;}+ f.memberRequests = count(support["member_requests_this_release"]);}out = std::move(info);return true;diff --git a/src/core/UpdateCheck.h b/src/core/UpdateCheck.hindex 324b71ad..86cfd36a 100644--- a/src/core/UpdateCheck.h+++ b/src/core/UpdateCheck.h@@ -17,6 +17,17 @@ inline constexpr const char* kUpdateFeedUrl = "https://sculptforge.app/latest.jsinline constexpr const char* kUpdateFeedMirrorUrl = "https://islandmed.github.io/latest.json";inline constexpr int64_t kUpdateCheckInterval = 24 * 60 * 60; // seconds+// The membership card's honest line (the feed's optional "support" block, app/Support.h): {"funded_this_month":+// ["Cloth brush", ...], "founding": {"taken": 2, "limit": 100}, "member_requests_this_release": 3}. Only real+// numbers the coordinator writes by hand; anything missing or odd stays unset (-1, empty) and the card keeps its+// usual words. Names printable text (48 bytes at most, 5 at most).+struct SupportFeed {+ bool present = false; // the feed had a "support" object+ std::vector<std::string> funded; // funded this month+ int foundingTaken = -1, foundingLimit = -1;+ int memberRequests = -1; // features in this release that members asked for+};+struct UpdateInfo {std::string version; // "0.6.0"std::string downloadUrl; // the download page@@ -28,6 +39,7 @@ struct UpdateInfo {// "Creatures"}): the membership card's moment, once per id. Empty when missing or odd; id letters, digits and// '-' (32 at most), title printable text (48 bytes at most).std::string challengeId, challengeTitle;+ SupportFeed support;};// Which releases the update check offers (Preferences > Updates): Stable, or Preview, which adds the betasdiff --git a/tests/test_support.cpp b/tests/test_support.cppindex 1ea91dac..b466337b 100644--- a/tests/test_support.cpp+++ b/tests/test_support.cpp@@ -191,3 +191,117 @@ TEST(support_card_timing) {member.supporter = true;CHECK(supportCardDue(member, true, false) == SupportCardReason::None);}++TEST(member_card_backoff) {+ const int64_t day = 24 * 3600, now = 1'800'000'000;+ SupportCardPrefs p;+ // Weekly for the first two "Not now"s.+ for (int i = 1; i <= 2; ++i) {+ p.shownAt = now;+ applyMemberCardChoice(p, MemberCardChoice::NotNow, now);+ CHECK(p.notNow == i);+ CHECK(!memberMomentAllowed(p, false, now + 6 * day, false));+ CHECK(memberMomentAllowed(p, false, now + 7 * day, false));+ }+ // After the 3rd: monthly (the snooze and the gap between cards).+ applyMemberCardChoice(p, MemberCardChoice::NotNow, now);+ CHECK(p.notNow == 3);+ CHECK(!memberMomentAllowed(p, false, now + 29 * day, false));+ CHECK(memberMomentAllowed(p, false, now + 30 * day, false));+ p.hiddenUntil = 0;+ CHECK(!memberMomentAllowed(p, false, now + 8 * day, false)); // shown a week ago: not yet+ // Become a member snoozes as long without counting as a "Not now".+ SupportCardPrefs b = p;+ applyMemberCardChoice(b, MemberCardChoice::Become, now);+ CHECK(b.notNow == 3 && b.hiddenUntil == now + 30 * day);+ // After the 6th: only the first start after an update (still at most monthly).+ for (int i = 0; i < 3; ++i) applyMemberCardChoice(p, MemberCardChoice::NotNow, now);+ CHECK(p.notNow == 6);+ for (MemberMoment m : {MemberMoment::Sculpted, MemberMoment::SavedRender, MemberMoment::Challenge, MemberMoment::Starts,+ MemberMoment::SculptHours, MemberMoment::Saves, MemberMoment::None})+ CHECK(!memberMomentAllowed(p, false, now + 60 * day, false, m));+ CHECK(!memberMomentAllowed(p, false, now + 29 * day, false, MemberMoment::Updated));+ CHECK(memberMomentAllowed(p, false, now + 60 * day, false, MemberMoment::Updated));+ // Members and tests: never, whatever the moment.+ CHECK(!memberMomentAllowed(p, true, now + 60 * day, false, MemberMoment::Updated));+ CHECK(!memberMomentAllowed(p, false, now + 60 * day, true, MemberMoment::Updated));+}++TEST(member_card_milestones) {+ SupportCardPrefs p;+ CHECK(milestoneDue(p) == MemberMoment::None);+ p.starts = kMilestoneStarts - 1;+ p.sculptSeconds = kMilestoneSculptSeconds - 1.0;+ p.saves = kMilestoneSaves - 1;+ CHECK(milestoneDue(p) == MemberMoment::None);+ // The 10th start, 10 hours of sculpting, the 100th save; each once, in that order when several are due.+ p.starts = 14;+ p.sculptSeconds = 12.7 * 3600.0;+ p.saves = 100;+ CHECK(milestoneDue(p) == MemberMoment::Starts);+ p.milestonesShown |= milestoneBit(MemberMoment::Starts);+ CHECK(milestoneDue(p) == MemberMoment::SculptHours);+ p.milestonesShown |= milestoneBit(MemberMoment::SculptHours);+ CHECK(milestoneDue(p) == MemberMoment::Saves);+ p.milestonesShown |= milestoneBit(MemberMoment::Saves);+ CHECK(milestoneDue(p) == MemberMoment::None);+ CHECK(milestoneBit(MemberMoment::Sculpted) == 0);+ // The words state the true number as it shows (hours whole, rounded down).+ auto words = [&](MemberMoment m) {+ const CardLine l = milestoneLine(m, p);+ return formatCardLine(l, l.format);+ };+ CHECK(words(MemberMoment::Starts) == "You've opened SculptForge 14 times. Members keep it free and growing.");+ CHECK(words(MemberMoment::SculptHours) == "You've sculpted 12 hours in SculptForge. Members keep it free and growing.");+ CHECK(words(MemberMoment::Saves) == "You've saved your work 100 times in SculptForge. Members keep it free and growing.");+ CHECK(words(MemberMoment::Updated).empty());+ // A milestone still counts against the weekly limit like any moment.+ const int64_t day = 24 * 3600, now = 1'800'000'000;+ SupportCardPrefs q;+ q.shownAt = now;+ CHECK(!memberMomentAllowed(q, false, now + 3 * day, false, MemberMoment::Starts));+ CHECK(memberMomentAllowed(q, false, now + 7 * day, false, MemberMoment::Starts));+}++TEST(member_card_feed_lines) {+ // No "support" block: no line (the card keeps its Founding Members words).+ SupportFeed none;+ CHECK(supportFeedLines(none).empty());+ CHECK(supportFeedLine(none, 3).format == nullptr);+ // The feed's block, parsed and checked (core/UpdateCheck.h).+ UpdateInfo u;+ std::string err;+ CHECK(parseUpdateFeed(R"({"version": "9.0.0", "download": "https://sculptforge.app/#download",+ "support": {"funded_this_month": ["Cloth brush", "Faster \u0007remesh", 7, "", "c", "d", "e", "f"],+ "founding": {"taken": 2, "limit": 100}, "member_requests_this_release": 3}})",+ u, err));+ CHECK(u.support.present);+ CHECK(u.support.funded.size() == 5 && u.support.funded[1] == "Faster remesh");+ CHECK(u.support.foundingTaken == 2 && u.support.foundingLimit == 100 && u.support.memberRequests == 3);+ const std::vector<CardLine> lines = supportFeedLines(u.support);+ CHECK(lines.size() == 3);+ auto words = [](const CardLine& l) { return formatCardLine(l, l.format); };+ CHECK(words(lines[0]) == "Members funded this month: Cloth brush, Faster remesh, c, d, e.");+ CHECK(words(lines[1]) ==+ "Founding Members so far: 2 of 100. A badge, your name in the credits and your price locked for good.");+ CHECK(words(lines[2]) == "3 changes in this release were members' requests.");+ // They take turns, card by card.+ CHECK(words(supportFeedLine(u.support, 0)) == words(lines[0]));+ CHECK(words(supportFeedLine(u.support, 4)) == words(lines[1]));+ // Odd values are left out, never guessed: a full founding list, taken over the limit, fractions, negatives.+ UpdateInfo odd;+ CHECK(parseUpdateFeed(R"({"version": "9.0.0", "download": "https://sculptforge.app/#download",+ "support": {"founding": {"taken": 120, "limit": 100}, "member_requests_this_release": 2.5}})",+ odd, err));+ CHECK(odd.support.present && odd.support.foundingTaken == -1 && odd.support.memberRequests == -1);+ CHECK(supportFeedLines(odd.support).empty());+ SupportFeed full;+ full.foundingTaken = full.foundingLimit = 100;+ full.memberRequests = 1;+ const std::vector<CardLine> one = supportFeedLines(full); // (no founding line once they're all taken)+ CHECK(one.size() == 1 && words(one[0]) == "1 change in this release was a member's request.");+ // No block at all: not present.+ UpdateInfo plain;+ CHECK(parseUpdateFeed(R"({"version": "9.0.0", "download": "https://sculptforge.app/#download"})", plain, err));+ CHECK(!plain.support.present);+}diff --git a/tests/ui/data/update_support.json b/tests/ui/data/update_support.jsonnew file mode 100644index 00000000..ea3ccfc4--- /dev/null+++ b/tests/ui/data/update_support.json@@ -0,0 +1,3 @@+{"version": "0.1.0", "download": "https://islandmed.github.io/SculptForge/#download",+ "support": {"funded_this_month": ["Cloth brush", "Faster remesh"], "founding": {"taken": 2, "limit": 100},+ "member_requests_this_release": 3}}diff --git a/tests/ui/studio/studio_mode.sfui b/tests/ui/studio/studio_mode.sfuiindex ff46871f..e5517813 100644--- a/tests/ui/studio/studio_mode.sfui+++ b/tests/ui/studio/studio_mode.sfui@@ -3,6 +3,9 @@# the studio's mirror (a file here that doesn't exist: nothing is asked of the internet).run ui_look look=classic layout=classicrun new_sphere subdivisions=3+# A Studio member's own build: no membership heart (nor badge) in the top bar.+expect_not "Support SculptForge##topbar.heart"+expect_not "Member##topbar.member"click "Help##palette.help"click "About SculptForge##help.about"expect_text "Studio build for Example Studio"diff --git a/tests/ui/support/support_shots.sfui b/tests/ui/support/support_shots.sfuinew file mode 100644index 00000000..476169ba--- /dev/null+++ b/tests/ui/support/support_shots.sfui@@ -0,0 +1,36 @@+# Screenshots of the membership moments at 1440 and 1024 px wide (CMakeLists.txt: ui_support_shots_1440 / _1024):+# the top bar's heart in the Classic and the SculptForge looks (it gives way before crowding a narrow bar), the+# milestone card, the card with the feed's honest line, and a member's badge. Nothing size-dependent is asserted here;+# support_moments.sfui checks the behaviour.+run ui_look look=classic layout=classic+run new_sphere subdivisions=3+wait_idle+shot heart-classic+member_card milestone days=0 starts=12+wait 0.4+shot card-milestone-classic+click "Not now##member_card.not_now"+env SF_UPDATE_FEED $SCRIPT_DIR/../data/update_support.json+click "Help##palette.help"+click "Check for updates##help.check_updates"+wait_idle 20+wait 0.2+member_card milestone days=8 sculpt_hours=12.6+wait 0.4+shot card-feed-classic+click "Not now##member_card.not_now"++run ui_look look=forge layout=sculptforge+wait 0.2+shot heart-forge+member_card render days=16+wait 0.4+shot card-feed-forge+click "I'm already a member##member_card.already"+wait 0.3+member_sign_in ok+wait 0.4+shot badge-forge+run ui_look look=classic layout=classic+wait 0.2+shot badge-classicdiff --git a/tests/ui/support_moments.sfui b/tests/ui/support_moments.sfuinew file mode 100644index 00000000..bc716159--- /dev/null+++ b/tests/ui/support_moments.sfui@@ -0,0 +1,115 @@+# Membership moments for returning users (Support.h, PanelSupportCard.cpp): milestones (the 10th start, 10 hours of+# sculpting, the 100th save; counted on this computer only) with the true number, the feed's honest line (latest.json's+# "support"), the backoff (after the 3rd Not now monthly, after the 6th only with an update) and the top bar's quiet+# heart (Help > Support SculptForge), a member's badge instead. Every rule of the card stays: never modal, never+# mid-stroke, never in tests (member_card lets the moments through), never for members.+run ui_look look=classic layout=classic # written for the Classic look and the classic palette bar and shelves+run new_sphere subdivisions=3+wait_idle++# The heart: Help > Support SculptForge (the membership page; UI tests never start a browser).+expect "Support SculptForge##topbar.heart"+expect_not "Member##topbar.member"+click "Support SculptForge##topbar.heart"+expect_value support_requests == 1+expect_status https://sculptforge.app/support.html++# A test-mode start counts nothing: no milestone.+member_card milestone days=0+wait 0.3+expect_value member_card_open == 0++# The 10th start (here the 12th): the true number.+member_card milestone days=0 starts=12+wait 0.4+expect_value member_card_open == 1+expect_text You've opened SculptForge 12 times. Members keep it free and growing.+expect_text Founding Members+expect "Not now##member_card.not_now"+expect_value member_card_milestones == 1+shot milestone-starts+click "Not now##member_card.not_now"+expect_value member_card_not_now == 1+# Once each: the starts milestone doesn't come back.+member_card milestone days=8 starts=40+wait 0.3+expect_value member_card_open == 0++# 10 hours of sculpting (stroke time, every session; whole hours, rounded down).+member_card milestone days=12 sculpt_hours=12.6+wait 0.4+expect_value member_card_open == 1+expect_text You've sculpted 12 hours in SculptForge. Members keep it free and growing.+shot milestone-hours+click "Not now##member_card.not_now"+expect_value member_card_not_now == 2++# The feed's "support" block: honest lines in turn instead of the Founding Members line (this is the 3rd card: the+# third line).+env SF_UPDATE_FEED $SCRIPT_DIR/data/update_support.json+click "Help##palette.help"+click "Check for updates##help.check_updates"+wait_idle 20+wait 0.2+# The 100th save: a real save counts (Ctrl+S; UI tests count once member_card has run). The card waits for its week.+run save_project path=sf_ui_support_moments.sfproj+member_card none days=24 saves=99+key ctrl+s+wait 0.4+expect_value member_card_saves == 100+expect_value member_card_open == 1+expect_text You've saved your work 100 times in SculptForge. Members keep it free and growing.+expect_text 3 changes in this release were members' requests.+expect_no_text The first 100 members are Founding Members+shot milestone-saves-feed+click "Not now##member_card.not_now"+expect_value member_card_not_now == 3+# The next card: the feed's next line.+member_card render days=60+wait 0.4+expect_value member_card_open == 1+expect_text Nice render.+expect_text Members funded this month: Cloth brush, Faster remesh.+shot feed-funded++# After the 3rd Not now: monthly. (Shown on day 60: day 80 brings nothing, day 90 does.)+click "Not now##member_card.not_now"+expect_value member_card_not_now == 4+member_card render days=80+wait 0.3+expect_value member_card_open == 0+member_card render days=90.1+wait 0.4+expect_value member_card_open == 1+expect_text Founding Members so far: 2 of 100.+click "Not now##member_card.not_now"+member_card render days=121+wait 0.4+expect_value member_card_open == 1+click "Not now##member_card.not_now"+expect_value member_card_not_now == 6+# After the 6th: only the first start after an update (and still at most monthly).+member_card render days=200+member_card sculpted days=200+member_card challenge days=200+member_card milestone days=200 starts=500+wait 0.3+expect_value member_card_open == 0+expect_value member_card_pending == 0+member_card updated days=200+wait 0.4+expect_value member_card_open == 1+expect_text is here. Members get new versions early, as betas.++# A member: the heart becomes a small badge (no count, nothing that moves), and no more cards.+click "I'm already a member##member_card.already"+wait 0.3+member_sign_in ok+wait 0.4+expect_value supporter == 1+expect "Member##topbar.member"+expect_not "Support SculptForge##topbar.heart"+member_card updated days=400+wait 0.3+expect_value member_card_open == 0+shot member-badge