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.

Right click on the canvas opens the QuickMenu, as in ZBrush (#22)

islandmedff358e3f2dd3
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 754ed25e..bc50c7f3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,15 @@ All notable changes to SculptForge are listed here. The format follows
## [Unreleased]
+### Added
+- A right click on the canvas opens the QuickMenu under the cursor, as in ZBrush (#22). Pressed and let go
+ without moving more than 4 px, beside the model or on it; the view waits until the press moves past that, so
+ a click never nudges it, and a right drag turns, pans or zooms as before (by everything it moved, nothing
+ lost). A pen button set to Right click works the same; SDL's own mouse click for another pen button doesn't
+ open it. On by default in every input style (a right click without a drag did nothing before);
+ **Preferences > Input > Right click opens the QuickMenu** turns it off (`rightClickQuickMenu` in ui.json).
+ UI test right_click_menu (mouse, tremble, drag, pen button, Blender style, preference off).
+
### Changed
- Large brushes on dense meshes are faster and stay closer to the pointer. Measured on a 21M-triangle sphere
with a 200 px brush (`--measure-stroke 3,200`, M1 Pro):
diff --git a/docs/guide/coming-from-zbrush.md b/docs/guide/coming-from-zbrush.md
index 5d29d90c..b18bc95e 100644
--- a/docs/guide/coming-from-zbrush.md
+++ b/docs/guide/coming-from-zbrush.md
@@ -107,7 +107,7 @@ in Blender or Maya. Press **Store Config** (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kb
| Frame | <kbd>F</kbd> | <kbd>F</kbd> |
| Brush pop-up | <kbd>B</kbd> | <kbd>B</kbd> |
| Draw Size / Z Intensity / RGB Intensity / Focal Shift | <kbd>S</kbd> / <kbd>U</kbd> / <kbd>I</kbd> / <kbd>O</kbd> | Same |
-| QuickMenu | <kbd>Space</kbd> | <kbd>Space</kbd> (right-click navigates) |
+| QuickMenu | <kbd>Space</kbd> or right-click | <kbd>Space</kbd> or right-click (a right drag navigates) |
| LazyMouse | <kbd>L</kbd> | <kbd>L</kbd> |
| Pick colour / switch colour | <kbd>C</kbd> / <kbd>V</kbd> | Same |
| Symmetry | <kbd>X</kbd> | <kbd>X</kbd> |
diff --git a/docs/guide/interface.md b/docs/guide/interface.md
index 7e6643c4..6baf6fa7 100644
--- a/docs/guide/interface.md
+++ b/docs/guide/interface.md
@@ -227,7 +227,7 @@ brushes](brush-lab.md)).
As in ZBrush, press <kbd>S</kbd> for a Draw Size slider under the mouse, <kbd>U</kbd> for Z Intensity,
<kbd>I</kbd> for RGB Intensity or <kbd>O</kbd> for Focal Shift. Drag the slider, or type a number and press
<kbd>Enter</kbd> (<kbd>Esc</kbd> cancels). The pop-up closes when you release the slider. <kbd>[</kbd> and
-<kbd>]</kbd> make the brush 10% smaller or larger at any time. <kbd>Space</kbd> opens the QuickMenu with all of
+<kbd>]</kbd> make the brush 10% smaller or larger at any time. <kbd>Space</kbd> (or a right click on the canvas) opens the QuickMenu with all of
them and the brush, stroke, alpha and material (see [The QuickMenu](sculpting.md#the-quickmenu)).
## The LightBox
@@ -437,7 +437,9 @@ brushes (<kbd>9</kbd> is QuickSave in the ZBrush style), <kbd>I</kbd> opens Z In
<kbd>Ctrl</kbd>+drag on the background zooms when nothing is masked; or **Blender**: middle-drag navigation,
the numpad views and Blender's sculpt-mode keys (see [Blender keys](shortcuts.md#blender-keys)). In the Blender
style, **Emulate Numpad** makes the number row work as the numpad, and **Import Blender keymap...** takes the keys
-from a keymap you exported in Blender. **Rotation** chooses free rotation (ZBrush) or a turntable. See
+from a keymap you exported in Blender. **Right click opens the QuickMenu** (on by default, in every style) opens
+the [QuickMenu](sculpting.md#the-quickmenu) with a right click on the canvas; a right drag navigates either
+way. **Rotation** chooses free rotation (ZBrush) or a turntable. See
[Coming from ZBrush](coming-from-zbrush.md).
### The background
diff --git a/docs/guide/sculpting.md b/docs/guide/sculpting.md
index afc02ada..aff55753 100644
--- a/docs/guide/sculpting.md
+++ b/docs/guide/sculpting.md
@@ -181,6 +181,11 @@ Draw Size, Focal Shift, Z Intensity and RGB Intensity, Zadd / Zsub, Sculpt / Pai
<kbd>Space</kbd> and let go to close it again (it stays while the pointer is on it), or tap <kbd>Space</kbd> to
keep it open until you click elsewhere or press <kbd>Esc</kbd>. Clicking a tile opens its picker.
+A right click on the canvas opens it too, as in ZBrush: press the right button and let go without moving, beside
+the model or on it, and the QuickMenu stays open at the cursor. A right drag still turns the view (and pans or
+zooms with <kbd>Alt</kbd> or <kbd>Ctrl</kbd>), and a pen button set to **Right click** (Preferences > Tablet)
+works the same way. Turn it off with **Preferences > Input > Right click opens the QuickMenu**.
+
## Strokes
The stroke type decides how cursor movement becomes brush dabs. Choose it from the **Stroke** tile on the left
diff --git a/docs/guide/whats-new.md b/docs/guide/whats-new.md
index 419858df..79459c3a 100644
--- a/docs/guide/whats-new.md
+++ b/docs/guide/whats-new.md
@@ -14,6 +14,12 @@ with a 200-pixel brush, the brush now trails the pointer by half as far, a frame
first dab appears in half the time, and lifting the pen no longer pauses for up to a second while waiting dabs
are placed. See [Performance](performance.md).
+### Right click for the QuickMenu
+
+A right click on the canvas opens the QuickMenu under the cursor, as in ZBrush (Space still does too). A right
+drag turns the view as before, and **Preferences > Input > Right click opens the QuickMenu** turns it off. See
+[The QuickMenu](sculpting.md#the-quickmenu).
+
## Version 0.9.6
### Extract
diff --git a/src/app/App.cpp b/src/app/App.cpp
index 8b19c408..a9e43d47 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -579,6 +579,7 @@ constexpr int kIdleTickMs = 250; // asleep: wake this often to run the pol
constexpr int kCaretTickMs = 530; // a text field has the keyboard: redraw for the caret's blink
constexpr double kAfterChangeSeconds = 0.25; // a poller changed something: draw for this long
constexpr double kStrokeBudgetSeconds = 0.010; // a frame's share of placing a stroke's dabs; the rest waits for the next
+constexpr float kRightClickSlop = 4.0f; // pixels a right press may move and still be a click (#22)
constexpr double kStrokeBacklogSeconds = 0.05; // queued dabs beyond this much work are thinned (strokeTo)
constexpr size_t kStrokeBacklogMinDabs = 4; // ... but never fewer dabs than this waiting
@@ -881,6 +882,9 @@ void App::handleEvent(const SDL_Event& e) {
onMouseDown(e.button.x, e.button.y, e.button.button);
break;
case SDL_EVENT_MOUSE_BUTTON_UP:
+ // A right click that didn't drag: the QuickMenu (#22). (SDL's click for a pen button doesn't count: a pen
+ // button opens it only when set to Right click, in penButton.)
+ if (e.button.button == SDL_BUTTON_RIGHT && e.button.which != SDL_PEN_MOUSEID) rightClickRelease();
onMouseUp();
break;
case SDL_EVENT_MOUSE_MOTION:
@@ -933,6 +937,13 @@ void App::onMouseDown(float x, float y, Uint8 button) {
if (eraserAction() == PenAction::EraseMask && previewLod_ < 0 && pick(x, y, hit)) beginMaskStroke(x, y);
return;
}
+ // A right press with no keys held may be a click that opens the QuickMenu (rightClickRelease); it navigates
+ // only once it moves past the slop.
+ rightClick_.pending = button == SDL_BUTTON_RIGHT && uiPrefs_.rightClickQuickMenu &&
+ !(SDL_GetModState() & (SDL_KMOD_SHIFT | SDL_KMOD_CTRL | SDL_KMOD_ALT | SDL_KMOD_GUI));
+ rightClick_.x = x;
+ rightClick_.y = y;
+ rightClick_.dx = rightClick_.dy = 0.0f;
if (blenderStyle() && blenderNavigationDown(button)) return; // middle / Alt+left / right drags navigate
if (button == SDL_BUTTON_LEFT) {
if (zsphereMouseDown(x, y, mod)) return; // a ZSphere SubTool takes clicks on it (PanelZSpheres.cpp)
@@ -1013,6 +1024,16 @@ void App::onMouseMove(float x, float y, float dx, float dy, bool fromPen) {
mouseX_ = x;
mouseY_ = y;
lastInputPen_ = fromPen;
+ if (rightClick_.pending) { // a right click so far: the view waits until it is a drag
+ // (By the motion's own steps, not the position: some input moves only relatively.) Past the slop, the
+ // drag goes on by everything since the press, so it loses nothing.
+ rightClick_.dx += dx;
+ rightClick_.dy += dy;
+ if (std::hypot(rightClick_.dx, rightClick_.dy) <= kRightClickSlop) return;
+ rightClick_.pending = false;
+ dx = rightClick_.dx;
+ dy = rightClick_.dy;
+ }
// ZBrush: start a pan with Alt, then let go of Alt while still dragging to zoom.
if (drag_ == Drag::Pan && panFromAlt_ && !(inputMods() & SDL_KMOD_ALT)) drag_ = Drag::Zoom;
// Shift+press on the background: letting go of Shift before the drag gets going rolls the view instead.
@@ -1078,6 +1099,7 @@ void App::rollBy(float x, float y, float dx, float dy) {
void App::onMouseUp() {
rollPending_ = false;
+ rightClick_.pending = false;
orbitStarted_ = false;
panFromAlt_ = false;
if (drag_ == Drag::Select) selectionMouseUp();
diff --git a/src/app/App.h b/src/app/App.h
index 7bd97b63..fffafe32 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -1131,6 +1131,10 @@ private:
void drawZIntensitySlider(const char* id);
void openQuickMenu();
void quickMenuKeyUp(); // Space released: a hold closes the menu, a tap leaves it open
+ // A right click on the canvas (pressed and let go without moving past kRightClickSlop) opens the QuickMenu
+ // there, as in ZBrush (#22); a right drag navigates as before. Preferences > Input > Right click opens the
+ // QuickMenu (uiPrefs_.rightClickQuickMenu).
+ void rightClickRelease();
void drawQuickMenu();
void groupMasked(); // Ctrl+W
// Straight strokes: Shift pressed after a stroke started constrains it to a line from where Shift went down,
@@ -1147,6 +1151,11 @@ private:
bool untilLeave = false; // Space let go over the menu: it closes when the pointer leaves it
int openedFrame = -1;
} quickMenu_;
+ struct RightClick {
+ bool pending = false; // a right press that hasn't moved past the slop: navigation waits
+ float x = 0.0f, y = 0.0f;
+ float dx = 0.0f, dy = 0.0f; // the motion since the press
+ } rightClick_;
struct StraightStroke {
bool active = false; // Shift went down mid-stroke
bool shiftAtStart = false; // the stroke began with Shift (it smooths; Shift isn't a constraint then)
diff --git a/src/app/Config.cpp b/src/app/Config.cpp
index fadb88ce..ac6e7afe 100644
--- a/src/app/Config.cpp
+++ b/src/app/Config.cpp
@@ -49,6 +49,7 @@ Json toJson(const UiPrefs& p) {
j.set("turntable", p.turntable);
j.set("inputStyle", std::string(p.inputStyle == 2 ? "blender" : p.inputStyle == 1 ? "sculptforge" : "zbrush"));
j.set("emulateNumpad", p.emulateNumpad);
+ j.set("rightClickQuickMenu", p.rightClickQuickMenu);
j.set("alphabeticalPalettes", p.alphabeticalPalettes);
j.set("tablet", toJson(p.tablet));
j.set("spaceMouse", toJson(p.spaceMouse));
@@ -82,6 +83,7 @@ void fromJson(const Json& j, UiPrefs& p) {
p.inputStyle = style == "blender" ? 2 : style == "sculptforge" ? 1 : 0;
}
p.emulateNumpad = j["emulateNumpad"].asBool(p.emulateNumpad);
+ p.rightClickQuickMenu = j["rightClickQuickMenu"].asBool(p.rightClickQuickMenu);
p.alphabeticalPalettes = j["alphabeticalPalettes"].asBool(p.alphabeticalPalettes);
fromJson(j["tablet"], p.tablet);
fromJson(j["spaceMouse"], p.spaceMouse);
diff --git a/src/app/Config.h b/src/app/Config.h
index f9b184da..2f6dc245 100644
--- a/src/app/Config.h
+++ b/src/app/Config.h
@@ -33,6 +33,7 @@ struct UiPrefs {
int inputStyle = 0; // Preferences > Input: 0 ZBrush, 1 SculptForge (1-0 brushes, I = Z Intensity...),
// 2 Blender (middle-drag orbit, numpad views, Blender's sculpt keys; Input.cpp)
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)
TabletSettings tablet; // Preferences > Tablet: pressure curve, eraser, pen buttons
SpaceMouseSettings spaceMouse; // Preferences > Input > SpaceMouse
// Preferences > Performance (PanelPerformance.cpp).
diff --git a/src/app/Input.cpp b/src/app/Input.cpp
index 4e990d9a..4237d243 100644
--- a/src/app/Input.cpp
+++ b/src/app/Input.cpp
@@ -131,6 +131,11 @@ void App::registerInputActions() {
"orthographic...), for keyboards without one.",
[this] { uiPrefs_.emulateNumpad = !uiPrefs_.emulateNumpad; }, [this] { return uiPrefs_.emulateNumpad; },
[this] { return blenderStyle(); });
+ add("input.right_click_menu", "Right click opens the QuickMenu", nullptr, "Preferences > Input", "",
+ "A right click on the canvas, without dragging, opens the QuickMenu under the cursor, as in ZBrush (Space "
+ "does too). A right drag still turns, pans or zooms the view. A pen button set to Right click works the same.",
+ [this] { uiPrefs_.rightClickQuickMenu = !uiPrefs_.rightClickQuickMenu; },
+ [this] { return uiPrefs_.rightClickQuickMenu; });
add("input.import_blender", "Import Blender keymap...", ICON_LC_FILE_INPUT, "Preferences > Input", "",
"Use the keys from a keymap you exported in Blender (Preferences > Keymap > Export, a .py file). Switches "
"to the Blender style, then takes the navigation and sculpt keys SculptForge has an equivalent for. The "
@@ -388,6 +393,10 @@ void App::drawInputSection() {
if (ImGui::Checkbox("Emulate Numpad", &emulate)) uiPrefs_.emulateNumpad = emulate;
ui::HelpAction(*this, "input.emulate_numpad");
}
+ bool rightClickMenu = uiPrefs_.rightClickQuickMenu;
+ if (ui::Checkbox("Right click opens the QuickMenu##input.right_click_menu", &rightClickMenu))
+ uiPrefs_.rightClickQuickMenu = rightClickMenu;
+ ui::HelpAction(*this, "input.right_click_menu");
ui::ActionButton(*this, "input.import_blender", ImVec2(-FLT_MIN, 0), ui::Look::IconLabel);
ImGui::TextDisabled("Rotation");
ImGui::SameLine();
@@ -471,6 +480,19 @@ void App::openQuickMenu() {
quickMenu_.openedFrame = ImGui::GetFrameCount();
}
+void App::rightClickRelease() {
+ if (!rightClick_.pending) return;
+ rightClick_.pending = false;
+ if (!uiPrefs_.rightClickQuickMenu) return;
+ // Opened as a tap of Space would: it stays until a click elsewhere or Esc.
+ quickMenu_.open = true;
+ quickMenu_.at = ImVec2(rightClick_.x, rightClick_.y);
+ quickMenu_.openedAt = ImGui::GetTime();
+ quickMenu_.keyHeld = false;
+ quickMenu_.untilLeave = false;
+ quickMenu_.openedFrame = ImGui::GetFrameCount();
+}
+
void App::quickMenuKeyUp() {
if (!quickMenu_.keyHeld) return;
quickMenu_.keyHeld = false;
diff --git a/src/app/Tablet.cpp b/src/app/Tablet.cpp
index 4bfba684..63e8637d 100644
--- a/src/app/Tablet.cpp
+++ b/src/app/Tablet.cpp
@@ -131,6 +131,7 @@ void App::penButton(int button, bool down, float x, float y) {
}
if (drag_ != Drag::None) penNavButton_ = button;
} else if (penNavButton_ == button) {
+ if (a == PenAction::RightClick) rightClickRelease(); // a tap of the button: the QuickMenu, as the mouse's
if (drag_ == Drag::Orbit || drag_ == Drag::Pan || drag_ == Drag::Zoom) {
drag_ = Drag::None;
dragFromPen_ = false;
diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cpp
index 956aeae7..94803b6f 100644
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@ -94,7 +94,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, lazy_mouse, input_style (0 ZBrush, 1 SculptForge, 2 Blender), turntable,
+// quickmenu_open, right_click_menu, 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
// claim), brush_type (BrushType
// index, -1 for a custom brush or Paint), last_dab_x / last_dab_y (window pixels), paint_r
@@ -377,6 +377,7 @@ double Demo::query(const std::string& name, bool& known) const {
if (name == "focal_shift") return std::round(app_.focalShift_ * 100.0f);
if (name == "draw_size") return std::round(app_.radiusPx_);
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 == "size_popup_open" || name == "size_knob_x" || name == "size_knob_y") {
ImVec2 knob(-1.0f, -1.0f);
const bool open = PickerUi::sliderKnob(knob);
diff --git a/tests/ui/right_click_menu.sfui b/tests/ui/right_click_menu.sfui
new file mode 100644
index 00000000..3c8e2334
--- /dev/null
+++ b/tests/ui/right_click_menu.sfui
@@ -0,0 +1,71 @@
+# A right click on the canvas opens the QuickMenu under the cursor, as in ZBrush (#22): pressed and let go
+# without moving more than a few pixels, beside the model or on it, and the view doesn't move. A right drag still
+# turns the view and opens nothing. A pen button set to Right click (the lower one, by default) does the same.
+# Preferences > Input > Right click opens the QuickMenu turns it off.
+run new_sphere subdivisions=3
+camera 0 0
+remember camera_yaw y0
+remember camera_pitch p0
+expect_value right_click_menu == 1
+
+# Beside the model: the menu opens there, the view hasn't moved.
+button_drag right 0.12 0.3 0.12 0.3 0.1
+expect_value quickmenu_open == 1
+expect "##qm_drawsize"
+expect_value camera_yaw == $y0
+expect_value camera_pitch == $p0
+shot opened
+key escape
+expect_value quickmenu_open == 0
+
+# On the model, with a hand's tremble (under 2 px): still a click.
+button_drag right 0.5 0.5 0.501 0.5 0.1
+expect_value quickmenu_open == 1
+expect_value camera_yaw == $y0
+key escape
+
+# A right drag turns the view and opens nothing.
+button_drag right 0.12 0.3 0.12 0.5
+expect_value quickmenu_open == 0
+expect_value camera_pitch < $p0-20
+
+# The pen's lower button (Right click): a tap opens it, a drag turns the view.
+camera 0 0
+pen_hover 0.5 0.5
+pen_button 1 down
+pen_button 1 up
+expect_value quickmenu_open == 1
+expect_value camera_yaw == $y0
+key escape
+expect_value quickmenu_open == 0
+pen_button 1 down
+pen_hover 0.9 0.5
+pen_button 1 up
+expect_value camera_yaw != $y0
+expect_value quickmenu_open == 0
+pen_out
+
+# The Blender style too (its right drag navigates as well).
+click "Preferences##palette.preferences"
+click "Input##preferences.input"
+click "Blender##input.style_blender"
+expect_value input_style == 2
+key escape
+camera 0 0
+button_drag right 0.12 0.3 0.12 0.3 0.1
+expect_value quickmenu_open == 1
+key escape
+button_drag right 0.12 0.3 0.12 0.5
+expect_value quickmenu_open == 0
+expect_value camera_pitch != $p0
+
+# Turned off: a right click does nothing (and a drag still navigates). (Input is still open from above.)
+click "Preferences##palette.preferences"
+click "Right click opens the QuickMenu##input.right_click_menu"
+expect_value right_click_menu == 0
+key escape
+camera 0 0
+button_drag right 0.12 0.3 0.12 0.3 0.1
+expect_value quickmenu_open == 0
+button_drag right 0.12 0.3 0.12 0.5
+expect_value camera_pitch != $p0