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
Triple-click another SubTool in the viewport: it becomes the active one and is framed (#43); UI test (click_subtool takes a click count)
islandmed613e37a14c52
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex aa8098d8..59c5e294 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -27,6 +27,7 @@ All notable changes to SculptForge are listed here. The format follows- **Keep Masked** for Voxel Remesh, Decimate and QRemesh (#43, off by default): masked areas keep theirtriangles exactly; the rest is rebuilt and, for the remeshers, joined to them along the mask's edge with astrip of triangles so the model stays closed (`keep_masked=true` on `remesh`, `decimate`, `qremesh`).+- Triple-click another SubTool in the viewport to make it the active one and frame it (#43).- SubTool thumbnails in the SubTool list (#43), drawn from each SubTool's existing GPU buffers (no upload, themotion proxy on dense meshes), one per frame at most and only once a change has settled, never during a stroke.diff --git a/docs/guide/navigation.md b/docs/guide/navigation.mdindex ae350da7..0bc201dc 100644--- a/docs/guide/navigation.md+++ b/docs/guide/navigation.md@@ -54,7 +54,7 @@ camera.Zoom drags go the ZBrush way: drag up to zoom out, down to zoom in. The SculptForge input style(**Preferences > Input**) reverses them: drag up to come closer.-| Frame one SubTool | <kbd>Shift</kbd>+<kbd>Alt</kbd>+click it (it becomes the active SubTool) |+| Frame one SubTool | <kbd>Shift</kbd>+<kbd>Alt</kbd>+click it, or triple-click another SubTool (it becomes the active SubTool) |"Background" means any part of the canvas where the cursor isn't over the model. A left-drag that starts onthe model sculpts instead, so with a pen or a one-button mouse, start rotations beside the model. When thediff --git a/docs/guide/shortcuts.md b/docs/guide/shortcuts.mdindex 7f5621ff..5e235939 100644--- a/docs/guide/shortcuts.md+++ b/docs/guide/shortcuts.md@@ -178,7 +178,7 @@ action registry, the same source as the Controls window.| Hide a polygroup | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Alt</kbd>+click it || Show everything | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+click the background || Hide outside a rectangle or lasso | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+drag (add <kbd>Alt</kbd>: hide inside); **SelectRect** or **SelectLasso** in **Tool > Visibility** |-| Select a SubTool | <kbd>Alt</kbd>+click it in the view (<kbd>Shift</kbd>+<kbd>Alt</kbd>+click: select and frame it) |+| Select a SubTool | <kbd>Alt</kbd>+click it in the view (<kbd>Shift</kbd>+<kbd>Alt</kbd>+click, or a triple-click on another SubTool: select and frame it) || Move, scale or rotate with the Gizmo 3D | <kbd>W</kbd>, <kbd>E</kbd> or <kbd>R</kbd>, then drag a handle; hold <kbd>Shift</kbd> to snap (15 degrees, the grid, 10%) || Move the gizmo only | <kbd>Alt</kbd>+drag a gizmo handle || Put the gizmo's pivot on the model | <kbd>Alt</kbd>+click the model in Move, Scale or Rotate mode |diff --git a/docs/guide/subtools.md b/docs/guide/subtools.mdindex a50f9185..a099853b 100644--- a/docs/guide/subtools.md+++ b/docs/guide/subtools.md@@ -31,7 +31,7 @@ and they catch up a moment after you stop changing a SubTool (not during a strok| To | Do this ||---|---|-| Select a SubTool | Click its row, or <kbd>Alt</kbd>+click it in the viewport |+| Select a SubTool | Click its row, or <kbd>Alt</kbd>+click it in the viewport; triple-click another SubTool in the viewport to select it and frame it || Rename it | Double-click the row (or right-click > **Rename**), type, press <kbd>Enter</kbd> || Hide or show it | Click the eye at the end of the row || Duplicate or delete it | Right-click the row > **Duplicate** or **Delete...** |diff --git a/src/app/App.cpp b/src/app/App.cppindex 1dff8a1b..314b6405 100644--- a/src/app/App.cpp+++ b/src/app/App.cpp@@ -1076,8 +1076,11 @@ void App::handleEvent(const SDL_Event& event) {case SDL_EVENT_MOUSE_BUTTON_DOWN:lastInputPen_ = e.button.which == SDL_PEN_MOUSEID;// Strokes and navigation start only on the canvas, never on the shell around it.- if (!io.WantCaptureMouse && canvasRect().contains(e.button.x, e.button.y))+ if (!io.WantCaptureMouse && canvasRect().contains(e.button.x, e.button.y)) {+ mouseClicks_ = e.button.clicks;onMouseDown(e.button.x, e.button.y, e.button.button);+ mouseClicks_ = 1;+ }break;case SDL_EVENT_MOUSE_BUTTON_UP:// A right click that didn't drag: the QuickMenu (#22). (SDL's click for a pen button doesn't count: a pen@@ -1155,6 +1158,17 @@ void App::onMouseDown(float x, float y, Uint8 button) {if (faceMouseDown(x, y, mod)) return; // placing facial landmarks (PanelFace.cpp)if (sculptableMouseDown(x, y)) return; // Make sculptable: landmarks, crop box (PanelSculptable.cpp)if (captureMouseDown(x, y)) return; // Capture from view: the drag draws the square (PanelKelvinlet.cpp)+ // A triple-click on another SubTool makes it the active one and frames it (#43). (Its first two clicks+ // don't sculpt it: brushes work on the active SubTool only.)+ if (mouseClicks_ >= 3 && !(mod & (SDL_KMOD_SHIFT | SDL_KMOD_CTRL | SDL_KMOD_ALT | SDL_KMOD_GUI)) &&+ insertType_.empty() && doc_.subtoolCount() > 1) {+ const int target = pickSubtool(x, y);+ if (target >= 0 && target != doc_.activeSubtool) {+ runCommand("subtool_select", {{"index", double(target)}});+ frameActiveSubtool();+ return;+ }+ }// Alt+click on another SubTool selects it (ZBrush); Alt+drag stays an inverted stroke or a pan.// Shift+Alt+click selects and frames it (ZBrush), the active one too.const bool frameClick = (mod & SDL_KMOD_ALT) && (mod & SDL_KMOD_SHIFT) && !ctrlDown(mod);diff --git a/src/app/App.h b/src/app/App.hindex 65d48a01..0281625b 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -968,6 +968,7 @@ private:void subtoolClickRelease(); // ... and releasing without dragging selects itint subtoolClickTarget_ = -1;bool subtoolClickFrame_ = false; // Shift+Alt+click: frame the SubTool as well+ int mouseClicks_ = 1; // SDL's click count of the press being handled (3 = a triple-click, #43)float subtoolClickX_ = 0.0f, subtoolClickY_ = 0.0f;uint32_t renamingSubtool_ = 0; // SubTool id being renamed inline (0: none)uint32_t listedActiveSubtool_ = 0; // the list scrolls to the active SubTool when it changesdiff --git a/src/app/Demo.cpp b/src/app/Demo.cppindex 95e20651..f86c6464 100644--- a/src/app/Demo.cpp+++ b/src/app/Demo.cpp@@ -209,14 +209,14 @@ void Demo::mouseMotion(float x, float y, SDL_MouseID which) {app_.handleEvent(e);}-void Demo::mouseButton(bool down, int button, SDL_MouseID which) {+void Demo::mouseButton(bool down, int button, SDL_MouseID which, int clicks) {SDL_Event e{};e.type = down ? SDL_EVENT_MOUSE_BUTTON_DOWN : SDL_EVENT_MOUSE_BUTTON_UP;e.button.windowID = SDL_GetWindowID(app_.window_);e.button.which = which;e.button.button = Uint8(button);e.button.down = down;- e.button.clicks = 1;+ e.button.clicks = Uint8(clicks);e.button.x = mouse_.x;e.button.y = mouse_.y;if (button == SDL_BUTTON_LEFT) buttonDown_ = down;diff --git a/src/app/Demo.h b/src/app/Demo.hindex 994b6e8a..00af8b85 100644--- a/src/app/Demo.h+++ b/src/app/Demo.h@@ -110,7 +110,7 @@ private:// Input injection.void mouseMotion(float x, float y, SDL_MouseID which = 0); // which = SDL_PEN_MOUSEID: synthesized from a pen- void mouseButton(bool down, int button, SDL_MouseID which = 0);+ void mouseButton(bool down, int button, SDL_MouseID which = 0, int clicks = 1);// Pen events as SDL3 sends them (UiTest.cpp): the pen's own event, then the mouse event SDL synthesizes.void penProximity(bool in);void penMove(float x, float y); // PEN_MOTION (+ mouse motion), touching or hoveringdiff --git a/src/app/UiTest.cpp b/src/app/UiTest.cppindex d367f8d9..d2cf471e 100644--- a/src/app/UiTest.cpp+++ b/src/app/UiTest.cpp@@ -51,8 +51,9 @@// expect_help TEXT the Ctrl-hover help box shown this frame contains TEXT (hold ctrl, then hover)// clipboard TEXT put TEXT on the clipboard (to test pasting, e.g. a brush code)// expect_clipboard TEXT the clipboard contains TEXT (after a copy)-// click_subtool NAME [U V] left-click SubTool NAME in the viewport (with the held modifiers, e.g.-// hold alt to select it); U V: fractions of its on-screen bounds+// click_subtool NAME [U V [N]] left-click SubTool NAME in the viewport (with the held modifiers, e.g.+// hold alt to select it); U V: fractions of its on-screen bounds; N clicks in a row+// (3 = a triple-click)// expect_value NAME OP N triangles, vertices, layers, brushes, masked, hidden, groups, colored,// can_undo, dirty, splats, show_polygroups, show_mask, show_mesh, wireframe,// flat_shading (the scene's: 1 Flat), gradient_background (1 Gradient, 0 Flat Colour),@@ -878,7 +879,8 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& eif (!need(1)) return false;const std::string name = w[1];const float u = num(2, 0.5f), v = num(3, 0.5f);- steps_.push_back([this, line, name, u, v](float t) {+ const int times = std::clamp(int(num(4, 1.0f)), 1, 3); // click_subtool NAME U V 3: a triple-click+ steps_.push_back([this, line, name, u, v, times](float t) {const int index = app_.doc_.findSubtool(name);if (index < 0) {fail(line, "no SubTool named \"" + name + "\"");@@ -921,8 +923,10 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& emouseMotion(p.x, p.y);return false;}- mouseButton(true, SDL_BUTTON_LEFT);- mouseButton(false, SDL_BUTTON_LEFT);+ for (int c = 1; c <= times; ++c) { // SDL counts the clicks of a quick series+ mouseButton(true, SDL_BUTTON_LEFT, 0, c);+ mouseButton(false, SDL_BUTTON_LEFT, 0, c);+ }return true;});wait(0.1f);diff --git a/tests/ui/triple_click.sfui b/tests/ui/triple_click.sfuinew file mode 100644index 00000000..2fdee058--- /dev/null+++ b/tests/ui/triple_click.sfui@@ -0,0 +1,20 @@+# #43: a triple-click on another SubTool in the viewport makes it the active one and frames it, without+# sculpting anything; single and double clicks on it don't select it.+run new_sphere subdivisions=3+run subtool_append type=cube name=Cube+run subtool_select index=0+key f+expect_value active_subtool == 0++# One or two clicks: still the sphere.+click_subtool Cube 0.5 0.5 2+expect_value active_subtool == 0++# Three: the Cube, framed (the camera moves in on it).+remember camera_distance far+click_subtool Cube 0.5 0.5 3+expect_value active_subtool == 1+expect_status Active SubTool: Cube+expect_value camera_distance < $far+expect_value edited_subtools == 0+shot triple_click_frame