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.

Trays round 2: no grabs over labels, one header grammar, indented sections, calm picker

islandmedc0cb1e7c7737
diff --git a/docs/ui-design.md b/docs/ui-design.md
index c70117db..c5f116a9 100644
--- a/docs/ui-design.md
+++ b/docs/ui-design.md
@@ -500,8 +500,9 @@ Style:
- `ScrollbarSize 10`, `GrabMinSize 6`.
- Top shelf hierarchy: mode groups full size on a trough; options 12 px, 22 px high, dim until on; LightBox / AI Brush plain buttons. The title strip's QuickSave, 1 2 3 and Menus have no fill until hovered; its readout is 12 px.
- Font: Inter Regular 15 x scale (as now). Shelf labels and tile captions 12 px (a second Inter size), help titles Inter SemiBold 15, console ProggyClean 13.
-- Trays: sub-palette headers are quiet (no fill until hovered or open, a small chevron, a hairline under each); the accent is not used on them. The active row of a list (SubTools) is the accent at ~15% with a 2 px accent bar on its left, not a solid fill. Helper text is 12 px `textDim`.
-- The left tray's colour field is drawn by hand (`App::drawColorWidget`, Pickers.cpp): a rounded saturation/value square with a ring marker, an 8 px hue strip with a thin pill notch, and the main/second swatches with a 1 px edge.
+- Trays (helpers in `src/app/Palettes.h`): two header levels only. A palette header is a filled bar (icon, bold title, chevron at the right). A sub-palette header is 22 px and quiet: title 8 px in, chevron at the right, no fill until hovered or open, an opaque hairline under it, no accent. The open section's content is indented 8 px (`tray::Section`), so it lines up with the header title. A group inside a section ("Project", "QRemesh", "Tablet") is `tray::GroupLabel`: 12 px `textDim` flush with the content, then a hairline; not `ImGui::SeparatorText`.
+- Tray controls: every slider is a `ui::SliderInside` (ints through `tray::SliderInt`), never a stock grab over its label. Check marks in palettes are the text colour (`tray::Style`), not the accent. A row of controls fills the line in equal halves or thirds; a number beside a button is a drag field of the same size (no tiny - / + buttons). The active row of a list (SubTools) is a lighter neutral (white ~9%) with a 2 px accent bar on its left, in a recessed well with no outline. Helper text is 12 px `textDim`.
+- The left tray's colour field is drawn by hand (`App::drawColorWidget`, Pickers.cpp): a rounded saturation/value square with a ring marker, a 10 px hue strip with a thin bar marker that stays inside its ends, and the main/second swatches as equal halves with a 1 px edge. One 4 px gap between all of them. The default main colour is a mid grey (second: white), so the swatches are neutral until the user picks a colour.
---
diff --git a/src/app/Palettes.cpp b/src/app/Palettes.cpp
index 7bd18d54..ab3f81a2 100644
--- a/src/app/Palettes.cpp
+++ b/src/app/Palettes.cpp
@@ -10,6 +10,7 @@
#include "app/Config.h"
#include "app/Demo.h"
+#include "app/Palettes.h"
#include "app/Shell.h"
#include "app/Theme.h"
#include "app/Ui.h"
@@ -18,8 +19,11 @@
#include <IconsLucide.h>
#include <algorithm>
+#include <cfloat>
+#include <cmath>
#include <cstdio>
#include <iterator>
+#include <string>
namespace sf {
@@ -57,8 +61,13 @@ const PaletteDef* findPalette(std::string_view id) {
namespace {
-// The hairline under each sub-palette header. Should become a theme token (Theme.h): a step above shellBg.
-constexpr ImU32 kSectionRule = IM_COL32(58, 58, 63, 160);
+// The hairline under each sub-palette header: opaque, a clear step above panelBg so the closed list reads as rows.
+// Should become a theme token (Theme.h).
+constexpr ImU32 kSectionRule = IM_COL32(54, 54, 60, 255);
+constexpr float kSectionHeaderH = 22.0f; // sub-palette header height, unscaled
+constexpr float kSectionInset = 8.0f; // header titles and section content start this far in, unscaled
+// Check marks in the palettes: the text colour, so a column of options doesn't read as a row of accents.
+constexpr ImVec4 kCheckMark = theme::rgb(0xd8d8d8);
// A row of equal-width action buttons filling the line.
void actionRow(App& app, std::initializer_list<const char*> ids) {
@@ -105,17 +114,60 @@ void hint(const App& app, const char* text) {
} // namespace
+namespace tray {
+
+Section::Section() { ImGui::Indent(kSectionInset * ImGui::GetFontSize() / 15.0f); }
+
+Section::~Section() {
+ const float s = ImGui::GetFontSize() / 15.0f;
+ ImGui::Unindent(kSectionInset * s);
+ ImGui::Dummy(ImVec2(0, 4.0f * s));
+}
+
+Style::Style() { ImGui::PushStyleColor(ImGuiCol_CheckMark, kCheckMark); }
+
+Style::~Style() { ImGui::PopStyleColor(); }
+
+void GroupLabel(const App& app, const char* text) {
+ const float s = ImGui::GetFontSize() / 15.0f;
+ ImGui::Dummy(ImVec2(0, 2.0f * s));
+ if (app.smallFont()) ImGui::PushFont(app.smallFont());
+ ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));
+ ImGui::PushStyleColor(ImGuiCol_Separator, ImGui::ColorConvertU32ToFloat4(kSectionRule));
+ ImGui::PushStyleVar(ImGuiStyleVar_SeparatorTextPadding, ImVec2(0.0f, 2.0f * s));
+ ImGui::PushStyleVar(ImGuiStyleVar_SeparatorTextAlign, ImVec2(0.0f, 0.5f));
+ ImGui::SeparatorText(text);
+ ImGui::PopStyleVar(2);
+ ImGui::PopStyleColor(2);
+ if (app.smallFont()) ImGui::PopFont();
+}
+
+bool SliderInt(const char* id, int* v, int lo, int hi, const char* format, ImGuiSliderFlags flags) {
+ // The same widget as the float sliders: the value as a float shown with no decimals, rounded back.
+ std::string fmt = format ? format : "%d";
+ if (const size_t at = fmt.find("%d"); at != std::string::npos) fmt.replace(at, 2, "%.0f");
+ float f = float(*v);
+ if (!ui::SliderInside(id, &f, float(lo), float(hi), fmt.c_str(), flags)) return false;
+ const int next = std::clamp(int(std::lround(f)), lo, hi);
+ if (next == *v) return false;
+ *v = next;
+ return true;
+}
+
+} // namespace tray
+
bool App::subpalette(const char* id, const char* title) {
auto& open = layout_.openSubpalettes;
bool isOpen = std::find(open.begin(), open.end(), id) != open.end();
const float s = uiScale_;
- const float h = 24.0f * s;
+ const float h = kSectionHeaderH * s;
const ImVec2 p = ImGui::GetCursorScreenPos();
const float w = ImGui::GetContentRegionAvail().x;
const bool clicked = ImGui::InvisibleButton((std::string(title) + "##" + id).c_str(), ImVec2(w, h));
const bool hovered = ImGui::IsItemHovered();
- // A quiet section header: no fill until hovered or open, a hairline under it, a small chevron. The accent is
- // kept for the current tool (docs/ui-design.md §10), so an open section is told apart by its fill and text only.
+ // A quiet section header in the palette header's grammar: title at the left, chevron at the right. No fill until
+ // hovered or open, a hairline under it. The title lines up with the section's content (tray::Section). The accent
+ // is kept for the current tool (docs/ui-design.md §10), so an open section shows by its fill and text only.
ImDrawList* dl = ImGui::GetWindowDrawList();
if (isOpen || hovered)
dl->AddRectFilled(p, ImVec2(p.x + w, p.y + h), theme::u32(hovered ? theme::headerHover : theme::header, isOpen ? 0.9f : 0.6f),
@@ -123,11 +175,12 @@ bool App::subpalette(const char* id, const char* title) {
dl->AddLine(ImVec2(p.x, p.y + h - 0.5f * s), ImVec2(p.x + w, p.y + h - 0.5f * s), kSectionRule, 1.0f * s);
ImFont* font = ImGui::GetFont();
const float chevronSize = ImGui::GetFontSize() * 0.8f;
- dl->AddText(font, chevronSize, ImVec2(p.x + 6.0f * s, p.y + (h - chevronSize) * 0.5f),
- theme::u32(isOpen || hovered ? theme::text : theme::textDim, isOpen ? 0.9f : 1.0f),
- isOpen ? ICON_LC_CHEVRON_DOWN : ICON_LC_CHEVRON_RIGHT);
- const float ty = p.y + (h - ImGui::GetFontSize()) * 0.5f;
- dl->AddText(ImVec2(p.x + 22.0f * s, ty), theme::u32(theme::text, isOpen || hovered ? 1.0f : 0.78f), title);
+ const char* chevron = isOpen ? ICON_LC_CHEVRON_DOWN : ICON_LC_CHEVRON_RIGHT;
+ const ImVec2 cs = font->CalcTextSizeA(chevronSize, FLT_MAX, 0.0f, chevron);
+ dl->AddText(font, chevronSize, ImVec2(std::floor(p.x + w - h * 0.5f - cs.x * 0.5f), std::floor(p.y + (h - cs.y) * 0.5f)),
+ theme::u32(isOpen || hovered ? theme::text : theme::textDim, isOpen ? 0.9f : 1.0f), chevron);
+ const float ty = std::floor(p.y + (h - ImGui::GetFontSize()) * 0.5f);
+ dl->AddText(ImVec2(p.x + kSectionInset * s, ty), theme::u32(theme::text, isOpen || hovered ? 1.0f : 0.78f), title);
ImGui::LogText("%s", title);
ui::HelpText(title, nullptr,
"Click to open or close. Opening one closes the others (Shift+click keeps them open; Preferences > "
@@ -156,6 +209,7 @@ bool App::subpalette(const char* id, const char* title) {
void App::drawPalette_Alpha() { drawAlphaSection(); }
void App::drawPalette_Brush() {
+ const tray::Style style; // quiet check marks
// Your brushes first (PanelBrushLibrary.cpp: tags, and the right-click menu to share, rename or delete),
// then every brush as thumbnails (Pickers.cpp, the same grid as the B picker).
actionRow(*this, {"ui.brush_lab", "ui.brush_gallery"});
@@ -170,6 +224,7 @@ void App::drawPalette_Brush() {
? &doc_.brushes[size_t(doc_.activeBrush)]
: nullptr) {
if (subpalette("brush.recipe", ("Edit recipe: " + recipe->name).c_str())) {
+ tray::Section section;
drawRecipeEditor(*recipe);
if (!pendingRename_.empty()) {
runCommand("brush_rename", {{"to", pendingRename_}});
@@ -177,11 +232,15 @@ void App::drawPalette_Brush() {
}
}
}
- if (subpalette("brush.vdm", "Vector Displacement")) drawVdmSection(); // PanelVdm.cpp
+ if (subpalette("brush.vdm", "Vector Displacement")) {
+ tray::Section section;
+ drawVdmSection(); // PanelVdm.cpp
+ }
drawBrushGrid(*this, GridMode::Palette);
}
void App::drawPalette_Draw() {
+ const tray::Style style; // quiet check marks
ImGui::SetNextItemWidth(-1);
ui::SliderInside("##drawsize", &radiusPx_, 2.0f, 800.0f, "Draw Size %.0f", ImGuiSliderFlags_Logarithmic);
ui::HelpText("Draw Size", "S", "Brush radius in screen pixels. [ and ] change it by 10%.", "Draw");
@@ -201,7 +260,7 @@ void App::drawPalette_Draw() {
segmented(*this, {"draw.sculpt", "draw.paint"});
segmented(*this, {"draw.zadd", "draw.zsub"});
actionRow(*this, {"draw.rgb", "draw.front_faces"});
- ImGui::SeparatorText("Dynamic topology");
+ tray::GroupLabel(*this, "Dynamic topology");
actionRow(*this, {"draw.dynamic"});
ImGui::SetNextItemWidth(-1);
drawDetailSlider("##dyntopo_detail_palette");
@@ -214,7 +273,7 @@ void App::drawPalette_Draw() {
if (doc_.sculptor.dyntopo.enabled && !dyntopoBlocker(doc_.mesh).empty())
hint(*this, "This SubTool has subdivision levels, so strokes don't remesh it: delete the lower (or higher) levels "
"first.");
- ImGui::SeparatorText("Tablet");
+ tray::GroupLabel(*this, "Tablet");
ImGui::Checkbox("Pressure > strength", &pressureStrength_);
ui::HelpAction(*this, "draw.pressure_strength");
ImGui::Checkbox("Pressure > size", &pressureSize_);
@@ -243,7 +302,7 @@ void App::drawPalette_File() {
ImGui::Separator();
menuAction(*this, "file.open");
drawFileMenuProjectItems(); // Open Recent, Save, Save As, autosave
- ImGui::SeparatorText("Import / Export");
+ tray::GroupLabel(*this, "Import / Export");
menuAction(*this, "file.import");
menuAction(*this, "file.export_obj");
menuAction(*this, "file.export_stl");
@@ -262,10 +321,11 @@ void App::drawPalette_File() {
}
void App::drawPalette_Generate() {
+ const tray::Style style; // quiet check marks
actionRow(*this, {"ui.generate3d"});
hint(*this, "Image or text to a sculptable 3D model: Hugging Face (free), fal.ai, Meshy, your ComfyUI server, your own "
"command, or an offline blockout.");
- ImGui::SeparatorText("From an image");
+ tray::GroupLabel(*this, "From an image");
if (ImGui::Button(refImage_.empty() ? "Choose image...##generate" : "Change image...##generate", ImVec2(-1, 0))) {
static const SDL_DialogFileFilter filters[] = {{"Images", "png;jpg;jpeg;bmp;tga;psd;gif"}, {"All files", "*"}};
SDL_ShowOpenFileDialog(
@@ -294,7 +354,10 @@ void App::drawPalette_Generate() {
if (ImGui::Button("Stamp", ImVec2(third, 0))) projectImageFromView();
ui::HelpText("Stamp", nullptr, "Projects the image onto the model from this view as surface detail.", "Generate");
ImGui::EndDisabled();
- if (subpalette("generate.ai", "AI brush provider")) drawAiSettings();
+ if (subpalette("generate.ai", "AI brush provider")) {
+ tray::Section section;
+ drawAiSettings();
+ }
}
void App::drawPalette_Help() {
@@ -311,8 +374,10 @@ void App::drawPalette_Help() {
}
void App::drawPalette_Preferences() {
+ const tray::Style style; // quiet check marks
// The sub-palettes come from Config.cpp (Store / Restore UI, interface preferences, hotkeys, LightBox).
if (subpalette("preferences.config", "Config")) {
+ tray::Section section;
config::drawConfigSection(*this);
ImGui::TextDisabled("Layout");
for (int i = 1; i <= 3; ++i) {
@@ -320,16 +385,38 @@ void App::drawPalette_Preferences() {
ui::ActionButton(*this, ("ui.preset." + std::to_string(i)).c_str(), ImVec2(ImGui::GetFrameHeight() * 1.4f, 0));
}
}
- if (subpalette("preferences.interface", "Interface")) config::drawInterfaceSection(*this);
- if (subpalette("preferences.input", "Input")) drawInputSection();
- if (subpalette("preferences.hotkeys", "Hotkeys")) config::drawHotkeysSection(*this);
- if (subpalette("preferences.lightbox", "LightBox")) config::drawLightBoxSection(*this);
- if (subpalette("preferences.tablet", "Tablet")) drawTabletSection();
- if (subpalette("preferences.performance", "Performance")) drawPerformanceSection();
- if (subpalette("preferences.updates", "Updates")) drawUpdatesSection();
+ if (subpalette("preferences.interface", "Interface")) {
+ tray::Section section;
+ config::drawInterfaceSection(*this);
+ }
+ if (subpalette("preferences.input", "Input")) {
+ tray::Section section;
+ drawInputSection();
+ }
+ if (subpalette("preferences.hotkeys", "Hotkeys")) {
+ tray::Section section;
+ config::drawHotkeysSection(*this);
+ }
+ if (subpalette("preferences.lightbox", "LightBox")) {
+ tray::Section section;
+ config::drawLightBoxSection(*this);
+ }
+ if (subpalette("preferences.tablet", "Tablet")) {
+ tray::Section section;
+ drawTabletSection();
+ }
+ if (subpalette("preferences.performance", "Performance")) {
+ tray::Section section;
+ drawPerformanceSection();
+ }
+ if (subpalette("preferences.updates", "Updates")) {
+ tray::Section section;
+ drawUpdatesSection();
+ }
if (subpalette("preferences.autosave", "Autosave")) {
+ tray::Section section;
ImGui::SetNextItemWidth(-1);
- ImGui::SliderInt("##autosave", &autosaveMinutes_, 0, 60, autosaveMinutes_ ? "Every %d min" : "Autosave off");
+ tray::SliderInt("##autosave", &autosaveMinutes_, 0, 60, autosaveMinutes_ ? "Every %d min" : "Autosave off");
if (ImGui::IsItemDeactivatedAfterEdit()) saveProjectPrefs();
ui::HelpText("Autosave", nullptr, "Save a recovery copy this often (0 = off). Restored after a crash.",
"Preferences > Autosave");
@@ -337,6 +424,7 @@ void App::drawPalette_Preferences() {
}
void App::drawPalette_Render() {
+ const tray::Style style; // quiet check marks
ImGui::Checkbox("Wireframe", &renderSettings_.wireframe);
ui::HelpAction(*this, "view.wireframe");
ImGui::Checkbox("Show Mesh", &renderSettings_.showMesh);
@@ -367,6 +455,7 @@ void App::drawPalette_Script() {
void App::drawPalette_Stroke() { drawStrokeGrid(*this, GridMode::Palette); } // Pickers.cpp, as in the stroke picker
void App::drawPalette_Tool() {
+ const tray::Style style; // quiet check marks
const float s = uiScale_;
// Header: the active SubTool and its size, then Open / Save / Import.
{
@@ -382,6 +471,7 @@ void App::drawPalette_Tool() {
ImGui::Dummy(ImVec2(0, 2.0f * s));
}
if (subpalette("tool.subtool", "SubTool")) {
+ tray::Section section;
Demo::pushScope("SubTools");
drawSubToolsContents();
Demo::popScope();
@@ -390,31 +480,37 @@ void App::drawPalette_Tool() {
Demo::popScope();
}
if (subpalette("tool.layers", "Layers")) {
+ tray::Section section;
Demo::pushScope("Layers");
drawLayersContents();
Demo::popScope();
}
if (subpalette("tool.face", "Facial Shapes")) {
+ tray::Section section;
Demo::pushScope("Facial Shapes");
drawFaceContents(); // PanelFace.cpp
Demo::popScope();
}
if (subpalette("tool.paint_layers", "Paint Layers")) {
+ tray::Section section;
Demo::pushScope("Paint Layers");
drawPaintLayersContents();
Demo::popScope();
}
if (subpalette("tool.texture", "Texture Map")) {
+ tray::Section section;
Demo::pushScope("Texture Map");
drawTextureMapContents();
Demo::popScope();
}
if (subpalette("tool.bake", "Bake")) {
+ tray::Section section;
Demo::pushScope("Bake");
drawBakeContents();
Demo::popScope();
}
if (subpalette("tool.geometry", "Geometry")) {
+ tray::Section section;
Demo::pushScope("Geometry");
drawGeometrySection();
actionRow(*this, {"geometry.subdivide"});
@@ -431,6 +527,7 @@ void App::drawPalette_Tool() {
Demo::popScope();
}
if (subpalette("tool.remesh", "Remesh")) {
+ tray::Section section;
const float half = (ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x) * 0.5f;
if (voxelRemesh_) { // remeshing a painted SubTool in the background (PanelRetopo.cpp)
ImGui::ProgressBar(voxelRemesh_->progress->load(), ImVec2(half, 0), "Remeshing...");
@@ -444,7 +541,7 @@ void App::drawPalette_Tool() {
}
ImGui::SameLine();
ImGui::SetNextItemWidth(-1);
- ImGui::SliderInt("##voxres", &voxelResolution_, 64, 400, "Resolution %d");
+ tray::SliderInt("##voxres", &voxelResolution_, 64, 400, "Resolution %d");
ui::HelpText("Resolution", nullptr, "Voxels across the model: higher keeps more detail and makes more triangles.",
"Tool > Remesh");
if (voxelRemesh_) {
@@ -454,15 +551,26 @@ void App::drawPalette_Tool() {
drawKeepTextureCheckbox("Keep Texture##remesh", "Tool > Remesh"); // only for a painted SubTool
}
}
- if (subpalette("tool.masking", "Masking")) drawMaskingSection();
- if (subpalette("tool.polygroups", "Polygroups")) drawPolygroupsSection();
- if (subpalette("tool.visibility", "Visibility")) drawVisibilitySection();
+ if (subpalette("tool.masking", "Masking")) {
+ tray::Section section;
+ drawMaskingSection();
+ }
+ if (subpalette("tool.polygroups", "Polygroups")) {
+ tray::Section section;
+ drawPolygroupsSection();
+ }
+ if (subpalette("tool.visibility", "Visibility")) {
+ tray::Section section;
+ drawVisibilitySection();
+ }
if (subpalette("tool.export", "Export")) {
+ tray::Section section;
Demo::pushScope("Game Ready");
drawGameExportContents();
Demo::popScope();
}
if (subpalette("tool.display", "Display")) {
+ tray::Section section;
ImGui::Checkbox("Wireframe##display", &renderSettings_.wireframe);
ui::HelpAction(*this, "view.wireframe");
ImGui::SameLine();
@@ -477,6 +585,7 @@ void App::drawPalette_Tool() {
}
void App::drawPalette_Transform() {
+ const tray::Style style; // quiet check marks
ImGui::TextDisabled("Gizmo 3D");
drawGizmoContents(false);
ImGui::TextDisabled("Symmetry");
diff --git a/src/app/Palettes.h b/src/app/Palettes.h
new file mode 100644
index 00000000..b62ee545
--- /dev/null
+++ b/src/app/Palettes.h
@@ -0,0 +1,42 @@
+// SculptForge - open source digital sculpting
+// SPDX-License-Identifier: GPL-3.0-or-later
+//
+// Small helpers the palette bodies and the right-tray panels share, so every
+// section is laid out the same way (docs/ui-design.md §10, the tray rules).
+#pragma once
+
+#include <imgui.h>
+
+namespace sf {
+class App;
+}
+
+namespace sf::tray {
+
+// The content of an open sub-palette, indented to line up with its header title. Scoped: construct it right after
+// subpalette() returns true; it unindents and leaves a little room before the next header when it goes.
+struct Section {
+ Section();
+ ~Section();
+ Section(const Section&) = delete;
+ Section& operator=(const Section&) = delete;
+};
+
+// The palette bodies' quiet controls: check marks in the text colour, not the accent (the accent marks the
+// current tool or mode). Scoped like Section.
+struct Style {
+ Style();
+ ~Style();
+ Style(const Style&) = delete;
+ Style& operator=(const Style&) = delete;
+};
+
+// A group label inside a section ("Project", "QRemesh", "Tablet"): small dim text flush with the content, then a
+// hairline to the end of the line. Replaces ImGui::SeparatorText, whose leading dash made a third header style.
+void GroupLabel(const App& app, const char* text);
+
+// ui::SliderInside for an int ("passes 3"): the label inside the frame and a thin accent bar, no grab over the text.
+// `format` uses %d.
+bool SliderInt(const char* id, int* v, int lo, int hi, const char* format, ImGuiSliderFlags flags = 0);
+
+} // namespace sf::tray
diff --git a/src/app/PanelBake.cpp b/src/app/PanelBake.cpp
index aea91407..91aafe1d 100644
--- a/src/app/PanelBake.cpp
+++ b/src/app/PanelBake.cpp
@@ -336,6 +336,7 @@ void App::drawBakeContents() {
BakeUiState& b = *bake_;
const Mesh& m = doc_.mesh;
const ImGuiStyle& style = ImGui::GetStyle();
+ const float x0 = ImGui::GetCursorPosX(); // line start, inside the section indent
const float half = (ImGui::GetContentRegionAvail().x - style.ItemSpacing.x) * 0.5f;
// What the maps go onto.
@@ -390,7 +391,10 @@ void App::drawBakeContents() {
"Colour transfer: the source's polypaint, or its painted texture.",
};
for (int i = 0; i < kBakeMapCount; ++i) {
- if (i % 2) ImGui::SameLine(half + style.ItemSpacing.x + style.WindowPadding.x);
+ if (i % 2) {
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
+ }
bool on = (b.settings.maps & (1u << i)) != 0;
if (ImGui::Checkbox(bakeMapLabel(BakeMap(i)), &on)) b.settings.maps = on ? b.settings.maps | (1u << i) : b.settings.maps & ~(1u << i);
ui::HelpText(bakeMapLabel(BakeMap(i)), nullptr, kMapHelp[i], kPath);
diff --git a/src/app/PanelFace.cpp b/src/app/PanelFace.cpp
index fcce30f4..b815574c 100644
--- a/src/app/PanelFace.cpp
+++ b/src/app/PanelFace.cpp
@@ -6,6 +6,7 @@
// bake for export).
#include "app/App.h"
#include "app/Demo.h"
+#include "app/Palettes.h"
#include "app/Ui.h"
#include "core/Face.h"
@@ -299,7 +300,7 @@ void App::drawFaceContents() {
kFacePath);
// Landmarks.
- ImGui::SeparatorText("Landmarks");
+ tray::GroupLabel(*this, "Landmarks");
const float half = (ImGui::GetContentRegionAvail().x - ImGui::GetStyle().ItemSpacing.x) * 0.5f;
actionButton(*this, "face.landmarks", half);
ImGui::SameLine();
@@ -315,7 +316,7 @@ void App::drawFaceContents() {
}
// Face test.
- ImGui::SeparatorText("Face test");
+ tray::GroupLabel(*this, "Face test");
const bool shapes = hasFaceShapes();
if (!shapes) dimText("Generate the shapes first.");
ImGui::BeginDisabled(!shapes);
@@ -328,7 +329,7 @@ void App::drawFaceContents() {
ui::HelpText(presets[i].name, nullptr, presets[i].help, kFacePath);
}
ImGui::SetNextItemWidth(-1);
- ImGui::SliderFloat("##faceamount", &facePresetAmount_, 0.0f, 1.0f, "preset amount %.2f");
+ ui::SliderInside("##faceamount", &facePresetAmount_, 0.0f, 1.0f, "preset amount %.2f");
ui::HelpText("Preset amount", nullptr, "How strongly the presets above are applied (click a preset again to see it).",
kFacePath);
// A slider per shape, by region.
@@ -341,7 +342,7 @@ void App::drawFaceContents() {
if (!mine) continue;
float w = l.weight;
ImGui::SetNextItemWidth(-1);
- if (ImGui::SliderFloat(("##" + l.name).c_str(), &w, 0.0f, 1.0f, (l.name + " %.2f").c_str())) {
+ if (ui::SliderInside(("##" + l.name).c_str(), &w, 0.0f, 1.0f, (l.name + " %.2f").c_str())) {
faceTakePlaying_ = false;
applyFaceWeights(doc_, {{l.name, w}});
}
@@ -355,7 +356,7 @@ void App::drawFaceContents() {
ImGui::EndDisabled();
// Takes.
- ImGui::SeparatorText("Take");
+ tray::GroupLabel(*this, "Take");
actionButton(*this, "face.take_load");
if (!faceTake_.empty()) {
ImGui::TextDisabled("%s: %.1f / %.1f s", faceTake_.name.c_str(), double(faceTakeTime_), double(faceTake_.duration()));
diff --git a/src/app/PanelMasking.cpp b/src/app/PanelMasking.cpp
index 49423b72..5f785537 100644
--- a/src/app/PanelMasking.cpp
+++ b/src/app/PanelMasking.cpp
@@ -6,6 +6,7 @@
// "Masking" section of the Tools panel. The operations themselves are the
// mask_* commands (core/Masking.cpp).
#include "app/App.h"
+#include "app/Palettes.h"
#include "app/Pickers.h"
#include "app/Ui.h"
@@ -175,20 +176,23 @@ void App::drawMaskingSection() {
ImGui::SameLine();
if (ImGui::Button("Shrink##mask", ImVec2(half, 0))) runCommand("mask_shrink", passes);
ImGui::SetNextItemWidth(-1);
- ImGui::SliderInt("##maskpasses", &maskIterations_, 1, 20, "passes %d");
+ tray::SliderInt("##maskpasses", &maskIterations_, 1, 20, "Passes %d");
if (ImGui::Button("By cavity", ImVec2(half, 0)))
runCommand("mask_by_cavity", {{"strength", double(maskStrength_)}, {"threshold", double(cavityThreshold_)}});
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Mask creases and folds (replaces the mask; uses the mask strength)");
ImGui::SameLine();
ImGui::SetNextItemWidth(-1);
- ImGui::SliderFloat("##cavitythreshold", &cavityThreshold_, -0.2f, 0.5f, "threshold %.2f");
+ ui::SliderInside("##cavitythreshold", &cavityThreshold_, -0.2f, 0.5f, "Threshold %.2f");
if (ImGui::Button("By polygroup", ImVec2(half, 0)))
runCommand("mask_by_polygroup", {{"group", double(maskGroup_)}});
if (ImGui::IsItemHovered()) ImGui::SetTooltip("Mask one polygroup (replaces the mask)");
ImGui::SameLine();
+ // The group id as a drag field the size of the button beside it (Ctrl+click or double-click types a number),
+ // rather than an input with tiny - and + buttons.
ImGui::SetNextItemWidth(-1);
- if (ImGui::InputInt("##maskgroup", &maskGroup_)) maskGroup_ = std::max(0, maskGroup_);
+ if (ImGui::DragInt("##maskgroup", &maskGroup_, 0.1f, 0, 1 << 30, "Group %d", ImGuiSliderFlags_AlwaysClamp))
+ maskGroup_ = std::max(0, maskGroup_);
}
} // namespace sf
diff --git a/src/app/PanelPolygroups.cpp b/src/app/PanelPolygroups.cpp
index 2deda77d..775df54b 100644
--- a/src/app/PanelPolygroups.cpp
+++ b/src/app/PanelPolygroups.cpp
@@ -77,7 +77,7 @@ void App::drawPolygroupsSection() {
if (ImGui::IsItemHovered()) ImGui::SetTooltip("New group wherever the surface turns more than the angle");
ImGui::SameLine();
ImGui::SetNextItemWidth(-1);
- ImGui::SliderFloat("##pgangle", &polygroupAngle_, 1.0f, 90.0f, "%.0f deg");
+ ui::SliderInside("##pgangle", &polygroupAngle_, 1.0f, 90.0f, "Angle %.0f deg");
if (ImGui::Button("By pieces", ImVec2(half, 0))) group("polygroup_by_connectivity");
if (ImGui::IsItemHovered()) ImGui::SetTooltip("One group per disconnected piece");
ImGui::SameLine();
diff --git a/src/app/PanelRetopo.cpp b/src/app/PanelRetopo.cpp
index 0e993d28..7053bf83 100644
--- a/src/app/PanelRetopo.cpp
+++ b/src/app/PanelRetopo.cpp
@@ -8,6 +8,7 @@
// ZRemesher Guides, core/QRemeshGuides.h) draws the curves QRemesh follows.
#include "app/App.h"
#include "app/Demo.h"
+#include "app/Palettes.h"
#include "app/Ui.h"
#include "core/TextureTransfer.h"
@@ -265,7 +266,8 @@ void App::pollQRemesh() {
void App::drawQRemeshContents() {
const ImGuiStyle& style = ImGui::GetStyle();
- ImGui::SeparatorText("QRemesh");
+ const float x0 = ImGui::GetCursorPosX(); // line start, inside the section indent
+ tray::GroupLabel(*this, "QRemesh");
const float full = ImGui::GetContentRegionAvail().x;
const float half = (full - style.ItemSpacing.x) * 0.5f;
const float third = (full - 2.0f * style.ItemSpacing.x) / 3.0f;
@@ -285,7 +287,7 @@ void App::drawQRemeshContents() {
}
ImGui::SetNextItemWidth(-1);
- ImGui::SliderInt("##qtarget", &retopo_.target, 100, 200000, "Target Polygons %d", ImGuiSliderFlags_Logarithmic);
+ tray::SliderInt("##qtarget", &retopo_.target, 100, 200000, "Target Polygons %d", ImGuiSliderFlags_Logarithmic);
ui::HelpText("Target Polygons", nullptr,
"About how many quads QRemesh makes (Ctrl+click to type a number). Half / Same / Double set it from "
"the SubTool's current polygon count.",
@@ -314,7 +316,8 @@ void App::drawQRemeshContents() {
"Edge loops follow the polygroup borders exactly and the result keeps the polygroups. Paint groups "
"where you want loops (around the eyes, the mouth) to guide the flow.",
kQRemeshPath);
- ImGui::SameLine(half + style.ItemSpacing.x);
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
ImGui::Checkbox("Detect Edges", &retopo_.detectEdges);
ui::HelpText("Detect Edges", nullptr, "Hard edges (faces meeting at more than 50 degrees) get an edge loop, so they stay sharp.",
kQRemeshPath);
@@ -323,7 +326,8 @@ void App::drawQRemeshContents() {
"Paint where you want density: red areas get up to 4 times the quads, blue areas down to a quarter, "
"white is unchanged.",
kQRemeshPath);
- ImGui::SameLine(half + style.ItemSpacing.x);
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
ImGui::Checkbox("Symmetry", &retopo_.symmetry);
const char axis = char('X' + symmetryAxis(symmetry_));
const std::string symHelp = std::string("Mirror the topology across ") + axis +
@@ -337,7 +341,8 @@ void App::drawQRemeshContents() {
"ProjectAll its detail back. Off: replace it, as ZBrush does (undo brings it back).",
kQRemeshPath);
if (hasTexture(doc_.mesh)) { // only matters for a painted SubTool
- ImGui::SameLine(half + style.ItemSpacing.x);
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
drawKeepTextureCheckbox("Keep Texture##qremesh", kQRemeshPath);
}
drawQRemeshGuideControls();
@@ -351,7 +356,7 @@ void App::drawQRemeshGuideControls() {
const ImGuiStyle& style = ImGui::GetStyle();
const float full = ImGui::GetContentRegionAvail().x;
const float half = (full - style.ItemSpacing.x) * 0.5f;
- ImGui::SeparatorText("Guides");
+ tray::GroupLabel(*this, "Guides");
ui::ActionButton(*this, "brush.qremesh_guides", ImVec2(half, 0));
ImGui::SameLine();
ImGui::AlignTextToFramePadding();
@@ -573,7 +578,8 @@ void App::drawQRemeshGuides() {
void App::drawProjectContents() {
const ImGuiStyle& style = ImGui::GetStyle();
- ImGui::SeparatorText("Project");
+ const float x0 = ImGui::GetCursorPosX(); // line start, inside the section indent
+ tray::GroupLabel(*this, "Project");
const float half = (ImGui::GetContentRegionAvail().x - style.ItemSpacing.x) * 0.5f;
ui::ActionButton(*this, "subtool.project_all", ImVec2(half, 0));
ImGui::SameLine();
@@ -584,7 +590,7 @@ void App::drawProjectContents() {
"size. Raise it if parts don't pick up the detail; lower it where surfaces are close together.",
kProjectPath);
ImGui::SetNextItemWidth(half);
- ImGui::SliderInt("##pblur", &retopo_.projectBlur, 0, 10, "PA Blur %d");
+ tray::SliderInt("##pblur", &retopo_.projectBlur, 0, 10, "PA Blur %d");
ui::HelpText("PA Blur", nullptr, "Smooth the projected result this many times (softens noise from the source).",
kProjectPath);
ImGui::SameLine();
@@ -594,7 +600,8 @@ void App::drawProjectContents() {
kProjectPath);
ImGui::Checkbox("Geometry", &retopo_.projectGeometry);
ui::HelpText("Geometry", nullptr, "Project the shape (into the active sculpt layer).", kProjectPath);
- ImGui::SameLine(half + style.ItemSpacing.x);
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
ImGui::Checkbox("Polypaint", &retopo_.projectPolypaint);
ui::HelpText("Polypaint", nullptr, "Project the polypaint (into the active paint layer) when a source has any.",
kProjectPath);
diff --git a/src/app/PanelSculptable.cpp b/src/app/PanelSculptable.cpp
index 51ff4988..dd4a394a 100644
--- a/src/app/PanelSculptable.cpp
+++ b/src/app/PanelSculptable.cpp
@@ -11,6 +11,7 @@
// shows each run as splat_to_mesh / face_guides script lines.
#include "app/App.h"
#include "app/Demo.h"
+#include "app/Palettes.h"
#include "app/Ui.h"
#include "core/Sculptable.h"
@@ -306,7 +307,8 @@ void App::drawSculptableSection() {
if (!sculptable_) sculptable_ = std::make_shared<SculptableUiState>();
SculptableUiState& s = *sculptable_;
const ImGuiStyle& style = ImGui::GetStyle();
- ImGui::SeparatorText("From scan");
+ const float x0 = ImGui::GetCursorPosX(); // line start, inside the section indent
+ tray::GroupLabel(*this, "From scan");
Demo::pushScope("Make sculptable"); // UI tests: "Make sculptable/<label>"
struct PopScope {
~PopScope() { Demo::popScope(); }
@@ -353,7 +355,7 @@ void App::drawSculptableSection() {
ImGui::BeginDisabled(s.job != nullptr || s.reviewing);
ImGui::SetNextItemWidth(-1);
- ImGui::SliderInt("##sculptdetail", &s.detail, 96, 512, "Detail %d");
+ tray::SliderInt("##sculptdetail", &s.detail, 96, 512, "Detail %d");
ui::HelpText("Detail", nullptr,
"How finely the surface follows the capture: voxels across the subject. Higher keeps thinner parts and "
"more detail but takes longer (about 5 s at 384 for a million splats).",
@@ -377,7 +379,8 @@ void App::drawSculptableSection() {
"give QRemesh edge loops round the eyes and mouth and along the nasolabial folds, mirrored across "
"the face (animation topology). Turn the view to face it first.",
kPath);
- ImGui::SameLine(half + style.ItemSpacing.x);
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
ImGui::BeginDisabled(!s.faceLoops);
ImGui::Checkbox("Review##sculptable", &s.review);
ImGui::EndDisabled();
@@ -387,7 +390,8 @@ void App::drawSculptableSection() {
kPath);
ImGui::RadioButton("Polypaint##sculptcolor", &s.color, 0);
ui::HelpText("Polypaint", nullptr, "The capture's colours go into the vertices (polypaint): more polygons, more colour detail.", kPath);
- ImGui::SameLine(half + style.ItemSpacing.x);
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
ImGui::RadioButton("Texture##sculptcolor", &s.color, 1);
ui::HelpText("Texture", nullptr,
"Auto UV the result and bake the capture's colours into a 2K texture (sharp colour on a light mesh, "
@@ -397,21 +401,23 @@ void App::drawSculptableSection() {
ui::HelpText("Keep scan", nullptr,
"Keep the dense voxel surface as a hidden \"<name> Scan\" SubTool, to ProjectAll more detail from later.",
kPath);
- ImGui::SameLine(half + style.ItemSpacing.x);
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
ui::ActionButton(*this, "splats.sculptable_crop", ImVec2(-1, 0));
if (ImGui::TreeNode("More##sculptable")) {
ImGui::SetNextItemWidth(-1);
ui::SliderInside("##sculptopacity", &s.minOpacity, 0.0f, 0.9f, "Min Opacity %.2f");
ui::HelpText("Min Opacity", nullptr, "Splats fainter than this are ignored (haze and floaters are usually faint).", kPath);
ImGui::SetNextItemWidth(-1);
- ImGui::SliderInt("##sculptclose", &s.close, 0, 8, "Close Gaps %d");
+ tray::SliderInt("##sculptclose", &s.close, 0, 8, "Close Gaps %d");
ui::HelpText("Close Gaps", nullptr, "Seal gaps up to this many voxels between splats.", kPath);
ImGui::Checkbox("Fill holes", &s.fillHoles);
ui::HelpText("Fill holes", nullptr,
"Fill big holes such as the open bottom of a subject standing on a table (space boxed in on five "
"sides counts as inside). Turn off for open cavities like a cup.",
kPath);
- ImGui::SameLine(half + style.ItemSpacing.x);
+ ImGui::SameLine();
+ ImGui::SetCursorPosX(x0 + half + style.ItemSpacing.x); // the right column, inside the section indent
ImGui::Checkbox("All pieces", &s.keepParts);
ui::HelpText("All pieces", nullptr, "Keep every solid piece instead of only the largest (floaters come back too).", kPath);
ImGui::TreePop();
diff --git a/src/app/PanelSubTools.cpp b/src/app/PanelSubTools.cpp
index 32ae7a87..4f0dde66 100644
--- a/src/app/PanelSubTools.cpp
+++ b/src/app/PanelSubTools.cpp
@@ -22,7 +22,11 @@ namespace {
constexpr float kClickSlopPx = 4.0f; // movement that turns an Alt+click into a drag
constexpr int kListRows = 6; // the list scrolls beyond this many SubTools
-constexpr float kRowTint = 0.15f; // accent alpha of the active row; should become a theme token (Theme.h)
+// The SubTool list's colours; should become theme tokens (Theme.h).
+constexpr ImVec4 kListWell = theme::rgb(0x1c1c1f); // the recessed area behind the rows, a step below panelBg
+constexpr ImVec4 kRowSelected = theme::rgb(0xffffff, 0.09f); // the active row: lighter neutral, plus the accent bar
+constexpr ImVec4 kRowHover = theme::rgb(0xffffff, 0.11f);
+constexpr ImVec4 kRowPressed = theme::rgb(0xffffff, 0.14f);
const SDL_DialogFileFilter kAppendFilters[] = {
{"Models and projects", "obj;fbx;glb;gltf;ply;stl;GoZ;goz;usda;usd;usdz;sfproj"}, {"All files", "*"}};
@@ -128,12 +132,17 @@ void App::drawSubToolsContents() {
const float rowH = ImGui::GetTextLineHeight() + 2.0f * cellPad.y;
const float listH = rowH * float(std::min(count, kListRows)) + 2.0f;
ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPad);
- // The active row is a tint with an accent bar at its left edge, not a solid accent fill (docs/ui-design.md §10).
- ImGui::PushStyleColor(ImGuiCol_Header, theme::rgb(0xf0882e, kRowTint));
- ImGui::PushStyleColor(ImGuiCol_HeaderHovered, theme::rgb(0xf0882e, kRowTint + 0.06f));
- ImGui::PushStyleColor(ImGuiCol_HeaderActive, theme::rgb(0xf0882e, kRowTint + 0.12f));
- if (ImGui::BeginTable("##subtools", 4, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter,
- ImVec2(-1, listH))) {
+ // The list sits in a recessed well, no outline. The active row is a lighter neutral with the accent only as the
+ // 2 px bar at its left edge (docs/ui-design.md §10), so it doesn't read as a dimmed orange fill.
+ {
+ const ImVec2 w0 = ImGui::GetCursorScreenPos();
+ ImGui::GetWindowDrawList()->AddRectFilled(w0, ImVec2(w0.x + ImGui::GetContentRegionAvail().x, w0.y + listH),
+ ImGui::ColorConvertFloat4ToU32(kListWell), style.FrameRounding);
+ }
+ ImGui::PushStyleColor(ImGuiCol_Header, kRowSelected);
+ ImGui::PushStyleColor(ImGuiCol_HeaderHovered, kRowHover);
+ ImGui::PushStyleColor(ImGuiCol_HeaderActive, kRowPressed);
+ if (ImGui::BeginTable("##subtools", 4, ImGuiTableFlags_ScrollY | ImGuiTableFlags_RowBg | ImGuiTableFlags_PadOuterX, ImVec2(-1, listH))) {
const float eyeW = ImGui::GetTextLineHeight() * 1.2f;
ImGui::TableSetupColumn("name", ImGuiTableColumnFlags_WidthStretch);
// Subdivision levels, as ZBrush lists them ("SDiv 3/5"); empty for meshes without levels.
diff --git a/src/app/Pickers.cpp b/src/app/Pickers.cpp
index 215bc447..cb1b3090 100644
--- a/src/app/Pickers.cpp
+++ b/src/app/Pickers.cpp
@@ -41,6 +41,9 @@ constexpr ImU32 kFieldHairline = IM_COL32(255, 255, 255, 28); // inner highlight
constexpr ImU32 kFieldHover = IM_COL32(255, 255, 255, 90); // outline of the swatch under the mouse
constexpr ImU32 kMarkerLight = IM_COL32(255, 255, 255, 245); // SV ring and hue notch
constexpr ImU32 kMarkerDark = IM_COL32(0, 0, 0, 150); // their outline, readable on white
+constexpr float kFieldGap = 4.0f; // one gap between every part of the colour field (square, strip, swatches, Fill)
+constexpr float kHueStripW = 10.0f; // wide enough to read as a control next to the square
+constexpr float kSwatchH = 18.0f;
const SDL_DialogFileFilter kAlphaFilters[] = {{"Images", "png;jpg;jpeg;bmp;tga;psd;gif"}, {"All files", "*"}};
@@ -1189,7 +1192,7 @@ void App::drawColorWidget(float width) {
if (sat <= 1e-4f || val <= 1e-4f) h = store->GetFloat(hueKey, h);
if (val <= 1e-4f) sat = store->GetFloat(satKey, sat);
- const float stripW = 8.0f * s, gap = 6.0f * s;
+ const float stripW = kHueStripW * s, gap = kFieldGap * s;
const float squareW = width - stripW - gap, squareH = squareW;
bool changed = false;
@@ -1206,7 +1209,7 @@ void App::drawColorWidget(float width) {
if (ImGui::IsItemHovered() || ImGui::IsItemActive()) ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
ImGui::SameLine(0.0f, gap * 0.5f);
- // Hue, red at the top. The strip is slim; its hit area takes the half of the gap beside it too.
+ // Hue, red at the top. Its hit area takes the half of the gap beside it too.
const ImVec2 hs(ImGui::GetCursorScreenPos().x + gap * 0.5f, ImGui::GetCursorScreenPos().y);
const ImVec2 hsMax(hs.x + stripW, hs.y + squareH);
ImGui::InvisibleButton("hue", ImVec2(stripW + gap * 0.5f, squareH));
@@ -1233,7 +1236,7 @@ void App::drawColorWidget(float width) {
dl->AddRect(sq, sqMax, kFieldEdge, rounding, 0, 1.0f * s);
ringMarker(dl, ImVec2(sq.x + sat * squareW, sq.y + (1.0f - val) * squareH), 4.0f * s, s);
- // The strip: six bands, the end ones rounded, and a thin pill notch a little wider than it.
+ // The strip: six bands, the end ones rounded, and a thin bar across it that stays inside its ends.
const float band = squareH / 6.0f;
for (int i = 0; i < 6; ++i) {
float r0, g0, b0, r1, g1, b1;
@@ -1245,24 +1248,23 @@ void App::drawColorWidget(float width) {
i == 0 ? ImDrawFlags_RoundCornersTop : i == 5 ? ImDrawFlags_RoundCornersBottom : ImDrawFlags_RoundCornersNone);
}
dl->AddRect(hs, hsMax, kFieldEdge, stripW * 0.5f, 0, 1.0f * s);
- const float ny = std::clamp(hs.y + h * squareH, hs.y + 2.0f * s, hsMax.y - 2.0f * s);
- const ImVec2 na(hs.x - 2.0f * s, ny - 1.5f * s), nb(hsMax.x + 2.0f * s, ny + 1.5f * s);
- dl->AddRect(ImVec2(na.x - 1.0f * s, na.y - 1.0f * s), ImVec2(nb.x + 1.0f * s, nb.y + 1.0f * s), kMarkerDark, 3.0f * s, 0,
+ const float ny = std::clamp(hs.y + h * squareH, hs.y + 2.5f * s, hsMax.y - 2.5f * s);
+ const ImVec2 na(hs.x - 1.0f * s, ny - 1.5f * s), nb(hsMax.x + 1.0f * s, ny + 1.5f * s);
+ dl->AddRect(ImVec2(na.x - 1.0f * s, na.y - 1.0f * s), ImVec2(nb.x + 1.0f * s, nb.y + 1.0f * s), kMarkerDark, 2.0f * s, 0,
1.0f * s);
- dl->AddRectFilled(na, nb, kMarkerLight, 2.0f * s);
+ dl->AddRectFilled(na, nb, kMarkerLight, 1.5f * s);
ImGui::PopStyleVar();
ImGui::PopID();
ImGui::EndGroup();
ui::HelpText("Colour", "C", "The polypaint colour (C over the model picks one).", "Left shelf");
- // Two swatches, like ZBrush's main and secondary colour: clicking either swaps them ("Alternate"). The main one is
- // wide, the second a small square beside it.
- ImGui::Dummy(ImVec2(0.0f, 2.0f * s));
- const float swH = 20.0f * s, secondW = 20.0f * s;
- const float mainW = width - secondW - gap;
+ // Two swatches, like ZBrush's main and secondary colour: clicking either swaps them ("Alternate"). Equal halves of
+ // the column, main on the left, the same gap as between the square and the strip.
+ const float swH = kSwatchH * s;
+ const float mainW = std::floor((width - gap) * 0.5f), secondW = width - gap - mainW;
const glm::vec3 second = linearToSrgb(secondaryColor_);
- ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(gap, ImGui::GetStyle().ItemSpacing.y));
+ ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(gap, gap));
const ImVec2 pa = ImGui::GetCursorScreenPos();
bool swap = ImGui::InvisibleButton("##primary", ImVec2(mainW, swH));
swatch(dl, pa, ImVec2(pa.x + mainW, pa.y + swH), ImVec4(srgb.x, srgb.y, srgb.z, 1.0f), rounding, s, ImGui::IsItemHovered());
@@ -1273,10 +1275,9 @@ void App::drawColorWidget(float width) {
swatch(dl, pb, ImVec2(pb.x + secondW, pb.y + swH), ImVec4(second.x, second.y, second.z, 1.0f),
rounding, s, ImGui::IsItemHovered());
ui::HelpText("Second colour", nullptr, "Click to swap it with the main colour (ZBrush Alternate).", "Left shelf");
- ImGui::PopStyleVar();
if (swap) std::swap(doc_.paintColor, secondaryColor_);
- ImGui::Dummy(ImVec2(0.0f, 2.0f * s));
ui::ActionButton(*this, "color.fill", ImVec2(width, 0), ui::Look::IconLabel);
+ ImGui::PopStyleVar();
ui::HelpAction(*this, "color.fill");
ImGui::EndGroup();
}
diff --git a/src/core/Document.h b/src/core/Document.h
index 338f744d..0e81a813 100644
--- a/src/core/Document.h
+++ b/src/core/Document.h
@@ -55,7 +55,7 @@ struct Document {
std::vector<BrushRecipe> brushes = builtinBrushRecipes();
int activeBrush = -1; // index into `brushes`, -1 = use a built-in brush type
BrushAlpha brushAlpha; // stamp shaping every brush's falloff (empty = round); brush_set_alpha
- glm::vec3 paintColor{0.6f, 0.03f, 0.02f}; // current polypaint colour (linear RGB; see set_color)
+ glm::vec3 paintColor{0.22f, 0.22f, 0.22f}; // current polypaint colour (linear RGB; see set_color); a mid grey
// Vector displacement maps for the VDM brush (core/Vdm.h): the built-ins, then the studio and user
// library's .sfvdm files and any loaded this session. `brushVdm` is the one the VDM brush stamps.
std::vector<std::shared_ptr<const VectorDisplacement>> vdms = builtinVdms();