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.

Deform panel look shots at 1440x900 and 1024x768 (tests/ui/sizes/); below 1280 px a right-tray palette opens as a drop-down from the bar again (it only flashed the tray that isn't drawn there)

islandmed8f209fdfd222
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ca5fc522..0a6fb9cf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -958,6 +958,9 @@ if(SCULPTFORGE_BUILD_TESTS)
sculptforge_ui_test(part_folders_hidpi hidpi/part_folders --size 3200x1800)
set_tests_properties(ui_right_tray_looks_720 ui_windows_dpi_2560 ui_windows_dpi_2160 PROPERTIES LABELS "ui;dpi" TIMEOUT 300)
sculptforge_ui_test(user_guide_1080 user_guide --size 1920x1080)
+ # The Deform panel for the look review (tests/ui/sizes/: scripts only run at their own sizes).
+ sculptforge_ui_test(deform_panel_1440 sizes/deform_panel --size 1440x900)
+ sculptforge_ui_test(deform_panel_1024 sizes/deform_panel_1024 --size 1024x768)
# A crash leaves a note in the log file (#16). Needs no window.
add_test(NAME crash_log COMMAND ${CMAKE_COMMAND} -DAPP=$<TARGET_FILE:sculptforge>
-DDIR=${CMAKE_CURRENT_BINARY_DIR}/crash-log-test -P ${CMAKE_CURRENT_SOURCE_DIR}/tests/crash_log.cmake)
diff --git a/src/app/App.h b/src/app/App.h
index e9557eaa..8829df17 100644
--- a/src/app/App.h
+++ b/src/app/App.h
@@ -1713,6 +1713,8 @@ private:
void drawPaletteBody(const std::string& id);
void movePaletteToTray(const std::string& id, bool right);
void removePaletteFromTrays(const std::string& id);
+ // In a tray that is drawn: below 1280 px the right tray isn't, and its palettes open as drop-downs instead.
+ bool paletteInShownTray(const std::string& id) const;
void finishShelfDrag();
void noteLayoutChanged();
void applyPreset(int preset);
diff --git a/src/app/Shell.cpp b/src/app/Shell.cpp
index 25724dc1..bf47b724 100644
--- a/src/app/Shell.cpp
+++ b/src/app/Shell.cpp
@@ -777,8 +777,7 @@ void App::registerShellActions() {
id == "preferences" ? "Ctrl+," : "", // (Cmd+, on macOS, where apps keep their settings, #111)
"",
[this, id] {
- if (std::count(layout_.leftTray.begin(), layout_.leftTray.end(), id) +
- std::count(layout_.rightTray.begin(), layout_.rightTray.end(), id)) {
+ if (paletteInShownTray(id)) {
flashPalette_ = id;
flashStart_ = ImGui::GetTime();
return;
@@ -904,6 +903,11 @@ void App::applyPreset(int preset) {
lastCommandOk_ = true;
}
+bool App::paletteInShownTray(const std::string& id) const {
+ return std::count(layout_.leftTray.begin(), layout_.leftTray.end(), id) ||
+ (!shell_.narrow && std::count(layout_.rightTray.begin(), layout_.rightTray.end(), id));
+}
+
void App::removePaletteFromTrays(const std::string& id) {
for (auto* tray : {&layout_.leftTray, &layout_.rightTray}) tray->erase(std::remove(tray->begin(), tray->end(), id), tray->end());
}
@@ -1214,9 +1218,7 @@ 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;
+ const bool inTray = paletteInShownTray(p.id);
const bool open = dropdown_ == p.id;
ImGui::PushStyleColor(ImGuiCol_Button, open ? theme::header : ImVec4(0, 0, 0, 0));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, theme::headerHover);
@@ -1478,11 +1480,7 @@ void App::drawStatusBar(const ShellGeometry& g) {
} else {
// The section shown last, else the first one; one that sits in a tray is already on screen, so the
// menu opens on the next one (a menu whose sections are all in trays flashes the tray instead).
- auto inTray = [&](const std::string& id) {
- return std::count(layout_.leftTray.begin(), layout_.leftTray.end(), id) +
- std::count(layout_.rightTray.begin(), layout_.rightTray.end(), id) >
- 0;
- };
+ auto inTray = [&](const std::string& id) { return paletteInShownTray(id); };
std::string section = menuSection_[m.id];
if (section.empty() || taskMenuOf(section) != i || inTray(section)) {
section.clear();
diff --git a/tests/ui/sizes/deform_panel.sfui b/tests/ui/sizes/deform_panel.sfui
new file mode 100644
index 00000000..90df5341
--- /dev/null
+++ b/tests/ui/sizes/deform_panel.sfui
@@ -0,0 +1,21 @@
+# The Deform panel as people see it (docs/design/deform-panel.md), for the look review on a 1440x900 window
+# (CMake: ui_deform_panel_1440; deform_panel_1024.sfui is the same at 1024x768): a tall Part, a stack of three
+# steps previewed on it, one on two axes, and Size showing the Part's real dimensions.
+run ui_look look=classic layout=classic
+run new_sphere subdivisions=5
+run deform_scale amount=100 axes=y
+click "Tool##palette.tool"
+click "Deformation##tool.deformation"
+expect "Size/##deform_size_x"
+click "##deform_stack_add"
+click "Stack/Taper##deform_add_Taper"
+click "##deform_stack_add"
+click "Stack/Twist##deform_add_Twist"
+click "##deform_stack_add"
+click "Stack/Bend##deform_add_Bend"
+expect_status "Deform stack (3 steps)"
+click "Stack/Z"
+expect_status "Deform stack (3 steps)"
+click "Frame##view.frame"
+wait_idle 30
+shot deform-panel
diff --git a/tests/ui/sizes/deform_panel_1024.sfui b/tests/ui/sizes/deform_panel_1024.sfui
new file mode 100644
index 00000000..39d96a62
--- /dev/null
+++ b/tests/ui/sizes/deform_panel_1024.sfui
@@ -0,0 +1,21 @@
+# tests/ui/sizes/deform_panel.sfui on a 1024x768 window (CMake: ui_deform_panel_1024): narrower than 1280 px the
+# right tray is not drawn and Tool opens as a drop-down from the bar (it only flashed the hidden tray before).
+run ui_look look=classic layout=classic
+run new_sphere subdivisions=5
+run deform_scale amount=100 axes=y
+click "Frame##view.frame"
+click "Tool##palette.tool"
+wait_idle 10
+click "Deformation##tool.deformation"
+expect "Size/##deform_size_x"
+click "##deform_stack_add"
+click "Stack/Taper##deform_add_Taper"
+click "##deform_stack_add"
+click "Stack/Twist##deform_add_Twist"
+click "##deform_stack_add"
+click "Stack/Bend##deform_add_Bend"
+expect_status "Deform stack (3 steps)"
+click "Stack/Z"
+expect_status "Deform stack (3 steps)"
+wait_idle 30
+shot deform-panel