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
Preferences > Input > Start strokes off the model (#62, off by default) and Toggle strokes off the model (Shift+L)
islandmed3945b67e7c4a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 01370900..d68dde36 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -6,6 +6,15 @@ All notable changes to SculptForge are listed here. The format follows## [Unreleased]+### Added+- **Preferences > Input > Start strokes off the model** (#62, off by default) and **Toggle strokes off the model**+ (<kbd>Shift</kbd>+<kbd>L</kbd>): a left-drag that starts on the background begins a stroke, which touches the model+ once the cursor reaches it (LazyMouse and the stroke path start there, so nothing jumps). Ctrl (mask) and Shift+ (smooth) strokes work the same way; a Ctrl+click on the background still inverts the mask. The view still turns+ with a right-drag (or a pen button set to Right click), pans with Alt+drag or a middle-drag, moves with Space held+ when that option is on, and Blender and Maya keys keep Alt+left-drag. A label at the top of the canvas shows while+ it is on. MaskLasso, MaskRect and the hide / show shapes are unchanged.+### Changed- Faster CI and releases with the same tests (docs/releasing.md):- **Compiler caching:** compiles go through ccache, cached only by pushes to main and maintainers' own runs.diff --git a/docs/guide/navigation.md b/docs/guide/navigation.mdindex d21885a9..4a62bd50 100644--- a/docs/guide/navigation.md+++ b/docs/guide/navigation.md@@ -52,6 +52,7 @@ camera.| Turn in 15 degree steps | <kbd>Numpad 4</kbd> / <kbd>Numpad 6</kbd> (around), <kbd>Numpad 8</kbd> / <kbd>Numpad 2</kbd> (over); <kbd>Numpad 9</kbd>: the other side || Frame the active SubTool | <kbd>Numpad .</kbd> || Frame one SubTool | <kbd>Shift</kbd>+<kbd>Alt</kbd>+click it, or triple-click another SubTool (it becomes the active SubTool) |+| Sculpt from the background | Turn on **Preferences > Input > Start strokes off the model**, or press <kbd>Shift</kbd>+<kbd>L</kbd> (**Toggle strokes off the model**): a left-drag that starts beside the model sculpts once it reaches the surface || Move the camera with Space held | Turn on **Preferences > Input > Hold Space and drag to move the camera**, then hold <kbd>Space</kbd>: left-drag rotates, right- or middle-drag pans, <kbd>Ctrl</kbd>+drag zooms, anywhere on the canvas (on the model too) |Zoom drags go the ZBrush way: drag up to zoom out, down to zoom in. The SculptForge input style@@ -61,6 +62,16 @@ Zoom drags go the ZBrush way: drag up to zoom out, down to zoom in. The SculptFoQuickMenu. With it on, <kbd>Space</kbd> no longer opens the QuickMenu (a right click still does), and a space typed ina text field is never taken.+**Start strokes off the model** is off by default. With it on (a label at the top of the canvas says so), a+left-drag on the background no longer rotates: it waits, and the brush starts where the cursor first reaches the+model, so strokes that begin at the silhouette never turn the view by accident. <kbd>Ctrl</kbd> (mask) and+<kbd>Shift</kbd> (smooth) strokes start the same way, and a <kbd>Ctrl</kbd>+click on the background still inverts+the mask. To move the view, right-drag (a pen's lower button is a right click by default), <kbd>Alt</kbd>+drag to pan,+middle-drag, or hold <kbd>Space</kbd> if **Hold Space and drag to move the camera** is on; with the Blender or Maya+style, <kbd>Alt</kbd>+left-drag rotates as before. With a pen that has no buttons and the ZBrush or SculptForge style,+press <kbd>Shift</kbd>+<kbd>L</kbd> to turn it off while you rotate, or turn on Hold Space. MaskLasso, MaskRect and the+<kbd>Ctrl</kbd>+<kbd>Shift</kbd> hide and show shapes work as before.+"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 themodel fills the view, zoom out a little or use the right-shelf buttons.diff --git a/docs/guide/shortcuts.md b/docs/guide/shortcuts.mdindex 15078e20..e66d67fa 100644--- a/docs/guide/shortcuts.md+++ b/docs/guide/shortcuts.md@@ -96,6 +96,7 @@ action registry, the same source as the Controls window.| Save UI... | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> | Save the layout, shortcuts and interface preferences to a file you can share. || Shelves | <kbd>Tab</kbd> | Hide or show the shelves and trays around the canvas. || Store Config | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>I</kbd> | Keep the current layout, shortcuts and interface preferences for future sessions. Like ZBrush, SculptForge never saves them on its own. |+| Toggle strokes off the model | <kbd>Shift</kbd>+<kbd>L</kbd> | Turn Preferences > Input > Start strokes off the model on or off: with it on, a left-drag on the background sculpts once it reaches the model instead of turning the view (#62). |### Render@@ -163,6 +164,7 @@ action registry, the same source as the Controls window.| Action | Gesture ||---|---|| Sculpt | Left-drag on the model |+| Sculpt from beside the model | Turn on **Preferences > Input > Start strokes off the model** (or press <kbd>Shift</kbd>+<kbd>L</kbd>), then left-drag from the background onto the model; the view then turns with a right-drag (see [Navigation](navigation.md#mouse-and-pen)) || Invert the brush (subtract) | Hold <kbd>Alt</kbd> while sculpting || Smooth | Hold <kbd>Shift</kbd> while sculpting (works with any brush, and with Paint) || Straight line | Press <kbd>Shift</kbd> after a stroke has started (45 degree steps) |diff --git a/docs/guide/whats-new.md b/docs/guide/whats-new.mdindex d6455830..9738a3f5 100644--- a/docs/guide/whats-new.md+++ b/docs/guide/whats-new.md@@ -5,6 +5,14 @@ chapter opens by itself the first time you start a new version; you can always f**Help > What's New**. Every detail is in the[changelog](https://github.com/islandmed/SculptForge/blob/main/CHANGELOG.md).+## Version 0.10.5++### From your requests on GitHub++- **Start strokes off the model** (#62): an option in **Preferences > Input**, off by default, and+ <kbd>Shift</kbd>+<kbd>L</kbd> to turn it on and off. With it on, a left-drag that starts on the background+ sculpts once it reaches the model instead of turning the view. See [Navigation](navigation.md#mouse-and-pen).+## Version 0.10.4### From your requests on GitHubdiff --git a/src/app/AirStroke.h b/src/app/AirStroke.hnew file mode 100644index 00000000..8021f8fe--- /dev/null+++ b/src/app/AirStroke.h@@ -0,0 +1,17 @@+// SculptForge - open source digital sculpting+// SPDX-License-Identifier: GPL-3.0-or-later+//+// Preferences > Input > Start strokes off the model (#62): which left presses on the background wait to become a+// stroke (App::airStrokeMouseDown) instead of moving the view.+#pragma once++namespace sf {++// enabled: the preference. keyboardAlt: Alt on the keyboard itself (Alt+drag on the background still pans, and+// with Blender or Maya keys it orbits). ctrlShift: Ctrl+Shift, the hide / show selection shapes, left alone.+// busy: a LOD preview, or Append > Insert waiting for its click.+inline bool airStrokeStarts(bool enabled, bool keyboardAlt, bool ctrlShift, bool busy) {+ return enabled && !keyboardAlt && !ctrlShift && !busy;+}++} // namespace sfdiff --git a/src/app/App.cpp b/src/app/App.cppindex b4ba1440..fd685b6a 100644--- a/src/app/App.cpp+++ b/src/app/App.cpp@@ -3,6 +3,7 @@#include "app/App.h"#include "app/ShellQuote.h"#include "app/SpaceCamera.h"+#include "app/AirStroke.h"#include "app/AsyncStroke.h"#include "app/Calibration.h"#include "app/CrashLog.h"@@ -1236,6 +1237,7 @@ void App::onMouseDown(float x, float y, Uint8 button) {if (previewLod_ < 0 && pick(x, y, hit)) {if (maskMod) beginMaskStroke(x, y);else beginStroke(x, y, hit);+ } else if (airStrokeMouseDown(x, y, mod)) { // Start strokes off the model (#62, Input.cpp)} else if (blenderStyle()) {// Blender: a drag beside the model navigates as the middle button would (Shift pans, Ctrl zooms).const SDL_Keymod keys = SDL_GetModState();@@ -1336,6 +1338,7 @@ void App::onMouseMove(float x, float y, float dx, float dy, bool fromPen) {case Drag::Sculptable: sculptableMouseMove(x, y); break;case Drag::Capture: captureMouseMove(x, y); break;case Drag::ZSphere: zsphereDragTo(x, y); break;+ case Drag::AirStroke: airStrokeTo(x, y); break;case Drag::None: break;}}@@ -1411,6 +1414,7 @@ void App::onMouseUp() {if (drag_ == Drag::Sculptable) sculptableMouseUp();if (drag_ == Drag::Capture) captureMouseUp();if (drag_ == Drag::ZSphere) zsphereRelease();+ if (drag_ == Drag::AirStroke) airStrokeRelease();gizmoRelease();drag_ = Drag::None;dragFromPen_ = false;@@ -2044,6 +2048,7 @@ void App::drawUi() {drawSculptableOverlay(); // Make sculptable: crop box, face landmarks (PanelSculptable.cpp)drawCaptureOverlay(); // Capture from view: the square, the result window (PanelKelvinlet.cpp)if (uiPrefs_.showAxes) drawAxisGizmo(); // X / Y / Z in the canvas corner (#31)+ drawAirStrokeIndicator(); // Start strokes off the model is on (#62, Input.cpp)if (drag_ == Drag::Insert) { // the size the insert will getinsertPx_ = std::hypot(mouse.x - insertX_, mouse.y - insertY_);ImGui::GetForegroundDrawList()->AddCircle(ImVec2(insertX_, insertY_), std::max(insertPx_, 12.0f * uiScale_),diff --git a/src/app/App.h b/src/app/App.hindex 71a2d9b0..af0a60a4 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -134,7 +134,8 @@ public:void queueFile(FileAction action, std::string path);private:- enum class Drag { None, Stroke, Orbit, Pan, Zoom, Roll, MaskCanvas, SubToolClick, Select, Gizmo, Guide, Sculptable, ZSphere, Insert, Capture };+ enum class Drag { None, Stroke, Orbit, Pan, Zoom, Roll, MaskCanvas, SubToolClick, Select, Gizmo, Guide, Sculptable, ZSphere, Insert, Capture,+ AirStroke }; // AirStroke: a stroke begun off the model, waiting to reach it (#62)void handleEvent(const SDL_Event& e);void onMouseDown(float x, float y, Uint8 button);@@ -148,6 +149,15 @@ private:bool pick(float x, float y, RayHit& hit) const; // the active SubTool (what brushes work on)BrushType activeBrush() const;void beginStroke(float x, float y, const RayHit& hit);+ // Preferences > Input > Start strokes off the model (#62): a left press on the background waits as+ // Drag::AirStroke; the stroke begins where the drag first reaches the surface (airStrokeTo, Input.cpp).+ bool airStrokeMouseDown(float x, float y, SDL_Keymod mod);+ void airStrokeTo(float x, float y);+ void airStrokeRelease();+ void drawAirStrokeIndicator();+ bool airMask_ = false; // the waiting stroke masks (Ctrl held at the press)+ bool airMoved_ = false; // it moved past the click slop (a Ctrl+click still inverts the mask)+ float airX_ = 0.0f, airY_ = 0.0f; // where it was pressedvoid strokeTo(float x, float y);void dabAt(float x, float y, float pressure = -1.0f); // pressure < 0: strokePressure()void endStroke();diff --git a/src/app/Config.cpp b/src/app/Config.cppindex 431fddb1..ddec7741 100644--- a/src/app/Config.cpp+++ b/src/app/Config.cpp@@ -54,6 +54,7 @@ Json toJson(const UiPrefs& p) {j.set("emulateNumpad", p.emulateNumpad);j.set("rightClickQuickMenu", p.rightClickQuickMenu);j.set("spaceCamera", p.spaceCamera);+ j.set("airStrokes", p.airStrokes);j.set("cursorFollowsSurface", p.cursorFollowsSurface);j.set("showAxes", p.showAxes);j.set("alphabeticalPalettes", p.alphabeticalPalettes);@@ -94,6 +95,7 @@ void fromJson(const Json& j, UiPrefs& p) {p.emulateNumpad = j["emulateNumpad"].asBool(p.emulateNumpad);p.rightClickQuickMenu = j["rightClickQuickMenu"].asBool(p.rightClickQuickMenu);p.spaceCamera = j["spaceCamera"].asBool(p.spaceCamera);+ p.airStrokes = j["airStrokes"].asBool(p.airStrokes);p.cursorFollowsSurface = j["cursorFollowsSurface"].asBool(p.cursorFollowsSurface);p.showAxes = j["showAxes"].asBool(p.showAxes);p.alphabeticalPalettes = j["alphabeticalPalettes"].asBool(p.alphabeticalPalettes);diff --git a/src/app/Config.h b/src/app/Config.hindex 23cb6db7..400889e6 100644--- a/src/app/Config.h+++ b/src/app/Config.h@@ -36,6 +36,8 @@ struct UiPrefs {bool emulateNumpad = false; // Blender style: the 1-9 and 0 keys above the letters act as the numpad (laptops)bool rightClickQuickMenu = true; // a right click on the canvas (no drag) opens the QuickMenu, as in ZBrush (#22)bool spaceCamera = false; // hold Space and drag to move the camera (#43; off: Space opens the QuickMenu)+ bool airStrokes = false; // start strokes off the model (#62): a left-drag on the background sculpts once it+ // reaches the surface instead of turning the view (off: it turns the view, ZBrush)bool showAxes = true; // Draw > Camera > Axes: the X / Y / Z gizmo in the canvas corner (#31)bool cursorFollowsSurface = true; // the brush ring lies on the surface under the pointer, as in SculptGL (#25)TabletSettings tablet; // Preferences > Tablet: pressure curve, eraser, pen buttonsdiff --git a/src/app/I18nSpanish.cpp b/src/app/I18nSpanish.cppindex 22838756..c6c1bb7b 100644--- a/src/app/I18nSpanish.cpp+++ b/src/app/I18nSpanish.cpp@@ -544,6 +544,9 @@ constexpr Entry kSpanish[] = {{"Emulate Numpad", "Emular teclado numérico"},{"Right click opens the QuickMenu", "El clic derecho abre el QuickMenu"},{"Hold Space and drag to move the camera", "Mantén Espacio y arrastra para mover la cámara"},+ {"Start strokes off the model", "Empezar trazos fuera del modelo"},+ {"Strokes start off the model", "Los trazos empiezan fuera del modelo"},+ {"Toggle strokes off the model", "Activar trazos fuera del modelo"},{"Cursor follows surface", "El cursor sigue la superficie"},{"Import Blender keymap", "Importar atajos de Blender"},{"QuickMenu", "QuickMenu"},diff --git a/src/app/Input.cpp b/src/app/Input.cppindex f690e885..1ad617ba 100644--- a/src/app/Input.cpp+++ b/src/app/Input.cpp@@ -11,8 +11,10 @@// and 3D View), with the brush letters on SculptForge's nearest brush. The mouse side is in App.cpp// (onMouseDown: middle-drag orbit, Alt+left-drag as the middle button) and blenderMods (Ctrl inverts).#include "app/App.h"+#include "app/AirStroke.h"#include "app/BlenderKeymap.h"#include "app/Pickers.h"+#include "app/Theme.h"#include "app/Ui.h"#include "app/I18n.h"#include "core/Polygroups.h"@@ -35,6 +37,8 @@ namespace {constexpr double kQuickMenuTapSeconds = 0.25; // Space released sooner: a tap, the QuickMenu stays open+bool ctrlDown(SDL_Keymod mod) { return (mod & (SDL_KMOD_CTRL | SDL_KMOD_GUI)) != 0; } // as App.cpp+bool anyMasked(const Mesh& mesh) {return std::any_of(mesh.mask.begin(), mesh.mask.end(), [](float m) { return m > 0.0f; });}@@ -151,6 +155,22 @@ void App::registerInputActions() {"and with Ctrl held too a drag zooms (#43). Off by default: in ZBrush, Space opens the QuickMenu (with this ""on, a right click still does). Typing a space in a text field is never taken.",[this] { uiPrefs_.spaceCamera = !uiPrefs_.spaceCamera; }, [this] { return uiPrefs_.spaceCamera; });+ add("input.air_strokes", "Start strokes off the model", nullptr, "Preferences > Input", "",+ "A left-drag that starts on the background begins a brush stroke instead of turning the view; the brush "+ "touches the model once the cursor reaches it (#62). Ctrl (mask) and Shift (smooth) work the same way, and "+ "a Ctrl+click on the background still inverts the mask. The view still turns with a right-drag or a pen "+ "button set to Right click, pans with Alt+drag or a middle-drag, and moves with Space held if Hold Space is "+ "on; with Blender or Maya keys, Alt+left-drag orbits. Shift+L turns it on and off.",+ [this] { uiPrefs_.airStrokes = !uiPrefs_.airStrokes; }, [this] { return uiPrefs_.airStrokes; });+ add("input.toggle_air_strokes", "Toggle strokes off the model", nullptr, "Preferences > Input", "Shift+L",+ "Turn Preferences > Input > Start strokes off the model on or off: with it on, a left-drag on the background "+ "sculpts once it reaches the model instead of turning the view (#62).",+ [this] {+ uiPrefs_.airStrokes = !uiPrefs_.airStrokes;+ status_ = uiPrefs_.airStrokes ? "Strokes start off the model: right-drag or Alt+drag to move the view"+ : "Strokes off the model: off (a drag on the background turns the view)";+ },+ [this] { return uiPrefs_.airStrokes; });add("input.surface_cursor", "Cursor follows surface", nullptr, "Preferences > Input", "","The brush ring lies on the model under the pointer, turned to the surface and pressed onto its bumps, at ""the brush's real size there (as in SculptGL), with a short line along the surface's direction. With "@@ -423,6 +443,9 @@ void App::drawInputSection() {if (ui::Checkbox("Hold Space and drag to move the camera##input.space_camera", &spaceCamera))uiPrefs_.spaceCamera = spaceCamera;ui::HelpAction(*this, "input.space_camera");+ bool airStrokes = uiPrefs_.airStrokes;+ if (ui::Checkbox("Start strokes off the model##input.air_strokes", &airStrokes)) uiPrefs_.airStrokes = airStrokes;+ ui::HelpAction(*this, "input.air_strokes");bool surfaceCursor = uiPrefs_.cursorFollowsSurface;if (ui::Checkbox("Cursor follows surface##input.surface_cursor", &surfaceCursor))uiPrefs_.cursorFollowsSurface = surfaceCursor;@@ -605,4 +628,62 @@ void App::drawQuickMenu() {if (close) quickMenu_.open = false;}+// ---------------------------------------------------------------------------+// Start strokes off the model (#62)+// ---------------------------------------------------------------------------++// A left press on the background (no surface under it): with the preference on, the stroke waits until the drag+// reaches the model. Alt+drag still navigates and Ctrl+Shift still draws the hide / show shapes; the mask shapes+// (MaskLasso, MaskRect) and every other tool took the press before this.+bool App::airStrokeMouseDown(float x, float y, SDL_Keymod mod) {+ const SDL_Keymod keys = SDL_GetModState(); // the keyboard itself (blenderMods turns Ctrl into Alt)+ if (!airStrokeStarts(uiPrefs_.airStrokes, (keys & SDL_KMOD_ALT) != 0, ctrlDown(mod) && (mod & SDL_KMOD_SHIFT),+ previewLod_ >= 0 || !insertType_.empty()))+ return false;+ drag_ = Drag::AirStroke;+ airMask_ = ctrlDown(mod) && !(mod & SDL_KMOD_SHIFT);+ airMoved_ = false;+ airX_ = x;+ airY_ = y;+ return true;+}++// The waiting stroke begins at the first point over the surface, exactly as a press there would: the stroke path,+// LazyMouse and the first dab start from that point, so nothing jumps from where the drag began.+void App::airStrokeTo(float x, float y) {+ if (!airMoved_ && std::hypot(x - airX_, y - airY_) >= 4.0f) airMoved_ = true;+ doc_.syncBvh();+ RayHit hit;+ if (!pick(x, y, hit)) return;+ drag_ = Drag::None;+ if (airMask_) {+ beginMaskStroke(x, y);+ if (drag_ == Drag::Stroke && maskClickPending_) { // (a Ctrl+press on the model waits to tell a click)+ maskClickPending_ = false;+ firstDab(x, y);+ }+ } else {+ beginStroke(x, y, hit);+ if (drag_ == Drag::Orbit) drag_ = Drag::None; // (the active layer's weight is 0: never turn the view)+ }+}++// Let go before reaching the model: nothing happens, except a Ctrl+click, which inverts the mask as before.+void App::airStrokeRelease() {+ if (airMask_ && !airMoved_) runCommand("mask_invert");+}++void App::drawAirStrokeIndicator() {+ if (!uiPrefs_.airStrokes) return;+ const CanvasRect c = canvasRect();+ const char* text = tr("Strokes start off the model");+ const ImVec2 size = ImGui::CalcTextSize(text);+ const float pad = 6.0f * uiScale_;+ const ImVec2 at(c.x + (c.w - size.x) * 0.5f, c.y + 10.0f * uiScale_);+ ImDrawList* dl = ImGui::GetForegroundDrawList();+ dl->AddRectFilled(ImVec2(at.x - pad, at.y - pad * 0.5f), ImVec2(at.x + size.x + pad, at.y + size.y + pad * 0.5f),+ IM_COL32(0, 0, 0, 110), 4.0f * uiScale_);+ dl->AddText(at, theme::u32(theme::accent), text);+}+} // namespace sfdiff --git a/src/app/UiTest.cpp b/src/app/UiTest.cppindex d57c1394..ddc50969 100644--- a/src/app/UiTest.cpp+++ b/src/app/UiTest.cpp@@ -118,7 +118,7 @@// 2 DragDot, 3 Spray, 4 LazyMouse), vdms (VDM brush maps), vdm_files (.sfvdm in the library)// z_intensity, smooth_intensity, rgb_intensity (0-100), focal_shift (-100..100), draw_size,// size_popup_open (the S / U / I / O slider), size_knob_x / size_knob_y (its knob, pixels),-// quickmenu_open, right_click_menu, space_camera, space_held, radial_open / radial_menu (-1 none) / radial_held /+// quickmenu_open, right_click_menu, space_camera, space_held, air_strokes, radial_open / radial_menu (-1 none) / radial_held /// radial_hover / radial_ran (radial menus: open, the menu, held by its key or button, the// slot pointed at, the slot run last), radial_menus, radial_slots_N, lazy_mouse, input_style (0 ZBrush, 1 SculptForge, 2 Blender), turntable,// camera_ortho, mask_brush (Blender's Mask brush on), shortcut_conflicts (keys two actions@@ -424,6 +424,7 @@ double Demo::query(const std::string& name, bool& known) const {if (name == "quickmenu_open") return app_.quickMenu_.open ? 1.0 : 0.0;if (name == "right_click_menu") return app_.uiPrefs_.rightClickQuickMenu ? 1.0 : 0.0;if (name == "space_camera") return app_.uiPrefs_.spaceCamera ? 1.0 : 0.0;+ if (name == "air_strokes") return app_.uiPrefs_.airStrokes ? 1.0 : 0.0;if (name == "space_held") return app_.spaceHeld_ ? 1.0 : 0.0;if (name == "radial_open") return app_.radial_.menu >= 0 ? 1.0 : 0.0;if (name == "radial_menu") return double(app_.radial_.menu); // -1: none opendiff --git a/tests/test_air_stroke.cpp b/tests/test_air_stroke.cppnew file mode 100644index 00000000..1f1306c1--- /dev/null+++ b/tests/test_air_stroke.cpp@@ -0,0 +1,16 @@+// SculptForge - open source digital sculpting+// SPDX-License-Identifier: GPL-3.0-or-later+// Start strokes off the model (#62): which left presses on the background wait to become a stroke.+#include "TestHarness.h"++#include "app/AirStroke.h"++using namespace sf;++TEST(air_stroke_starts) {+ CHECK(airStrokeStarts(true, false, false, false));+ CHECK(!airStrokeStarts(false, false, false, false)); // off by default: a drag on the background turns the view+ CHECK(!airStrokeStarts(true, true, false, false)); // Alt+drag still pans (Blender / Maya: orbits)+ CHECK(!airStrokeStarts(true, false, true, false)); // Ctrl+Shift: the hide / show shapes+ CHECK(!airStrokeStarts(true, false, false, true)); // a LOD preview or a pending Insert+}diff --git a/tests/ui/air_strokes.sfui b/tests/ui/air_strokes.sfuinew file mode 100644index 00000000..db6302de--- /dev/null+++ b/tests/ui/air_strokes.sfui@@ -0,0 +1,88 @@+# #62: Preferences > Input > Start strokes off the model (off by default: a drag on the background turns the view).+run new_sphere subdivisions=4+key f+camera 0 0+snapshot++# Off: a left drag from the background onto the model turns the view and leaves the surface alone.+expect_value air_strokes == 0+remember camera_yaw yaw0+drag_path -0.3 0.5 0.5 0.5+expect_value camera_yaw != $yaw0+expect_value moved == 0+expect_value can_undo == 0++# On (the checkbox): the same drag sculpts from where it reaches the surface; the camera stays put.+camera 0 0+click "Preferences##palette.preferences"+click "Input##preferences.input"+hold ctrl+hover "Start strokes off the model##input.air_strokes"+expect_help "background"+hold none+click "Start strokes off the model##input.air_strokes"+expect_value air_strokes == 1+key escape+remember camera_yaw yaw1+remember camera_pitch pitch1+drag_path -0.3 0.5 0.5 0.5+expect_value camera_yaw == $yaw1+expect_value camera_pitch == $pitch1+expect_value moved > 0+expect_value can_undo == 1+shot air_strokes++# A drag that never reaches the model does nothing at all.+key ctrl+z+expect_value can_undo == 0+drag_path -0.3 -0.3 -0.3 1.3+expect_value camera_yaw == $yaw1+expect_value can_undo == 0++# Ctrl: a mask stroke from the background; a Ctrl+click on the background still inverts the mask.+expect_value masked == 0+hold ctrl+drag_path -0.3 0.4 0.5 0.4+hold none+expect_value masked > 0+expect_value camera_yaw == $yaw1+remember masked m0+hold ctrl+drag_path -0.3 -0.3 -0.3 -0.3+hold none+expect_value masked > $m0+key ctrl+shift+a+expect_value masked == 0++# Shift: a smooth stroke from the background.+snapshot+hold shift+drag_path -0.3 0.6 0.5 0.6+hold none+expect_value camera_yaw == $yaw1+expect_value moved > 0++# Navigation still works: right drag turns, Alt+drag pans.+button_drag right 0.12 0.5 0.12 0.7+expect_value camera_pitch != $pitch1+remember camera_pan pan0+hold alt+drag_path -0.3 0.5 -0.3 0.8+hold none+expect_value camera_pan != $pan0++# With the pen: a tip drag from the background onto the model sculpts, the view stays.+camera 0 0+remember camera_yaw yaw2+snapshot+pen_drag 0.12 0.5 0.5 0.5+expect_value camera_yaw == $yaw2+expect_value moved > 0+pen_out++# Shift+L turns it off again: the drag turns the view.+key shift+l+expect_value air_strokes == 0+expect_value shortcut_conflicts == 0+drag_path -0.3 0.5 0.5 0.5+expect_value camera_yaw != $yaw2