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.

Merge feat/hide-empty-shelves 74fb20b1: empty shelves hide outside Customize Shelves, the canvas gets their space (#139)

islandmede0c0dd5cf4ae
diff --cc src/app/UiTest.cpp
index 90179f47,1675205d..82a1a17f
--- a/src/app/UiTest.cpp
+++ b/src/app/UiTest.cpp
@@@ -827,12 -826,14 +827,19 @@@ double Demo::query(const std::string& n
if (name == "shelves_visible") return app_.layout_.shelvesVisible ? 1.0 : 0.0;
if (name == "right_tray_open") return app_.layout_.rightTrayOpen ? 1.0 : 0.0;
if (name == "left_tray_open") return app_.layout_.leftTrayOpen ? 1.0 : 0.0;
+ if (name == "canvas_width") return double(app_.shell_.canvas.w / std::max(app_.uiScale_, 0.01f)); // logical px
+ // A shelf drawn (not hidden for being empty outside Customize Shelves, #139): 0 top, 1 left, 2 right, 3 bottom.
+ if (name.rfind("shelf_shown_", 0) == 0) {
+ const CanvasRect* r[] = {&app_.shell_.topShelf, &app_.shell_.leftShelf, &app_.shell_.rightShelf, &app_.shell_.bottomShelf};
+ const int k = std::atoi(name.c_str() + 12);
+ return k >= 0 && k < 4 && r[k]->w > 0.0f && r[k]->h > 0.0f ? 1.0 : 0.0;
+ }
if (name == "right_tray_shown") return app_.shell_.rightTray.w > 0.0f ? 1.0 : 0.0; // drawn, not just set open (#107)
+ if (name == "menu_rect_changes") { // times the open task menu moved or resized since the last read (a jitter is many)
+ const int n = app_.menuRectChanges_;
+ app_.menuRectChanges_ = 0;
+ return double(n);
+ }
if (name == "shell_narrow") return app_.shell_.narrow ? 1.0 : 0.0;
if (name == "offscreen_items") { // items drawn past the window's edge last frame (#105); names them in the log
const std::vector<std::string> off = Demo::offscreenItems();