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.

Maya style view keys (#134): Alt, then Ctrl+left drag rolls; Alt+F frames the Part, Alt+H resets the view; Wheel zooms toward the pointer

islandmed9a3152a16b06
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c405e6e2..1f2894b9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,14 @@ All notable changes to SculptForge are listed here. The format follows
## [Unreleased]
+### Added
+- **Maya style view keys** (#134, thanks RodTDai): hold Alt, then add Ctrl, and a left drag rolls the view (left /
+ right); Alt+F frames the active Part; Alt+H resets the view (front, upright, perspective, everything in view). Ctrl
+ first (or both together) still masks with Ctrl+Alt, on the model and beside it.
+- **Edit > Preferences > Input > Wheel zooms toward the pointer** (#134): the wheel zooms toward the point of the model
+ under the pointer, which stays put. On with the Maya style; the other styles keep zooming toward the middle (the box
+ turns it on in any style). **Reset view** is also an action in the Controls window, for a key of your own.
+
## [0.11.1] - 2026-11-05
### Added
diff --git a/docs/guide/navigation.md b/docs/guide/navigation.md
index 5abf8010..6e2a1f82 100644
--- a/docs/guide/navigation.md
+++ b/docs/guide/navigation.md
@@ -43,15 +43,16 @@ camera.
| To | Do this |
|---|---|
| Rotate | Left-drag on the background, or right-drag anywhere on the canvas; add <kbd>Shift</kbd> to snap to an axis view |
-| Roll (turn about the view axis) | <kbd>Shift</kbd>+click the background, let go of <kbd>Shift</kbd>, then drag |
+| Roll (turn about the view axis) | <kbd>Shift</kbd>+click the background, let go of <kbd>Shift</kbd>, then drag (Maya style: hold <kbd>Alt</kbd>, add <kbd>Ctrl</kbd>, left-drag sideways) |
| Pan | <kbd>Alt</kbd>+left-drag on the background, <kbd>Alt</kbd>+right-drag, or middle-drag |
-| Zoom | Mouse wheel; <kbd>Alt</kbd>+left-drag on the background, then let go of <kbd>Alt</kbd> and keep dragging; <kbd>Ctrl</kbd>+right-drag; <kbd>Ctrl</kbd>+middle-drag; <kbd>Ctrl</kbd>+left-drag on the background when nothing is masked (not with the Classic sculpting keys) |
+| Zoom | Mouse wheel (toward the middle of the view, or toward the pointer with **Edit > Preferences > Input > Wheel zooms toward the pointer**, on in the Maya style); <kbd>Alt</kbd>+left-drag on the background, then let go of <kbd>Alt</kbd> and keep dragging; <kbd>Ctrl</kbd>+right-drag; <kbd>Ctrl</kbd>+middle-drag; <kbd>Ctrl</kbd>+left-drag on the background when nothing is masked (not with the Classic sculpting keys) |
| Frame the model | <kbd>F</kbd> (Blender style: <kbd>Home</kbd>), or **Frame** on the right shelf |
| Front, right, top view | <kbd>Numpad 1</kbd>, <kbd>Numpad 3</kbd>, <kbd>Numpad 7</kbd>; <kbd>Ctrl</kbd> for the back, left and bottom |
| Front, side, top or bottom view with the mouse | Click an end of the axis gizmo in the canvas corner |
| Orthographic on or off | <kbd>Numpad 5</kbd> |
| Turn in 15 degree steps | <kbd>Numpad 4</kbd> / <kbd>Numpad 6</kbd> (around), <kbd>Numpad 8</kbd> / <kbd>Numpad 2</kbd> (over); <kbd>Numpad 9</kbd>: the other side |
-| Frame the active Part | <kbd>Numpad .</kbd> |
+| Frame the active Part | <kbd>Numpad .</kbd> (Maya style: also <kbd>Alt</kbd>+<kbd>F</kbd>) |
+| Reset the view | Maya style: <kbd>Alt</kbd>+<kbd>H</kbd> (front, upright, everything in view); any style: **Reset view** in the Controls window (<kbd>F1</kbd>), where you can give it a key |
| Frame one Part | <kbd>Shift</kbd>+<kbd>Alt</kbd>+click it, or triple-click another Part (it becomes the active Part) |
| Sculpt from the background | Turn on **Edit > Preferences > Input > Start strokes off the model**, **View > Lock camera**, or press <kbd>Shift</kbd>+<kbd>L</kbd>: a left-drag that starts beside the model sculpts once it reaches the surface |
| Move the camera with Space held | Turn on **Edit > Preferences > Input > Hold Space and drag to move the camera**, then hold <kbd>Space</kbd>: left-drag rotates, right- or middle-drag pans, <kbd>Ctrl</kbd>+drag zooms, anywhere on the canvas (on the model too) |
@@ -217,7 +218,8 @@ These live on the right shelf and in the **View** menu:
> **Not yet:** SculptForge has no rotation around the point under the cursor (the
> camera always orbits its target, which Frame sets to the scene centre), no floor grid and no saved camera
-> views. Pan the target onto the area you're working on to orbit around it.
+> views. Pan the target onto the area you're working on to orbit around it, or zoom there with the wheel and
+> **Wheel zooms toward the pointer** on: that moves the target toward the point under the pointer too.
## See also
diff --git a/docs/guide/shortcuts.md b/docs/guide/shortcuts.md
index c64d845c..e6aea9d0 100644
--- a/docs/guide/shortcuts.md
+++ b/docs/guide/shortcuts.md
@@ -164,7 +164,7 @@ generated from SculptForge's action registry, the same source as the Controls wi
| Bottom view | <kbd>Ctrl</kbd>+<kbd>Numpad 7</kbd> | Look up at the model from below (orthographic). |
| Draw | <kbd>Q</kbd> | Draw mode: brushes sculpt and paint (leaves the Gizmo). |
| Frame | <kbd>F</kbd> | Fit the whole model in the view. |
-| Frame Part | <kbd>Numpad .</kbd> | Fit the active Part in the view (Blender: View Selected). |
+| Frame Part | <kbd>Numpad .</kbd> | Fit the active Part in the view (Blender: View Selected; Maya keys: Alt+F). |
| Front view | <kbd>Numpad 1</kbd> | Look at the model from the front (orthographic). |
| Left view | <kbd>Ctrl</kbd>+<kbd>Numpad 3</kbd> | Look at the model's left side (orthographic). |
| Move | <kbd>W</kbd> | Gizmo, Move: drag an arrow to move along an axis, a square to move in a plane, the centre to move in the view. Masked parts stay; Shift snaps to the grid; Alt+drag moves only the gizmo. W again: back to Draw. |
@@ -303,12 +303,23 @@ long as <kbd>Alt</kbd> is the only key held:
|---|---|
| Rotate | <kbd>Alt</kbd>+left-drag |
| Pan | <kbd>Alt</kbd>+middle-drag |
-| Zoom | <kbd>Alt</kbd>+right-drag **sideways**: right zooms in, left zooms out, as Maya's own dolly |
+| Zoom | <kbd>Alt</kbd>+right-drag **sideways**: right zooms in, left zooms out, as Maya's own dolly; the mouse wheel zooms toward the pointer |
+| Roll (turn about the view axis) | Hold <kbd>Alt</kbd>, then add <kbd>Ctrl</kbd>, and left-drag left or right |
+| Frame the active Part | <kbd>Alt</kbd>+<kbd>F</kbd> (also <kbd>Numpad .</kbd>) |
+| Reset the view | <kbd>Alt</kbd>+<kbd>H</kbd>: from the front, upright, in perspective, the whole model in view |
| Invert the brush (subtract) | Hold <kbd>Ctrl</kbd> while sculpting |
| Paint a mask / erase it | <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+drag / <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>Shift</kbd>+drag |
| Smooth | Hold <kbd>Shift</kbd> while sculpting |
| Visibility gestures | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>, as in the other styles |
+The roll needs <kbd>Alt</kbd> first: press <kbd>Ctrl</kbd> first (or both together) and <kbd>Ctrl</kbd>+<kbd>Alt</kbd>
+masks as before, on the model, and clears the mask beside it.
+
+**Edit > Preferences > Input > Wheel zooms toward the pointer** (#134) keeps the point of the model under the pointer
+where it is while the wheel zooms; beside the model it zooms toward the pointer at the model's depth. Choosing the Maya
+style turns it on and the other styles turn it off (they zoom toward the middle of the view); the box changes it in
+any style.
+
Maya's default dolly follows a sideways drag, so that is the default here too. **Edit > Preferences > Input > Zoom
drag** switches it to **Up and down** (drag up to zoom in) if you set Maya up that way. **Invert zoom**, in every
style, turns zoom drags around (the mouse wheel stays as it is).
diff --git a/src/app/App.cpp b/src/app/App.cpp
index fc031144..8533b0e1 100644
--- a/src/app/App.cpp
+++ b/src/app/App.cpp
@@ -412,6 +412,7 @@ int App::runUiTest(int w, int h, int fps) {
if (finalFrame) break;
finalFrame = true; // one more frame, for a failure screenshot
}
+ trackModOrder(); // (the script's held keys of the last frame: Maya's Alt, then Ctrl, #134)
demo_->update(dt);
processPendingFiles();
animateLayers(dt);
@@ -605,6 +606,7 @@ int App::runRecording() {
SDL_Event e;
while (SDL_PollEvent(&e)) {
} // the demo provides all input
+ trackModOrder(); // (the script's held keys of the last frame: Maya's Alt, then Ctrl, #134)
demo_->update(dt);
processPendingFiles();
animateLayers(dt);
@@ -1003,6 +1005,7 @@ int App::run() {
else drainStrokeDabs(kStrokeBudgetSeconds);
mark();
kelvinCatchUp(); // a long Kelvinlet move, a bounded part per frame (PanelKelvinlet.cpp)
+ trackModOrder(); // (keys that change without an event of ours, e.g. a UI test's hold)
Uint64 now = SDL_GetTicksNS();
float dt = float(double(now - lastTicks) * 1e-9);
lastTicks = now;
@@ -1324,6 +1327,7 @@ void App::dispatchEvent(const SDL_Event& event) {
event.type != SDL_EVENT_MOUSE_REMOVED) ||
(event.type >= SDL_EVENT_PEN_PROXIMITY_IN && event.type <= SDL_EVENT_PEN_AXIS))
lastInputAt_ = double(SDL_GetTicksNS()) * 1e-9; // (focusKeepsDrawing)
+ trackModOrder(); // (before the event: Maya's Alt, then Ctrl roll, #134)
wintabEvent(event); // Windows Ink off: the tablet driver's pressure for its mouse events (Tablet.cpp)
SDL_Event e = event;
mapPenPosition(e); // a tablet in mouse mode moves the cursor relatively (#54), for the canvas and the UI
@@ -1409,7 +1413,7 @@ void App::dispatchEvent(const SDL_Event& event) {
case SDL_EVENT_MOUSE_WHEEL:
// (Not the scroll a trackpad sends during a pinch or twist: Touch.cpp zooms for that.)
if (!io.WantCaptureMouse && !touchPinching_ && canvasRect().contains(e.wheel.mouse_x, e.wheel.mouse_y))
- camera_.zoom(e.wheel.y);
+ wheelZoom(e.wheel.mouse_x, e.wheel.mouse_y, e.wheel.y);
break;
case SDL_EVENT_KEY_DOWN:
if (e.key.key == SDLK_SPACE && !e.key.repeat && // hold Space and drag: the camera (#43; not while typing)
@@ -1672,6 +1676,15 @@ void App::onMouseDown(float x, float y, Uint8 button) {
// when the press started navigating.
bool App::mayaNavigationDown(Uint8 button) {
const SDL_Keymod keys = SDL_GetModState(); // the keyboard itself, before inputMods' Maya mapping
+ // Alt held, then Ctrl added: a left drag rolls the view (#134). Ctrl first, or both at once, stays the Ctrl+Alt
+ // mask gestures (on the model: mask; beside it: clear the mask).
+ if (button == SDL_BUTTON_LEFT && altBeforeCtrl_ && (keys & SDL_KMOD_ALT) && (keys & SDL_KMOD_CTRL) &&
+ !(keys & SDL_KMOD_SHIFT)) {
+ drag_ = Drag::Roll;
+ rollSideways_ = true;
+ rightClick_.pending = false;
+ return true;
+ }
if (!(keys & SDL_KMOD_ALT) || ctrlDown(keys) || (keys & SDL_KMOD_SHIFT)) return false; // Alt alone navigates
if (button == SDL_BUTTON_LEFT) drag_ = Drag::Orbit;
else if (button == SDL_BUTTON_MIDDLE) drag_ = Drag::Pan;
@@ -1738,7 +1751,10 @@ void App::onMouseMove(float x, float y, float dx, float dy, bool fromPen) {
switch (drag_) {
case Drag::Stroke: strokeTo(x, y); break;
case Drag::Orbit: orbitBy(dx, dy); break;
- case Drag::Roll: rollBy(x, y, dx, dy); break;
+ case Drag::Roll:
+ if (rollSideways_) camera_.setOrientation(camera_.orientation() * glm::angleAxis(dx * 0.008f, glm::vec3(0, 0, 1)));
+ else rollBy(x, y, dx, dy);
+ break;
case Drag::Pan: camera_.pan(dx, dy, canvasHeight()); break;
case Drag::Zoom: camera_.zoom(zoomDragAmount(dx, dy)); break;
case Drag::MaskCanvas: maskCanvasMove(x, y); break;
@@ -1769,6 +1785,48 @@ float App::zoomDragAmount(float dx, float dy) const {
return a * 0.05f;
}
+void App::trackModOrder() {
+ const SDL_Keymod now = SDL_GetModState();
+ const bool alt = (now & SDL_KMOD_ALT) != 0, ctrl = (now & SDL_KMOD_CTRL) != 0;
+ if (!alt || !ctrl) altBeforeCtrl_ = false;
+ else if (!(modOrderLast_ & SDL_KMOD_CTRL)) altBeforeCtrl_ = (modOrderLast_ & SDL_KMOD_ALT) != 0; // Ctrl just went down
+ modOrderLast_ = now;
+}
+
+// The mouse wheel: toward the view's centre, or (Preferences > Input > Wheel zooms toward the pointer, #134) toward
+// the surface point under the pointer, which stays under it: the camera and its target scale about that point.
+// Beside the model, the point at the target's depth under the pointer.
+void App::wheelZoom(float x, float y, float steps) {
+ const float before = camera_.distance;
+ camera_.zoom(steps);
+ if (!uiPrefs_.wheelZoomToPointer || before <= 0.0f) return;
+ const float f = camera_.distance / before;
+ glm::vec3 origin, dir;
+ canvasRay(x, y, origin, dir);
+ dir = glm::normalize(dir);
+ const bool canPick = !solverBusy() && previewLod_ < 0; // (mid-stroke the solver thread owns the mesh)
+ if (canPick) doc_.syncBvh();
+ RayHit hit;
+ glm::vec3 p;
+ if (canPick && pick(x, y, hit)) {
+ p = hit.position;
+ } else {
+ const glm::vec3 fwd = camera_.forward();
+ const float along = glm::dot(dir, fwd);
+ if (std::abs(along) < 1e-6f) return;
+ p = origin + dir * (glm::dot(camera_.target - origin, fwd) / along);
+ }
+ camera_.target = p + (camera_.target - p) * f;
+}
+
+void App::resetView() {
+ camera_.yaw = camera_.pitch = camera_.roll = 0.0f; // the view a new model opens with: from the front
+ camera_.ortho = false;
+ autoOrtho_ = false;
+ camera_.frame(sceneBounds());
+ status_ = "View reset";
+}
+
void App::orbitBy(float dx, float dy) {
if (autoOrtho_) { // an axis view turned: back to perspective (Blender's Auto Perspective)
camera_.ortho = false;
@@ -1803,6 +1861,7 @@ void App::rollBy(float x, float y, float dx, float dy) {
void App::onMouseUp() {
rollPending_ = false;
+ rollSideways_ = false;
rightClick_.pending = false;
zsMenu_.armed = false;
orbitStarted_ = false;
diff --git a/src/app/App.h b/src/app/App.h
index 01277bcc..8eeac7a2 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -2127,6 +2127,14 @@ private:
glm::vec2 origin{0.0f};
} straight_;
bool rollPending_ = false; // Shift+press on the background: let go of Shift before moving to roll the view
+ bool rollSideways_ = false; // Maya style Alt, then Ctrl+left drag (#134): left / right rolls the view
+ // Maya style (#134): Alt went down before Ctrl (Alt held, then Ctrl added) rolls on Alt+Ctrl+left drag; Ctrl first
+ // (or both at once) keeps the Ctrl+Alt mask gestures. trackModOrder follows the keys, per event and per frame.
+ SDL_Keymod modOrderLast_ = SDL_KMOD_NONE;
+ bool altBeforeCtrl_ = false;
+ void trackModOrder();
+ void wheelZoom(float x, float y, float steps); // Preferences > Input > Wheel zooms toward the pointer
+ void resetView(); // the view.reset action (Maya keys: Alt+H, #134)
float rollStartX_ = 0.0f, rollStartY_ = 0.0f;
glm::vec2 lastDabScreen_{0.0f}; // window pixels of the last dab (UI tests: last_dab_x / last_dab_y)
bool maskClickPending_ = false; // Ctrl+press on the model: a click blurs (Alt: sharpens), a drag paints
diff --git a/src/app/Config.cpp b/src/app/Config.cpp
index 908f63f4..13c1efd5 100644
--- a/src/app/Config.cpp
+++ b/src/app/Config.cpp
@@ -98,6 +98,7 @@ Json toJson(const UiPrefs& p) {
j.set("spaceCamera", p.spaceCamera);
j.set("emulate3Button", p.emulate3Button);
j.set("mayaZoomHorizontal", p.mayaZoomHorizontal);
+ j.set("wheelZoomToPointer", p.wheelZoomToPointer);
j.set("invertZoom", p.invertZoom);
j.set("quickRemesh", p.quickRemesh);
j.set("remeshAfterStroke", p.remeshAfterStroke);
@@ -169,6 +170,7 @@ void fromJson(const Json& j, UiPrefs& p) {
p.spaceCamera = j["spaceCamera"].asBool(p.spaceCamera);
p.emulate3Button = j["emulate3Button"].asBool(p.emulate3Button);
p.mayaZoomHorizontal = j["mayaZoomHorizontal"].asBool(p.mayaZoomHorizontal);
+ p.wheelZoomToPointer = j["wheelZoomToPointer"].asBool(p.inputStyle == 3); // (inputStyle is read above)
p.invertZoom = j["invertZoom"].asBool(p.invertZoom);
p.quickRemesh = j["quickRemesh"].asBool(p.quickRemesh);
p.remeshAfterStroke = j["remeshAfterStroke"].asBool(p.remeshAfterStroke);
diff --git a/src/app/Config.h b/src/app/Config.h
index 56cbb335..e0557abf 100644
--- a/src/app/Config.h
+++ b/src/app/Config.h
@@ -52,6 +52,9 @@ struct UiPrefs {
// vertical as the other styles. invertZoom turns every zoom drag around.
bool mayaZoomHorizontal = true;
bool invertZoom = false;
+ // The mouse wheel zooms toward the surface point under the pointer (#134) instead of the view's centre. On for
+ // the Maya style (set with the style, and the default when ui.json doesn't say); the other styles keep the centre.
+ bool wheelZoomToPointer = false;
// Tool > Remesh (#121): Quick Remesh (Shift+R, or hold N and drag on the background, remeshes the active Part at
// the Voxel Resolution) and Remesh after each stroke (a stroke that stretched the surface remeshes it).
bool quickRemesh = false, remeshAfterStroke = false;
diff --git a/src/app/I18nSpanish.cpp b/src/app/I18nSpanish.cpp
index 08ff8c4c..23aa2179 100644
--- a/src/app/I18nSpanish.cpp
+++ b/src/app/I18nSpanish.cpp
@@ -309,6 +309,8 @@ constexpr Entry kSpanish[] = {
{"Colour of the Studio material (the clay colour).", "Color del material Studio (el color de la arcilla)."},
{"Frame model", "Encuadrar modelo"},
{"Frame Part", "Encuadrar pieza"},
+ {"Reset view", "Restablecer vista"},
+ {"Wheel zooms toward the pointer", "La rueda acerca hacia el puntero"},
{"Fullscreen", "Pantalla completa"},
{"Gradient", "Degradado"},
{"Flat Colour", "Color plano"},
diff --git a/src/app/Input.cpp b/src/app/Input.cpp
index f10e2e31..60b589bf 100644
--- a/src/app/Input.cpp
+++ b/src/app/Input.cpp
@@ -189,7 +189,8 @@ void App::registerInputActions() {
[this] { setInputStyle(2); }, [this] { return uiPrefs_.inputStyle == 2; });
add("input.style_maya", "Maya", nullptr, "Preferences > Input", "",
"Maya's view controls: Alt+left-drag orbits, Alt+middle-drag pans, Alt+right-drag zooms, anywhere on the "
- "canvas. Ctrl inverts a stroke, Ctrl+Alt masks (Ctrl+Alt+drag on the background clears the mask), Shift "
+ "canvas; hold Alt, then add Ctrl, and a left drag rolls the view. Alt+F frames the Part, Alt+H resets the "
+ "view, the wheel zooms toward the pointer. Ctrl inverts a stroke, Ctrl+Alt masks (Ctrl+Alt+drag on the background clears the mask), Shift "
"smooths, Ctrl+Shift hides and shows. The Classic sculpting keys stay for everything else.",
[this] { setInputStyle(3); }, [this] { return uiPrefs_.inputStyle == 3; });
add("input.emulate_numpad", "Emulate Numpad", nullptr, "Preferences > Input", "",
@@ -332,12 +333,15 @@ void App::registerViewActions() {
});
add("view.zoom_in", "Zoom in", "Numpad Plus", "Move the view closer.", [this] { camera_.zoom(1.0f); });
add("view.zoom_out", "Zoom out", "Numpad Minus", "Move the view back.", [this] { camera_.zoom(-1.0f); });
- add("view.frame_selected", "Frame Part", "Numpad .", "Fit the active Part in the view (Blender: View Selected).",
- [this] { frameActivePart(); });
+ add("view.frame_selected", "Frame Part", "Numpad .", "Fit the active Part in the view (Blender: View Selected; "
+ "Maya keys: Alt+F).", [this] { frameActivePart(); });
+ add("view.reset", "Reset view", "", "Back to the view a new model opens with: from the front, in perspective, "
+ "the whole model in view (Maya keys: Alt+H).", [this] { resetView(); });
}
void App::setInputStyle(int style) {
uiPrefs_.inputStyle = std::clamp(style, 0, 3);
+ uiPrefs_.wheelZoomToPointer = mayaStyle(); // Maya's wheel zooms toward the pointer; the others to the centre (#134)
if (blenderStyle()) uiPrefs_.turntable = true; // Blender orbits as a turntable; Preferences > Input changes it
maskBrush_.on = false;
applyInputStyle();
@@ -376,6 +380,9 @@ void App::applyInputStyle() {
{"visibility.show_all", {"", "", "Alt+H"}},
};
for (const Keys& k : kKeys) actions_.setDefaultShortcut(k.id, k.keys[style]);
+ // Maya's own view keys on top of the Classic sculpting keys (#134): Alt+F frames the Part, Alt+H resets the view.
+ actions_.setDefaultShortcut("view.frame_selected", mayaStyle() ? "Alt+F / Numpad ." : "Numpad .");
+ actions_.setDefaultShortcut("view.reset", mayaStyle() ? "Alt+H" : "");
// Brushes: 1-9 and 0 in the SculptForge style; Blender's sculpt-mode letters in the Blender style.
static const std::pair<BrushType, const char*> kBlenderBrushes[] = {
{BrushType::Standard, "V"}, {BrushType::Smooth, "S"}, {BrushType::Pinch, "P"},
@@ -545,6 +552,11 @@ void App::drawInputSection() {
}
ui::Checkbox("Invert zoom##input.invert_zoom", &uiPrefs_.invertZoom);
ui::HelpText("Invert zoom", nullptr, "Turn zoom drags around (the mouse wheel stays as it is).", "Preferences > Input");
+ ui::Checkbox("Wheel zooms toward the pointer##input.wheel_to_pointer", &uiPrefs_.wheelZoomToPointer);
+ ui::HelpText("Wheel zooms toward the pointer", nullptr,
+ "The mouse wheel zooms toward the point of the model under the pointer, which stays under it, instead "
+ "of the middle of the view. On with Maya keys (choosing a style sets it), off with the others.",
+ "Preferences > Input");
{
ImGui::TextDisabled("%s", tr("Along the normal"));
ImGui::SameLine();
diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cpp
index ddd19380..3b368062 100644
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@ -235,6 +235,7 @@
// (another screen); values: focus_frames (1 while focus keeps it drawing), wants_frames (1
// while anything keeps the idle loop drawing: input, a job, an animation),
// pen_mouse_down, ui_left_down (the panels hold the left button), soft_cursor
+// wheel U V STEPS the mouse wheel over the model point U V, STEPS notches (positive zooms in)
// mouse_move U V a plain mouse (not the pen) moves to a point on the model, e.g. the stray mouse
// events Windows Ink sends beside the pen's
//
@@ -504,6 +505,7 @@ double Demo::query(const std::string& name, bool& known) const {
if (name == "smooth_remesh") return std::round(app_.doc_.sculptor.dyntopo.smoothRemesh * 100.0f);
if (name == "invert_zoom") return app_.uiPrefs_.invertZoom ? 1.0 : 0.0;
if (name == "maya_zoom_horizontal") return app_.uiPrefs_.mayaZoomHorizontal ? 1.0 : 0.0;
+ if (name == "wheel_to_pointer") return app_.uiPrefs_.wheelZoomToPointer ? 1.0 : 0.0;
if (name == "along_normal") return double(app_.uiPrefs_.alongNormal);
if (name == "stroke_along_normal") return app_.strokeAlongNormal_ ? 1.0 : 0.0;
if (name.rfind("forgesphere_x", 0) == 0 || name.rfind("forgesphere_r", 0) == 0) { // forgesphere_x2, forgesphere_r2: sphere 2's x / radius
@@ -2251,6 +2253,25 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& e
app_.handleEvent(e);
});
wait(0.05f);
+ } else if (verb == "wheel") { // wheel U V STEPS: the mouse wheel over the model point U V (+ zooms in)
+ if (!need(3)) return false;
+ auto at = std::make_shared<ImVec2>();
+ run([this, at, u = num(1, 0.5f), v = num(2, 0.5f)] {
+ *at = onModel(u, v);
+ mouseMotion(at->x, at->y);
+ });
+ wait(0.05f); // (the panels let go of the mouse first: ImGui's WantCaptureMouse is a frame behind)
+ run([this, at, steps = num(3, 1.0f)] {
+ const ImVec2 p = *at;
+ SDL_Event e{};
+ e.type = SDL_EVENT_MOUSE_WHEEL;
+ e.wheel.windowID = SDL_GetWindowID(app_.window_);
+ e.wheel.y = steps;
+ e.wheel.mouse_x = p.x;
+ e.wheel.mouse_y = p.y;
+ app_.handleEvent(e);
+ });
+ wait(0.05f);
} else if (verb == "mouse_move") {
if (!need(2)) return false;
run([this, u = num(1, 0.5f), v = num(2, 0.5f)] {
diff --git a/tests/ui/maya_navigation.sfui b/tests/ui/maya_navigation.sfui
new file mode 100644
index 00000000..6bc3244a
--- /dev/null
+++ b/tests/ui/maya_navigation.sfui
@@ -0,0 +1,99 @@
+# The Maya style's view keys (#134): Alt, then Ctrl+left drag rolls; Alt+F frames the Part, Alt+H resets the view;
+# the wheel zooms toward the pointer (on with Maya keys, off with the others). The Ctrl+Alt mask gestures stay:
+# Ctrl first (or both at once) masks on the model and clears the mask beside it.
+run ui_look look=classic layout=classic
+run new_sphere subdivisions=4
+input_style maya
+expect_value input_style == 3
+expect_value shortcut_conflicts == 0
+expect_value wheel_to_pointer == 1
+mouse_move 0.5 0.5
+key f
+
+# (A wait between the holds: the app sees Alt alone for a frame, as from a person's hands.)
+# Alt held, then Ctrl added: a sideways left drag rolls the view, on the model too, and doesn't mask or sculpt.
+snapshot
+remember camera_roll r0
+hold alt
+wait 0.05
+hold alt+ctrl
+stroke 0.3 0.5 0.7 0.5
+hold none
+expect_value camera_roll != $r0
+expect_value masked == 0
+expect_value moved == 0
+# ... and the other way.
+remember camera_roll r1
+hold alt
+wait 0.05
+hold alt+ctrl
+stroke 0.7 0.5 0.3 0.5
+hold none
+expect_value camera_roll != $r1
+
+# Alt+H: back to the front view, upright, the whole model in view.
+key alt+h
+expect_value camera_roll == 0
+expect_value camera_yaw == 0
+expect_value camera_pitch == 0
+expect_value camera_pan == 0
+
+# Ctrl first, then Alt: still masks on the model.
+hold ctrl
+wait 0.05
+hold ctrl+alt
+stroke 0.3 0.5 0.7 0.5
+hold none
+expect_value masked > 0
+expect_value camera_roll == 0
+# Both at once: masks too.
+key ctrl+z
+expect_value masked == 0
+hold ctrl+alt
+stroke 0.3 0.5 0.7 0.5
+hold none
+expect_value masked > 0
+# Ctrl, then Alt, drag beside the model: clears the mask (as before).
+hold ctrl
+wait 0.05
+hold ctrl+alt
+drag_path -0.4 0.5 -0.2 0.6
+hold none
+expect_value masked == 0
+expect_value camera_roll == 0
+
+# The wheel over the side of the model zooms in toward it: the view's centre moves that way.
+key alt+h
+remember camera_distance d0
+wheel 0.8 0.5 3
+expect_value camera_distance < $d0
+expect_value camera_pan > 0.01
+# Off (Preferences > Input), the wheel zooms toward the middle as before.
+key alt+h
+click "Preferences##palette.preferences"
+click "Input##preferences.input"
+shot wheel_pref
+click "Wheel zooms toward the pointer##input.wheel_to_pointer"
+expect_value wheel_to_pointer == 0
+click "Preferences##palette.preferences"
+remember camera_distance d1
+wheel 0.8 0.5 3
+expect_value camera_distance < $d1
+expect_value camera_pan == 0
+
+# Alt+F frames the active Part: a small one comes closer than the whole model.
+key alt+h
+run part_append type=sphere size=0.3
+remember camera_distance d2
+key alt+f
+expect_value camera_distance < $d2
+
+# The other styles keep the wheel toward the middle, and Alt+F / Alt+H aren't Maya's there.
+input_style sculptforge
+expect_value wheel_to_pointer == 0
+expect_shortcut view.frame_selected Numpad .
+input_style blender
+expect_value wheel_to_pointer == 0
+expect_shortcut visibility.show_all Alt+H
+input_style classic
+expect_value wheel_to_pointer == 0