Skip to content

Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.

Merge origin/merge/0.10.9 into feat/stroke-popup; the popup's Blender key is N (J is the Strokes radial menu)

islandmed75e5d2be2ad9
diff --cc CHANGELOG.md
index 8b1bb7f2,bb2fab40..bb6bfcf1
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -7,11 -7,183 +7,188 @@@ All notable changes to SculptForge are
## [Unreleased]
### Added
- - Stroke popup: press G (J in the Blender style; any key in Preferences > Hotkeys) or the new button under the Stroke
++- Stroke popup: press G (N in the Blender style; any key in Edit > Preferences > Hotkeys) or the new button under the Stroke
+ tile for a grid at the cursor with the stroke types and the modifiers Add / Sub, Smooth, Mask and Select. Hold the
+ key, point and let go (a hovering pen works too), or tap it and click. Smooth, Mask and Select stay on without
+ holding Shift or Ctrl until you pick them again or another brush; a label at the cursor shows which. A plain grid,
+ not a ring. (Suggested on Discord.)
+ - Alpha options in the Alpha palette (#76, requested by rodrigomoretto): **Follow stroke direction** turns the alpha
+ along the stroke with Blender's Rake smoothing (the direction is taken again every 20 pixels), **Angle** and **Angle
+ jitter** turn it by a fixed or a random amount per dab, and **Tile across / down** repeat it 1 to 8 times inside
+ the brush. They work with custom and Community brushes, are kept per brush, and the preview shows the tiling.
+ Scripts: `brush_alpha_options`.
+ - **View > Lock camera** (Shift+L, the same switch as Preferences > Input > Start strokes off the model) and a
+ **CAMERA LOCKED** chip in the status bar while it is on (#62 follow-up).
+ - Blender style: **Preferences > Input > Emulate 3 Button Mouse** (off by default): Alt+left-drag turns the view
+ everywhere, as before.
+ - Each brush keeps its own settings (#78, requested by dCo3lh0 and on Discord): Draw Size, Z Intensity, Falloff, RGB
+ Intensity, the stroke (with Spray's scatter and Lazy Stroke's radius) and the alpha follow the brush, custom and
+ Community brushes included. Switching back brings back the values that brush had this session; a brush not used yet
+ starts from the current values. **Brush > Save Brush Settings** keeps them for every start (`brush-settings.json`
+ in the user data folder), **Brush > Reset Brush to Default** restores the shipped values, and **Preferences >
+ Input > Share size and intensity across brushes** (off by default) keeps Draw Size and Z Intensity shared as before.
+ - **Gizmo size** (Draw > Camera): the corner axes come in Small, Medium (as before, the default) and Large, on top
+ of the UI scale; clicking an end still snaps to that side at every size. Saved in the preferences.
+ - **View Figure** (Draw > Camera, beside Axes, off by default): a small shaded head in the canvas corner that turns
+ with the camera; click it to snap to the nearest side view. Requested on Discord.
+ - Starter meshes (Discord #ideas): a human head with eye and mouth loops, a bust, a full body in A-pose, a hand, a
+ foot, an ear, an eye, a stylised head, a creature head blockout (skull, jaw and horns as Parts), a torso, and
+ bevelled rounded box, cylinder, capsule and ring primitives. All quads, centimetres, centred, standing on the
+ ground and symmetric where they should be; they open with subdivision levels over a small base cage (the whole
+ set adds 0.8 MB). **File > New from Starter Mesh**, a **Starter meshes** folder with thumbnails in Library > Tool,
+ **Start from a head** in the welcome, and `new_starter_mesh` for scripts. The human meshes are cut from the
+ MakeHuman base mesh (CC0); the rest are generated by `tools/starter/build_starter_meshes.py`
+ (docs/starter-meshes.md).
+ - "Your first sculpt in 10 minutes" (docs/guide/first-sculpt.md): a twelve-step lesson for complete beginners that
+ turns the default sphere into a mushroom house: masked Move strokes for the walls and an overhanging cap, colour
+ filled through the mask, Divide twice, a door and framed windows carved with Crease and Clay, raised spots
+ painted with a hard-edged Paint brush, PBR shading and a saved render. The welcome has a big **Start the 10-minute
+ lesson** button, and **Help > Your first sculpt (10 min)** opens it. Its screenshots come from
+ tests/ui/first_sculpt.sfui, which ctest runs so the lesson keeps working. The website links it from the homepage
+ and the guide index.
+ - **Render > Materials > Save Render**: the view without the interface at twice its size, saved as a PNG in the
+ library's Images folder (Library > Image).
+ - Upstream watch for studios: a weekly check of OpenUSD, MaterialX, OpenColorIO, OpenEXR, OpenVDB, OpenSubdiv,
+ OpenTimelineIO, OpenAssetIO, the VFX Reference Platform, Blender, Unreal Engine, Godot, SDL3, Dear ImGui and Python
+ opens a tracking issue for each new release, plus a monthly "Upstream digest" (targets in `packaging/upstream.json`).
+ - Insider daily drops: almost every day a new alpha, brush, VDM or Kelvinlet preset, made by SculptForge's own
+ procedural tools and checked on a test sculpt (too faint, seams, torn surfaces and near-duplicates are left out),
+ posted to Insiders as an .sfpack. Supporters get the month's drops as one Insider Pack at month end, and everyone
+ gets that pack free three months later (`tools/drops/`, `.github/workflows/insider-drop.yml`).
+ - Focus Detail (experimental, off by default): a billion-micro-triangle asset streamed from one compressed file.
+ Detail loads in under and ahead of the brush and wherever the camera would show it; everything else shows a
+ coarse version. Saving writes only the changed tiles. Try `sculptforge --benchmark standard-1b` or
+ `sculptforge --focus-detail FILE.sfdetail`; design and numbers in docs/design/focus-detail.md.
+ - Precision work (guide: Sculpting > Precision work). **Steady Stroke** (<kbd>L</kbd>) now works with every stroke
+ type (Dots, Drag Stamp, Slide Stamp, Spray), with **Catch up on release** (finish the line to the cursor) and the
+ string drawn to the lagging brush; the Lazy Stroke type is Dots with it on. **World Size** (Draw palette) keeps
+ Draw Size in model units, so the brush stays the same size on the surface as you zoom; every Draw Size slider
+ and the cursor show px and mm. Draw Size goes down to 0.5 px; <kbd>Shift</kbd>+<kbd>[</kbd> /
+ <kbd>Shift</kbd>+<kbd>]</kbd> step 1 px, <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+right-drag scrubs the size finely,
+ and small brushes space their dabs closer so tiny strokes stay continuous. **Precision drag**: hold
+ <kbd>Shift</kbd>+<kbd>Alt</kbd> while drawing and the brush moves at a quarter of the pen's speed, at
+ **Precision Intensity**. **A pressure curve per brush**: 2 to 5 points with Soft, Linear, Firm and Fine detail
+ presets, in Brush Lab and Preferences > Tablet.
+ - Smooth face group borders only (Brush palette): Smooth straightens the borders between face groups along the
+ surface and leaves the rest alone, for clean clothing edges (#81, thanks bossian0220).
+ - Colour tints the material (Color palette, on by default): the current colour tints the Lit Sphere material of
+ Parts with no vertex paint; grey leaves it as it is (thanks ThinkingPolygons).
+ - Cut (#101, #91): one tool that cuts the active Part with a Line, Lasso, Rectangle or Polyline drawn on the screen,
+ in the Ctrl+Shift brush picker and in Tool > Cut. Away removes what the shape covers through the whole Part and
+ closes the cut with a flat cap (a face group of its own), In cuts a flat-bottomed pocket Depth deep, Add extrudes
+ the shape out of the surface (boolean union). An exact boolean in screen space: the uncut surface and its mask,
+ colours, UVs and layers are kept, and the result is watertight. Follows X/Y/Z and radial symmetry; one undo step.
+ Scriptable as the `cut` command.
+ - Mask Lasso and Mask Rectangle: Front faces only (#91), also `front_faces_only` on mask_lasso / mask_rect.
+ - Duplicate Part shortcut: Ctrl+Shift+D (also Duplicate Part in the command palette).
+
+ ### Changed
+ - What's New is a window now: after an update (and from **Help > What's New**) a centred card shows the version's main
+ features, each with a picture, one line and a **Try it** button that opens it (switch the look, open the membership
+ card, select the brush, open the benchmark...), plus the full release notes, the Discord and Close. It takes the
+ look's colours, fades in, follows the UI scale and works from the keyboard (Esc, Tab, Enter). The guide chapter and
+ the website page show the last three versions in full (a band with the date, the feature cards, "All changes"
+ folded) and the older ones as short groups (0.10.1 to 0.10.5, 0.9.x, 0.8 and earlier); the contents list follows.
+ The data is a ```features block per version in docs/guide/whats-new.md, read by the app and build_site.py alike.
+ - Image and text to 3D work out of the box with no token: the free Hugging Face default is now **Hunyuan3D 2.1**,
+ for new installs and for everyone who never picked a model (an explicit choice is kept; a saved TRELLIS.2 is
+ kept when a token is saved too). TRELLIS.2 shows as "Best detail (needs token)".
+ - TRELLIS.2 without a Hugging Face token no longer fails: Hunyuan3D 2.1 runs instead and the status line says
+ "TRELLIS.2 needs a free Hugging Face token (Preferences > AI); used Hunyuan3D 2.1 instead." The token can now be
+ set in the new **Preferences > AI** too.
+ - Generated models get **Quad Remesh** by default instead of voxel remesh: clean quads (about resolution² / 2, 32768
+ at the default 256) with one subdivision level projected onto the model, ready to sculpt and subdivide. A voxel
+ pass cleans up holes and overlapping pieces first. It runs in the background with the progress bar (about 20 s
+ for a typical Hunyuan3D model). **Remesh** in Generate 3D also offers Voxel remesh and Off; the CLI takes
+ `remesh=quad|voxel|false` (`true` means quad) and `levels=0-2`. The status line says "remeshed to N quads".
+ - The Hunyuan3D licence notice (the Tencent Hunyuan Community License doesn't cover use in the EU, UK or South
+ Korea) is shown once, the first time a Hunyuan3D model runs, and stays in the Model picker's tooltip.
+ - Hover in every look is calm and clear: buttons, menu items, shelf buttons and palette headers brighten a little in
+ about 100 ms (no accent tint), pressed is a touch darker, and brush, alpha, material and look tiles (shelves,
+ pickers, Library) lift slightly without moving anything; the active tile keeps its orange outline. Sliders
+ brighten, grow a knob and show their exact value. Hover and keyboard-focus rings follow **Outlines** (Off: none;
+ Subtle; On) and **Outline opacity**. New **Preferences > Interface > Reduce motion**: colour changes only, no easing
+ or lifting. Animations draw frames only while they run.
+ - Large brushes on dense meshes no longer stall the view: from 2 million vertices a stroke's dabs are placed on the
+ stroke thread (the same dabs, in the same order, as the frame loop places them; no preview), so a frame keeps
+ drawing while a 240 px dab moves millions of vertices, and a light batch is still waited for within the frame.
+ On the standard scene's 240 px brush the slowest frames drop from 139 ms (15M) and 306 ms (33M) to about 30 ms in
+ first runs, and lifting the pen no longer waits (162 ms at 33M). `SF_BACKGROUND_DABS=0` turns it off.
+ - Move on dense meshes no longer stalls: it worked out its whole region's normals and bounds again for every pointer
+ sample (several times a frame with a 240 Hz pen, more the slower the frame got: seconds at 33M under load). The
+ positions still follow every sample; the normals and bounds now follow once a frame, and the mesh comes out the
+ same, bit for bit.
+ - The first orbit after a long stroke no longer stalls (180-300 ms at 33M): the moving view's lighter stand-ins for
+ the changed areas are rebuilt a few milliseconds a frame, the rest drawn in full detail until then.
+
+ ### Fixed
+ - Blender style: Alt+left-drag on the model masks and Ctrl+Alt+left-drag unmasks, as Blender 5.1+'s default
+ sculpt keymap does, instead of turning the view (#77, reported by TheRedWaxPolice). Beside the model Alt+drag still
+ turns the view, and Alt+Shift+drag pans anywhere. Shift+F (Strength) sets the brush's Intensity instead of Smooth's.
+ - UI test runs remove their temporary settings folder when they pass (thousands of runs had filled `/tmp`).
+ - Tablets (a Wacom Intuos 3 report): a tablet plugged in after launch works without a restart ("Tablet connected" /
+ "Tablet disconnected" in the status bar), also through Wacom Bridge; on Windows, pressure now also comes from the
+ Wacom driver with "Use Windows Ink" off (Wintab); a pen without pressure draws at full strength instead of not at
+ all, and Preferences > Input and > Tablet say "Pressure: on" or "not detected" with a troubleshooting link. The
+ view no longer jumps when the pen comes back into range elsewhere or leaves mid-drag. The active Part changes only
+ with the keyboard's Alt and a quick click (not with a pen button set to Alt, a long pen press or quick pen taps),
+ and the status bar says "Active Part: <name> (Alt+click)".
+ - The enlarged brush or alpha thumbnail you point at in a picker is drawn over its neighbours again, not
+ under them (#86, thanks tristratos).
+ - The brush centre now sits exactly under the cursor at high zoom and on HiDPI screens: the brush's ray is worked
+ out from the camera directly, and the view is drawn on whole pixels where the rays are cast (it could be up to
+ half a pixel off). The surface point under the brush is lightly filtered, so strokes on dense meshes no longer
+ wobble.
+ - Preferences > Interface > UI scale applies at once: text, controls and panels resize live, no restart (#87).
+ Before, the choice waited for the next start and was lost unless Store Config saved it. Automatic now follows
+ the monitor the window is on: on Windows (per-monitor DPI v2, now declared in the app's manifest) dragging the
+ window between a 100 % and a 150 % monitor, or changing Settings > Display > Scale, rescales the UI right away.
+ - The pen picks a brush, then stops clicking the panels and the canvas until the mouse is used (#95; Huion Kamvas,
+ display tablets, Wacom with Windows Ink on or off): SDL 3.2 keeps one "a pen is touching" flag for all pens, and
+ once Windows took a pen away while it touched (a drag capturing the mouse), it made no mouse events for any pen
+ again. SculptForge now makes the pen tip's mouse events from the pen's own and ignores SDL's, lets go of the
+ button whenever the pen leaves, and ignores the mouse presses some drivers (Huion) send beside the pen's, whose
+ release may never come. A replay test covers Windows Ink, a Huion-style pen + mouse stream, SDL's stuck state and
+ Wintab-style input.
+ - Tablet Mouse mode (#72, 0.10.8): it followed the system cursor, which with the tablet driver in pen mode is where
+ the pen is, so it felt the same as Pen mode. Now only the pen's movement moves the cursor, with no jump when the
+ pen comes back elsewhere, and while the pen is in range the arrow is drawn at the brush (the system's, at the
+ pen's place on the tablet, is hidden), so arrow, brush and clicks agree.
+ - With two screens, moving the pointer to the other screen made SculptForge draw as if it were in the background
+ until the pointer came back (Windows 11). It now keeps drawing after any input while its window has focus,
+ wherever the pointer is, and rests only when it loses focus.
+ - Turn AI off: **Preferences > AI > Enable AI features** (also asked in the first-run welcome). Off hides AI Brush,
+ Generate 3D and their menu, shelf and command palette entries, removes the AI commands from scripts, the CLI and
+ the MCP tool list, and stops every AI network call; the MCP server and the offline Relief / Inflate / Stamp stay.
+ Saved at once. Studios: `SF_AI=off` (or `--no-ai`) turns it off and locks it. About and the website now say:
+ "Your art is never uploaded or used for training. AI features run only when you use them and can be turned off."
+ - Help > Benchmark (and `--benchmark`) checks the memory free now before each scene instead of trusting the
+ computer's total: a scene that doesn't fit (15M needs about 2.2 GB free, 33M about 5 GB, plus a margin) is skipped
+ with a clear message ("33M skipped: needs ~5 GB free, 1.3 GB available. Close other apps and run again") rather
+ than running the system out of memory. The result lists skipped scenes; the command line exits with code 2.
+ - Subdivide, Divide, Divide to a micro level and Voxel Remesh ask first ("Not enough free memory", Continue anyway or
+ Cancel) when the mesh they would build doesn't fit the memory free now.
+ - Runs started by scripts and agents (`SDL_APP_ID=sculptforge-agent`, or `SF_ISOLATE=1`) use their own settings and
+ log folder for every mode (renders, `--bench`, `--calibrate` too), so they no longer write into your
+ sculptforge.log or move your session's log aside. Isolated runs remove their temporary folder when they pass.
+ - Clay and Clay Block follow Intensity and pen pressure: below the default Intensity a dab no longer planes the
+ surface all the way to its plane, so light strokes and low Intensity build gently instead of looking the same as
+ full strength (#83, thanks NimeNayota). Custom clay brushes and micro levels too.
+ - Alphas work on micro levels: Drag Stamp and every other stroke stamp the alpha instead of a round dab (#92,
+ thanks Devon0209).
+ - Strokes keep sculpting across a silhouette: when the cursor slides just past the edge of a form seen in profile
+ and the brush still covers it, the dab lands on the edge instead of stopping (#84, thanks Bro-Code-99).
+ - Brush shelf previews: Tendril and Elastic Tendril pull a long horn out past the ball (Tendril's preview re-aimed
+ every dab at the ball and dropped the dabs past its edge; scripted Tendril strokes now drag in the view plane as
+ the viewport does), and Layer and Nudge draw clean shapes instead of a pinched plateau and a torn ridge. Previews
+ are re-rendered once (thumbnail version 4). A new test sculpts every built-in brush's preview and checks its shape.
+ - Library > Projects listed each project twice on Windows: recent files and the User folder spelled the same path
+ with different slashes (#90). Paths are now compared normalised, and without case on Windows.
+ - The Library's close button stays on screen on small displays (1280x720), and Esc closes the Library (#80).
+ - The right shelf's region outline is no longer drawn under its buttons, and the "x" buttons (Library, console,
+ window, palettes) are centred (#98).
+ - macOS: a window closed in full screen reopens maximised instead of full screen, so the traffic lights and menu
+ bar stay reachable (#85, again after #41).
## [0.10.8] - 2026-11-02
diff --cc CMakeLists.txt
index 0782e241,31a0ad8a..d26b95e1
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@@ -646,10 -704,17 +706,21 @@@ if(SCULPTFORGE_BUILD_TESTS
add_test(NAME ui_size_popup_scaled COMMAND sculptforge --ui-test ${CMAKE_CURRENT_SOURCE_DIR}/tests/ui/size_popup.sfui
--size 2400x1350 --ui-out ${CMAKE_CURRENT_BINARY_DIR}/ui-shots/size_popup_scaled)
set_tests_properties(ui_size_popup_scaled PROPERTIES LABELS ui TIMEOUT 300)
+ # The stroke popup on a UI scaled 1.5x: it opens under the cursor and its items are where they're drawn.
+ add_test(NAME ui_stroke_popup_scaled COMMAND sculptforge --ui-test ${CMAKE_CURRENT_SOURCE_DIR}/tests/ui/stroke_popup.sfui
+ --size 2400x1350 --ui-out ${CMAKE_CURRENT_BINARY_DIR}/ui-shots/stroke_popup_scaled)
+ set_tests_properties(ui_stroke_popup_scaled PROPERTIES LABELS ui TIMEOUT 300)
+ # UI scale (#87) at 1600x900, where Automatic in a test is exactly 100 %; label "dpi": release.sh step check runs them before the tag.
+ add_test(NAME ui_ui_scale_900 COMMAND sculptforge --ui-test ${CMAKE_CURRENT_SOURCE_DIR}/tests/ui/ui_scale.sfui
+ --size 1600x900 --ui-out ${CMAKE_CURRENT_BINARY_DIR}/ui-shots/ui_scale_900)
+ set_tests_properties(ui_ui_scale_900 PROPERTIES LABELS "ui;dpi" TIMEOUT 300)
+ if(TEST ui_ui_scale)
+ set_tests_properties(ui_ui_scale PROPERTIES LABELS "ui;dpi")
+ endif()
+ # The Library on a 1280x720 screen (#80): its close button stays on screen.
+ add_test(NAME ui_library_small_screen_720 COMMAND sculptforge --ui-test ${CMAKE_CURRENT_SOURCE_DIR}/tests/ui/library_small_screen.sfui
+ --size 1280x720 --ui-out ${CMAKE_CURRENT_BINARY_DIR}/ui-shots/library_small_screen_720)
+ set_tests_properties(ui_library_small_screen_720 PROPERTIES LABELS ui TIMEOUT 300)
add_test(NAME ui_user_guide_1080 COMMAND sculptforge --ui-test ${CMAKE_CURRENT_SOURCE_DIR}/tests/ui/user_guide.sfui
--size 1920x1080 --ui-out ${CMAKE_CURRENT_BINARY_DIR}/ui-shots/user_guide_1080)
set_tests_properties(ui_user_guide_1080 PROPERTIES LABELS ui TIMEOUT 300)
@@@ -675,8 -745,8 +751,8 @@@
# The system clipboard is one per desktop (one X server under CI's xvfb-run), and on X11 every SDL program asks a
# new clipboard owner what it holds: a program that quits meanwhile makes the owner's answer fail (BadWindow).
# Scripts that set, read or paste it (or click a Copy / Paste button) run alone under ctest -j.
- foreach(t ${SCULPTFORGE_UI_TESTS} shell_layout_1080 help_console_1080 size_popup_scaled stroke_popup_scaled user_guide_1080)
- string(REGEX REPLACE "_1080$|_scaled$" "" base ${t})
- foreach(t ${SCULPTFORGE_UI_TESTS} shell_layout_1080 help_console_1080 size_popup_scaled user_guide_1080 ui_scale_900)
++ foreach(t ${SCULPTFORGE_UI_TESTS} shell_layout_1080 help_console_1080 size_popup_scaled stroke_popup_scaled user_guide_1080 ui_scale_900)
+ string(REGEX REPLACE "_1080$|_scaled$|_900$" "" base ${t})
get_filename_component(base ${base} NAME_WE)
set(script ${CMAKE_CURRENT_SOURCE_DIR}/tests/ui/${base}.sfui)
get_filename_component(name ${t} NAME_WE)
diff --cc REPLY.md
index cdc171cb,00000000..cc392b57
mode 100644,000000..100644
--- a/REPLY.md
+++ b/REPLY.md
@@@ -1,7 -1,0 +1,7 @@@
- Thanks for the idea, it's in 0.10.9: **the stroke popup**. Press **G** (J in the Blender keys) or the new button under the Stroke tile and a plain grid opens right at the cursor: Dots, Drag Stamp, Slide Stamp, Spray and Lazy Stroke on top, and Add / Sub, Smooth, Mask and Select below, with big icons and labels.
++Thanks for the idea, it's in 0.10.9: **the stroke popup**. Press **G** (N in the Blender keys) or the new button under the Stroke tile and a plain grid opens right at the cursor: Dots, Drag Stamp, Slide Stamp, Spray and Lazy Stroke on top, and Add / Sub, Smooth, Mask and Select below, with big icons and labels.
+
+- Hold G, point, let go: picked. Or tap G and click. Works with a hovering pen too.
+- Smooth, Mask and Select **stay on** without holding Shift or Ctrl, until you pick them again or pick another brush. A small label by the cursor shows which one is on, so no more Ctrl+Shift / Alt juggling mid-stroke.
- - The key can be changed in Preferences > Hotkeys.
++- The key can be changed in Edit > Preferences > Hotkeys.
+
+Guide: Sculpting > Strokes > The stroke popup. Tell us how it feels in your workflow, especially on a tablet.
diff --cc TESTERS.md
index 79d71184,00000000..6fca4df1
mode 100644,000000..100644
--- a/TESTERS.md
+++ b/TESTERS.md
@@@ -1,9 -1,0 +1,9 @@@
+# Testers: Stroke popup, 0.10.9
+- Press and hold **G** over the model, move onto **Spray**, let go. Is Spray picked (the Stroke tile changes)? Does the grid open with your current stroke right under the pointer?
+- Tap **G** (quick press). The grid should stay open: click **Lazy Stroke**, it closes. Tap again, click **Mask**, then **Sub**: the grid stays open and both light up. Press **Esc**.
+- With **Mask** on, sculpt a plain stroke: does it mask without holding Ctrl? Is there a small "Mask" label next to the cursor? Drag beside the model: does the view still turn (not invert the mask)?
+- Pick another brush on the bottom shelf: does Mask turn itself off?
+- **Pen tablets (Windows first)**: hover the pen (tip up) while holding G, move onto an item, let go of G. Then tap G and tap an item with the pen tip. Does the tip tap ever sculpt the model under the grid? Tell us your tablet model and driver.
+- Click the grid button under the **Stroke** tile on the left shelf: does the grid open next to it?
+- At 150% / 200% Windows scaling, are the icons, labels and the key hints (Alt, Shift, Ctrl) sharp and not cut off? Send a screenshot.
- - Blender input style: is it **J** there (G stays the Move brush)?
++- Blender input style: is it **N** there (G stays the Move brush)?
diff --cc docs/guide/sculpting.md
index 4ac4d05d,17d9d2dc..bb5f3c10
--- a/docs/guide/sculpting.md
+++ b/docs/guide/sculpting.md
@@@ -319,30 -351,56 +351,79 @@@ Notes
- Mask strokes (<kbd>Ctrl</kbd>) always use dots, even when Drag Stamp or Slide Stamp is selected.
- Custom brushes set their own dab spacing and can add jitter (see [Brush Lab](brush-lab.md)).
+### The stroke popup
+
- Press <kbd>G</kbd> (<kbd>J</kbd> in the Blender style) for a grid under the cursor, or click the grid button under
++Press <kbd>G</kbd> (<kbd>N</kbd> in the Blender style) for a grid under the cursor, or click the grid button under
+the **Stroke** tile on the left shelf. The top row holds the stroke types, the bottom row the modifiers:
+
+| Modifier | What it does | Instead of holding |
+|---|---|---|
+| **Add** / **Sub** | Brushes add to or subtract from the surface (the same switch as Add / Sub on the top shelf). | <kbd>Alt</kbd> |
+| **Smooth** | Strokes smooth. | <kbd>Shift</kbd> |
+| **Mask** | Strokes paint the mask (<kbd>Alt</kbd> still unmasks). | <kbd>Ctrl</kbd> |
+| **Select** | Strokes draw the selection (hide) shape. | <kbd>Ctrl</kbd>+<kbd>Shift</kbd> |
+
+- **Hold and let go**: hold <kbd>G</kbd>, move over an item and let go. It opens with your current stroke under the
+ pointer, so letting go without moving changes nothing. A pen hovering over the tablet works the same.
+- **Tap and click**: tap <kbd>G</kbd> and the grid stays open. Click a stroke to pick it (the grid closes); click a
+ modifier to switch it (the grid stays open, so you can set a stroke too). <kbd>Esc</kbd> or a click beside the
+ grid closes it. The click never touches the model.
+- **Smooth, Mask and Select stay on** until you pick the same one again or pick another brush. A small label next
+ to the brush cursor shows which one is on. Dragging beside the model still turns the view.
- - Change the key in **Preferences > Hotkeys** (*Stroke popup*), or hold <kbd>Ctrl</kbd>+<kbd>Alt</kbd> and click the shelf button, then press the new key.
++- The **Strokes** radial menu (<kbd>J</kbd>, see [Radial menus](#radial-menus)) picks a stroke type too; the popup
++ adds the modifiers and shows every choice at once.
++- Change the key in **Edit > Preferences > Hotkeys** (*Stroke popup*), or hold <kbd>Ctrl</kbd>+<kbd>Alt</kbd> and click the shelf button, then press the new key.
+
- > **ZBrush:** Drag Stamp, Slide Stamp, Spray and Lazy Stroke match ZBrush's DragRect, DragDot, Spray and LazyMouse. Freehand and Dots are the same thing here.
+ > **ZBrush:** Drag Stamp, Slide Stamp, Spray and Steady Stroke match ZBrush's DragRect, DragDot, Spray and LazyMouse. Freehand and Dots are the same thing here.
> Roll and curve strokes are not available yet.
+ ## Precision work
+
+ Pores, wrinkles, jewellery and hard-surface trims need a brush that goes exactly where you mean, at exactly the
+ size you mean. These tools work with every brush and every stroke type.
+
+ **Steady Stroke** (<kbd>L</kbd>, or the checkbox in the stroke picker). The brush trails the cursor on a string
+ and only moves once the string is taut, so hand shake never reaches the surface. It works with Dots, Drag Stamp,
+ Slide Stamp and Spray. The viewport draws the string and a faint circle of its length. **Steady radius** sets the
+ length (longer is steadier). **Catch up on release** (on by default) finishes the line to where the cursor is when
+ you let go; turn it off to end the line a string's length behind.
+
+ **World Size** (**Draw** palette). Draw Size is normally in screen pixels, so the brush gets smaller on the model
+ as you zoom in. With World Size on, the size is kept in model units instead: a 0.4 mm pore brush stays 0.4 mm
+ whether you are looking at the whole head or one eyelid. Every Draw Size slider shows both numbers, for example
+ **Draw Size 12 px 0.40 mm**; the mm figure is the brush radius on the surface under the cursor (a model unit is a
+ metre, as when exporting for 3D printing).
+
+ **Finer size control.**
+
+ | Do this | Change |
+ |---|---|
+ | <kbd>[</kbd> / <kbd>]</kbd> | 10% smaller / larger |
+ | <kbd>Shift</kbd>+<kbd>[</kbd> / <kbd>Shift</kbd>+<kbd>]</kbd> | 1 px smaller / larger (0.5 px below 2 px) |
+ | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+right-drag | Scrub the size finely: 100 px to the right is about 1.5 times larger |
+
+ Draw Size goes down to 0.5 px. Small brushes space their dabs closer together, so a 1 px stroke is still one
+ continuous line, and the cursor adds a small cross so you can see where a tiny brush is. The size, in px and mm,
+ shows next to the cursor for a moment after it changes (all the time with World Size on).
+
+ **Precision drag** (<kbd>Shift</kbd>+<kbd>Alt</kbd>, held while drawing). Start the stroke, then hold
+ <kbd>Shift</kbd>+<kbd>Alt</kbd>: the brush moves at a quarter of the pen's speed, drawn as a blue ring with a line
+ back to the pen, and works at **Precision Intensity** (stroke picker, default 10). Let go and the brush glides back
+ under the pen as you keep moving; it never jumps. Hold the keys after the stroke has started: at the press,
+ <kbd>Shift</kbd>+<kbd>Alt</kbd> still selects and frames a Part (ZBrush and SculptForge styles), and in the Blender
+ style <kbd>Alt</kbd>+click still navigates. The same works in every input style.
+
+ **A pressure curve for each brush.** Every brush keeps its own pen pressure curve, applied after the tablet's
+ curve. Edit it in **Brush Lab** (under the recipe sliders) or in **Preferences > Tablet** (under the tablet's
+ curve); both edit the brush you are holding. Drag a point, double-click the curve to add one (up to 5), right-click
+ a point to remove it. The presets are **Soft**, **Linear**, **Firm** and **Fine detail**: Fine detail keeps light
+ pressure very light and tops out below full strength, for pores and fine lines. Curves are saved as you change
+ them.
+
+ **Accuracy.** The brush centre sits exactly under the cursor at any zoom and on HiDPI screens (to a fraction of a
+ pixel), and the surface point under the brush is lightly filtered, so strokes on very dense meshes don't wobble
+ with every tiny bump. A real step in the surface is followed at once.
+
## Alphas
An alpha is a grayscale stamp that shapes the brush tip: white is full effect, black is none. It affects every
diff --cc docs/guide/whats-new.md
index 1db89fcc,ee18c78e..343bc28f
--- a/docs/guide/whats-new.md
+++ b/docs/guide/whats-new.md
@@@ -7,10 -7,136 +7,140 @@@ three versions in full, then the older
## Version 0.10.9
- - **Stroke popup**: press <kbd>G</kbd> (<kbd>J</kbd> in the Blender style) or the button under the **Stroke**
+ ```features
+ date: unreleased
+ tagline: Your first sculpt in ten minutes, starter meshes, brushes that keep their settings, and tablets that just work.
+ highlight: Your first sculpt in 10 minutes: a beginner lesson from sphere to a rendered mushroom house
+ highlight: Starter meshes: heads, a body, hands and clean primitives, all quads with levels ready
+ highlight: Each brush keeps its own size, intensity, stroke and alpha
+ highlight: Tablets: plug in while running, pressure with or without Windows Ink, no camera jumps
+ title: Your first sculpt
+ line: A 12-step lesson that turns the default sphere into a painted, rendered mushroom house.
+ image: images/wn-first-sculpt.jpg
+ action: help.first_sculpt
+ link: first-sculpt.md
+ title: Starter meshes
+ line: Start from a head, bust, body, hand or clean primitive, all quads at life size.
+ image: images/wn-starter-meshes.jpg
+ action: file.new_starter
+ link: projects.md#start-from-a-starter-mesh
+ title: Brushes keep their settings
+ line: Size, intensity, falloff, stroke and alpha follow each brush; Save Brush Settings keeps them.
+ image: images/wn-brush-settings.jpg
+ action: brush:Clay
+ link: sculpting.md#each-brush-keeps-its-own-settings
+ title: What's New, redesigned
+ line: The main features as cards with a Try it button; older versions fold into short groups.
+ image: images/wn-whats-new.jpg
+ action: guide:whats-new.md
+ ```
+
++- **Stroke popup**: press <kbd>G</kbd> (<kbd>N</kbd> in the Blender style) or the button under the **Stroke**
+ tile for a grid at the cursor: the stroke types plus **Add**, **Sub**, **Smooth**, **Mask** and **Select**. Hold
+ the key, point and let go, or tap it and click. Smooth, Mask and Select stay on without holding
+ <kbd>Shift</kbd> or <kbd>Ctrl</kbd>. See [Strokes](sculpting.md#the-stroke-popup).
+ - **Each brush keeps its own settings**: Draw Size, Intensity, Falloff, RGB Intensity, stroke and alpha follow
+ the brush, custom and Community brushes included. **Brush > Save Brush Settings** keeps them for the next start,
+ **Reset Brush to Default** puts back the shipped values, and **Preferences > Input > Share size and intensity
+ across brushes** keeps the old way (#78). See [Sculpting](sculpting.md#each-brush-keeps-its-own-settings).
+ - **Alpha options** (**Alpha** palette): **Follow stroke direction** turns the alpha along the stroke, smoothed as
+ Blender's Rake does; **Angle** and **Angle jitter** turn it by a fixed or a random amount; **Tile** repeats it
+ inside the brush. They work with custom and Community brushes too, and each brush keeps its own (#76). See
+ [Alpha options](sculpting.md#alpha-options).
+ - **Blender style: Alt+drag masks** on the model and Ctrl+Alt+drag unmasks, as in Blender 5.1 and later; beside the
+ model Alt+drag still turns the view. **Preferences > Input > Emulate 3 Button Mouse** makes Alt+drag turn the view
+ everywhere. Shift+F now sets the brush's Intensity, not Smooth's (#77).
+ - **View > Lock camera** (<kbd>Shift</kbd>+<kbd>L</kbd>): drags that start beside the model sculpt instead of
+ turning the view, and the status bar shows **CAMERA LOCKED** while it is on (#62).
+ - **Tablets**: plug a tablet in while SculptForge runs and it just works ("Tablet connected" in the status bar),
+ also through Wacom Bridge. On Windows, pressure works with the Wacom driver's **Use Windows Ink** on or off.
+ **Preferences > Input** shows whether pressure is detected, with a troubleshooting link. The view no longer jumps
+ when the pen comes back into range, and the active Part changes only with **Alt+click** on the keyboard; the
+ status bar names the new Part. See [Troubleshooting](troubleshooting.md#pen-tablets).
+ - **Smaller (or larger) corner axes**: **Draw > Camera > Gizmo size** sets Small, Medium or Large
+ ([Navigation](navigation.md)).
+ - **View Figure**: turn it on beside **Axes** for a small head in the corner that turns with the view; click it to
+ snap to the nearest side.
+ - **Starter meshes**: start a sculpt from a human head with eye and mouth loops, a bust, a full body in A-pose, a
+ hand, a foot, an ear, an eye, a stylised head, a creature head, a torso, or a bevelled box, cylinder, capsule or
+ ring, all clean quads at life size with subdivision levels ready. **File > New from Starter Mesh**, the Library's
+ **Tool > Starter meshes**, or **Start from a head** in the welcome. See
+ [Projects](projects.md#start-from-a-starter-mesh).
+ - **Your first sculpt in 10 minutes**: a step-by-step lesson for people who have never sculpted. Turn the
+ default sphere into a little mushroom house with a spotted red cap, a door and glowing windows, using masks,
+ Move, Inflate, Crease and Clay, Vertex Paint and PBR shading, and save a render to share. Start it from the
+ welcome's **Start the 10-minute lesson** button or **Help > Your first sculpt (10 min)**. See
+ [Your first sculpt](first-sculpt.md).
+ - **Save Render** (**Render > Materials**): the view without the interface, at twice its size, as a PNG in your
+ Library (**Library > Image**).
+
+ - **A new What's New**: after an update, a window shows the main features as cards with a picture, one line and a
+ **Try it** button that opens the feature (switch the look, select the brush, open the membership card...).
+ **Help > What's New** opens it again; <kbd>Esc</kbd> closes it. This chapter shows the last three versions in
+ full and folds the older ones into short groups, on the website too.
+ - **Image to 3D with no setup**: the free default is now Hunyuan3D 2.1, which needs no token. TRELLIS.2 ("Best
+ detail") still needs a free Hugging Face token (**Preferences > AI**); without one, Hunyuan3D 2.1 runs instead
+ and the status line tells you. Your own model choice is kept. See [Image and text to 3D](generate-3d.md).
+ - **Generated models arrive as clean quads**: Quad Remesh is now the default, with one subdivision level holding
+ the detail, so you can sculpt and subdivide straight away. Voxel remesh and Off are still in **Remesh**.
+ - **Calm, clear hover**: buttons, menus and shelves brighten a little as you point at them, tiles lift a little,
+ sliders show their exact value, and the keyboard focus gets a ring as strong as your **Outlines** setting. Prefer less
+ movement? Turn on **Preferences > Interface > Reduce motion** ([Interface](interface.md)).
+ - **Picker thumbnails on top**: the enlarged thumbnail you point at in a picker is no longer hidden under its
+ neighbours (#86).
+ - **Focus Detail (experimental)**: sculpt a head of a billion micro triangles from one compressed file. Detail
+ loads where you look and where the brush is heading, and the rest shows a lighter version. Saving writes only
+ what you changed. Try it with `sculptforge --benchmark standard-1b` (Linux and macOS for now).
+ - **Precision work** for pores, wrinkles, jewellery and trims: **Steady Stroke** (<kbd>L</kbd>) with every stroke
+ type and a catch-up on release; **World Size**, so the brush keeps its size in mm on the surface as you zoom;
+ Draw Size down to 0.5 px with <kbd>Shift</kbd>+<kbd>[</kbd> / <kbd>]</kbd> for 1 px steps; hold
+ <kbd>Shift</kbd>+<kbd>Alt</kbd> while drawing to move the brush at a quarter of the pen's speed; and a pressure
+ curve for each brush with a **Fine detail** preset. The brush centre now sits exactly under the cursor at any
+ zoom. See [Precision work](sculpting.md#precision-work).
+ - **UI scale works live**: **Preferences > Interface > UI scale** (100% to 200%) resizes text and panels at once,
+ no restart. **Automatic** follows the monitor the window is on, so on Windows moving it between a 100% and a
+ 150% monitor rescales it right away (#87). See [The interface](interface.md#interface-preferences).
+ - **The pen keeps working the panels**: with some tablets (Huion, pen displays, Wacom with Windows Ink on or off)
+ the pen picked one brush, then stopped clicking menus and the canvas until you used the mouse. SculptForge now
+ makes the pen's clicks itself (#95). See [Troubleshooting](troubleshooting.md#pen-tablets).
+ - **Mouse mode is relative again**: with **Mouse mode** on (Preferences > Tablet) the pen moves the cursor by how
+ far it moves, whatever the driver's mode, and the arrow is drawn right at the brush (#72).
+ - **Two screens**: SculptForge no longer slows down when the pointer is on your other screen; it rests only when
+ its window loses focus.
+ - **Turn AI off**: **Preferences > AI > Enable AI features** (the welcome asks too). Off hides AI Brush and
+ Generate 3D everywhere and SculptForge makes no AI network calls. Your art is never uploaded or used for training. AI features run only when you use them and can be turned off. Studios can set `SF_AI=off`.
+ See [The interface](interface.md#turning-ai-off).
+ - **Big brushes stay smooth on dense meshes**: on models from about 4 million triangles a stroke's dabs are worked
+ out beside the view, so a 240 px brush on 33 million triangles no longer freezes the view for a third of a
+ second at a time (slowest frames about 35 ms instead of 300), and letting go of the pen is instant. The stroke
+ itself comes out the same.
+ - **Move keeps up on dense meshes**: Move no longer slows to a crawl on 33 million triangles with a fast pen, and the
+ first orbit after a long stroke no longer hitches.
+ - **No more running out of memory**: **Help > Benchmark** skips a scene your computer hasn't got the free memory
+ for (and says how much to free), and Subdivide, Divide, Micro and Voxel Remesh ask first when the result
+ wouldn't fit in the memory free now.
+ - **Clay follows Intensity and pressure**: Clay and Clay Block build gently with a light pen or a low Intensity
+ instead of planing flat as at full strength (#83). See [Sculpting](sculpting.md#built-in-brushes).
+ - **Alphas on micro levels**: Drag Stamp and every stroke stamp your alpha on a micro level too (#92).
+ - **Brushes hold on at silhouettes**: a stroke sliding past the edge of a form in profile keeps sculpting while the
+ brush still covers it (#84).
+ - **Smooth face group borders**: a Brush palette option that straightens jagged clothing edges between face
+ groups and leaves the rest alone (#81). See [Smooth face group borders](sculpting.md#smooth-face-group-borders).
+ - **Colour tints the material**: pick a colour and Parts with no vertex paint take it on in the Lit Sphere
+ material. See [Vertex Paint and materials](vertex-paint.md#materials-lit-spheres).
+ - **Cut**: one tool that cuts the active Part with a **Line**, **Lasso**, **Rectangle** or **Polyline**. **Away**
+ removes what the shape covers and closes the cut with a flat cap, **In** cuts a flat-bottomed pocket and **Add**
+ raises the shape out of the surface. The result stays watertight and follows the symmetry. Hold
+ <kbd>Ctrl</kbd>+<kbd>Shift</kbd> and pick a Cut shape, or open **Tool > Cut**. See [Cut](cut.md) (#101, #91).
+ - **Mask: Front faces only**: Mask Lasso and Mask Rectangle can leave the far side alone
+ ([Masking](masking.md#mask-with-a-lasso-or-rectangle), #91).
+ - **Duplicate Part** has a shortcut: <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd> ([Parts](parts.md)).
+ - **Brush previews fixed**: the shelf shows Tendril and Elastic Tendril as long horns pulled out past the ball, as
+ they behave in the viewport, and Layer and Nudge with clean shapes; previews are rebuilt once after updating.
+ - **Library**: projects no longer show twice on Windows (#90); the close button stays on small screens and
+ <kbd>Esc</kbd> closes the Library (#80).
+ - **Cleaner outlines**: the right shelf's outline draws correctly and the **x** buttons are centred (#98).
+ - **macOS**: a window closed in full screen reopens maximised, with the window buttons reachable (#85).
## Version 0.10.8
diff --cc src/app/App.cpp
index cac3b44a,b9872933..d8fe2ad4
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@@ -1137,8 -1201,8 +1201,9 @@@ void App::dispatchEvent(const SDL_Event
SDL_Event e = event;
mapPenPosition(e); // a tablet in mouse mode moves the cursor relatively (#54), for the canvas and the UI
if (supportCardEvent(e)) return; // the support card at launch takes clicks and keys while open
+ if (whatsNewEvent(e)) return; // so does What's New (WhatsNewPopup.cpp)
if (radialMouseEvent(e)) return; // clicks on an open radial menu, and the buttons that open one (RadialMenu.cpp)
+ if (strokePopupMouseEvent(e)) return; // clicks on the open stroke popup (StrokePopup.cpp)
ImGui_ImplSDL3_ProcessEvent(&e);
const ImGuiIO& io = ImGui::GetIO();
@@@ -1152,11 -1216,18 +1217,19 @@@
case SDL_EVENT_JOYSTICK_BUTTON_DOWN:
spaceMouseEvent(e); // a SpaceMouse (SpaceMouse.cpp)
break;
+ case SDL_EVENT_WINDOW_FOCUS_GAINED:
+ windowFocused_ = true;
+ break;
case SDL_EVENT_WINDOW_FOCUS_LOST:
+ windowFocused_ = false;
if (radial_.hold != RadialHold::None) closeRadialMenu(); // its key or button's release won't come here
+ if (strokePopup_.held) closeStrokePopup();
spaceHeld_ = false; // Space let go in another window never reaches us
break;
+ case SDL_EVENT_WINDOW_DISPLAY_SCALE_CHANGED: // dragged to a monitor at another scale, or the system setting changed
+ case SDL_EVENT_WINDOW_DISPLAY_CHANGED:
+ if (e.window.windowID == SDL_GetWindowID(window_)) requestUiScale();
+ break;
case SDL_EVENT_WINDOW_CLOSE_REQUESTED:
if (e.window.windowID == SDL_GetWindowID(window_)) requestQuit();
break;
diff --cc src/app/App.h
index f87f86e0,54747dc4..ae472964
--- a/src/app/App.h
+++ b/src/app/App.h
@@@ -30,7 -34,7 +34,8 @@@
#include "core/AutoUv.h"
#include "core/QRemesh.h"
#include "core/RadialMenu.h"
+ #include "core/Precision.h"
+#include "core/StrokePopup.h"
#include "core/Stroke.h"
#include "core/StrokePath.h"
#include "core/SurfaceCursor.h"
@@@ -1667,38 -1853,6 +1855,38 @@@ private
int openedFrame = -1;
int ran = -1; // the slot run last (UI tests)
} radial_;
+ // ---- The stroke popup (StrokePopup.cpp, core/StrokePopup.h; Discord 11-02) ----
- // One key (stroke.popup, G; J in the Blender style) or the left shelf's button opens a grid at the cursor: the
++ // One key (stroke.popup, G; N in the Blender style) or the left shelf's button opens a grid at the cursor: the
+ // stroke types and the modifiers Add / Sub, Smooth, Mask, Select. Hold the key, point, let go: picked. Tap it:
+ // the grid stays open for a click (a stroke closes it, a modifier toggles and leaves it open). Esc cancels.
+ // Smooth, Mask and Select latch: strokes act as if Shift, Ctrl or Ctrl+Shift were held until the same item is
+ // picked again or another brush is picked.
+ void registerStrokePopupActions();
+ void openStrokePopup(bool held, int key);
+ void closeStrokePopup() { strokePopup_.open = false; }
+ void pickStrokePopupItem(int item, bool close);
+ bool strokePopupMouseEvent(const SDL_Event& e); // true: the popup used the event
+ void strokePopupKeyUp(SDL_Keycode key);
+ void drawStrokePopup();
+ bool strokePopupItemScreen(int item, ImVec2& out) const; // an item's centre, window pixels (UI tests)
+ StrokeLatch strokeLatch() const; // the latch in effect (None once another brush was picked)
+ void setStrokeLatch(StrokeLatch latch);
+ struct StrokePopupOpen {
+ bool open = false;
+ ImVec2 at{0, 0}; // the panel's top-left
+ double openedAt = 0.0; // seconds (a short press is a tap)
+ bool held = false; // its key holds it open; false: tapped open, stays until a click or Esc
+ int key = 0; // the held key (SDL_Keycode)
+ int hover = -1; // the item under the pointer
+ int picked = -1; // the item picked last (UI tests)
+ } strokePopup_;
+ struct StrokeLatchState {
+ StrokeLatch latch = StrokeLatch::None;
+ BrushType brush = BrushType::Standard; // the brush it was latched with: picking another ends it
+ int custom = -1;
+ bool paint = false;
+ } strokeLatch_;
+ uint32_t strokePopupSwallowUp_ = 0; // mouse buttons whose press the popup took: their release is its too
SDL_Keycode keyDown_ = SDLK_UNKNOWN; // the key onKey is handling: a radial menu's key holds the pie open
uint32_t radialSwallowUp_ = 0; // mouse buttons whose press the pie took: their release is its too
std::optional<Json> radialPending_; // radial menus read from ui.json before the actions existed
@@@ -1758,10 -1919,8 +1953,11 @@@ private
void penButton(int button, bool down, float x, float y);
void penLeft(); // out of proximity: ends what the pen was doing
float strokePressure() const; // pressure after the global curve; 1 for the mouse
- SDL_Keymod inputMods() const; // the keyboard's modifiers plus those a pen button holds (Alt, Shift)
+ // The keyboard's modifiers plus those a pen button holds (Alt, Shift) and, with latch, the stroke popup's
+ // latched modifier (Shift for Smooth, Ctrl for Mask, Ctrl+Shift for Select). Navigation reads it without the
+ // latch: a latched Mask still lets a drag beside the model turn the view.
+ SDL_Keymod inputMods(bool latch = true) const;
+ SDL_Keymod keyMods() const; // the keyboard's alone (in the input style's terms)
bool erasing() const; // the pen's eraser end is drawing
PenAction eraserAction() const { return uiPrefs_.tablet.eraser; }
void firstDab(float x, float y); // the stroke's first dab, once the pen reports a real pressure
diff --cc src/app/Input.cpp
index ca342864,77ac1e9b..f79989f1
--- a/src/app/Input.cpp
+++ b/src/app/Input.cpp
@@@ -290,7 -363,6 +364,7 @@@ void App::applyInputStyle()
{"draw.paint", {"P", "P", ""}},
{"ui.picker.material", {"M", "M", ""}},
{"stroke.lazy", {"L", "L", "L / Shift+S"}},
- {"stroke.popup", {"G", "G", "J"}}, // (Blender's G is its Move brush)
++ {"stroke.popup", {"G", "G", "N"}}, // (Blender's G is its Move brush; J opens the Strokes radial menu)
{"mask.clear", {"Ctrl+Shift+A", "Ctrl+Shift+A", "Alt+M / Ctrl+Shift+A"}},
{"geometry.lower_res", {"Shift+D", "Shift+D", "Alt+1 / Shift+D"}},
{"geometry.higher_res", {"D", "D", "Alt+2 / D"}},
diff --cc src/app/Shell.cpp
index 8cbaaf7a,78fb1e3e..beae5ff9
--- a/src/app/Shell.cpp
+++ b/src/app/Shell.cpp
@@@ -2383,22 -2456,6 +2442,24 @@@ void App::drawStrokeIcon(ImDrawList* dl
}
default: break;
}
+}
+
+void App::drawStrokeTile(const char* id, ImVec2 size) {
+ const float s = uiScale_;
+ if (const HeldBrushItem* held = heldBrushCurrent(heldBrush())) { // Ctrl / Ctrl+Shift: the mask's stroke
+ ImVec2 a, b;
- const bool clicked = tileFrame(id, size, fontSmall_, held->stroke, s, a, b);
++ ui::TileLiftScope lift;
++ const bool clicked = tileFrame(id, size, lift.lift, fontSmall_, held->stroke, s, a, b);
+ drawHeldBrushIcon(ImGui::GetWindowDrawList(), a, b, held->icon, heldBrush() == HeldBrush::Select);
+ if (clicked) openPicker(Picker::Stroke, ImVec2(ImGui::GetItemRectMax().x + 4.0f * s, ImGui::GetItemRectMin().y));
+ ui::HelpText("Stroke", nullptr, "Ctrl held: the mask's stroke, Dots (Mask Pen), Lasso or Rect (Ctrl+Shift: the "
+ "selection's). Click with Ctrl held to choose.", "Left shelf");
+ return;
+ }
+ ImVec2 a, b;
- const bool clicked = tileFrame(id, size, fontSmall_, strokeTypeName(strokeType_), s, a, b);
++ ui::TileLiftScope lift;
++ const bool clicked = tileFrame(id, size, lift.lift, fontSmall_, strokeTypeName(strokeType_), s, a, b);
+ drawStrokeIcon(ImGui::GetWindowDrawList(), a, b, strokeType_);
if (clicked) openPicker(Picker::Stroke, ImVec2(ImGui::GetItemRectMax().x + 4.0f * s, ImGui::GetItemRectMin().y));
ui::HelpText("Stroke", nullptr, "How dabs follow the cursor: Dots, Drag Stamp, Slide Stamp, Spray or Lazy Stroke. Click to choose.",
"Left shelf");
diff --cc src/app/StrokePopup.cpp
index ffd6f1fb,00000000..adc83d57
mode 100644,000000..100644
--- a/src/app/StrokePopup.cpp
+++ b/src/app/StrokePopup.cpp
@@@ -1,278 -1,0 +1,278 @@@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// The stroke popup (Discord 11-02: "a popup for stroke type selection; the constant Ctrl+Shift / Alt combinations
- // interrupt the thought process"). One key (stroke.popup: G, J in the Blender style) or the left shelf's button
++// interrupt the thought process"). One key (stroke.popup: G, N in the Blender style) or the left shelf's button
+// opens a plain grid at the cursor, the current stroke under the pointer: the stroke types, then Add / Sub and
+// the latched modifiers Smooth, Mask and Select. Hold the key, point, let go: picked (a pen hovering works the
+// same). Tap the key: the grid stays open; a click on a stroke picks it and closes, a click on a modifier toggles
+// it and leaves the grid open, a click beside it or Esc closes it. The click never reaches the model. The grid's
+// geometry and the latch rules are in core/StrokePopup.h.
+#include "app/App.h"
+#include "app/Theme.h"
+#include "app/Ui.h"
+
+#include <IconsLucide.h>
+
+#include <algorithm>
+#include <cfloat>
+#include <iterator>
+#include <string>
+
+namespace sf {
+
+namespace {
+
+constexpr double kStrokePopupTapSeconds = 0.25; // let go sooner without pointing at an item: a tap, it stays open
+
+struct ModifierLook {
+ const char* label;
+ const char* glyph;
+ const char* keys; // what it saves holding (the ZBrush keys; the latches stand for them in every style)
+ const char* help;
+};
+constexpr ModifierLook kModifiers[] = {
+ {"Add", ICON_LC_CIRCLE_PLUS, "", "Brushes add to the surface."},
+ {"Sub", ICON_LC_CIRCLE_MINUS, "Alt", "Brushes subtract from the surface."},
+ {"Smooth", ICON_LC_WAVES, "Shift", "Strokes smooth, as with Shift held, until you pick Smooth again or another brush."},
+ {"Mask", ICON_LC_VENETIAN_MASK, "Ctrl", "Strokes paint the mask, as with Ctrl held, until you pick Mask again or another brush."},
+ {"Select", ICON_LC_LASSO_SELECT, "Ctrl+Shift",
+ "Strokes draw the selection (hide) shape, as with Ctrl+Shift held, until you pick Select again or another brush."},
+};
+static_assert(std::size(kModifiers) == size_t(kStrokePopupModifiers));
+
+StrokePopupGeometry popupGeometry(float s) {
+ StrokePopupGeometry g;
+ g.tile = 64.0f * s;
+ g.label = 20.0f * s;
+ g.gap = 6.0f * s;
+ g.header = 22.0f * s;
+ g.pad = 10.0f * s;
+ g.columns = 5;
+ return g;
+}
+
+} // namespace
+
+void App::registerStrokePopupActions() {
+ Action a;
+ a.id = "stroke.popup";
+ a.label = "Stroke popup";
+ a.icon = ICON_LC_LAYOUT_GRID;
+ a.palette = "Stroke";
+ a.description = "A grid at the cursor with the stroke types and the modifiers (Add / Sub, Smooth, Mask, Select). "
+ "Hold the key, point at one and let go; or tap the key and click. Smooth, Mask and Select stay on "
+ "without holding Shift or Ctrl, until you pick them again or another brush.";
+ a.run = [this] { openStrokePopup(keyDown_ != SDLK_UNKNOWN, int(keyDown_)); };
+ a.checked = [this] { return strokePopup_.open; };
+ actions_.add(std::move(a)); // (its key depends on the input style: applyInputStyle in Input.cpp)
+}
+
+StrokeLatch App::strokeLatch() const {
+ const StrokeLatchState& l = strokeLatch_;
+ if (l.latch == StrokeLatch::None) return StrokeLatch::None;
+ const bool sameBrush = brush_ == l.brush && doc_.activeBrush == l.custom && paintMode_ == l.paint && !guidesMode_;
+ return sameBrush ? l.latch : StrokeLatch::None;
+}
+
+void App::setStrokeLatch(StrokeLatch latch) {
+ strokeLatch_ = {latch, brush_, doc_.activeBrush, paintMode_};
+ status_ = latch == StrokeLatch::None
+ ? std::string("Modifiers off: strokes sculpt")
+ : std::string(strokeLatchName(latch)) + " on: strokes " +
+ (latch == StrokeLatch::Smooth ? "smooth" : latch == StrokeLatch::Mask ? "mask" : "select") +
+ " until you pick " + strokeLatchName(latch) + " again or another brush";
+}
+
+void App::openStrokePopup(bool held, int key) {
+ if (strokePopup_.open && !strokePopup_.held) { // tapped open, its key (or the button) again: close
+ closeStrokePopup();
+ return;
+ }
+ if (drag_ != Drag::None) return; // not in the middle of a stroke or a view drag
+ quickMenu_.open = false;
+ closeRadialMenu();
+ const StrokePopupGeometry g = popupGeometry(uiScale_);
+ // The current stroke under the pointer (a quick tap and let go changes nothing), the whole grid on the canvas.
+ const glm::vec2 cur = g.itemMin(int(strokeType_)) + g.itemSize() * 0.5f;
+ const glm::vec2 size = g.size();
+ const CanvasRect c = canvasRect();
+ ImVec2 at(mouseX_ - cur.x, mouseY_ - cur.y);
+ at.x = c.w > size.x ? std::clamp(at.x, c.x, c.x + c.w - size.x) : c.x;
+ at.y = c.h > size.y ? std::clamp(at.y, c.y, c.y + c.h - size.y) : c.y;
+ strokePopup_.open = true;
+ strokePopup_.at = at;
+ strokePopup_.openedAt = ImGui::GetTime();
+ strokePopup_.held = held;
+ strokePopup_.key = key;
+ strokePopup_.hover = -1;
+}
+
+void App::pickStrokePopupItem(int item, bool close) {
+ if (item < 0 || item >= kStrokePopupItems) return;
+ strokePopup_.picked = item;
+ if (strokePopupIsStroke(item)) {
+ strokeType_ = StrokeType(item);
+ status_ = std::string("Stroke: ") + strokeTypeName(strokeType_);
+ closeStrokePopup();
+ return;
+ }
+ const StrokeModifier m = strokePopupModifier(item);
+ if (m == StrokeModifier::Add || m == StrokeModifier::Sub) {
+ invertToggle_ = m == StrokeModifier::Sub;
+ status_ = invertToggle_ ? "Sub: brushes subtract (Alt adds for one stroke)"
+ : "Add: brushes add (Alt subtracts for one stroke)";
+ } else {
+ setStrokeLatch(toggledStrokeLatch(strokeLatch(), strokeModifierLatch(m)));
+ }
+ if (close) closeStrokePopup();
+}
+
+void App::strokePopupKeyUp(SDL_Keycode key) {
+ if (!strokePopup_.open || !strokePopup_.held || SDL_Keycode(strokePopup_.key) != key) return;
+ const StrokePopupGeometry g = popupGeometry(uiScale_);
+ const int item = g.itemAt({mouseX_ - strokePopup_.at.x, mouseY_ - strokePopup_.at.y});
+ const bool tap = ImGui::GetTime() - strokePopup_.openedAt < kStrokePopupTapSeconds;
+ // It opens with the current stroke under the pointer: let go there quickly and it was a tap (stays open for a
+ // click); pointed at another item, or held a moment, and let go: that item.
+ if (item >= 0 && (!tap || item != int(strokeType_))) {
+ pickStrokePopupItem(item, true);
+ return;
+ }
+ if (tap) {
+ strokePopup_.held = false;
+ return;
+ }
+ closeStrokePopup(); // held and let go beside the items: nothing
+}
+
+bool App::strokePopupMouseEvent(const SDL_Event& e) {
+ if (e.type != SDL_EVENT_MOUSE_BUTTON_DOWN && e.type != SDL_EVENT_MOUSE_BUTTON_UP) return false;
+ const int button = e.button.button;
+ const uint32_t bit = button >= 0 && button < 32 ? 1u << button : 0u;
+ if (e.type == SDL_EVENT_MOUSE_BUTTON_UP) {
+ if (!(strokePopupSwallowUp_ & bit)) return false;
+ strokePopupSwallowUp_ &= ~bit; // the press went to the popup: so does the release
+ return true;
+ }
+ if (!strokePopup_.open) return false;
+ // Open: a left click (mouse or pen tip) on an item picks it; inside the panel elsewhere does nothing; any
+ // other click closes it. Nothing reaches the canvas or the panels under it.
+ strokePopupSwallowUp_ |= bit;
+ if (button == SDL_BUTTON_LEFT) {
+ const StrokePopupGeometry g = popupGeometry(uiScale_);
+ const glm::vec2 p(e.button.x - strokePopup_.at.x, e.button.y - strokePopup_.at.y);
+ const int item = g.itemAt(p);
+ if (item >= 0) {
+ strokePopup_.held = false; // (its key's release must not pick again)
+ pickStrokePopupItem(item, false);
+ return true;
+ }
+ const glm::vec2 size = g.size();
+ if (p.x >= 0.0f && p.y >= 0.0f && p.x < size.x && p.y < size.y) return true;
+ }
+ closeStrokePopup();
+ return true;
+}
+
+bool App::strokePopupItemScreen(int item, ImVec2& out) const {
+ if (!strokePopup_.open || item < 0 || item >= kStrokePopupItems) return false;
+ const StrokePopupGeometry g = popupGeometry(uiScale_);
+ const glm::vec2 c = g.itemMin(item) + g.itemSize() * 0.5f;
+ out = ImVec2(strokePopup_.at.x + c.x, strokePopup_.at.y + c.y);
+ return true;
+}
+
+void App::drawStrokePopup() {
+ const float s = uiScale_;
+ ImDrawList* fg = ImGui::GetForegroundDrawList();
+ const StrokeLatch latch = strokeLatch();
+ if (!strokePopup_.open) {
+ // A latched modifier shows beside the brush cursor: strokes do something other than sculpt.
+ const ImGuiIO& io = ImGui::GetIO();
+ if (latch != StrokeLatch::None && !io.WantCaptureMouse && canvasRect().contains(mouseX_, mouseY_) &&
+ radial_.menu < 0 && !quickMenu_.open) {
+ ImFont* font = fontSmall_ ? fontSmall_ : ImGui::GetFont();
+ const char* text = strokeLatchName(latch);
+ const ImVec2 ts = font->CalcTextSizeA(font->FontSize, FLT_MAX, 0.0f, text);
+ const ImVec2 a(mouseX_ + 14.0f * s, mouseY_ + 14.0f * s);
+ const ImVec2 b(a.x + ts.x + 12.0f * s, a.y + ts.y + 6.0f * s);
+ fg->AddRectFilled(a, b, theme::u32(theme::panelBg, 0.92f), (b.y - a.y) * 0.5f);
+ fg->AddRect(a, b, theme::u32(theme::accent), (b.y - a.y) * 0.5f, 0, 1.0f * s);
+ fg->AddText(font, font->FontSize, ImVec2(a.x + 6.0f * s, a.y + 3.0f * s), theme::u32(theme::textBright), text);
+ }
+ return;
+ }
+ if (ImGui::IsKeyPressed(ImGuiKey_Escape, false)) {
+ closeStrokePopup();
+ return;
+ }
+ const StrokePopupGeometry g = popupGeometry(s);
+ const ImVec2 o = strokePopup_.at;
+ const glm::vec2 size = g.size();
+ strokePopup_.hover = g.itemAt({mouseX_ - o.x, mouseY_ - o.y});
+ const float round = theme::rounding(6.0f * s);
+ fg->AddRectFilled(ImVec2(o.x + 2 * s, o.y + 3 * s), ImVec2(o.x + size.x + 2 * s, o.y + size.y + 3 * s),
+ IM_COL32(0, 0, 0, 90), round); // a soft shadow
+ fg->AddRectFilled(o, ImVec2(o.x + size.x, o.y + size.y), theme::u32(theme::panelBg, 0.97f), round);
+ fg->AddRect(o, ImVec2(o.x + size.x, o.y + size.y), theme::u32(theme::border), round, 0, 1.0f);
+
+ ImFont* small = fontSmall_ ? fontSmall_ : ImGui::GetFont();
+ ImFont* tiny = fontTiny_ ? fontTiny_ : small;
+ auto header = [&](bool modifiers, const char* title, const char* note) {
+ const float y = o.y + g.sectionTop(modifiers);
+ const float ty = y + (g.header - small->FontSize) * 0.5f - 1.0f * s;
+ fg->AddText(small, small->FontSize, ImVec2(o.x + g.pad, ty), theme::u32(theme::textDim), title);
+ const ImVec2 ns = tiny->CalcTextSizeA(tiny->FontSize, FLT_MAX, 0.0f, note);
+ fg->AddText(tiny, tiny->FontSize, ImVec2(o.x + size.x - g.pad - ns.x, y + (g.header - tiny->FontSize) * 0.5f - 1.0f * s),
+ theme::u32(theme::textDim), note);
+ };
+ header(false, "Stroke", "Let go over one, or click \xc2\xb7 Esc");
+ header(true, "Modifiers", "Smooth, Mask, Select stay on");
+
+ const glm::vec2 is = g.itemSize();
+ for (int item = 0; item < kStrokePopupItems; ++item) {
+ const glm::vec2 m = g.itemMin(item);
+ const ImVec2 a(o.x + m.x, o.y + m.y), b(a.x + is.x, a.y + is.y);
+ const ImVec2 iconB(b.x, a.y + g.tile);
+ const bool stroke = strokePopupIsStroke(item);
+ const StrokeModifier mod = stroke ? StrokeModifier::Count : strokePopupModifier(item);
+ const bool on = stroke ? strokeType_ == StrokeType(item)
+ : mod == StrokeModifier::Add ? !invertToggle_
+ : mod == StrokeModifier::Sub ? invertToggle_
+ : latch == strokeModifierLatch(mod);
+ const bool hot = item == strokePopup_.hover;
+ const float r = theme::rounding(4.0f * s);
+ fg->AddRectFilled(a, b, theme::u32(hot ? theme::buttonHover : on ? theme::toggleOn : theme::tile), r);
+ fg->AddRect(a, b, theme::u32(hot || on ? theme::accent : theme::tileBorder, hot ? 1.0f : on ? 0.8f : 1.0f), r, 0,
+ (hot ? 2.0f : 1.0f) * s);
+ const char* label = stroke ? strokeTypeName(StrokeType(item)) : kModifiers[int(mod)].label;
+ if (stroke) {
+ drawStrokeIcon(fg, a, iconB, StrokeType(item));
+ } else {
+ const ModifierLook& look = kModifiers[int(mod)];
+ const float fs = g.tile * 0.42f;
+ const ImVec2 gs = ImGui::GetFont()->CalcTextSizeA(fs, FLT_MAX, 0.0f, look.glyph);
+ fg->AddText(ImGui::GetFont(), fs, ImVec2(a.x + (g.tile - gs.x) * 0.5f, a.y + (g.tile - gs.y) * 0.5f + 2.0f * s),
+ theme::u32(on ? theme::accent : theme::text), look.glyph);
+ if (*look.keys) { // the keys it stands for, in the corner
+ const ImVec2 ks = tiny->CalcTextSizeA(tiny->FontSize, FLT_MAX, 0.0f, look.keys);
+ fg->AddText(tiny, tiny->FontSize, ImVec2(b.x - ks.x - 4.0f * s, a.y + 3.0f * s), theme::u32(theme::textDim),
+ look.keys);
+ }
+ }
+ const ImVec2 ls = small->CalcTextSizeA(small->FontSize, FLT_MAX, 0.0f, label);
+ fg->AddText(small, small->FontSize, ImVec2(a.x + (is.x - ls.x) * 0.5f, iconB.y + (g.label - ls.y) * 0.5f - 2.0f * s),
+ theme::u32(on || hot ? theme::textBright : theme::textOff), label);
+ }
+ // The hovered item's line of help under the panel (Ctrl-hover help doesn't reach a foreground drawing).
+ if (strokePopup_.hover >= 0 && !strokePopupIsStroke(strokePopup_.hover)) {
+ const char* help = kModifiers[int(strokePopupModifier(strokePopup_.hover))].help;
+ const ImVec2 hs = small->CalcTextSizeA(small->FontSize, FLT_MAX, 0.0f, help);
+ const ImVec2 a(o.x, o.y + size.y + 4.0f * s), b(o.x + hs.x + 14.0f * s, a.y + hs.y + 8.0f * s);
+ fg->AddRectFilled(a, b, theme::u32(theme::panelBg, 0.95f), theme::rounding(4.0f * s));
+ fg->AddText(small, small->FontSize, ImVec2(a.x + 7.0f * s, a.y + 4.0f * s), theme::u32(theme::text), help);
+ }
+}
+
+} // namespace sf
diff --cc src/app/Tablet.cpp
index c8b3ea99,37129ad1..2fd2ea64
--- a/src/app/Tablet.cpp
+++ b/src/app/Tablet.cpp
@@@ -220,21 -288,99 +288,99 @@@ void App::penLeft()
lastInputPen_ = false; // whatever moves the cursor next is a mouse until the pen says otherwise
}
+ // A tablet plugged in after launch works without a restart (SDL finds its pens as they come into range); this
+ // forgets what the last one did (its name, pressure, held buttons) and says so in the status bar.
+ void App::tabletDeviceEvent(const SDL_Event& e) {
+ if (e.type == SDL_EVENT_MOUSE_ADDED) {
+ wintab_.open(window_); // Windows: a tablet without Windows Ink plugged in after launch
+ const char* name = SDL_GetMouseNameForID(e.mdevice.which);
+ const std::string n = name ? name : "";
+ tabletNote(tabletHotplug_.mouseAdded(uint32_t(e.mdevice.which), n), n);
+ } else if (e.type == SDL_EVENT_MOUSE_REMOVED) {
+ tabletNote(tabletHotplug_.mouseRemoved(uint32_t(e.mdevice.which)), {});
+ }
+ }
+
+ void App::tabletNote(TabletHotplug::Note note, const std::string& name) {
+ if (note == TabletHotplug::Note::None) return;
+ if (note == TabletHotplug::Note::Disconnected) {
+ if (penInProximity_ || penButtons_ || (dragFromPen_ && drag_ != Drag::None)) penLeft(); // no Alt left held
+ penTracker_.reset();
+ wintabPen_ = wintabTip_ = false;
+ status_ = "Tablet disconnected";
+ return;
+ }
+ penTracker_.reset(); // a new pen: whether it has pressure is its own
+ penTiltSeen_ = false;
+ if (note == TabletHotplug::Note::NewPen) return;
+ if (!name.empty()) penName_ = name;
+ else detectPenName();
+ status_ = penName_.empty() ? std::string("Tablet connected") : "Tablet connected: " + penName_;
+ }
+
+ const char* App::pressureStatus() const {
+ if (!penSeen_) return "Pressure: no pen seen yet";
+ if (penTracker_.hasPressure()) return "Pressure: on";
+ if (penTracker_.noPressure() || penTracker_.everSampled()) return "Pressure: not detected";
+ return "Pressure: touch the tablet to check";
+ }
+
+ void App::drawPressureStatus() {
+ const bool ok = penSeen_ && penTracker_.hasPressure();
+ ImGui::TextColored(col(ok ? ui::color::accent : ui::color::textDim), "%s", pressureStatus());
+ ImGui::SameLine();
+ if (ImGui::SmallButton(ICON_LC_CIRCLE_HELP " Troubleshooting##pressure_help")) guide_.open("troubleshooting.md#pen-tablets");
+ #if defined(_WIN32)
+ ui::HelpText("Pressure", nullptr,
+ "No pressure? In Wacom Tablet Properties > Mapping, switch \"Use Windows Ink\" (on for most tablets, "
+ "off for some older drivers), then bring the pen back. Without pressure the pen draws at full "
+ "strength.",
+ "Preferences > Tablet");
+ #else
+ ui::HelpText("Pressure", nullptr,
+ "Whether the pen reports pressure. Without it the pen draws at full strength; check the tablet in "
+ "your desktop's tablet settings.",
+ "Preferences > Tablet");
+ #endif
+ }
+
+ // Windows with "Use Windows Ink" off in the tablet driver: no SDL pen events, the driver moves the mouse, and the
+ // pressure comes from Wintab. While Windows Ink speaks (SDL pen events in the last second) it is the one source.
+ void App::wintabEvent(const SDL_Event& e) {
+ const bool mouse = (e.type == SDL_EVENT_MOUSE_MOTION && e.motion.which != SDL_PEN_MOUSEID) ||
+ ((e.type == SDL_EVENT_MOUSE_BUTTON_DOWN || e.type == SDL_EVENT_MOUSE_BUTTON_UP) &&
+ e.button.which != SDL_PEN_MOUSEID);
+ if (!mouse || !wintab_.isOpen()) return;
+ const Uint64 now = SDL_GetTicksNS();
+ if (penInProximity_ && now - lastPenNs_ < 1000000000ull) return; // Windows Ink is on: SDL's pen events count
+ WintabPressure::Sample s;
+ if (wintab_.poll(s)) {
+ wintabNs_ = now;
+ if (!wintabPen_) {
+ wintabPen_ = penSeen_ = true;
+ if (penName_.empty()) penName_ = "Tablet (Wintab)";
+ }
+ if (s.tip != wintabTip_) {
+ wintabTip_ = s.tip;
+ if (s.tip) penTracker_.touchDown();
+ else penTracker_.touchUp();
+ }
+ penTracker_.sample(s.pressure);
+ if (s.tip) penTracker_.motion();
+ penEraser_ = s.tip && s.eraser;
+ } else if (wintabPen_ && now - wintabNs_ > 250000000ull) {
+ wintabPen_ = wintabTip_ = penEraser_ = false; // the mouse itself: full pressure
+ penTracker_.touchUp();
+ }
+ }
+
float App::strokePressure() const {
- if (!lastInputPen_) return 1.0f; // the mouse always presses fully
- return uiPrefs_.tablet.curve.apply(penTracker_.raw());
+ if (!lastInputPen_ && !wintabPen_) return 1.0f; // the mouse always presses fully
+ return uiPrefs_.tablet.curve.apply(penTracker_.pressure()); // a pen without pressure: full
}
-SDL_Keymod App::inputMods() const {
+SDL_Keymod App::inputMods(bool latch) const {
- SDL_Keymod mods = SDL_GetModState();
- if (blenderStyle()) mods = blenderMods(mods); // Blender's Ctrl inverts, its Mask brush masks (Input.cpp)
- if (mayaStyle()) { // Maya: Ctrl inverts (as ZBrush's Alt), Ctrl+Alt masks (as ZBrush's Ctrl)
- const bool ctrl = (mods & SDL_KMOD_CTRL) != 0, alt = (mods & SDL_KMOD_ALT) != 0, shift = (mods & SDL_KMOD_SHIFT) != 0;
- // Ctrl+Alt+Shift erases the mask (#32): ZBrush's Ctrl+Alt, not Ctrl+Shift (visibility).
- if (ctrl && alt && shift) mods = SDL_Keymod((mods & ~SDL_KMOD_SHIFT) | SDL_KMOD_LCTRL | SDL_KMOD_LALT);
- else if (ctrl && alt) mods = SDL_Keymod((mods & ~SDL_KMOD_ALT) | SDL_KMOD_LCTRL);
- else if (ctrl && !shift) mods = SDL_Keymod((mods & ~SDL_KMOD_CTRL) | SDL_KMOD_LALT);
- }
+ SDL_Keymod mods = keyMods();
for (int b = 1; b <= kPenButtons; ++b) {
if (!(penButtons_ & (1u << b))) continue;
const PenAction a = penButtonAction(b);
diff --cc src/app/UiTest.cpp
index d1ba6d25,fc14a9df..586e1b6f
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@@ -132,7 -139,15 +142,15 @@@
// 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, 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, stroke_popup_open / stroke_popup_held / stroke_popup_hover / stroke_popup_picked (the stroke popup: items are strokes 0-4, then Add, Sub, Smooth, Mask, Select), stroke_latch (0 none, 1 Smooth, 2 Mask, 3 Select), invert_toggle, lazy_mouse, input_style (0 ZBrush, 1 SculptForge, 2 Blender), turntable,
-// slot pointed at, the slot run last), radial_menus, radial_slots_N, lazy_mouse (the Lazy Stroke type),
++// slot pointed at, the slot run last), radial_menus, radial_slots_N, stroke_popup_open / stroke_popup_held / stroke_popup_hover / stroke_popup_picked (the stroke popup: items are strokes 0-4, then Add, Sub, Smooth, Mask, Select), stroke_latch (0 none, 1 Smooth, 2 Mask, 3 Select), invert_toggle, lazy_mouse (the Lazy Stroke type),
+ // steady_stroke (Steady Stroke on, any type), steady_lag (px from the pointer to the brush on
+ // its string), steady_catch_up, world_size, world_radius_mm, draw_size_exact (px, unrounded),
+ // precision_active (Shift+Alt mid-stroke), precision_lag (px from the pointer to the brush),
+ // brush_curve_points / brush_curve_half (the current brush's
+ // pressure curve: its points, its value at half pressure x100), brush_curves (brushes with
+ // their own curve), dab_error_px (the last stroke's dab furthest from its cursor
+ // position, projected back), dab_jitter / dab_jitter_raw (its depth wobble with / without
+ // the pick filter, x1000 radii), dabs, pixel_density (2 on a HiDPI screen), input_style (0 ZBrush, 1 SculptForge, 2 Blender), turntable,
// camera_ortho, mask_brush (Blender's Mask brush on), shortcut_conflicts (keys two actions
// claim), brush_type (BrushType
// index, -1 for a custom brush or Paint), last_dab_x / last_dab_y (window pixels), paint_r
@@@ -465,17 -511,18 +514,24 @@@ double Demo::query(const std::string& n
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 == "look_outline_opacity") return double(std::lround(app_.uiPrefs_.look.outlineOpacity * 100.0f)); // percent
+ if (name == "look_outlines") return double(app_.uiPrefs_.look.outlines); // 0 off, 1 subtle, 2 on
+ if (name == "look_neutral") return app_.uiPrefs_.look.scheme == "neutral" ? 1.0 : 0.0; // Forge Terminal's Neutral colours
if (name == "look") return double(app_.uiPrefs_.look.look); // 0 Classic, 1 Forge Terminal, 2 Phosphor, 3 Blueprint
+ if (name == "hover_rings") return double(ui::HoverRingsShown()); // hover and focus rings drawn last frame
+ if (name == "hover_lifts") return double(ui::HoverLiftsShown()); // tiles lifted last frame
+ if (name == "reduce_motion") return app_.uiPrefs_.reduceMotion ? 1.0 : 0.0;
if (name == "shell_layout") return double(app_.uiPrefs_.shellLayout); // 0 ZBrush-style, 1 SculptForge
if (name == "air_strokes") return app_.uiPrefs_.airStrokes ? 1.0 : 0.0;
+ if (name == "emulate_3_button") return app_.uiPrefs_.emulate3Button ? 1.0 : 0.0; // Blender style (#77)
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 == "stroke_popup_open") return app_.strokePopup_.open ? 1.0 : 0.0;
+ if (name == "stroke_popup_held") return app_.strokePopup_.open && app_.strokePopup_.held ? 1.0 : 0.0;
+ if (name == "stroke_popup_hover") return double(app_.strokePopup_.hover); // item: strokes 0-4, Add 5 ... Select 9
+ if (name == "stroke_popup_picked") return double(app_.strokePopup_.picked); // -1: none yet
+ if (name == "stroke_latch") return double(int(app_.strokeLatch())); // 0 none, 1 Smooth, 2 Mask, 3 Select
+ if (name == "invert_toggle") return app_.invertToggle_ ? 1.0 : 0.0;
if (name == "radial_menu") return double(app_.radial_.menu); // -1: none open
if (name == "radial_held") return app_.radial_.menu >= 0 && app_.radial_.hold != App::RadialHold::None ? 1.0 : 0.0;
if (name == "radial_hover") return double(app_.radial_.hover);
diff --cc tests/test_shell_layout.cpp
index 815ea754,93a22e1f..fd140a8c
--- a/tests/test_shell_layout.cpp
+++ b/tests/test_shell_layout.cpp
@@@ -161,21 -160,14 +161,33 @@@ TEST(shell_right_shelf_undo_redo)
CHECK(back.rightShelf.size() == 1);
}
+TEST(shell_left_shelf_stroke_popup) {
+ // The stroke popup's button sits under the Stroke tile; a layout stored before it (version < 4) gets it there.
+ const UiLayout l = standardLayout();
+ const auto tile = std::find(l.leftShelf.begin(), l.leftShelf.end(), "widget.tile.stroke");
+ CHECK(tile != l.leftShelf.end() && tile + 1 != l.leftShelf.end() && *(tile + 1) == "stroke.popup");
+ Json old = toJson(l);
+ old.set("version", 3.0);
+ old.set("leftShelf", shelfJson({"widget.tile.brush", "widget.tile.stroke", "widget.color"}));
+ UiLayout back;
+ std::string err;
+ CHECK(fromJson(old, back, err));
+ CHECK(back.leftShelf.size() == 4 && back.leftShelf[2] == "stroke.popup" && back.leftShelf[3] == "widget.color");
+ // A current layout the user took it out of stays without it.
+ Json now = toJson(l);
+ now.set("leftShelf", shelfJson({"widget.tile.stroke"}));
+ CHECK(fromJson(now, back, err));
+ CHECK(back.leftShelf.size() == 1);
+}
++
+ // #85 (regression of #41): on macOS a window saved full screen comes back maximised, never straight into full screen
+ // (its traffic lights couldn't be reached); elsewhere it comes back full screen.
+ TEST(window_restore_fullscreen) {
+ CHECK(!restoresFullscreen(true, true));
+ CHECK(!restoresFullscreen(false, true));
+ CHECK(restoresFullscreen(true, false));
+ CHECK(!restoresFullscreen(false, false));
+ #if defined(__APPLE__)
+ CHECK(!restoresFullscreen(true));
+ #endif
+ }
diff --cc tests/ui/stroke_popup.sfui
index 7bfa4d57,00000000..afb023e0
mode 100644,000000..100644
--- a/tests/ui/stroke_popup.sfui
+++ b/tests/ui/stroke_popup.sfui
@@@ -1,128 -1,0 +1,128 @@@
- # The stroke popup (Discord 11-02): G (J in the Blender style) opens a grid at the cursor with the stroke types and
++# The stroke popup (Discord 11-02): G (N in the Blender style) opens a grid at the cursor with the stroke types and
+# the modifiers Add / Sub, Smooth, Mask, Select, the current stroke under the pointer. Hold G, point, let go:
+# picked. Tap G: it stays open; a click on a stroke picks it and closes, a click on a modifier toggles it and stays
+# open, Esc or a click beside it closes it; the click never reaches the model. Smooth, Mask and Select latch:
+# strokes act as with Shift, Ctrl or Ctrl+Shift held, until picked again or another brush is picked; a drag beside
+# the model still turns the view. A pen hovering works as the mouse. The left shelf's button opens it too. CMake
+# runs this again with the UI scaled 1.5x (ui_stroke_popup_scaled).
+run new_sphere subdivisions=4
+camera 0 0
+expect_shortcut stroke.popup G
+expect_value shortcut_conflicts == 0
+expect_value stroke_type == 0
+expect_value stroke_latch == 0
+
+# Hold G: open, held, Dots under the pointer. Point at Spray and let go: Spray.
+hover_window 0.5 0.5
+key_down g
+expect_value stroke_popup_open == 1
+expect_value stroke_popup_held == 1
+expect_value stroke_popup_hover == 0
+shot open
+stroke_popup_item spray
+expect_value stroke_popup_hover == 3
+shot hover_spray
+key_up g
+expect_value stroke_popup_open == 0
+expect_value stroke_type == 3
+expect_value stroke_popup_picked == 3
+
+# Held, then let go beside the grid after a moment: closed, nothing picked.
+hover_window 0.5 0.5
+key_down g
+stroke_popup_item outside
+wait 0.3
+key_up g
+expect_value stroke_popup_open == 0
+expect_value stroke_type == 3
+expect_value stroke_popup_picked == 3
+
+# Tapped: it stays open. A click on Dots picks it and closes; the model isn't touched.
+hover_window 0.5 0.5
+snapshot
+key g
+expect_value stroke_popup_open == 1
+expect_value stroke_popup_held == 0
+stroke_popup_item dots click
+expect_value stroke_popup_open == 0
+expect_value stroke_type == 0
+expect_value stroking == 0
+expect_value moved == 0
+
+# Modifiers: a click toggles and the grid stays open. Sub, then Mask latched; Esc closes, they stay on.
+key g
+stroke_popup_item sub click
+expect_value invert_toggle == 1
+expect_value stroke_popup_open == 1
+stroke_popup_item mask click
+expect_value stroke_latch == 2
+expect_value stroke_popup_open == 1
+shot modifiers
+stroke_popup_item select
+shot hover_select
+key escape
+expect_value stroke_popup_open == 0
+expect_value stroke_latch == 2
+
+# Mask latched: a plain stroke masks (no Ctrl held) and doesn't move the surface; the label shows at the cursor.
+expect_value masked == 0
+hover_model 0.5 0.5
+shot mask_latched
+stroke 0.3 0.5 0.7 0.5
+expect_value masked > 50
+expect_value moved == 0
+remember masked m
+# A drag beside the model turns the view (a held Ctrl would invert the mask there instead).
+expect_value camera_aligned == 1
+view_drag 0.65 0.22 0.7 0.27
+expect_value masked == $m
+expect_value camera_aligned == 0
+camera 0 0
+
+# Picked again: off. Add back on; a stroke sculpts again.
+key g
+stroke_popup_item mask click
+expect_value stroke_latch == 0
+stroke_popup_item add click
+expect_value invert_toggle == 0
+key escape
+
+# Picking another brush ends a latch.
+key g
+stroke_popup_item smooth click
+expect_value stroke_latch == 1
+key escape
+key 2
+expect_value stroke_latch == 0
+key 1
+
+# A pen hovering: hold G, hover over Slide Stamp, let go. Tapped open, the pen's tip taps Lazy Stroke.
+pen_hover 0.5 0.5
+key_down g
+stroke_popup_item slide_stamp pen
+expect_value stroke_popup_hover == 2
+key_up g
+expect_value stroke_type == 2
+key g
+stroke_popup_item lazy pen click
+expect_value stroke_popup_open == 0
+expect_value stroke_type == 4
+expect_value stroking == 0
+pen_out
+
+# The left shelf's button opens it (tapped open), a click on Dots closes it.
+click "Stroke popup##stroke.popup"
+expect_value stroke_popup_open == 1
+expect_value stroke_popup_held == 0
+shot from_shelf
+stroke_popup_item dots click
+expect_value stroke_popup_open == 0
+expect_value stroke_type == 0
+
- # The ZBrush style: G too. The Blender style: J (its G is the Move brush).
++# The ZBrush style: G too. The Blender style: N (its G is the Move brush, J the Strokes radial menu).
+input_style zbrush
+expect_shortcut stroke.popup G
+expect_value shortcut_conflicts == 0
+input_style blender
- expect_shortcut stroke.popup J
++expect_shortcut stroke.popup N
+expect_value shortcut_conflicts == 0