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.

Parts tools: credit foirgairwolf on Discord (not a GitHub account); 1440 / 1024 px runs of the Split and Check Mesh UI tests; a narrow window opens right-tray palettes as drop-downs; Check scrolls to its rows; quick clicks on the shade mark don't rename

islandmed88b78f2153a8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e18b1a28..68c02302 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -936,6 +936,10 @@ if(SCULPTFORGE_BUILD_TESTS)
sculptforge_ui_test(help_console_1080 help_console --size 1920x1080)
# The S / U / I / O slider on a UI scaled 1.5x (Windows at 150%, #9): it must still open under the cursor.
sculptforge_ui_test(size_popup_scaled size_popup --size 2400x1350)
+ # The Parts / Geometry tools (foirgairwolf on Discord) at a laptop's and a small window's width: rows fit.
+ sculptforge_ui_test(parts_split_selection_1440 parts_split_selection --size 1440x900)
+ sculptforge_ui_test(mesh_check_1440 mesh_check --size 1440x900)
+ sculptforge_ui_test(parts_tools_1024 sizes/parts_tools_1024 --size 1024x768) # (palettes are drop-downs there)
# The stroke popup on a UI scaled 1.5x: it opens under the cursor and its items are where they're drawn.
sculptforge_ui_test(stroke_popup_scaled stroke_popup --size 2400x1350)
# Library single click (#142) on a UI scaled 1.5x: tiles still take one click.
diff --git a/changes/feat-parts-tools.md b/changes/feat-parts-tools.md
index 827c6e27..547097c6 100644
--- a/changes/feat-parts-tools.md
+++ b/changes/feat-parts-tools.md
@@ -1,6 +1,6 @@
---
whats_new: **Split > Hidden / Masked / Unmasked** (**Tool > Parts**): move the hidden, masked or unmasked triangles
- of a Part into a new Part just below it, in one undo step. Asked for by @foirgairwolf.
+ of a Part into a new Part just below it, in one undo step. Asked for by foirgairwolf on Discord.
whats_new: **Delete masked** (**Tool > Visibility**) deletes what is masked, as **Delete hidden** does for what is
hidden. Undoable.
whats_new: **Smooth or flat per Part, right in the list**: click the mark left of a Part's eye to go from the scene's
@@ -10,20 +10,22 @@ added: **Split > Hidden / Masked / Unmasked** (Tool > Parts; `part_split_hidden`
`part_split_unmasked`): the triangles leave the active Part for a new Part below it (same folder, visibility and
shading), one undo step that also removes the new Part. A triangle is masked when its corners' average mask is
above 50%. UVs, face groups, vertex paint and sculpt layers carry over; subdivision levels are cut at the current
- level (undo restores them). Thanks @foirgairwolf.
-added: **Delete masked** (Tool > Visibility; `delete_masked`), the mirror of Delete hidden. Thanks @foirgairwolf.
-added: A per-Part shading mark in the Parts list (Scene / Smooth / Flat; `part_shading`). Thanks @foirgairwolf.
+ level (undo restores them). Thanks foirgairwolf on Discord.
+added: **Delete masked** (Tool > Visibility; `delete_masked`), the mirror of Delete hidden. Thanks foirgairwolf on
+ Discord.
+added: A per-Part shading mark in the Parts list (Scene / Smooth / Flat; `part_shading`). Thanks foirgairwolf on
+ Discord.
whats_new: **Merge by Distance** (**Tool > Geometry**): merge points closer than a distance, with a live count and the
- points shown on the model before you click. For unwelded imports. Asked for by @foirgairwolf.
+ points shown on the model before you click. For unwelded imports. Asked for by foirgairwolf on Discord.
whats_new: **Check Mesh** (**Tool > Geometry**): counts non-manifold edges, holes, duplicate, degenerate, zero-area and
flipped triangles and isolated points, with a **Fix** per row and **Fix all**. Checking never changes the mesh.
added: **Merge by Distance** (Tool > Geometry; `weld_points distance=... preview=true`): the points of the active Part
within the distance merge into the nearest kept one; collapsed triangles go; one undo step. The count follows the
- slider and the points that would merge show in orange. Thanks @foirgairwolf.
+ slider and the points that would merge show in orange. Thanks foirgairwolf on Discord.
added: **Check Mesh** (Tool > Geometry; `mesh_check`, `mesh_fix issue=...`): non-manifold edges (Fix loosens the extra
triangles), holes (capped as Close Holes), duplicate and degenerate triangles (deleted), zero-area triangles
(shortest edge collapsed), flipped triangles and inside-out closed pieces (rewound), isolated points (removed).
- Fix all fixes everything except holes, as one undo step. Thanks @foirgairwolf.
+ Fix all fixes everything except holes, as one undo step. Thanks foirgairwolf on Discord.
testers:
- Any OS: mask half a sphere, Tool > Parts > Split > Masked: a new "<name> masked" Part below, unmasked; Ctrl+Z
once puts the half back and removes the Part.
@@ -36,4 +38,4 @@ testers:
Fix all, then Ctrl+Z once brings every problem back.
- Windows at 150% scaling: the Check Mesh rows' counts and Fix buttons line up at the right edge.
---
-The Discord #ideas request (1568553579323588630) by @foirgairwolf: Geometry / Parts panel additions.
+The Discord #ideas request (1568553579323588630) by foirgairwolf: Geometry / Parts panel additions.
diff --git a/src/app/App.h b/src/app/App.h
index e26ed534..1b59cda3 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -1802,6 +1802,7 @@ private:
std::vector<glm::vec3> weldPoints_; // a sample (<= 20000) of the points that would merge, for the preview
MeshReport meshReport_;
uint64_t meshReportKey_ = 0; // 0 = not checked yet
+ int meshReportScroll_ = 0; // frames left to scroll the tray down to a new report's rows (below the fold)
void runMeshCheck();
void runExtract(); // Extract with the palette's settings (a preview; Accept keeps it)
static std::string axesText(const bool axes[3]); // "x", "xz", "" (the axis argument of mirror commands)
diff --git a/src/app/PanelMeshCheck.cpp b/src/app/PanelMeshCheck.cpp
index 6c6015a6..79f41ece 100644
--- a/src/app/PanelMeshCheck.cpp
+++ b/src/app/PanelMeshCheck.cpp
@@ -1,7 +1,7 @@
// SculptForge - open source digital sculpting
// SPDX-License-Identifier: GPL-3.0-or-later
//
-// Tool > Geometry > Merge by Distance and Check Mesh (@foirgairwolf). The work is done by the weld_points,
+// Tool > Geometry > Merge by Distance and Check Mesh (foirgairwolf on Discord). The work is done by the weld_points,
// mesh_check and mesh_fix commands (core/MeshCheck.h); this is their panel and the weld's preview on the model.
#include "app/App.h"
#include "app/Demo.h"
@@ -33,6 +33,7 @@ uint64_t App::meshCheckKey() const {
void App::runMeshCheck() {
meshReport_ = checkMesh(doc_.mesh);
meshReportKey_ = meshCheckKey() | 1; // (never 0: checked)
+ meshReportScroll_ = 2; // (two frames: the first one's scroll is clamped to the size before the rows)
}
void App::drawMeshCheckContents() {
@@ -142,6 +143,10 @@ void App::drawMeshCheckContents() {
ImGui::PopID();
}
}
+ if (meshReportScroll_ > 0) { // the report's last line just above the tray's bottom edge
+ --meshReportScroll_;
+ if (ImGui::GetCursorScreenPos().y > ImGui::GetWindowPos().y + ImGui::GetWindowHeight()) ImGui::SetScrollHereY(1.0f);
+ }
Demo::popScope();
}
diff --git a/src/app/PanelParts.cpp b/src/app/PanelParts.cpp
index ffd650c2..0b15d8f6 100644
--- a/src/app/PanelParts.cpp
+++ b/src/app/PanelParts.cpp
@@ -364,12 +364,12 @@ void App::drawPartsContents() {
} else {
if (!s.visible) ImGui::PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]);
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.0f, 0.5f));
- if (ImGui::Selectable(s.name.c_str(), isActive,
- ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap |
- ImGuiSelectableFlags_AllowDoubleClick | ImGuiSelectableFlags_NoAutoClosePopups,
- ImVec2(0.0f, innerH)) &&
- !isActive)
- selectIndex = i;
+ // (Pressed itself, not through the shade mark or eye over it: two quick clicks on those aren't a
+ // double-click on the row, so they don't start a rename.)
+ const ImGuiSelectableFlags rowFlags = ImGuiSelectableFlags_SpanAllColumns | ImGuiSelectableFlags_AllowOverlap |
+ ImGuiSelectableFlags_AllowDoubleClick | ImGuiSelectableFlags_NoAutoClosePopups;
+ const bool rowPressed = ImGui::Selectable(s.name.c_str(), isActive, rowFlags, ImVec2(0.0f, innerH));
+ if (rowPressed && !isActive) selectIndex = i;
ImGui::PopStyleVar();
if (!s.visible) ImGui::PopStyleColor();
if (ImGui::BeginDragDropSource()) { // #96: drag a Part onto a folder (or onto a Part outside folders)
@@ -387,7 +387,7 @@ void App::drawPartsContents() {
ImGui::GetWindowDrawList()->AddRectFilled(ImVec2(x, r0.y), ImVec2(x + 2.0f * scale, r1.y),
theme::u32(theme::accent));
}
- if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
+ if (rowPressed && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) {
renamingPart_ = s.id;
focusRename_ = true;
std::snprintf(renameBuffer_, sizeof renameBuffer_, "%s", s.name.c_str());
diff --git a/src/app/Shell.cpp b/src/app/Shell.cpp
index 25724dc1..c0bb351c 100644
--- a/src/app/Shell.cpp
+++ b/src/app/Shell.cpp
@@ -1214,9 +1214,11 @@ void App::drawPaletteBar(const ShellGeometry& g) {
for (size_t k = 0; k < order.size(); ++k) {
const int i = int(k);
const PaletteDef& p = list[order[k]];
- const bool inTray = std::count(layout_.leftTray.begin(), layout_.leftTray.end(), p.id) +
- std::count(layout_.rightTray.begin(), layout_.rightTray.end(), p.id) >
- 0;
+ // In a tray that shows: a narrow window draws no right tray, so its palettes open as drop-downs from here
+ // (else a click only flashed a tray that isn't there, and Tool could not be opened at 1024 px).
+ const bool inTray =
+ (layout_.leftTrayOpen && std::count(layout_.leftTray.begin(), layout_.leftTray.end(), p.id) > 0) ||
+ (layout_.rightTrayOpen && !shell_.narrow && std::count(layout_.rightTray.begin(), layout_.rightTray.end(), p.id) > 0);
const bool open = dropdown_ == p.id;
ImGui::PushStyleColor(ImGuiCol_Button, open ? theme::header : ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, theme::headerHover);
diff --git a/src/core/MeshCheck.h b/src/core/MeshCheck.h
index b47af28d..febb94fc 100644
--- a/src/core/MeshCheck.h
+++ b/src/core/MeshCheck.h
@@ -1,7 +1,7 @@
// SculptForge - open source digital sculpting
// SPDX-License-Identifier: GPL-3.0-or-later
//
-// Merge by distance and Check Mesh (Tool > Geometry, @foirgairwolf). Weld merges the points closer than a
+// Merge by distance and Check Mesh (Tool > Geometry, foirgairwolf on Discord). Weld merges the points closer than a
// distance; Check Mesh counts what makes a mesh hard to sculpt, remesh, print or export, and each Fix changes
// only what its issue names (nothing is fixed while checking). Everything here works on a copy: the commands
// (weld_points, mesh_check, mesh_fix) replace the active Part's mesh as one undo step.
diff --git a/tests/test_mesh_check.cpp b/tests/test_mesh_check.cpp
index 26bec545..7ea51949 100644
--- a/tests/test_mesh_check.cpp
+++ b/tests/test_mesh_check.cpp
@@ -1,7 +1,7 @@
// SculptForge - open source digital sculpting
// SPDX-License-Identifier: GPL-3.0-or-later
//
-// Merge by distance and Check Mesh / Fix (core/MeshCheck.h; @foirgairwolf).
+// Merge by distance and Check Mesh / Fix (core/MeshCheck.h; foirgairwolf on Discord).
#include "TestHarness.h"
#include "core/Commands.h"
diff --git a/tests/test_parts.cpp b/tests/test_parts.cpp
index 11be9236..a5778395 100644
--- a/tests/test_parts.cpp
+++ b/tests/test_parts.cpp
@@ -245,7 +245,8 @@ TEST(part_folders) {
}
TEST(part_split_by_selection) {
- // Split Hidden / Masked / Unmasked (@foirgairwolf): the triangles leave for a new Part below, one undo step.
+ // Split Hidden / Masked / Unmasked (foirgairwolf on Discord): the triangles leave for a new Part below, one undo
+ // step.
Document doc;
CommandRegistry reg;
CHECK(reg.execute(doc, "new_sphere", {{"subdivisions", 3.0}}).ok);
diff --git a/tests/ui/mesh_check.sfui b/tests/ui/mesh_check.sfui
index 9aeb604b..a87df9bf 100644
--- a/tests/ui/mesh_check.sfui
+++ b/tests/ui/mesh_check.sfui
@@ -1,4 +1,4 @@
-# Merge by Distance and Check Mesh in Tool > Geometry (@foirgairwolf), on a cube whose faces don't share their
+# Merge by Distance and Check Mesh in Tool > Geometry (foirgairwolf on Discord), on a cube whose faces don't share their
# points (each face nudged 1e-5 apart, so the importer keeps them), with one flipped and one repeated triangle.
run open path=$SCRIPT_DIR/../data/check_mesh_cube.obj
expect_value vertices == 24
diff --git a/tests/ui/parts_split_selection.sfui b/tests/ui/parts_split_selection.sfui
index 20ae3932..22ad1168 100644
--- a/tests/ui/parts_split_selection.sfui
+++ b/tests/ui/parts_split_selection.sfui
@@ -1,4 +1,5 @@
-# Split hidden / masked / unmasked and Delete masked (@foirgairwolf), and the per-Part shading mark in the list.
+# Split hidden / masked / unmasked and Delete masked (foirgairwolf on Discord), and the per-Part shading mark in
+# the list.
run new_sphere subdivisions=4 ; part_rename to=Body
remember triangles all
# Nothing masked yet: the command refuses.
@@ -50,6 +51,7 @@ expect_value part_shading == 0
# Delete masked in Tool > Visibility, undoable.
run mask_rect x0=0 y0=-1 x1=1 y1=1
click "Visibility"
+shot delete-masked-button
click "Delete masked"
expect_value triangles < $all
key ctrl+z
diff --git a/tests/ui/sizes/parts_tools_1024.sfui b/tests/ui/sizes/parts_tools_1024.sfui
new file mode 100644
index 00000000..2840f981
--- /dev/null
+++ b/tests/ui/sizes/parts_tools_1024.sfui
@@ -0,0 +1,40 @@
+# The Parts / Geometry tools (foirgairwolf on Discord) on a 1024x768 window (CMake: ui_parts_tools_1024), where the
+# window is narrow: no right tray, so Tool opens as a drop-down from the palette bar (the classic layout).
+run ui_look look=classic layout=classic
+expect_value shell_narrow == 1
+expect_value right_tray_shown == 0
+
+# Tool > Parts: the Split row and the shading mark.
+run new_sphere subdivisions=4 ; part_rename to=Body
+run mask_rect x0=0 y0=-1 x1=1 y1=1
+click "Tool##palette.tool"
+# (Parts is open by default: a click would close it)
+click "Parts/Masked##part_split"
+expect_value parts == 2
+click "Parts/##shade Body"
+click "Parts/##shade Body"
+expect_value part_shading == 2
+shot parts-split-shading
+key ctrl+z
+
+# Tool > Visibility: Delete masked beside Delete hidden.
+click "Visibility"
+shot delete-masked-button
+click "Delete masked"
+expect_status Deleted
+key ctrl+z
+
+# Tool > Geometry: Merge by Distance with its live count, then Check Mesh's rows and Fix buttons.
+run open path=$SCRIPT_DIR/../../data/check_mesh_cube.obj
+expect_value vertices == 24
+click "Geometry##tool.geometry"
+expect_text 16 points will merge
+shot weld-preview
+click "Merge##weld_points"
+expect_value vertices == 8
+click "Check##mesh_check"
+expect_text Flipped triangles
+shot check-rows
+click "Fix all##mesh_fix"
+expect_text No problems found
+shot fixed