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
Review fixes on today's main: Freeze Levels + Dynamic, mask tint + Mask darkness, wireframe fade, Extract 'Mask first', View > Views, accent toggles, guide smoothing, level confirms (WIP, unbuilt)
islandmed9f56c97401c9
diff --git a/docs/guide/dynamic-topology.md b/docs/guide/dynamic-topology.mdindex c33625dc..bba0bca5 100644--- a/docs/guide/dynamic-topology.md+++ b/docs/guide/dynamic-topology.md@@ -68,9 +68,10 @@ It is a preference (saved automatically) and is saved with the project; from a s## Subdivision levelsDynamic topology works on meshes without [subdivision levels](subdivision-levels.md). On a Part-with levels, **Dynamic** stays off and the status bar says why: go to the level you want to keep and use **Delete-Lower** and **Delete Higher** in **Tool > Geometry** first. If you turn it on and then pick a Part that has-levels, strokes sculpt it without remeshing.+with levels, clicking **Dynamic** offers **Freeze Levels and Turn On Dynamic**: the level you see becomes one plain+mesh and the other levels go (<kbd>Ctrl</kbd>+<kbd>Z</kbd> brings them back). To keep a different level, go to it+first. If you turn Dynamic on and then pick a Part that has levels, strokes sculpt it without remeshing, and the+Draw palette shows the same **Freeze Levels + Dynamic** button.A good workflow: block in with Dynamic, then [Quad Remesh](retopology.md) or [Voxel Remesh](geometry.md) for an evenbase, **Divide** for levels, and sculpt the fine detail on them.diff --git a/docs/guide/geometry.md b/docs/guide/geometry.mdindex bd9ee0c0..cfeea40b 100644--- a/docs/guide/geometry.md+++ b/docs/guide/geometry.md@@ -39,7 +39,8 @@ glTF (`.glb`) and STL only hold triangles, so those exports always write triangl## SubdivideFor sculpting at several resolutions use **Divide** (<kbd>Ctrl</kbd>+<kbd>D</kbd>), which keeps the lower levels to-step back to: see [Subdivision levels](subdivision-levels.md). **Subdivide** is the one-way version.+step back to: see [Subdivision levels](subdivision-levels.md). **Subdivide (removes levels)** is the one-way+version; on a Part with levels it asks before removing them.**Tool > Geometry > Subdivide** smooths the mesh with Loop subdivision. Each levelmultiplies the triangle count by four and rounds off the shape slightly.diff --git a/docs/guide/navigation.md b/docs/guide/navigation.mdindex 6e2a1f82..0fe7eff3 100644--- a/docs/guide/navigation.md+++ b/docs/guide/navigation.md@@ -198,6 +198,14 @@ every visible Part, plus the Gaussian splats when they are shown. SculptForge fryou open a file or start from a new primitive. Use it after panning far away, or when a model comes in at anunusual scale.+## Saved views++**View > Views** (the Render palette in the Classic layout) has a button for each axis view (Front, Back,+Left, Right, Top, Bottom) and your own saved cameras. Type a name (or leave it empty for "View 1", "View 2" ...)+and click **Save View** (<kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Numpad 0</kbd>); saving under a name that exists+replaces it. Click a name to go back to that view, or press <kbd>Numpad 0</kbd> for the one used last; **x** forgets+it. Saved views are kept in the project.+## Display toggles that help navigationThese live on the right shelf and in the **View** menu:@@ -206,7 +214,7 @@ These live on the right shelf and in the **View** menu:the surface as a wireframe. Quads show as quads (see [Quads and triangles](geometry.md#quads-and-triangles)).Useful for judging mesh density before you subdivide or remesh.- **Groups**: colours each face group.-- **Mask**: darkens masked areas.+- **Mask**: tints masked areas dark (how dark: **Mask darkness** in Preferences > Interface).- **Paint**: shows vertex paint colours (off shows the plain material).- **Solo**: shows only the active Part, to get at parts hidden behind others.- **Show Mesh** (**View** menu): hides the sculpt, for example to look at a splat capture on its own.@@ -217,9 +225,9 @@ These live on the right shelf and in the **View** menu:## Not yet> **Not yet:** SculptForge has no rotation around the point under the cursor (the-> camera always orbits its target, which Frame sets to the scene centre), no floor grid and no saved camera-> views. Pan the target onto the area you're working on to orbit around it, or zoom there with the wheel and-> **Wheel zooms toward the pointer** on: that moves the target toward the point under the pointer too.+> camera always orbits its target, which Frame sets to the scene centre) and no floor grid. Pan the target onto+> the area you're working on to orbit around it, or zoom there with the wheel and **Wheel zooms toward the pointer**+> on: that moves the target toward the point under the pointer too.## See alsodiff --git a/docs/guide/shortcuts.md b/docs/guide/shortcuts.mdindex e6aea9d0..7b9412b7 100644--- a/docs/guide/shortcuts.md+++ b/docs/guide/shortcuts.md@@ -174,8 +174,10 @@ generated from SculptForge's action registry, the same source as the Controls wi| Orbit right | <kbd>Numpad 6</kbd> | Turn the view 15 degrees to the right around the model. || Orbit up | <kbd>Numpad 8</kbd> | Turn the view 15 degrees up over the model. || Orthographic | <kbd>Numpad 5</kbd> | Switch between a perspective and an orthographic view (no foreshortening: sizes don't shrink with depth). |+| Restore View | <kbd>Numpad 0</kbd> | Go back to the view saved or restored last (View > Views). || Right view | <kbd>Numpad 3</kbd> | Look at the model's right side (orthographic). || Rotate | <kbd>R</kbd> | Gizmo, Rotate: drag a ring to turn about that axis, the outer ring to turn in the view. Mask the body and put the pivot at a joint to pose a limb. Shift snaps to 15 degrees. R again: back to Draw. |+| Save View | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Numpad 0</kbd> | Remember this camera as a named view (View > Views; the name field names it). Saved with the project. || Scale | <kbd>E</kbd> | Gizmo, Scale: drag a box to stretch along an axis or the centre to scale evenly (right or up: bigger). Shift snaps to 10% steps. E again: back to Draw. || Top view | <kbd>Numpad 7</kbd> | Look down on the model (orthographic). || X | <kbd>X</kbd> | Mirror strokes across X (left and right). |diff --git a/docs/guide/subdivision-levels.md b/docs/guide/subdivision-levels.mdindex 20f13054..efa3902a 100644--- a/docs/guide/subdivision-levels.md+++ b/docs/guide/subdivision-levels.md@@ -112,8 +112,10 @@ keeping the dense mesh exactly as it was. Press it again for more levels.at the level you were on. Merging and splitting Parts can't be undone, so step to the levelyou want to keep first, or save before.-> **Note:** **Subdivide** (in **Tool > Geometry**, below Divide) is still there: it replaces the mesh with a-> denser one and keeps no levels. Use Divide unless you want exactly that.+> **Note:** **Subdivide (removes levels)** (in **Tool > Geometry**, under **Change the Mesh (no levels)**, apart+> from Divide and Micro) replaces the mesh with a denser one and keeps no levels. On a Part with levels it asks+> first ("This removes your N subdivision levels"); **Don't ask again** turns that off. **Delete Lower** and **Delete+> Higher** ask too. Use **Divide (keeps levels)** unless you want exactly that.## Commandsdiff --git a/src/app/App.cpp b/src/app/App.cppindex f6b8af96..de9b2e80 100644--- a/src/app/App.cpp+++ b/src/app/App.cpp@@ -2125,7 +2125,8 @@ void App::beginStroke(float x, float y, const RayHit& hit) {if (!lods_.empty() || previewLod_ >= 0) clearLods();beginPaintStroke();if (doc_.sculptor.dyntopo.enabled && strokeSculpt_ && !dyntopoBlocker(doc_.mesh).empty())- status_ = "Dynamic is on, but this Part has subdivision levels: sculpting without remeshing";+ status_ = "Dynamic is on, but this Part has subdivision levels: sculpting without remeshing (Draw > Freeze "+ "Levels + Dynamic)";lastX_ = x;lastY_ = y;strokePath_.reset(x, y);@@ -2828,6 +2829,7 @@ void App::drawUi() {// An Extract preview goes once its source changes or another Part is picked (strokes aren't commands).if (doc_.extractPreview.id && !doc_.sculptor.strokeActive()) doc_.dropExtractPreview(true);drawProjectPopups();+ drawDynamicOffer();if (hideUi_) return; // demos: clean beauty shots// Draw order (ui-spec §12): shells, Library, floating windows, then pop-ups and help.drawShell();diff --git a/src/app/App.h b/src/app/App.hindex 68a2010b..7eb593bd 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -132,6 +132,7 @@ class App {public:App();+ void setMaskDarkness(float k); // 0-1: the preference and the view (Preferences > Interface, Tool > Masking)~App();bool init(const AppOptions& options);const std::string& startError() const { return startError_; } // why init failed, for the message box (#109)@@ -190,6 +191,15 @@ private:// Dynamic topology (dynamic topology, core/Dyntopo.h): turns it on or off (not on a mesh with// subdivision levels), saying so in the status bar; the Detail slider.void setDynamic(bool on);+ // Dynamic on a Part with subdivision levels: Freeze Levels (one undo step), then Dynamic on.+ void freezeLevelsAndDynamic();+ void drawDynamicOffer(); // the pop-up setDynamic opens instead of a dead-end message+ bool openDynamicOffer_ = false;+ // Delete Lower / Delete Higher from the interface: a confirmation naming the levels that go (scripts run directly).+ void confirmLevelDelete(const std::string& command);+ std::string pendingLevelDelete_;+ bool openLevelDelete_ = false;+ bool openSubdivideConfirm_ = false; // Subdivide on a Part with levels: confirm first (Shell.cpp)void drawDetailSlider(const char* id);void runCommand(const std::string& name, const Args& args = {});@@ -1858,6 +1868,17 @@ private:// every style. Import Blender keymap reads a keymap exported from Blender (BlenderKeymap.h).void registerViewActions();void viewAxis(float yawDegrees, float pitchDegrees); // Numpad 1 / 3 / 7: orthographic until turned+ // Saved views (View > Views): named cameras, kept in the project (projectSettings "views").+ struct SavedView {+ std::string name;+ Camera camera;+ };+ std::vector<SavedView> savedViews_;+ int lastSavedView_ = -1; // Numpad 0 restores it+ char savedViewName_[48] = "";+ void saveView(const std::string& name = {}); // a free name ("View 3") when empty; the same name replaces+ void restoreView(int index);+ void drawViewsSection(); // Palettes.cpp, in Viewvoid viewOrbitStep(float yawDegrees, float pitchDegrees);void frameActivePart();// Focus Detail (prototype, FocusDetailApp.cpp): open a .sfdetail file; once a frame, the camera and brush.diff --git a/src/app/Config.cpp b/src/app/Config.cppindex eaddc6e4..b31a1baf 100644--- a/src/app/Config.cpp+++ b/src/app/Config.cpp@@ -136,6 +136,8 @@ Json toJson(const UiPrefs& p) {j.set("backfaceCulling", p.backfaceCulling);j.set("uvPackColumns", double(p.uvPackColumns));j.set("uvPackRows", double(p.uvPackRows));+ j.set("maskDarkness", double(p.maskDarkness));+ j.set("confirmSubdivide", p.confirmSubdivide);j.set("background", std::string(p.gradientBackground ? "gradient" : "flat"));Json bg = Json::array();for (int i = 0; i < 3; ++i) bg.push(double(p.backgroundColor[i]));@@ -226,6 +228,8 @@ void fromJson(const Json& j, UiPrefs& p) {p.backfaceCulling = j["backfaceCulling"].asBool(p.backfaceCulling);p.uvPackColumns = std::clamp(int(j["uvPackColumns"].asNumber(p.uvPackColumns)), 1, 10);p.uvPackRows = std::clamp(int(j["uvPackRows"].asNumber(p.uvPackRows)), 1, 10);+ p.maskDarkness = std::clamp(float(j["maskDarkness"].asNumber(p.maskDarkness)), 0.0f, 1.0f);+ p.confirmSubdivide = j["confirmSubdivide"].asBool(p.confirmSubdivide);if (j["background"].isString()) p.gradientBackground = j["background"].asString() != "flat";p.showHints = j["showHints"].asBool(p.showHints);if (const Json& hints = j["hiddenHints"]; hints.size() > 0) {@@ -392,16 +396,26 @@ void App::initActions() {[this] { return doc_.undo.canUndo(); });add("edit.redo", "Redo", "Edit", "Ctrl+Shift+Z / Ctrl+Y", [this] { runCommand("redo"); }, ICON_LC_REDO_2, "redo", nullptr,[this] { return doc_.undo.canRedo(); });- add("geometry.subdivide", "Subdivide", "Tool > Geometry", nullptr, [this] { runCommand("subdivide"); }, nullptr, "subdivide");+ // Subdivide bakes: it keeps no levels, and on a Part with levels it removes them. Named and placed apart from+ // Divide, and it asks first on a Part with levels (Discord 11-02: "I keep pressing the wrong one").+ add("geometry.subdivide", "Subdivide (removes levels)", "Tool > Geometry", nullptr,+ [this] {+ if (doc_.mesh.multires && uiPrefs_.confirmSubdivide) openSubdivideConfirm_ = true;+ else runCommand("subdivide");+ },+ nullptr, "subdivide", nullptr, nullptr,+ "Destructive: four times the polygons as one plain mesh, with no lower levels to step back to. On a Part "+ "with subdivision levels it removes them (it asks first; Ctrl+Z brings them back). To keep levels, use "+ "Divide (keeps levels) instead.");add("geometry.close_holes", "Close Holes", "Tool > Geometry", nullptr, [this] { runCommand("close_holes"); },ICON_LC_CIRCLE_DOT, "close_holes", nullptr, nullptr,"Cap every open boundary of the active Part (a hole, an open bottom, the rim of an extracted shell) with a ""new patch sized like the polygons around it, so remeshing and sculpting see a closed surface. The rest of ""the Part stays as it is; the patches get a face group of their own (#103).");// Subdivision levels (Tool > Geometry; core/Multires.h).- add("geometry.divide", "Divide", "Tool > Geometry", "Ctrl+D", [this] { runCommand("subdiv_divide", {{"smooth", smt_}}); },+ add("geometry.divide", "Divide (keeps levels)", "Tool > Geometry", "Ctrl+D", [this] { runCommand("subdiv_divide", {{"smooth", smt_}}); },ICON_LC_GRID_2X2, "subdiv_divide", nullptr, nullptr,- "Add a subdivision level: four times the polygons, and the lower levels are kept, so you can step down to "+ "Non-destructive: add a subdivision level: four times the polygons, and the lower levels are kept, so you can step down to ""shape big forms and back up to the detail. Quads stay quads (Catmull-Clark). Smt off divides without smoothing.");add("geometry.smt", "Smt", "Tool > Geometry", nullptr, [this] { smt_ = !smt_; }, nullptr, nullptr,[this] { return smt_; }, nullptr,@@ -413,9 +427,9 @@ void App::initActions() {ICON_LC_CHEVRON_UP, "subdiv_higher", nullptr,[this] { return subdivCurrentLevel(doc_.mesh) + 1 < subdivLevelCount(doc_.mesh); },"Step one subdivision level up (more polygons, for detail). Edits made below carry the detail along.");- add("geometry.del_lower", "Delete Lower", "Tool > Geometry", nullptr, [this] { runCommand("subdiv_delete_lower"); }, nullptr,+ add("geometry.del_lower", "Delete Lower", "Tool > Geometry", nullptr, [this] { confirmLevelDelete("subdiv_delete_lower"); }, nullptr,"subdiv_delete_lower", nullptr, [this] { return subdivCurrentLevel(doc_.mesh) > 0; });- add("geometry.del_higher", "Delete Higher", "Tool > Geometry", nullptr, [this] { runCommand("subdiv_delete_higher"); }, nullptr,+ add("geometry.del_higher", "Delete Higher", "Tool > Geometry", nullptr, [this] { confirmLevelDelete("subdiv_delete_higher"); }, nullptr,"subdiv_delete_higher", nullptr,[this] { return subdivCurrentLevel(doc_.mesh) + 1 < subdivLevelCount(doc_.mesh); });add("geometry.reconstruct", "Reconstruct Subdiv", "Tool > Geometry", nullptr, [this] { runCommand("subdiv_reconstruct"); },@@ -1017,6 +1031,7 @@ bool App::readUiConfig(const std::string& path, std::string& err, bool own) {renderSettings_.flatShading = uiPrefs_.flatShading;renderSettings_.backfaceCulling = uiPrefs_.backfaceCulling;uvPackColumns_ = uiPrefs_.uvPackColumns, uvPackRows_ = uiPrefs_.uvPackRows;+ renderSettings_.maskDarkness = uiPrefs_.maskDarkness;renderSettings_.gradientBackground = uiPrefs_.gradientBackground;renderSettings_.backgroundColor = uiPrefs_.backgroundColor;return true;@@ -1488,6 +1503,13 @@ void drawInterfaceSection(App& app) {ui::HelpText("Tooltip delay", nullptr,"How long to point at an icon-only button (or a clipped label) before its name appears.","Preferences > Interface");+ ImGui::SetNextItemWidth(-FLT_MIN);+ if (ui::SliderInside("##mask_darkness", &p.maskDarkness, 0.0f, 1.0f, "Mask darkness %.2f"))+ app.setMaskDarkness(p.maskDarkness);+ ui::HelpText("Mask darkness", nullptr,+ "How dark masked areas show: 0 = not at all, 1 = nearly black. The default keeps the form readable "+ "under the mask.",+ "Preferences > Interface");ImGui::Checkbox(tr("Reduce motion"), &p.reduceMotion);ui::HelpText("Reduce motion", nullptr,"Hover and focus highlights change colour only: no easing, and tiles don't lift or grow.",diff --git a/src/app/Config.h b/src/app/Config.hindex de42e26c..7858f92b 100644--- a/src/app/Config.h+++ b/src/app/Config.h@@ -95,6 +95,10 @@ struct UiPrefs {bool backfaceCulling = false;// UV Editor > Pack > Columns x Rows (#135): the UDIM grid the last pack filled, the default for new projects.int uvPackColumns = 1, uvPackRows = 1;+ // Preferences > Interface > Mask darkness (and Tool > Masking): how dark masked areas show, 0-1+ // (RenderSettings::maskDarkness).+ float maskDarkness = 0.7f;+ bool confirmSubdivide = true; // Subdivide (removes levels) asks first on a Part with levels (Don't ask again)TabletSettings tablet; // Preferences > Tablet: pressure curve, eraser, pen buttonsSpaceMouseSettings spaceMouse; // Preferences > Input > SpaceMouse// Preferences > Performance (PanelPerformance.cpp).diff --git a/src/app/I18nSpanish.cpp b/src/app/I18nSpanish.cppindex b0b7913f..8fb9ea6c 100644--- a/src/app/I18nSpanish.cpp+++ b/src/app/I18nSpanish.cpp@@ -228,9 +228,10 @@ constexpr Entry kSpanish[] = {{"Top of viewport", "Arriba del visor"},{"How strongly painting colours the surface (1-100); Ctrl+click to type.","Con qué fuerza colorea la pintura la superficie (1-100); Ctrl+clic para escribirlo."},- {"This Part has subdivision levels, so strokes don't remesh it: delete the lower (or higher) levels first.",- "Esta pieza tiene niveles de subdivisión, así que los trazos no la remallan: borra antes los niveles "- "inferiores (o superiores)."},+ {"This Part has subdivision levels, so strokes don't remesh it. Freeze Levels keeps the level shown as one plain "+ "mesh (Ctrl+Z brings the levels back).",+ "Esta pieza tiene niveles de subdivisión, así que los trazos no la remallan. Congelar niveles conserva el nivel "+ "visible como una sola malla (Ctrl+Z recupera los niveles)."},// --- Edit, File, Help ---{"Undo", "Deshacer"},@@ -381,6 +382,11 @@ constexpr Entry kSpanish[] = {// --- Geometry ---{"Divide", "Dividir"},{"Subdivide", "Subdividir"},+ {"Subdivide (removes levels)", "Subdividir (quita los niveles)"},+ {"Divide (keeps levels)", "Dividir (conserva los niveles)"},+ {"Change the Mesh (no levels)", "Cambiar la malla (sin niveles)"},+ {"Micro Detail", "Detalle micro"},+ {"Subdivide and Remove Levels", "Subdividir y quitar los niveles"},{"Lower Level", "Res. menor"},{"Higher Level", "Res. mayor"},{"Delete Lower", "Borrar inferiores"},diff --git a/src/app/Input.cpp b/src/app/Input.cppindex 60b589bf..5d5779cd 100644--- a/src/app/Input.cpp+++ b/src/app/Input.cpp@@ -337,6 +337,41 @@ void App::registerViewActions() {"Maya keys: Alt+F).", [this] { frameActivePart(); });add("view.reset", "Reset view", "", "Back to the view a new model opens with: from the front, in perspective, ""the whole model in view (Maya keys: Alt+H).", [this] { resetView(); });+ // Saved views (from a review: "custom cam views, like Blender"): named cameras, kept with the project.+ add("view.save_view", "Save View", "Ctrl+Alt+Numpad 0",+ "Remember this camera as a named view (View > Views; the name field names it). Saved with the project.",+ [this] { saveView(savedViewName_); });+ add("view.restore_view", "Restore View", "Numpad 0", "Go back to the view saved or restored last (View > Views).",+ [this] { restoreView(lastSavedView_); });+}++void App::saveView(const std::string& requested) {+ std::string name = requested;+ if (name.empty())+ for (int n = int(savedViews_.size()) + 1;; ++n) {+ name = "View " + std::to_string(n);+ if (std::none_of(savedViews_.begin(), savedViews_.end(), [&](const SavedView& v) { return v.name == name; })) break;+ }+ auto it = std::find_if(savedViews_.begin(), savedViews_.end(), [&](const SavedView& v) { return v.name == name; });+ if (it == savedViews_.end()) it = savedViews_.insert(savedViews_.end(), SavedView{name, camera_});+ else it->camera = camera_;+ lastSavedView_ = int(it - savedViews_.begin());+ savedViewName_[0] = 0;+ doc_.modified = true; // (saved with the project)+ status_ = "View saved: " + name + " (Numpad 0 goes back to it)";+}++void App::restoreView(int index) {+ if (index < 0 || index >= int(savedViews_.size())) {+ status_ = "No saved view yet: Save View (Ctrl+Alt+Numpad 0) remembers this one";+ return;+ }+ const float aspect = camera_.aspect;+ camera_ = savedViews_[size_t(index)].camera;+ camera_.aspect = aspect;+ autoOrtho_ = false;+ lastSavedView_ = index;+ status_ = "View: " + savedViews_[size_t(index)].name;}void App::setInputStyle(int style) {diff --git a/src/app/Palettes.cpp b/src/app/Palettes.cppindex a167e38f..f304808b 100644--- a/src/app/Palettes.cpp+++ b/src/app/Palettes.cpp@@ -440,9 +440,11 @@ void App::drawPalette_Draw() {}}}- if (doc_.sculptor.dyntopo.enabled && !dyntopoBlocker(doc_.mesh).empty())- hint(*this, "This Part has subdivision levels, so strokes don't remesh it: delete the lower (or higher) levels "- "first.");+ if (doc_.sculptor.dyntopo.enabled && !dyntopoBlocker(doc_.mesh).empty() && doc_.mesh.multires) {+ hint(*this, "This Part has subdivision levels, so strokes don't remesh it. Freeze Levels keeps the level shown "+ "as one plain mesh (Ctrl+Z brings the levels back).");+ actionRow(*this, {"draw.dynamic_freeze"});+ }// Focal length (#26): the perspective view's lens in mm on a 36 x 24 mm frame (vertical field of view);// saved with the project as the camera's fov_y.tray::GroupLabel(*this, "Camera");@@ -708,10 +710,46 @@ void App::drawPalette_Render() {drawBackgroundControls("render");ImGui::TextDisabled("%s", tr("View resolution"));ui::Segmented(*this, {"perf.res_100", "perf.res_75", "perf.res_50"});+ drawViewsSection();actionRow(*this, {"view.frame", "view.fullscreen"});actionRow(*this, {"ui.library", "ui.console"}); // (the SculptForge layout's View menu: they left the shelf)}+void App::drawViewsSection() {+ tray::GroupLabel(*this, "Views");+ Demo::pushScope("Views");+ segmented(*this, {"view.front", "view.back", "view.left", "view.right", "view.top", "view.bottom"});+ const float saveW = ImGui::CalcTextSize(tr("Save View")).x + 2.0f * ImGui::GetStyle().FramePadding.x;+ ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - saveW - ImGui::GetStyle().ItemSpacing.x);+ const bool enter = ImGui::InputTextWithHint("##viewname", tr("name (optional)"), savedViewName_, sizeof savedViewName_,+ ImGuiInputTextFlags_EnterReturnsTrue);+ ImGui::SameLine();+ if (ui::ActionButton(*this, "view.save_view", ImVec2(-1, 0)) || enter) {+ if (enter) saveView(savedViewName_);+ }+ int remove = -1;+ for (size_t i = 0; i < savedViews_.size(); ++i) {+ ImGui::PushID(int(i));+ const float x = ImGui::GetFrameHeight();+ const bool last = int(i) == lastSavedView_;+ if (last) ImGui::PushStyleColor(ImGuiCol_Button, theme::toggleOn);+ if (ImGui::Button(savedViews_[i].name.c_str(), ImVec2(ImGui::GetContentRegionAvail().x - x - 2.0f, 0))) restoreView(int(i));+ if (last) ImGui::PopStyleColor();+ ui::HelpText("Saved view", nullptr, "Go to this saved view (Numpad 0 goes to the last one used).", "View > Views");+ ImGui::SameLine(0.0f, 2.0f);+ if (ImGui::Button("x##del", ImVec2(-1, 0))) remove = int(i);+ ui::HelpText("Delete view", nullptr, "Forget this saved view.", "View > Views");+ ImGui::PopID();+ }+ if (remove >= 0) {+ savedViews_.erase(savedViews_.begin() + remove);+ if (lastSavedView_ == remove) lastSavedView_ = -1;+ else if (lastSavedView_ > remove) --lastSavedView_;+ doc_.modified = true;+ }+ Demo::popScope();+}+void App::drawPalette_Script() {const bool any = actions_.find("ui.console") || actions_.find("script.run_file");actionRow(*this, {"ui.console"});@@ -793,6 +831,9 @@ void App::drawPalette_Tool() {tray::Section section;Demo::pushScope("Geometry");drawGeometrySection();+ // Apart from Divide and Micro: these change the mesh itself and keep no levels.+ ImGui::Spacing();+ tray::GroupLabel(*this, "Change the Mesh (no levels)");actionRow(*this, {"geometry.subdivide", "geometry.close_holes"});const float half = (ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x) * 0.5f;if (ImGui::Button(tr("Decimate"), ImVec2(half, 0))) {diff --git a/src/app/PanelExtract.cpp b/src/app/PanelExtract.cppindex 69b97c51..df494219 100644--- a/src/app/PanelExtract.cpp+++ b/src/app/PanelExtract.cpp@@ -5,6 +5,7 @@// (Tool > Deformation). The work is done by the extract / mirror_and_weld / mirror commands (core/ExtractMirror.h).#include "app/App.h"#include "app/Demo.h"+#include "app/I18n.h"#include "app/Palettes.h"#include "app/Ui.h"@@ -34,8 +35,17 @@ void App::drawExtractContents() {ui::ActionButton(*this, "part.extract", ImVec2(half, 0));ui::HelpAction(*this, "part.extract");ImGui::SameLine();- ui::ActionButton(*this, "part.extract_accept", ImVec2(-1, 0));- ui::HelpAction(*this, "part.extract_accept");+ // Extract works on the mask: without one, say so where Accept would be (a review read the greyed-out buttons+ // as unclickable); the row keeps its height.+ if (!doc_.mesh.hasMask() && !doc_.extractPreviewCurrent()) {+ ImGui::AlignTextToFramePadding();+ ImGui::TextDisabled("%s", tr("Mask first (Ctrl+drag)"));+ ui::HelpText("Extract", nullptr, "Extract makes a shell from the masked area: mask it first (Ctrl+drag on the model).",+ "Tool > Parts > Extract");+ } else {+ ui::ActionButton(*this, "part.extract_accept", ImVec2(-1, 0));+ ui::HelpAction(*this, "part.extract_accept");+ }// The settings: changing one while the preview shows extracts again, so the preview follows.bool changed = false;diff --git a/src/app/PanelGeometry.cpp b/src/app/PanelGeometry.cppindex dd3a8a49..5b07f53a 100644--- a/src/app/PanelGeometry.cpp+++ b/src/app/PanelGeometry.cpp@@ -4,6 +4,7 @@// Tool > Geometry: subdivision levels (Lower Level / Higher Level, SDiv, Delete Lower / Delete Higher,// Reconstruct Subdiv, Divide with Smt). The levels themselves live in core/Multires.#include "app/App.h"+#include "app/Palettes.h"#include "app/Ui.h"#include "app/I18n.h"@@ -65,8 +66,10 @@ void App::drawGeometrySection() {ImGui::TextDisabled("%s", tr("No subdivision levels - Divide adds them"));}- // Micro: displacement levels above the highest level (core/Micro.h). One row: the level slider and Divide to- // Micro (or Bake / Delete once there is one), so the section stays as tall as before.+ // Micro: displacement levels above the highest level (core/Micro.h), in a group of its own: Divide and Delete+ // Lower / Delete Higher change the levels, Micro only adds detail on top (a tester mixed them up side by side).+ ImGui::Spacing();+ tray::GroupLabel(*this, "Micro Detail");const bool micro = hasMicro(m);if (micro) microSlider_ = float(microLevel(m));const float sliderW = std::floor(ImGui::GetContentRegionAvail().x * 0.42f);diff --git a/src/app/PanelMasking.cpp b/src/app/PanelMasking.cppindex 70bb771b..b5058412 100644--- a/src/app/PanelMasking.cpp+++ b/src/app/PanelMasking.cpp@@ -429,6 +429,11 @@ void App::drawMaskingSection() {"Tool > Masking");}ImGui::SetNextItemWidth(-1);+ if (float k = uiPrefs_.maskDarkness; ui::SliderInside("##maskdarkness", &k, 0.0f, 1.0f, "Mask Darkness %.2f"))+ setMaskDarkness(k);+ ui::HelpText("Mask Darkness", nullptr, "How dark masked areas show (also in Preferences > Interface).",+ "Tool > Masking");+ ImGui::SetNextItemWidth(-1);ui::SliderInside("##maskstrength", &maskStrength_, 0.01f, 1.0f, "Mask Strength %.2f");// Mask by: whole-mesh masks from the shape, the paint, the groups and the border. Each replaces the mask.diff --git a/src/app/PanelProject.cpp b/src/app/PanelProject.cppindex 3a0a8b7b..dcde397c 100644--- a/src/app/PanelProject.cpp+++ b/src/app/PanelProject.cpp@@ -132,6 +132,7 @@ void App::initProject() {// new default once (PanelSupport.cpp).newLookCardDone_ = prefs["new_look_card_done"].asBool(false);quickTourDone_ = prefs["quick_tour_done"].asBool(false);+ uiPrefs_.confirmSubdivide = prefs["confirm_subdivide"].asBool(uiPrefs_.confirmSubdivide); // (Don't ask again)if (!uiPrefs_.lookSaved && !uiConfigDeterministic_) {UiPrefs saved = uiPrefs_;if (!lookFromJson(prefs["ui_look"], saved)) {@@ -213,6 +214,7 @@ void App::saveProjectPrefs() {}prefs.set("new_look_card_done", newLookCardDone_);prefs.set("quick_tour_done", quickTourDone_);+ prefs.set("confirm_subdivide", uiPrefs_.confirmSubdivide);std::ofstream(fsPath(prefDir_ + "project.json"), std::ios::binary | std::ios::trunc) << prefs.dump(true);}@@ -314,6 +316,20 @@ void App::storeProjectSettings() {cam.set("roll", double(camera_.roll));cam.set("fov_y", double(camera_.fovY));s.set("camera", std::move(cam));+ Json views = Json::array();+ for (const SavedView& v : savedViews_) {+ Json o = Json::object();+ o.set("name", v.name);+ o.set("target", vec3Json(v.camera.target));+ o.set("distance", double(v.camera.distance));+ o.set("yaw", double(v.camera.yaw));+ o.set("pitch", double(v.camera.pitch));+ o.set("roll", double(v.camera.roll));+ o.set("fov_y", double(v.camera.fovY));+ o.set("ortho", v.camera.ortho);+ views.push(std::move(o));+ }+ s.set("views", std::move(views));Json render = Json::object();render.set("wireframe", renderSettings_.wireframe);@@ -427,6 +443,24 @@ void App::applyProjectSettings() {camera_.distance = std::max(camera_.distance, 1e-4f);camera_.fovY = std::clamp(camera_.fovY, 0.05f, 3.0f);}+ savedViews_.clear();+ lastSavedView_ = -1;+ if (const Json& views = s["views"]; views.isArray())+ for (size_t i = 0; i < views.size(); ++i) {+ const Json& o = views[i];+ if (!o.isObject() || !o["name"].isString()) continue;+ SavedView v{o["name"].asString(), camera_};+ readVec3(o["target"], v.camera.target);+ readFloat(o, "distance", v.camera.distance);+ readFloat(o, "yaw", v.camera.yaw);+ readFloat(o, "pitch", v.camera.pitch);+ readFloat(o, "roll", v.camera.roll);+ readFloat(o, "fov_y", v.camera.fovY);+ readBool(o, "ortho", v.camera.ortho);+ v.camera.distance = std::max(v.camera.distance, 1e-4f);+ v.camera.fovY = std::clamp(v.camera.fovY, 0.05f, 3.0f);+ savedViews_.push_back(std::move(v));+ }if (const Json& r = s["render"]; r.isObject()) {readBool(r, "wireframe", renderSettings_.wireframe);readVec3(r["base_color"], renderSettings_.baseColor);diff --git a/src/app/PanelRetopo.cpp b/src/app/PanelRetopo.cppindex 7e6b3482..7be853a4 100644--- a/src/app/PanelRetopo.cpp+++ b/src/app/PanelRetopo.cpp@@ -641,14 +641,50 @@ bool App::guideMouseDown(float x, float y, SDL_Keymod mod) {}void App::guideDragTo(float x, float y) {- if (std::hypot(x - guidePathLast_[0], y - guidePathLast_[1]) < 2.0f * uiScale_) return;+ // Stroke smoothing: the curve follows the pointer at a distance (a lazy mouse), so a hand's or a pen's jitter+ // doesn't make it wobble; points every 4 px.+ const float dx = x - guidePathLast_[0], dy = y - guidePathLast_[1], d = std::hypot(dx, dy);+ const float lag = 6.0f * uiScale_;+ if (d < lag + 4.0f * uiScale_) return;+ const float k = (d - lag) / d;+ const float sx = guidePathLast_[0] + dx * k, sy = guidePathLast_[1] + dy * k;RayHit hit;- if (!pick(x, y, hit)) return; // off the model: the curve continues where it comes back+ if (!pick(sx, sy, hit)) return; // off the model: the curve continues where it comes backguidePath_.push_back(hit.position);- guidePathLast_[0] = x;- guidePathLast_[1] = y;+ guidePathLast_[0] = sx;+ guidePathLast_[1] = sy;}+namespace {++// Corner cutting (Chaikin), twice: the screen polyline of a guide drawn as a smooth curve, not 2 px segments.+void smoothPolyline(std::vector<ImVec2>& pts, bool closed) {+ for (int pass = 0; pass < 2 && pts.size() >= 3; ++pass) {+ std::vector<ImVec2> out;+ out.reserve(pts.size() * 2 + 2);+ const size_t n = pts.size(), segs = closed ? n : n - 1;+ if (!closed) out.push_back(pts[0]);+ for (size_t i = 0; i < segs; ++i) {+ const ImVec2 a = pts[i], b = pts[(i + 1) % n];+ out.push_back(ImVec2(a.x * 0.75f + b.x * 0.25f, a.y * 0.75f + b.y * 0.25f));+ out.push_back(ImVec2(a.x * 0.25f + b.x * 0.75f, a.y * 0.25f + b.y * 0.75f));+ }+ if (!closed) out.push_back(pts[n - 1]);+ pts.swap(out);+ }+}++// A guide line: a dark outline under the colour, so it reads on light and dark models alike.+void guideLine(ImDrawList* dl, std::vector<ImVec2>& pts, bool closed, ImU32 col, float width, bool outline) {+ if (pts.size() < 2) return;+ smoothPolyline(pts, closed);+ const ImDrawFlags flags = closed ? ImDrawFlags_Closed : ImDrawFlags_None;+ if (outline) dl->AddPolyline(pts.data(), int(pts.size()), IM_COL32(12, 12, 16, (col >> IM_COL32_A_SHIFT) * 3 / 4), flags, width + 2.0f);+ dl->AddPolyline(pts.data(), int(pts.size()), col, flags, width);+}++} // namespace+void App::guideRelease() {std::vector<glm::vec3> path = std::move(guidePath_);guidePath_.clear();@@ -733,35 +769,52 @@ void App::drawQRemeshGuides() {// Solid while the brush is picked; thin and faint otherwise, so the edge loop QRemesh put there shows.const ImU32 front = dead ? IM_COL32(255, 90, 80, 255) : IM_COL32(255, 196, 64, guidesMode_ ? 255 : 110);const ImU32 back = dead ? IM_COL32(255, 90, 80, 70) : IM_COL32(255, 196, 64, guidesMode_ ? 55 : 30);- const float width = guidesMode_ ? 2.5f : 1.25f;- ImVec2 prev;- bool havePrev = false, prevVis = false;- for (size_t i = 0; i <= n; ++i) {- if (i == n && !guide.closed) break;+ const float width = (guidesMode_ ? 2.5f : 1.6f) * s;+ // Runs of points with the same visibility, each drawn as one smooth polyline.+ std::vector<ImVec2> run;+ bool runVis = false;+ auto flush = [&](bool closed) {+ if (runVis) guideLine(dl, run, closed, front, width, true);+ else guideLine(dl, run, closed, back, 1.25f * s, false);+ run.clear();+ };+ bool whole = guide.closed;+ for (size_t i = 0; i < n; ++i) {ImVec2 p;- if (!gizmoProject(guide.points[i % n], p)) {- havePrev = false;- continue;- }- const bool vis = guideVisible_[g][i % n] != 0;- if (havePrev) {- const bool both = vis && prevVis;- dl->AddLine(prev, p, both ? front : back, (both ? width : 1.25f) * s);+ const bool on = gizmoProject(guide.points[i], p);+ const bool vis = on && guideVisible_[g][i] != 0;+ if (!on || (!run.empty() && vis != runVis)) {+ whole = false;+ if (!run.empty() && on) {+ const ImVec2 keep = run.back();+ flush(false);+ run.push_back(keep); // the next run starts where this one ended+ } else {+ flush(false);+ }}- prev = p;- prevVis = vis;- havePrev = true;+ if (!on) continue;+ runVis = vis;+ run.push_back(p);+ }+ if (guide.closed && !whole && !run.empty() && n > 0) { // close the loop back to the first point+ ImVec2 p0;+ if (gizmoProject(guide.points[0], p0)) run.push_back(p0);}+ flush(whole);}// The curve being drawn, with its mirror images.if (drag_ == Drag::Guide && guidePath_.size() >= 2)for (const glm::vec3& m : Sculptor::mirrors(symmetry_)) {const bool own = m == glm::vec3(1.0f);- for (size_t i = 1; i < guidePath_.size(); ++i) {- ImVec2 a, b;- if (gizmoProject(guidePath_[i - 1] * m, a) && gizmoProject(guidePath_[i] * m, b))- dl->AddLine(a, b, own ? IM_COL32(255, 230, 140, 255) : IM_COL32(255, 230, 140, 120), (own ? 2.5f : 1.5f) * s);+ std::vector<ImVec2> pts;+ for (const glm::vec3& q : guidePath_) {+ ImVec2 a;+ if (gizmoProject(q * m, a)) pts.push_back(a);}+ if (drag_ == Drag::Guide && own) pts.push_back(ImVec2(mouseX_, mouseY_)); // up to the pointer (the lazy lag)+ guideLine(dl, pts, false, own ? IM_COL32(255, 230, 140, 255) : IM_COL32(255, 230, 140, 140), (own ? 2.5f : 1.5f) * s,+ own);}// The guides brush's cursor: a small ring with a dot.if (guidesMode_ && !ImGui::GetIO().WantCaptureMouse && cr.contains(mouse.x, mouse.y)) {diff --git a/src/app/Shell.cpp b/src/app/Shell.cppindex 0ff3175d..eabab4e5 100644--- a/src/app/Shell.cpp+++ b/src/app/Shell.cpp@@ -17,6 +17,7 @@#include "app/I18n.h"#include "core/LitSphere.h"#include "core/Micro.h"+#include "core/Multires.h"#include "core/VertexPaint.h"#include "core/Texture.h"@@ -436,6 +437,11 @@ void App::registerShellActions() {"under the brush become triangles and UVs are dropped (Undo brings them back).","Draw", "", "dyntopo", [this] { setDynamic(!doc_.sculptor.dyntopo.enabled); },[this] { return doc_.sculptor.dyntopo.enabled; }, nullptr});+ add({"draw.dynamic_freeze", "Freeze Levels + Dynamic", nullptr,+ "Keep the subdivision level shown as a plain mesh, delete the other levels and turn Dynamic on (one undo "+ "step for the levels: Ctrl+Z brings them back).",+ "Draw", "", "dyntopo", [this] { freezeLevelsAndDynamic(); }, nullptr,+ [this] { return bool(doc_.mesh.multires); }});// Masking and visibility selection shapes (Tool > Masking, Tool > Visibility), named.auto shape = [this](std::string id, std::string label, std::string palette, SelectShape* target, SelectShape value,std::string description) {@@ -2336,6 +2342,8 @@ void App::setDynamic(bool on) {const std::string why = dyntopoBlocker(doc_.mesh);if (!why.empty()) {status_ = why;+ // Levels: offer to freeze them right there (a review hit a dead end here on the default sphere).+ if (doc_.mesh.multires) openDynamicOffer_ = true;return;}}@@ -2343,6 +2351,116 @@ void App::setDynamic(bool on) {status_ = dyntopoSummary(doc_.sculptor.dyntopo);}+void App::freezeLevelsAndDynamic() {+ if (!doc_.mesh.multires) {+ setDynamic(true);+ return;+ }+ runCommand("dyntopo", {{"enabled", true}, {"freeze_levels", true}});+}++void App::setMaskDarkness(float k) { uiPrefs_.maskDarkness = renderSettings_.maskDarkness = std::clamp(k, 0.0f, 1.0f); }++void App::confirmLevelDelete(const std::string& command) {+ pendingLevelDelete_ = command;+ openLevelDelete_ = true;+}++void App::drawDynamicOffer() {+ // Delete Lower / Delete Higher: say which levels go before they do.+ static constexpr const char* kDelete = "##level_delete";+ if (openLevelDelete_) {+ openLevelDelete_ = false;+ ImGui::OpenPopup(kDelete);+ }+ if (ImGui::BeginPopup(kDelete)) {+ Demo::pushScope("Delete Levels");+ const int levels = subdivLevelCount(doc_.mesh), current = subdivCurrentLevel(doc_.mesh);+ const bool lower = pendingLevelDelete_ == "subdiv_delete_lower";+ const int gone = lower ? current : levels - 1 - current;+ if (gone <= 0 || pendingLevelDelete_.empty()) {+ ImGui::CloseCurrentPopup();+ } else {+ if (lower)+ ImGui::Text(tr("Delete SDiv 1 to %d? SDiv %d becomes the base mesh."), current, current + 1);+ else+ ImGui::Text(tr("Delete SDiv %d to %d and the detail sculpted on them?"), current + 2, levels);+ ImGui::TextDisabled("%s", tr("Ctrl+Z brings them back."));+ ImGui::Spacing();+ if (ImGui::Button(tr(lower ? "Delete Lower Levels" : "Delete Higher Levels"))) {+ ImGui::CloseCurrentPopup();+ runCommand(pendingLevelDelete_);+ pendingLevelDelete_.clear();+ }+ ImGui::SameLine();+ if (ImGui::Button(tr("Cancel##level_delete")) || ImGui::IsKeyPressed(ImGuiKey_Escape)) {+ ImGui::CloseCurrentPopup();+ pendingLevelDelete_.clear();+ }+ }+ Demo::popScope();+ ImGui::EndPopup();+ }++ // Subdivide on a Part with levels removes them: ask (Don't ask again turns it off; Preferences keep it).+ static constexpr const char* kSubdivide = "##subdivide_confirm";+ if (openSubdivideConfirm_) {+ openSubdivideConfirm_ = false;+ ImGui::OpenPopup(kSubdivide);+ }+ if (ImGui::BeginPopup(kSubdivide)) {+ Demo::pushScope("Subdivide");+ if (!doc_.mesh.multires) {+ ImGui::CloseCurrentPopup();+ } else {+ ImGui::Text(tr("This removes your %d subdivision levels. Undo brings them back."), subdivLevelCount(doc_.mesh));+ ImGui::TextDisabled(tr("SDiv %d becomes one plain mesh, then it is subdivided. Divide (keeps levels) adds a "+ "level instead."),+ subdivCurrentLevel(doc_.mesh) + 1);+ bool ask = !uiPrefs_.confirmSubdivide;+ if (ImGui::Checkbox(tr("Don't ask again##subdivide"), &ask)) uiPrefs_.confirmSubdivide = !ask;+ ImGui::Spacing();+ if (ImGui::Button(tr("Subdivide and Remove Levels"))) {+ ImGui::CloseCurrentPopup();+ runCommand("subdivide");+ }+ ImGui::SameLine();+ if (ImGui::Button(tr("Cancel##subdivide")) || ImGui::IsKeyPressed(ImGuiKey_Escape)) {+ uiPrefs_.confirmSubdivide = true; // (Cancel doesn't stop the asking)+ ImGui::CloseCurrentPopup();+ }+ }+ Demo::popScope();+ ImGui::EndPopup();+ }++ static constexpr const char* kPopup = "##dynamic_offer";+ if (openDynamicOffer_) {+ openDynamicOffer_ = false;+ ImGui::OpenPopup(kPopup);+ }+ // A plain pop-up (not modal): a click anywhere else closes it.+ if (!ImGui::BeginPopup(kPopup)) return;+ Demo::pushScope("Dynamic");+ if (!doc_.mesh.multires) {+ ImGui::CloseCurrentPopup();+ } else {+ ImGui::Text(tr("This Part has %d subdivision levels (%s)."), subdivLevelCount(doc_.mesh),+ subdivLevelText(doc_.mesh).c_str());+ ImGui::TextDisabled("%s", tr("Dynamic needs one plain mesh: Freeze keeps the level shown and removes the "+ "others (Ctrl+Z brings them back)."));+ ImGui::Spacing();+ if (ImGui::Button(tr("Freeze Levels and Turn On Dynamic"))) {+ ImGui::CloseCurrentPopup();+ freezeLevelsAndDynamic();+ }+ ImGui::SameLine();+ if (ImGui::Button(tr("Cancel")) || ImGui::IsKeyPressed(ImGuiKey_Escape)) ImGui::CloseCurrentPopup();+ }+ Demo::popScope();+ ImGui::EndPopup();+}+void App::drawDetailSlider(const char* id) {float detail = doc_.sculptor.dyntopo.detail * 100.0f;if (ui::SliderInside(id, &detail, 0.0f, 100.0f, "Detail %.0f")) doc_.sculptor.dyntopo.detail = detail / 100.0f;diff --git a/src/app/Theme.cpp b/src/app/Theme.cppindex 8279d188..a3867836 100644--- a/src/app/Theme.cpp+++ b/src/app/Theme.cpp@@ -144,8 +144,9 @@ void setTokens(const looks::Palette& p, looks::LookId id) {accentHover = mixc(ac, p.light ? rgb(0x000000) : rgb(0xffffff), 0.18f);toggleOff = mixc(mantle, s0, 0.6f);toggleOffHover = s0;- toggleOn = s1;- toggleOnHover = s2;+ // On: a fill tinted with the accent, not just one surface step up (a review couldn't tell on from off).+ toggleOn = mixc(s1, ac, p.light ? 0.28f : 0.32f);+ toggleOnHover = mixc(s2, ac, p.light ? 0.34f : 0.38f);trough = mixc(mantle, s0, 0.7f);selection = mixc(s0, s1, 0.7f);selectionActive = s2;diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cppindex 747a2ab3..0ebceade 100644--- a/src/app/UiTest.cpp+++ b/src/app/UiTest.cpp@@ -45,6 +45,7 @@// button_drag middle|right X0 Y0 X1 Y1 [S] drag with that button in window fractions (with the held modifiers)// expect_shortcut ACTION KEYS the action's effective keys, e.g. expect_shortcut view.front Numpad 1// camera YAW PITCH set the view's angles in degrees (0 0 = the front view), e.g. for guide screenshots+// draw_size PX set Draw Size (the brush radius, screen pixels)// zoom FACTOR / look X Y Z move the camera FACTOR times closer / turn it about (and look at) the point X Y Z// camera_distance D put the camera D model units from the point it looks at (extreme zoom)// run COMMANDS sculptforge-cli commands, e.g. run new_sphere subdivisions=4 ($SCRIPT_DIR: the script's folder)@@ -121,6 +122,7 @@// cursor_ring (1 when the last brush cursor drawn had its ring; 0: the dot only, #88),// hide_ring_while_stroking (Preferences > Cursor, 1 on),// cursor_follows_surface (Preferences > Input, 1 on),+// saved_views (View > Views), mask_darkness (0-100),// camera_yaw / camera_pitch / camera_roll (degrees),// camera_up (the view's up vector . world Y), camera_aligned (1 when looking along a world// axis), camera_distance, camera_pan (target offset);@@ -707,6 +709,8 @@ double Demo::query(const std::string& name, bool& known) const {}if (name == "dynamic") return app_.doc_.sculptor.dyntopo.enabled ? 1.0 : 0.0;if (name == "dynamic_detail") return std::round(app_.doc_.sculptor.dyntopo.detail * 100.0f);+ if (name == "saved_views") return double(app_.savedViews_.size());+ if (name == "mask_darkness") return std::round(app_.renderSettings_.maskDarkness * 100.0f);if (name == "brush_type") return app_.doc_.activeBrush >= 0 || app_.paintMode_ ? -1.0 : double(int(app_.brush_));if (name == "last_dab_x") return app_.lastDabScreen_.x;if (name == "last_dab_y") return app_.lastDabScreen_.y;@@ -1622,6 +1626,10 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& eif (!need(1)) return false;run([this, d = num(1, 4)] { app_.camera_.distance = std::max(float(d), 1e-4f); });wait(0.1f);+ } else if (verb == "draw_size") { // draw_size PX: Draw Size (the brush radius in screen pixels), as the S slider+ if (!need(1)) return false;+ run([this, px = num(1, 50)] { app_.radiusPx_ = std::clamp(float(px), 2.0f, 800.0f); });+ wait(0.05f);} else if (verb == "look") { // look X Y Z: the camera turns about (and looks at) this pointif (!need(3)) return false;run([this, x = num(1, 0), y = num(2, 0), z = num(3, 0)] { app_.camera_.target = glm::vec3(float(x), float(y), float(z)); });diff --git a/src/core/Dyntopo.cpp b/src/core/Dyntopo.cppindex d06ed2f6..99738a9b 100644--- a/src/core/Dyntopo.cpp+++ b/src/core/Dyntopo.cpp@@ -109,7 +109,7 @@ float dyntopoEdgeLength(const DyntopoSettings& s, float radius, float diagonal)std::string dyntopoBlocker(const Mesh& mesh) {if (mesh.multires)- return "Dynamic topology needs a mesh without subdivision levels: delete the lower (or higher) levels first";+ return "Dynamic topology needs a mesh without subdivision levels: Freeze Levels keeps the level shown and removes the others";if (mesh.triangleCount() == 0) return "The mesh has no triangles";return {};}diff --git a/src/core/DyntopoCommands.cpp b/src/core/DyntopoCommands.cppindex f5f35b42..d8cb4c91 100644--- a/src/core/DyntopoCommands.cpp+++ b/src/core/DyntopoCommands.cpp@@ -2,6 +2,7 @@// SPDX-License-Identifier: GPL-3.0-or-later#include "core/Commands.h"#include "core/Dyntopo.h"+#include "core/Multires.h"#include <algorithm>#include <cmath>@@ -26,6 +27,10 @@ void registerDyntopoCommands(CommandRegistry& registry) {"mesh without subdivision levels; quads under the brush become triangles and UVs are dropped (undo ""brings them back). Without arguments, reports the settings.",{{"enabled", T::Bool, "true = on, false = off.", false},+ {"freeze_levels", T::Bool,+ "With enabled=true on a Part with subdivision levels: keep the level shown as a plain mesh "+ "(subdiv_freeze, its own undo step) and turn Dynamic on.",+ false},{"detail", T::Number, "Detail 0-100: how small the triangles get (default 50).", false},{"constant", T::Bool,"false (default) = the triangle size follows the brush size on screen (zoom in or shrink the brush "@@ -38,16 +43,20 @@ void registerDyntopoCommands(CommandRegistry& registry) {[](Document& doc, const Args& a) -> CommandResult {DyntopoSettings& s = doc.sculptor.dyntopo;const bool enable = argBool(a, "enabled", s.enabled);+ std::string frozen;+ if (enable && doc.mesh.multires && argBool(a, "freeze_levels", false) &&+ !freezeLevelsUndoable(doc, frozen))+ return {false, frozen};if (enable && !s.enabled) {const std::string why = dyntopoBlocker(doc.mesh);- if (!why.empty()) return {false, why};+ if (!why.empty()) return {false, why + " (or pass freeze_levels=true)"};}if (a.count("detail")) s.detail = float(std::clamp(argNumber(a, "detail", 50.0), 0.0, 100.0) / 100.0);s.constantDetail = argBool(a, "constant", s.constantDetail);if (a.count("smooth_remesh"))s.smoothRemesh = float(std::clamp(argNumber(a, "smooth_remesh", 100.0), 0.0, 100.0) / 100.0);s.enabled = enable;- return {true, dyntopoSummary(s)};+ return {true, frozen.empty() ? dyntopoSummary(s) : frozen + ". " + dyntopoSummary(s)};}});}diff --git a/src/core/Multires.cpp b/src/core/Multires.cppindex 4407b957..f3d9d8d2 100644--- a/src/core/Multires.cpp+++ b/src/core/Multires.cpp@@ -2318,6 +2318,24 @@ bool deleteHigherUndoable(Document& doc, std::string& message) {}, message);}+bool freezeLevelsUndoable(Document& doc, std::string& message) {+ if (!doc.mesh.multires) {+ message = "This Part has no subdivision levels";+ return false;+ }+ const int level = subdivCurrentLevel(doc.mesh) + 1, levels = subdivLevelCount(doc.mesh);+ return runUndoable(doc, "Freeze Levels", [&](Mesh& m, std::string& msg, BVH*) {+ if (m.micro) {+ msg = "This Part has a micro level: Bake it down or delete it (Tool > Geometry > Micro) before changing subdivision levels";+ return false;+ }+ if (m.multires && m.multires->current + 1 < int(m.multires->levels.size()) && !subdivDeleteHigher(m, msg)) return false;+ if (m.multires && m.multires->current > 0 && !subdivDeleteLower(m, msg)) return false;+ msg = "Froze SDiv " + std::to_string(level) + " of " + std::to_string(levels) + ": " + levelSummary(m);+ return true;+ }, message);+}+bool reconstructUndoable(Document& doc, std::string& message) {return runUndoable(doc, "Reconstruct Subdiv", [&](Mesh& m, std::string& msg, BVH* bvh) {if (!subdivReconstruct(m, msg, bvh)) return false;diff --git a/src/core/Multires.h b/src/core/Multires.hindex e9320022..c228199d 100644--- a/src/core/Multires.h+++ b/src/core/Multires.h@@ -241,6 +241,9 @@ bool setSubdivLevelUndoable(Document& doc, int level, std::string& message);bool deleteLowerUndoable(Document& doc, std::string& message);bool deleteHigherUndoable(Document& doc, std::string& message);bool reconstructUndoable(Document& doc, std::string& message);+// Freeze levels: keep the level shown as a plain mesh and delete every other level (Delete Higher and Delete Lower in+// one undo step), e.g. before Dynamic topology, which needs a mesh without levels.+bool freezeLevelsUndoable(Document& doc, std::string& message);// The undo step of a level operation (UndoRecord::subdiv): the level stack before it (after folding in// pending edits), so applying swaps stacks and loads the other stack's current level. `plain` is the meshdiff --git a/src/core/MultiresCommands.cpp b/src/core/MultiresCommands.cppindex e3cde57c..158b82ad 100644--- a/src/core/MultiresCommands.cpp+++ b/src/core/MultiresCommands.cpp@@ -87,6 +87,15 @@ void registerSubdivCommands(CommandRegistry& reg) {return result(ok, msg);}});+ reg.add({"subdiv_freeze",+ "Freeze Levels: keep the level shown as a plain mesh and delete every other subdivision level (one undo "+ "step), e.g. before Dynamic topology, which needs a mesh without levels.",+ {}, [](Document& doc, const Args&) -> CommandResult {+ std::string msg;+ const bool ok = freezeLevelsUndoable(doc, msg);+ return result(ok, msg);+ }});+reg.add({"subdiv_delete_higher","Delete Higher: delete the subdivision levels above the current one (and the detail sculpted on them).", {},[](Document& doc, const Args&) -> CommandResult {diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cppindex 5429e76f..98bca81a 100644--- a/src/render/Renderer.cpp+++ b/src/render/Renderer.cpp@@ -383,6 +383,7 @@ uniform vec3 uBaseColor;uniform vec3 uTintShift; // the material tint less 1 (0, the default, is no tint): the active colour, no vertex paintuniform int uPaint; // 1: vertex colours replace the base colouruniform int uShowMask; // 1: darken masked areas+uniform float uMaskDarkness; // RenderSettings::maskDarkness, 0..1uniform int uGroups; // 0: off, 1: per-triangle ids from uGroupIds, 2: everything is group 0, 3: per-triangle// colours (0xBBGGRR) from uGroupIds (the UV Editor's overlay)uniform usamplerBuffer uGroupIds;@@ -398,6 +399,13 @@ uniform float uAlpha; // X-Ray: the see-through Parts' opacity (1 = opaquniform int uTwoSided; // 1: back faces shade with the normal turned towards the viewer; 0: the motion proxy,// whose folds face backwards on the outside of the surfaceout vec4 fragColor;+// Masked areas: a cool dark tint that keeps the form readable (darkest at 1). The vertex mask is eased so its+// edge is a soft band rather than a hard, stepped one along the triangles.+vec3 maskTint(vec3 c, float m) {+ float k = smoothstep(0.0, 1.0, clamp(m, 0.0, 1.0)) * uMaskDarkness;+ vec3 tinted = c * vec3(0.20, 0.22, 0.30) + vec3(0.006, 0.008, 0.016);+ return mix(c, tinted, k);+}vec4 finish(vec3 c) {if (uDim == 1) c = mix(c, vec3(dot(c, vec3(0.2126, 0.7152, 0.0722))), 0.25) * 0.72;vec3 g = pow(c, vec3(1.0 / 2.2));@@ -560,7 +568,7 @@ void main() {if (uHasEmissive == 1) emissive = texture(uEmissiveTex, vUv).rgb;#endifvec3 c = toneMapped(pbrShade(albedo, n, v, rough, metal, ao, curvature, emissive));- if (uShowMask == 1) c *= 1.0 - 0.75 * clamp(V_MASK, 0.0, 1.0);+ if (uShowMask == 1) c = maskTint(c, V_MASK);fragColor = finish(c);return;}@@ -577,7 +585,7 @@ void main() {float mcrease = smoothstep(0.03, 0.18, curvature);float mridge = smoothstep(0.03, 0.2, -curvature);vec3 c = mc * tint * (1.0 - uLitSphereCavity.x * mcrease) * (1.0 + uLitSphereCavity.y * mridge);- if (uShowMask == 1) c *= 1.0 - 0.75 * clamp(V_MASK, 0.0, 1.0);+ if (uShowMask == 1) c = maskTint(c, V_MASK);fragColor = finish(c);return;}@@ -599,7 +607,7 @@ void main() {c += albedo * ridge * 0.3 * diff; // ridges catch the key lightc += vec3(spec) * (1.0 - crease) + rim * vec3(0.8, 0.85, 1.0);c = c * uLightLevels.x + albedo * uLightLevels.y * 0.6;- if (uShowMask == 1) c *= 1.0 - 0.75 * clamp(V_MASK, 0.0, 1.0);+ if (uShowMask == 1) c = maskTint(c, V_MASK);fragColor = finish(c);})";@@ -624,6 +632,36 @@ out vec4 fragColor;void main() { fragColor = vec4(0.05, 0.05, 0.08, uAlpha); })";+// The edge list's variant: edges shorter than a few pixels on screen fade out, so a dense mesh (1M+ triangles on a+// sphere) shows its wireframe as a light veil instead of a dark moire that hides the form and the mask.+const char* kWireLineGS = R"(#version 330 core+layout(lines) in;+layout(line_strip, max_vertices = 2) out;+uniform vec2 uViewportPx;+uniform float uAlpha;+out float gAlpha;+void main() {+ vec4 a = gl_in[0].gl_Position, b = gl_in[1].gl_Position;+ float fade = 1.0;+ if (a.w > 0.0 && b.w > 0.0) {+ float px = length((b.xy / b.w - a.xy / a.w) * 0.5 * uViewportPx);+ fade = mix(0.18, 1.0, smoothstep(2.0, 7.0, px));+ }+ gAlpha = uAlpha * fade;+ gl_Position = a;+ EmitVertex();+ gl_Position = b;+ EmitVertex();+ EndPrimitive();+}+)";++const char* kWireLineFS = R"(#version 330 core+in float gAlpha;+out vec4 fragColor;+void main() { fragColor = vec4(0.05, 0.05, 0.08, gAlpha); }+)";+// checkVertexIdBase: does gl_VertexID include the base vertex of glDrawElementsBaseVertex (it should)?const char* kVertexIdVS = R"(#version 330 coreflat out uint vId;@@ -888,6 +926,8 @@ bool Renderer::init(std::string& error) {}wireProgram_ = link(kWireVS, kWireFS, error);if (!wireProgram_) return false;+ wireLineProgram_ = link(kWireVS, kWireLineFS, error, nullptr, kWireLineGS);+ if (!wireLineProgram_) return false;bgProgram_ = link(kBgVS, kBgFS, error);if (!bgProgram_) return false;splatProgram_ = link(kSplatVS, kSplatFS, error);@@ -958,6 +998,7 @@ const Renderer::MeshProgram* Renderer::meshProgram(int features) {p.tintShift = at("uTintShift");p.paint = at("uPaint");p.showMask = at("uShowMask");+ p.maskDarkness = at("uMaskDarkness");p.groups = at("uGroups");p.litsphere = at("uLitSphere");p.litsphereCavity = at("uLitSphereCavity");@@ -1198,6 +1239,7 @@ void Renderer::shutdown() {p = MeshProgram();}deleteProgram(wireProgram_);+ deleteProgram(wireLineProgram_);deleteProgram(bgProgram_);deleteProgram(splatProgram_);gl::DeleteBuffers(1, &splatData_);@@ -2992,32 +3034,39 @@ void Renderer::draw(const Camera& camera, int targetWidth, int targetHeight, congl::ActiveTexture(GL_TEXTURE0);if (settings.wireframe) { // the active Part only- gl::UseProgram(wireProgram_);- gl::UniformMatrix4fv(gl::GetUniformLocation(wireProgram_, "uView"), 1, GL_FALSE, glm::value_ptr(view));- gl::UniformMatrix4fv(gl::GetUniformLocation(wireProgram_, "uProj"), 1, GL_FALSE, glm::value_ptr(proj));+ // Two programs: edge lists fade their sub-pixel edges (kWireLineGS); triangle outlines draw as before.+ auto use = [&](GLuint prog, const MeshSlot& slot) {+ gl::UseProgram(prog);+ gl::UniformMatrix4fv(gl::GetUniformLocation(prog, "uView"), 1, GL_FALSE, glm::value_ptr(view));+ gl::UniformMatrix4fv(gl::GetUniformLocation(prog, "uProj"), 1, GL_FALSE, glm::value_ptr(proj));+ gl::Uniform3fv(gl::GetUniformLocation(prog, "uGridOrigin"), 1, glm::value_ptr(slot.grid.origin));+ gl::Uniform1f(gl::GetUniformLocation(prog, "uGridStep"), slot.grid.step);+ if (prog == wireLineProgram_)+ gl::Uniform2f(gl::GetUniformLocation(prog, "uViewportPx"), float(fbWidth), float(fbHeight));+ return prog;+ };gl::Enable(GL_BLEND);gl::BlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);gl::DepthMask(GL_FALSE);for (const DrawItem& item : drawList_) {const MeshSlot* s = item.active ? findSlot(item.id) : nullptr;if (!s || s->drawnTriangles == 0 || s->micro) continue; // (micro levels: drawMicro draws theirs)- gl::Uniform3fv(gl::GetUniformLocation(wireProgram_, "uGridOrigin"), 1, glm::value_ptr(s->grid.origin));- gl::Uniform1f(gl::GetUniformLocation(wireProgram_, "uGridStep"), s->grid.step);cull(*s, frameCull_);if (!s->patches.empty() && s->patchVao) { // dynamic topology's patchesconst bool lines = s->patchLinesOn;- gl::Uniform1f(gl::GetUniformLocation(wireProgram_, "uAlpha"), lines ? 0.5775f : 0.35f);+ const GLuint prog = use(lines ? wireLineProgram_ : wireProgram_, *s);+ gl::Uniform1f(gl::GetUniformLocation(prog, "uAlpha"), lines ? 0.5775f : 0.35f);if (!lines) gl::PolygonMode(GL_FRONT_AND_BACK, GL_LINE);gl::BindVertexArray(lines ? s->patchLineVao : s->patchVao);drawPatches(*s, lines ? GL_LINES : GL_TRIANGLES, lines ? DrawPart::Lines : DrawPart::Triangles, -1);if (!lines) gl::PolygonMode(GL_FRONT_AND_BACK, GL_FILL);}if (s->linesValid) {- gl::Uniform1f(gl::GetUniformLocation(wireProgram_, "uAlpha"), 0.5775f); // 1 - (1 - 0.35)^2+ gl::Uniform1f(gl::GetUniformLocation(use(wireLineProgram_, *s), "uAlpha"), 0.5775f); // 1 - (1 - 0.35)^2gl::BindVertexArray(s->lineVao);drawClusters(*s, drawClusters_, GL_LINES, DrawPart::Lines, -1);} else { // edges not built (a mesh not synced for the wireframe): outline the triangles- gl::Uniform1f(gl::GetUniformLocation(wireProgram_, "uAlpha"), 0.35f);+ gl::Uniform1f(gl::GetUniformLocation(use(wireProgram_, *s), "uAlpha"), 0.35f);gl::PolygonMode(GL_FRONT_AND_BACK, GL_LINE);gl::BindVertexArray(s->vao);drawClusters(*s, drawClusters_, GL_TRIANGLES, DrawPart::Triangles, -1);@@ -3161,6 +3210,7 @@ void Renderer::drawMicro(const MeshSlot& s, bool active, bool flat, const Rendergl::Uniform2f(p->litsphereCavity, cavity.crease, cavity.ridge);gl::Uniform1i(p->paint, 0);gl::Uniform1i(p->showMask, active && settings.showMask ? 1 : 0);+ gl::Uniform1f(p->maskDarkness, std::clamp(settings.maskDarkness, 0.0f, 1.0f));gl::Uniform1i(p->groups, active && settings.showFaceGroups ? 2 : 0);gl::Uniform1i(p->dim, !active && settings.dimInactive ? 1 : 0);gl::Uniform1i(p->microWire, active && settings.wireframe ? 1 : 0); // (#128: the wireframe pass skips micro levels)@@ -3257,6 +3307,7 @@ void Renderer::drawSlot(const MeshSlot& s, bool active, bool flat, const RenderSgl::ActiveTexture(GL_TEXTURE0);gl::Uniform1i(p->paint, settings.showVertexPaint && s.hasColors ? 1 : 0);gl::Uniform1i(p->showMask, active && settings.showMask && s.hasMask ? 1 : 0);+ gl::Uniform1f(p->maskDarkness, std::clamp(settings.maskDarkness, 0.0f, 1.0f));gl::Uniform1i(p->groups, groups);gl::Uniform1i(p->dim, !active && settings.dimInactive ? 1 : 0);setLightUniforms(*p, settings);diff --git a/src/render/Renderer.h b/src/render/Renderer.hindex 14facd65..0b031420 100644--- a/src/render/Renderer.h+++ b/src/render/Renderer.h@@ -34,6 +34,7 @@ struct RenderSettings {glm::vec3 materialTint{1.0f};bool showTexture = true; // with showVertex paint: a Part's painted texture (core/Texture.h) multiplies inbool showMask = true; // masked areas render darker+ float maskDarkness = 0.7f; // how dark: 0 = no tint .. 1 = darkest (Preferences > Interface > Mask darkness)bool showFaceGroups = false; // colour each face group (see face groupColor)int litsphere = defaultLitSphere(); // built-in Lit Sphere material (core/Lit Sphere.h), Soft Clay; -1 = studio clay lightingbool showMesh = true;@@ -274,7 +275,7 @@ public:private:void drawSplats(const glm::mat4& view, const glm::mat4& proj, int fbWidth, int fbHeight, float opacity);- GLuint wireProgram_ = 0, bgProgram_ = 0, splatProgram_ = 0;+ GLuint wireProgram_ = 0, wireLineProgram_ = 0, bgProgram_ = 0, splatProgram_ = 0;// Splats: per-splat data in a texture buffer, drawn as instanced quads in back-to-front order.GLuint splatVao_ = 0, splatData_ = 0, splatTexture_ = 0, splatOrder_ = 0;GLsizei splatCount_ = 0;@@ -478,8 +479,8 @@ private:struct MeshProgram {GLuint id = 0;GLint view = -1, proj = -1, gridOrigin = -1, gridStep = -1, viewport = -1, projScale = -1, baseColor = -1, paint = -1,- showMask = -1, groups = -1, litsphere = -1, litsphereCavity = -1, dim = -1, primBase = -1, hasPaint = -1,- normalFlipY = -1, twoSided = -1, checker = -1, checkerScale = -1, tintShift = -1, lightRot = -1,+ showMask = -1, maskDarkness = -1, groups = -1, litsphere = -1, litsphereCavity = -1, dim = -1, primBase = -1,+ hasPaint = -1, normalFlipY = -1, twoSided = -1, checker = -1, checkerScale = -1, tintShift = -1, lightRot = -1,lightLevels = -1, alpha = -1, microWire = -1;GLint hasOrm = -1, hasEmissive = -1, hasMatNormal = -1, envLevels = -1, exposure = -1, toneMap = -1, material = -1,pbrCavity = -1, viewToEnv = -1, sh = -1;diff --git a/tests/test_multires.cpp b/tests/test_multires.cppindex bbae4ed6..02c6477f 100644--- a/tests/test_multires.cpp+++ b/tests/test_multires.cpp@@ -353,6 +353,39 @@ TEST(multires_delete_lower_and_higher) {CHECK(subdivLevelCount(d.mesh) == 3);}+// A review hit "Dynamic topology needs a mesh without subdivision levels" on the divided default sphere: Freeze+// Levels keeps the level shown as a plain mesh in one undo step, and dyntopo freeze_levels=true does it and turns+// Dynamic on.+TEST(multires_freeze_levels_for_dynamic) {+ Document d = dividedCube(3);+ CHECK(stroke(d, "0,0,2", "Standard", 0.3));+ CHECK(run(d, "subdiv_level", {{"level", 2.0}}).ok);+ const std::vector<glm::vec3> level2 = d.mesh.positions;+ const size_t tris2 = d.mesh.triangleCount();+ CHECK(!run(d, "dyntopo", {{"enabled", true}}).ok); // still blocked without the option+ CHECK(!d.sculptor.dyntopo.enabled);+ CHECK(run(d, "subdiv_freeze").ok);+ CHECK(subdivLevelCount(d.mesh) == 0);+ CHECK(d.mesh.triangleCount() == tris2);+ CHECK(bitEqual(d.mesh.positions, level2));+ CHECK(run(d, "undo").ok);+ CHECK(subdivLevelText(d.mesh) == "SDiv 2/4");+ CHECK(bitEqual(d.mesh.positions, level2));+ // In one go, from the top level.+ Document e = dividedCube(2);+ const size_t top = e.mesh.triangleCount();+ const CommandResult r = run(e, "dyntopo", {{"enabled", true}, {"freeze_levels", true}});+ CHECK(r.ok);+ CHECK(e.sculptor.dyntopo.enabled);+ CHECK(subdivLevelCount(e.mesh) == 0);+ CHECK(e.mesh.triangleCount() == top);+ CHECK(run(e, "undo").ok);+ CHECK(subdivLevelCount(e.mesh) == 3);+ // Nothing to freeze on a plain mesh.+ Document p = makeDoc(makeCube(3));+ CHECK(!run(p, "subdiv_freeze").ok);+}+TEST(multires_reconstruct_finds_lower_levels) {// A Catmull-Clark subdivided cube, imported as a plain mesh.Document src = dividedCube(2, 2);diff --git a/tests/ui/dyntopo.sfui b/tests/ui/dyntopo.sfuiindex daf1abfe..0c3404ce 100644--- a/tests/ui/dyntopo.sfui+++ b/tests/ui/dyntopo.sfui@@ -69,6 +69,8 @@ run subdiv_divideclick "Dynamic##draw.dynamic"expect_value dynamic == 0expect_status "subdivision levels"+expect_text "Freeze Levels and Turn On Dynamic"+click "Dynamic/Cancel"run subdiv_delete_lowerclick "Dynamic##draw.dynamic"expect_value dynamic == 1diff --git a/tests/ui/help_console.sfui b/tests/ui/help_console.sfuiindex 7432e8df..670dda17 100644--- a/tests/ui/help_console.sfui+++ b/tests/ui/help_console.sfui@@ -7,14 +7,14 @@ expect_value triangles == 1280# Ctrl+Alt+hover shows a command's scripting parameters.key f1type Controls/##controls_filter divide-expect Controls/Divide+expect "Controls/Divide (keeps levels)"hold ctrl-hover Controls/Divide+hover "Controls/Divide (keeps levels)"expect_help "subdivision level"expect_help Ctrl+Dshot help_ctrl_hoverhold ctrl+alt-hover Controls/Divide+hover "Controls/Divide (keeps levels)"expect_help "Smt: smooth the new level"shot help_ctrl_alt_hoverhold nonediff --git a/tests/ui/language.sfui b/tests/ui/language.sfuiindex ab983d35..77f5294a 100644--- a/tests/ui/language.sfui+++ b/tests/ui/language.sfui@@ -32,7 +32,7 @@ expect "Piezas##tool.part"click "Geometría##tool.geometry"expect_value sdiv_levels == 0expect_text "Sin niveles de subdivisión"-click "Dividir##geometry.divide"+click "Dividir (conserva los niveles)##geometry.divide"expect_value sdiv_levels == 2expect "Res. menor##geometry.lower_res"shot geometria@@ -55,7 +55,7 @@ hold none# The command palette finds commands by their Spanish names too.key f3type "##Command palette" Dividir-expect "Dividir##pal.geometry.divide"+expect "Dividir (conserva los niveles)##pal.geometry.divide"key escape# Back to English: the same items with their English labels.diff --git a/tests/ui/layers_levels.sfui b/tests/ui/layers_levels.sfuiindex de3a63d9..b943cfbe 100644--- a/tests/ui/layers_levels.sfui+++ b/tests/ui/layers_levels.sfui@@ -12,6 +12,7 @@ click "Geometry/Reconstruct Subdiv"click "Geometry/Reconstruct Subdiv"click "Geometry/Reconstruct Subdiv"click "Geometry/Delete Higher"+click "Delete Levels/Delete Higher Levels"expect_value triangles == 108key ctrl+dkey ctrl+ddiff --git a/tests/ui/levels_rebuild.sfui b/tests/ui/levels_rebuild.sfuiindex f6fe7eb8..4e4a1002 100644--- a/tests/ui/levels_rebuild.sfui+++ b/tests/ui/levels_rebuild.sfui@@ -39,13 +39,32 @@ expect_text "SDiv 2 / 3"shot levels-back# Subdivide (the flat one, without levels) from SDiv 2: four times its triangles.-click "Geometry/Subdivide"+click "Geometry/Subdivide (removes levels)"+# It asks first on a Part with levels (Discord 11-02); Cancel keeps the levels.+expect_text "This removes your 3 subdivision levels"+shot subdivide-confirm+click "Subdivide/Cancel"+expect_value sdiv_levels == 3+click "Geometry/Subdivide (removes levels)"+click "Subdivide/Subdivide and Remove Levels"expect_value triangles == 27648expect_value sdiv_levels == 0expect_status "Subdivision levels removed: SDiv 2 of 3 kept as the new base"key ctrl+zexpect_value sdiv_levels == 3expect_value sdiv == 2+# Don't ask again: the next Subdivide goes straight through.+click "Geometry/Subdivide (removes levels)"+click "Subdivide/Don't ask again"+click "Subdivide/Subdivide and Remove Levels"+expect_value sdiv_levels == 0+key ctrl+z+click "Geometry/Subdivide (removes levels)"+expect_value sdiv_levels == 0+expect_no_text "This removes your"+key ctrl+z+expect_value sdiv_levels == 3+expect_value sdiv == 2# Another Part and back: the levels step as before (the cached levels of the Part left are freed).run part_append type=sphere name=Eyediff --git a/tests/ui/multires.sfui b/tests/ui/multires.sfuiindex c77da4e5..3271e498 100644--- a/tests/ui/multires.sfui+++ b/tests/ui/multires.sfui@@ -9,7 +9,7 @@ expect_value triangles == 27648orbit 140 -70key fclick "Geometry##tool.geometry"-expect "Geometry/Divide"+expect "Geometry/Divide (keeps levels)"expect "Geometry/Smt"expect_value sdiv_levels == 0expect_text "No subdivision levels"@@ -33,11 +33,13 @@ shot reconstructed-cage# Delete Higher at the base leaves the plain 108-triangle cage to start from.click "Geometry/Delete Higher"+expect_text "Delete SDiv 2 to"+click "Delete Levels/Delete Higher Levels"expect_value sdiv_levels == 0expect_value triangles == 108# Divide (Ctrl+D or the button): every level has four times the quads.-click "Geometry/Divide"+click "Geometry/Divide (keeps levels)"expect_value sdiv_levels == 2expect_value sdiv == 2expect_value triangles == 432@@ -131,11 +133,17 @@ shot part-listclick "Geometry##tool.geometry"key dclick "Geometry/Delete Lower"+# It asks first (Discord 11-02: destructive steps confirm before levels go).+expect_text "Delete SDiv 1 to 1?"+click "Delete Levels/Delete Lower Levels"expect_value sdiv == 1expect_value sdiv_levels == 4expect_value triangles == 432click "Geometry/Higher Level"click "Geometry/Delete Higher"+expect_text "Delete SDiv 3 to 4"+shot delete-levels-confirm+click "Delete Levels/Delete Higher Levels"expect_value sdiv_levels == 2key ctrl+zexpect_value sdiv_levels == 4diff --git a/tests/ui/review_fixes.sfui b/tests/ui/review_fixes.sfuinew file mode 100644index 00000000..af82fb86--- /dev/null+++ b/tests/ui/review_fixes.sfui@@ -0,0 +1,66 @@+# What a 0.10.6 video review and a Discord tester hit: Dynamic on the divided default sphere was a dead end+# (now Freeze Levels), Extract greyed out without saying why, no saved camera views, a near-black mask under a+# dense wireframe, and Delete Lower / Delete Higher deleting levels without asking.+run new_sphere+run subdiv_divide+run subdiv_divide+expect_value sdiv_levels == 3+remember triangles top+key f+camera 0 0++# Dynamic on a Part with levels: the offer, not a dead end. Cancel leaves everything as it was.+click "Dynamic##draw.dynamic"+expect_value dynamic == 0+expect_text "subdivision levels"+shot dynamic_offer+click "Dynamic/Cancel"+expect_value sdiv_levels == 3+click "Dynamic##draw.dynamic"+click "Dynamic/Freeze Levels and Turn On Dynamic"+expect_value dynamic == 1+expect_value sdiv_levels == 0+expect_value triangles == $top+expect_status "Dynamic topology on"+# Small Clay and Standard strokes with X symmetry, at Draw Size 19 (the review's settings).+expect_value symmetry_x == 1 # (X symmetry is on by default)+draw_size 19+click "Clay##brush.clay"+stroke 0.30 0.40 0.45 0.45+click "Standard##brush.standard"+stroke 0.30 0.60 0.45 0.62+expect_value triangles != $top # (Dynamic resized the triangles under the strokes)+zoom 2.5+shot small_strokes_dynamic+key f+# Ctrl+Z: the strokes, then the levels come back.+key ctrl+z+key ctrl+z+key ctrl+z+expect_value sdiv_levels == 3+click "Dynamic##draw.dynamic"+expect_value dynamic == 0++# The mask: a readable tint with a soft edge, the wireframe still visible over it; Mask darkness is a preference.+run mask_rect y0=0.2+expect_value masked > 0+click "Wire##view.polyf"+expect_value mask_darkness == 70+shot mask_wire+click "Wire##view.polyf"+run mask_clear++# Extract without a mask says what it needs.+expect_text "Mask first (Ctrl+drag)"++# Saved views: save one, turn away, Numpad 0 comes back to it.+camera 30 20+key ctrl+alt+numpad0+expect_value saved_views == 1+expect_status "View saved: View 1"+camera 0 0+key numpad0+expect_value camera_yaw > 29.9+expect_value camera_yaw < 30.1+key numpad3+expect_value camera_yaw > 89.9diff --git a/tests/ui/shell_layout.sfui b/tests/ui/shell_layout.sfuiindex 257836f3..1d5c6d8e 100644--- a/tests/ui/shell_layout.sfui+++ b/tests/ui/shell_layout.sfui@@ -75,9 +75,9 @@ shot left-tray# Tool sub-palettes: one open at a time.click "Tool/Geometry"-expect "Subdivide"+expect "Subdivide (removes levels)"expect_not "Parts/Append"-click "Subdivide"+click "Subdivide (removes levels)"expect_value triangles == 20480click "Tool/Parts"expect "Parts/Append"diff --git a/tests/ui/user_guide.sfui b/tests/ui/user_guide.sfuiindex dc36ab8c..b47fcb1e 100644--- a/tests/ui/user_guide.sfui+++ b/tests/ui/user_guide.sfui@@ -49,7 +49,7 @@ key shift+f1# Ctrl-hover help names the chapter; F1 (Ctrl still held) opens it.click "Tool/Geometry"hold ctrl-hover "Subdivide"+hover "Subdivide (removes levels)"expect_help Learn more: Subdivide, remesh, decimate and LODskey f1hold nonediff --git a/tools/guide/shots.sfui b/tools/guide/shots.sfuiindex bf63f416..4da9d1da 100644--- a/tools/guide/shots.sfui+++ b/tools/guide/shots.sfui@@ -49,7 +49,7 @@ key escape# Help: Ctrl-hover, the command palette, the console.click "Tool/Geometry"hold ctrl-hover "Subdivide"+hover "Subdivide (removes levels)"wait 0.3shot ctrl-helphold none