Free, open-source 3D sculpting for Linux, macOS and Windows: dense meshes, remeshing, painting, built-in AI (image/text to 3D), Send to Unreal, game-ready LODs, Gaussian splats and OpenUSD.
C++ 3d3d-sculptingcppdear-imguidigital-sculptingfbxgame-developmentgaussian-splattinggltfimage-to-3dmcpopenglopenusdsculptingtext-to-3dunreal-engine
Sculpt the Part under the cursor: Alt+Q in every input style (Discord user Ziel)
islandmed5187fdd03f71
diff --git a/changes/feat-part-under-cursor.md b/changes/feat-part-under-cursor.mdnew file mode 100644index 00000000..a60e7982--- /dev/null+++ b/changes/feat-part-under-cursor.md@@ -0,0 +1,14 @@+---+whats_new: **Sculpt the Part under the cursor**: point at another Part and press <kbd>Alt</kbd>+<kbd>Q</kbd> (as in+ Blender, in every input style): it becomes the Part you sculpt, and the view stays where it is.+added: **Sculpt the Part under the cursor** (Alt+Q in every input style, the same key as Blender's; Preferences > Hotkeys+ changes it; in the command palette): the visible Part under the pointer becomes the active one, without moving the+ camera; each Part keeps its mask. The status bar says "Sculpting: <Part>", or that no Part is under the cursor.+ Asked for by Discord user Ziel.+testers:+ - Any OS, Blender input style: append a second Part, point at it, press Alt+Q; the status bar says "Sculpting:" and+ its name, the Parts list highlights it, the view doesn't move. Alt+Q over the background: "No Part under the cursor".+ - Windows and macOS (Option+Q), Classic and Maya styles: the same key works and Q alone still picks Draw.+---+Free in every style's keymap (classic, SculptForge, Blender, Maya; shortcut_conflicts == 0 in the UI test). Before,+Alt+Q fell back to Q (Draw) in all styles; Blender itself uses Alt+Q for this (transfer mode).diff --git a/docs/guide/parts.md b/docs/guide/parts.mdindex 599d1183..c785b254 100644--- a/docs/guide/parts.md+++ b/docs/guide/parts.md@@ -30,6 +30,7 @@ and they catch up a moment after you stop changing a Part (not during a stroke).| To | Do this ||---|---|| Select a Part | Click its row, or <kbd>Alt</kbd>+click it in the viewport; triple-click another Part in the viewport to select it and frame it |+| Sculpt the Part under the cursor | Point at it and press <kbd>Alt</kbd>+<kbd>Q</kbd> (every input style, as in Blender): it becomes the active Part, the view stays put and each Part keeps its mask || Rename it | Double-click the row (or right-click > **Rename**), type, press <kbd>Enter</kbd> || Hide or show it | Click the eye at the end of the row || Duplicate or delete it | Right-click the row > **Duplicate** (<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd>) or **Delete...** |diff --git a/docs/guide/shortcuts.md b/docs/guide/shortcuts.mdindex f451ad69..16b694a2 100644--- a/docs/guide/shortcuts.md+++ b/docs/guide/shortcuts.md@@ -222,6 +222,7 @@ generated from SculptForge's action registry, the same source as the Controls wi| Show everything | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+click the background || Hide outside a rectangle or lasso | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+drag (add <kbd>Alt</kbd>: hide inside); **Select Rectangle** or **Select Lasso** in **Tool > Visibility** || Select a Part | <kbd>Alt</kbd>+click it in the view (<kbd>Shift</kbd>+<kbd>Alt</kbd>+click, or a triple-click on another Part: select and frame it) |+| Sculpt the Part under the cursor | <kbd>Alt</kbd>+<kbd>Q</kbd> (every input style; the view stays put) || Move, scale or rotate with the Gizmo | <kbd>W</kbd>, <kbd>E</kbd> or <kbd>R</kbd>, then drag a handle; hold <kbd>Shift</kbd> to snap (15 degrees, the grid, 10%) || Move the gizmo only | <kbd>Alt</kbd>+drag a gizmo handle || Put the gizmo's pivot on the model | <kbd>Alt</kbd>+click the model in Move, Scale or Rotate mode |diff --git a/src/app/App.h b/src/app/App.hindex ce5edfe2..55f5ed07 100644--- a/src/app/App.h+++ b/src/app/App.h@@ -1481,6 +1481,7 @@ private:float partClickX_ = 0.0f, partClickY_ = 0.0f;Uint64 partClickNs_ = 0; // when the Alt press on another Part began (a long pen press isn't a click)void partSelected(const char* how);+ void sculptPartUnderCursor(); // Alt+Q: the Part under the pointer becomes the active one// A background job's result (Auto UV, Voxel Remesh, QRemesh, Unwrap) goes onto the Part it ran on, and the// active Part stays the one the user is on (Discord: "the active Part switches by itself" when a job finished// after picking another Part). JobPart makes the job's Part active for the result; its destructor goes backdiff --git a/src/app/Config.cpp b/src/app/Config.cppindex f4631743..3f60be76 100644--- a/src/app/Config.cpp+++ b/src/app/Config.cpp@@ -458,6 +458,10 @@ void App::initActions() {ICON_LC_COPY, "part_duplicate", nullptr, nullptr,"Copy the active Part, with its layers and attributes, and make the copy active (also in the Parts list's ""right-click menu).");+ add("part.sculpt_under_cursor", "Sculpt the Part under the cursor", "Tool > Parts", "Alt+Q",+ [this] { sculptPartUnderCursor(); }, ICON_LC_MOUSE_POINTER_CLICK, nullptr, nullptr, nullptr,+ "Make the Part under the pointer the one you sculpt, without moving the view (each Part keeps its mask). "+ "The same key as Blender's; Preferences > Hotkeys changes it.");// Tool > Part > Extract, Tool > Geometry > Modify Topology, Tool > Deformation (PanelExtract.cpp).add("part.extract", "Extract", "Tool > Parts", nullptr, [this] { runExtract(); }, nullptr, "extract", nullptr,[this] { return doc_.mesh.hasMask(); },diff --git a/src/app/I18nSimplifiedChinese.cpp b/src/app/I18nSimplifiedChinese.cppindex 094a3375..3d3b160d 100644--- a/src/app/I18nSimplifiedChinese.cpp+++ b/src/app/I18nSimplifiedChinese.cpp@@ -877,6 +877,10 @@ constexpr Entry kSimplifiedChinese[] = {"将微细分层级转为新部件中的普通网格(用于导出或需要真实几何的工具)。"},{"Write the micro level as a 32-bit EXR displacement map over the base UVs (next to the project).","将微细分层级写成基底 UV 上的 32 位 EXR 位移贴图(放在项目旁)。"},+ {"Sculpt the Part under the cursor", "雕刻光标下的部件"},+ {"Make the Part under the pointer the one you sculpt, without moving the view (each Part keeps its mask). "+ "The same key as Blender's; Preferences > Hotkeys changes it.",+ "将指针下的部件设为当前雕刻的部件,视图不动(每个部件保留各自的遮罩)。与 Blender 的按键相同;可在“偏好设置 > 快捷键”中更改。"},{"Duplicate Part", "复制部件"},{"Copy the active Part, with its layers and attributes, and make the copy active (also in the Parts list's ""right-click menu).",diff --git a/src/app/I18nSpanish.cpp b/src/app/I18nSpanish.cppindex 43f863c4..422ddd08 100644--- a/src/app/I18nSpanish.cpp+++ b/src/app/I18nSpanish.cpp@@ -1032,6 +1032,10 @@ constexpr Entry kSpanish[] = {"necesitan geometría real)."},{"Write the micro level as a 32-bit EXR displacement map over the base UVs (next to the project).","Escribe el nivel micro como mapa de desplazamiento EXR de 32 bits sobre las UV base (junto al proyecto)."},+ {"Sculpt the Part under the cursor", "Esculpir la Pieza bajo el cursor"},+ {"Make the Part under the pointer the one you sculpt, without moving the view (each Part keeps its mask). "+ "The same key as Blender's; Preferences > Hotkeys changes it.",+ "Hace que la Pieza bajo el puntero sea la que esculpes, sin mover la vista (cada Pieza conserva su máscara). La misma tecla que en Blender; se cambia en Preferencias > Atajos de teclado."},{"Duplicate Part", "Duplicar Pieza"},{"Copy the active Part, with its layers and attributes, and make the copy active (also in the Parts list's ""right-click menu).",diff --git a/src/app/I18nTraditionalChinese.cpp b/src/app/I18nTraditionalChinese.cppindex b71f139a..4d4a3727 100644--- a/src/app/I18nTraditionalChinese.cpp+++ b/src/app/I18nTraditionalChinese.cpp@@ -877,6 +877,10 @@ constexpr Entry kTraditionalChinese[] = {"將微細分層級轉為新部件中的一般網格(用於匯出或需要真實幾何的工具)。"},{"Write the micro level as a 32-bit EXR displacement map over the base UVs (next to the project).","將微細分層級寫成基底 UV 上的 32 位元 EXR 位移貼圖(放在專案旁)。"},+ {"Sculpt the Part under the cursor", "雕刻游標下的部件"},+ {"Make the Part under the pointer the one you sculpt, without moving the view (each Part keeps its mask). "+ "The same key as Blender's; Preferences > Hotkeys changes it.",+ "將指標下的部件設為目前雕刻的部件,視圖不動(每個部件保留各自的遮罩)。與 Blender 的按鍵相同;可在「偏好設定 > 快速鍵」中變更。"},{"Duplicate Part", "複製部件"},{"Copy the active Part, with its layers and attributes, and make the copy active (also in the Parts list's ""right-click menu).",diff --git a/src/app/PanelParts.cpp b/src/app/PanelParts.cppindex 8f06dc9e..8a51ecc7 100644--- a/src/app/PanelParts.cpp+++ b/src/app/PanelParts.cpp@@ -147,6 +147,23 @@ void App::partSelected(const char* how) {status_ = "Active Part: " + doc_.activePartInfo().name + " (" + how + ")";}+// The Part-under-cursor key (Alt+Q in every input style, like Blender's Alt+Q; Discord user Ziel): the visible+// Part under the pointer becomes the one sculpted. The camera stays, and each Part keeps its own mask.+void App::sculptPartUnderCursor() {+ if (drag_ != Drag::None) return; // mid-stroke or mid-drag: switching would split it across two Parts+ const bool overCanvas = !ImGui::GetIO().WantCaptureMouse && canvasRect().contains(mouseX_, mouseY_);+ const int target = overCanvas ? pickPart(mouseX_, mouseY_) : -1;+ if (target < 0) {+ status_ = "No Part under the cursor";+ return;+ }+ if (target != doc_.activePart) {+ runCommand("part_select", {{"index", double(target)}});+ if (!lastCommandOk_) return;+ }+ status_ = "Sculpting: " + doc_.activePartInfo().name;+}+App::JobPart::JobPart(App& a, int index) : app(a) {if (index < 0 || index == app.doc_.activePart) return;back = app.doc_.activePartInfo().id;diff --git a/src/app/UiTest.cpp b/src/app/UiTest.cppindex 80a269f7..8a5e3b48 100644--- a/src/app/UiTest.cpp+++ b/src/app/UiTest.cpp@@ -77,7 +77,7 @@// expect_clipboard TEXT the clipboard contains TEXT (after a copy)// click_part NAME [U V [N]] left-click Part NAME in the viewport (with the held modifiers, e.g.// hold alt to select it); U V: fractions of its on-screen bounds; N clicks in a row-// (3 = a triple-click)+// (3 = a triple-click; 0 = only point at it, e.g. for a key that acts under the cursor)// expect_value NAME OP N triangles, vertices, layers, brushes, masked, hidden, groups, colored,// can_undo, dirty, splats, show_face groups, show_mask, show_mesh, wireframe,// flat_shading (the scene's: 1 Flat), gradient_background (1 Gradient, 0 Flat Colour),@@ -1432,7 +1432,7 @@ bool Demo::parseStep(int line, const std::vector<std::string>& w, std::string& eif (!need(1)) return false;const std::string name = w[1];const float u = num(2, 0.5f), v = num(3, 0.5f);- const int times = std::clamp(int(num(4, 1.0f)), 1, 3); // click_part NAME U V 3: a triple-click+ const int times = std::clamp(int(num(4, 1.0f)), 0, 3); // click_part NAME U V 3: a triple-click; 0: hover onlyconst bool pen = w.back() == "pen" || (w.size() > 5 && w[5] == "pen"); // taps with the pen tip insteadconst float hold = pen && w.size() > 6 ? num(6, 0.0f) : 0.0f; // ... held this longsteps_.push_back([this, line, name, u, v, times, pen, hold](float t) {diff --git a/tests/ui/part_under_cursor.sfui b/tests/ui/part_under_cursor.sfuinew file mode 100644index 00000000..2fde26ee--- /dev/null+++ b/tests/ui/part_under_cursor.sfui@@ -0,0 +1,83 @@+# Sculpt the Part under the cursor (Discord user Ziel): Alt+Q, as in Blender, makes the visible Part under the pointer+# the active one, in every input style. The view doesn't move and each Part keeps its mask; with no Part under the+# pointer nothing changes and the status bar says so.+run ui_look look=classic layout=classic # written for the Classic look and the classic palette bar and shelves+run new_sphere subdivisions=4 ; part_rename to=Body+run part_append type=sphere name=Ball+input_style blender+expect_value input_style == 2+expect_value shortcut_conflicts == 0+expect_shortcut part.sculpt_under_cursor Alt+Q+key home+expect_value parts == 2++# The Body is active and masked; the Ball has no mask.+run part_select index=0 ; mask_all+expect_value active_part == 0+remember masked bodymask+expect_value masked > 0+remember camera_yaw yaw0+remember camera_pitch pitch0+remember camera_distance dist0++# Alt+Q over the second Part: it is the one sculpted now; the view stays.+click_part Ball 0.5 0.5 0+key alt+q+expect_value active_part == 1+expect_status Sculpting: Ball+expect_value masked == 0+expect_value camera_yaw == $yaw0+expect_value camera_pitch == $pitch0+expect_value camera_distance == $dist0+shot blender-alt-q-ball++# Back to the Body: its mask is as it was.+click_part Body 0.5 0.5 0+key alt+q+expect_value active_part == 0+expect_status Sculpting: Body+expect_value masked == $bodymask+expect_value camera_distance == $dist0+shot blender-alt-q-body++# Again over the active Part: it stays, and says so.+key alt+q+expect_value active_part == 0+expect_status Sculpting: Body++# Nothing under the pointer (the background or a panel): no switch.+hover_window 0.5 0.06+key alt+q+expect_value active_part == 0+expect_status No Part under the cursor+shot blender-alt-q-nothing++# The command palette finds it, with its key.+key f3+type "##Command palette" "part under the cursor"+expect_text "Sculpt the Part under the cursor"+shot command-palette+key esc++# The other input styles: the same free key (no conflicts); Alt+Q no longer falls back to Q (Draw).+input_style classic+expect_value shortcut_conflicts == 0+expect_shortcut part.sculpt_under_cursor Alt+Q+expect_shortcut tool.draw Q+click_part Ball 0.5 0.5 0+key alt+q+expect_value active_part == 1+expect_status Sculpting: Ball+input_style sculptforge+expect_value shortcut_conflicts == 0+expect_shortcut part.sculpt_under_cursor Alt+Q+click_part Body 0.5 0.5 0+key alt+q+expect_value active_part == 0+input_style maya+expect_value shortcut_conflicts == 0+expect_shortcut part.sculpt_under_cursor Alt+Q+click_part Ball 0.5 0.5 0+key alt+q+expect_value active_part == 1+expect_status Sculpting: Ball