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: hand-drawn colour field, quiet sub-palette headers, tinted SubTool row

islandmed91e8954dfa80
diff --git a/docs/ui-design.md b/docs/ui-design.md
index d352c7f3..8c28375f 100644
--- a/docs/ui-design.md
+++ b/docs/ui-design.md
@@ -496,6 +496,8 @@ Style:
- Spacing: `FramePadding (6,3)`, `ItemSpacing (4,4)`, `ItemInnerSpacing (4,4)`.
- `ScrollbarSize 10`, `GrabMinSize 6`.
- 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.
---
diff --git a/src/app/Palettes.cpp b/src/app/Palettes.cpp
index 8d7c5b41..1f987d6f 100644
--- a/src/app/Palettes.cpp
+++ b/src/app/Palettes.cpp
@@ -57,6 +57,9 @@ 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);
+
// A row of equal-width action buttons filling the line.
void actionRow(App& app, std::initializer_list<const char*> ids) {
std::vector<const char*> present;
@@ -91,10 +94,13 @@ void menuAction(App& app, const char* id) {
ui::HelpAction(app, id);
}
-void hint(const char* text) {
+// Helper text under a palette's controls: small and dim, so it doesn't compete with them.
+void hint(const App& app, const char* text) {
+ if (app.smallFont()) ImGui::PushFont(app.smallFont());
ImGui::PushStyleColor(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_TextDisabled));
ImGui::TextWrapped("%s", text);
ImGui::PopStyleColor();
+ if (app.smallFont()) ImGui::PopFont();
}
} // namespace
@@ -103,19 +109,25 @@ 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 = 22.0f * s;
+ const float h = 24.0f * 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.
ImDrawList* dl = ImGui::GetWindowDrawList();
- dl->AddRectFilled(p, ImVec2(p.x + w, p.y + h), theme::u32(hovered ? theme::headerHover : theme::header, isOpen ? 1.0f : 0.75f),
- 2.0f * s);
- if (isOpen) dl->AddRectFilled(p, ImVec2(p.x + 2.0f * s, p.y + h), theme::u32(theme::accent), 0.0f);
- const float ty = p.y + (h - ImGui::GetFontSize()) * 0.5f;
- dl->AddText(ImVec2(p.x + 6.0f * s, ty), theme::u32(isOpen ? theme::accent : theme::textDim),
+ 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),
+ 2.0f * s);
+ 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);
- dl->AddText(ImVec2(p.x + 24.0f * s, ty), theme::u32(isOpen || hovered ? theme::text : theme::text, isOpen ? 1.0f : 0.85f), title);
+ 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);
ImGui::LogText("%s", title);
ui::HelpText(title, nullptr,
"Click to open or close. Opening one closes the others (Shift+click keeps them open; Preferences > "
@@ -135,7 +147,7 @@ bool App::subpalette(const char* id, const char* title) {
}
isOpen = !isOpen;
}
- if (isOpen) ImGui::Dummy(ImVec2(0, 1.0f * s));
+ if (isOpen) ImGui::Dummy(ImVec2(0, 2.0f * s));
return isOpen;
}
@@ -200,7 +212,7 @@ void App::drawPalette_Draw() {
"size for the whole mesh, set by Detail. A preference (Store Config keeps it).",
"Draw > Dynamic topology");
if (doc_.sculptor.dyntopo.enabled && !dyntopoBlocker(doc_.mesh).empty())
- hint("This SubTool has subdivision levels, so strokes don't remesh it: delete the lower (or higher) levels "
+ hint(*this, "This SubTool has subdivision levels, so strokes don't remesh it: delete the lower (or higher) levels "
"first.");
ImGui::SeparatorText("Tablet");
ImGui::Checkbox("Pressure > strength", &pressureStrength_);
@@ -250,7 +262,7 @@ void App::drawPalette_File() {
void App::drawPalette_Generate() {
actionRow(*this, {"ui.generate3d"});
- hint("Image or text to a sculptable 3D model: Hugging Face (free), fal.ai, Meshy, your ComfyUI server, your own "
+ 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");
if (ImGui::Button(refImage_.empty() ? "Choose image...##generate" : "Change image...##generate", ImVec2(-1, 0))) {
@@ -347,7 +359,7 @@ void App::drawPalette_Script() {
actionRow(*this, {"script.run_file"});
actionRow(*this, {"script.copy_session", "script.clear_console"});
if (!any)
- hint("Every action is a script command: run them with --script \"subdivide; remesh resolution=200\" or the "
+ hint(*this, "Every action is a script command: run them with --script \"subdivide; remesh resolution=200\" or the "
"sculptforge-cli tool.");
}
diff --git a/src/app/PanelSubTools.cpp b/src/app/PanelSubTools.cpp
index d5476f08..32ae7a87 100644
--- a/src/app/PanelSubTools.cpp
+++ b/src/app/PanelSubTools.cpp
@@ -6,8 +6,11 @@
// the ZBrush viewport gesture Alt+click to select a SubTool. Every action goes
// through the subtool_* commands (core/SubTools.cpp).
#include "app/App.h"
+#include "app/Theme.h"
#include "core/Multires.h"
+#include <imgui_internal.h>
+
#include <algorithm>
#include <cmath>
#include <cstdio>
@@ -19,6 +22,7 @@ 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)
const SDL_DialogFileFilter kAppendFilters[] = {
{"Models and projects", "obj;fbx;glb;gltf;ply;stl;GoZ;goz;usda;usd;usdz;sfproj"}, {"All files", "*"}};
@@ -124,6 +128,10 @@ 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))) {
const float eyeW = ImGui::GetTextLineHeight() * 1.2f;
@@ -165,6 +173,12 @@ void App::drawSubToolsContents() {
!isActive)
selectIndex = i;
if (!s.visible) ImGui::PopStyleColor();
+ if (isActive) {
+ const ImVec2 r0 = ImGui::GetItemRectMin(), r1 = ImGui::GetItemRectMax();
+ const float x = ImGui::TableGetCellBgRect(ImGui::GetCurrentTable(), 0).Min.x;
+ 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)) {
renamingSubtool_ = s.id;
focusRename_ = true;
@@ -218,6 +232,7 @@ void App::drawSubToolsContents() {
}
ImGui::EndTable();
}
+ ImGui::PopStyleColor(3);
ImGui::PopStyleVar();
if (renameIndex >= 0 && !renameTo.empty() && renameTo != doc_.subtools[size_t(renameIndex)].name)
@@ -262,6 +277,8 @@ void App::drawSubToolsContents() {
confirm("Delete SubTool?", "Delete \"" + activeName + "\"? This can't be undone.", "Delete", "subtool_delete");
ImGui::EndDisabled();
+ const float half2 = (ImGui::GetContentRegionAvail().x - style.ItemSpacing.x) * 0.5f;
+ const float arrowW = ImGui::GetFrameHeight();
ImGui::BeginDisabled(active <= 0);
if (ImGui::ArrowButton("##up", ImGuiDir_Up)) runCommand("subtool_move", {{"direction", std::string("up")}});
ImGui::EndDisabled();
@@ -274,11 +291,10 @@ void App::drawSubToolsContents() {
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled | ImGuiHoveredFlags_DelayNormal))
ImGui::SetTooltip("Move down the list");
ImGui::SameLine();
- const float half2 = (ImGui::GetContentRegionAvail().x - style.ItemSpacing.x) * 0.5f;
const bool solo = count > 1 && visibleCount == 1 && doc_.activeSubtoolInfo().visible;
ImGui::BeginDisabled(count < 2);
if (solo) ImGui::PushStyleColor(ImGuiCol_Button, style.Colors[ImGuiCol_ButtonActive]);
- if (ImGui::Button("Solo", ImVec2(half2, 0))) runCommand("subtool_solo");
+ if (ImGui::Button("Solo", ImVec2(half2 - 2.0f * (arrowW + style.ItemSpacing.x), 0))) runCommand("subtool_solo");
if (solo) ImGui::PopStyleColor();
ImGui::EndDisabled();
if (ImGui::IsItemHovered(ImGuiHoveredFlags_DelayNormal))
@@ -327,7 +343,9 @@ void App::drawSubToolsContents() {
ImGui::EndDisabled();
if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled | ImGuiHoveredFlags_DelayNormal))
ImGui::SetTooltip("One SubTool per disconnected piece");
+ if (fontSmall_) ImGui::PushFont(fontSmall_);
ImGui::TextDisabled("Alt+click a SubTool to select it");
+ if (fontSmall_) ImGui::PopFont();
}
void App::drawSubToolPopups() {
diff --git a/src/app/Pickers.cpp b/src/app/Pickers.cpp
index 4f77fa96..215bc447 100644
--- a/src/app/Pickers.cpp
+++ b/src/app/Pickers.cpp
@@ -35,6 +35,12 @@ constexpr ImU32 kGlyph = IM_COL32(140, 140, 144, 255);
constexpr ImU32 kText = IM_COL32(216, 216, 216, 255);
constexpr ImU32 kTextDim = IM_COL32(140, 140, 144, 255);
constexpr ImU32 kPanelBg = IM_COL32(37, 37, 40, 252); // #252528, pop-ups
+// The left tray's colour field. These should become theme tokens (Theme.h) once the theme settles.
+constexpr ImU32 kFieldEdge = IM_COL32(14, 14, 16, 255); // 1 px around the SV square, hue strip and swatches
+constexpr ImU32 kFieldHairline = IM_COL32(255, 255, 255, 28); // inner highlight that lifts a swatch off the tray
+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
const SDL_DialogFileFilter kAlphaFilters[] = {{"Images", "png;jpg;jpeg;bmp;tga;psd;gif"}, {"All files", "*"}};
@@ -1123,4 +1129,156 @@ void drawPickers(App& app) {
}
}
+// ---------------------------------------------------------------------------
+// The left tray's colour field: a saturation/value square, a slim hue strip and the main/second swatches. Drawn
+// by hand rather than with ImGui::ColorPicker3 so its markers and corners match the rest of the shell.
+
+namespace {
+
+// Fills a rounded rect, then gives its vertices a linear gradient from `c0` at `p0` to `c1` at `p1` (colour and alpha;
+// the anti-aliased fringe stays transparent).
+void gradientRect(ImDrawList* dl, ImVec2 a, ImVec2 b, ImVec2 p0, ImVec2 p1, ImU32 c0, ImU32 c1, float rounding,
+ ImDrawFlags flags) {
+ const int start = dl->VtxBuffer.Size;
+ dl->AddRectFilled(a, b, IM_COL32_WHITE, rounding, flags);
+ const ImVec2 d(p1.x - p0.x, p1.y - p0.y);
+ const float len2 = std::max(d.x * d.x + d.y * d.y, 1e-6f);
+ const ImVec4 f0 = ImGui::ColorConvertU32ToFloat4(c0), f1 = ImGui::ColorConvertU32ToFloat4(c1);
+ for (int i = start; i < dl->VtxBuffer.Size; ++i) {
+ ImDrawVert& v = dl->VtxBuffer[i];
+ const float t = std::clamp(((v.pos.x - p0.x) * d.x + (v.pos.y - p0.y) * d.y) / len2, 0.0f, 1.0f);
+ const float fringe = float((v.col >> IM_COL32_A_SHIFT) & 0xff) / 255.0f; // 0 on the anti-aliased edge
+ v.col = ImGui::ColorConvertFloat4ToU32(ImVec4(f0.x + (f1.x - f0.x) * t, f0.y + (f1.y - f0.y) * t,
+ f0.z + (f1.z - f0.z) * t, (f0.w + (f1.w - f0.w) * t) * fringe));
+ }
+}
+
+// The SV square's marker: a light ring with a dark outline inside and out, readable on any colour.
+void ringMarker(ImDrawList* dl, ImVec2 c, float r, float s) {
+ dl->AddCircle(c, r + 1.0f * s, kMarkerDark, 20, 1.0f * s);
+ dl->AddCircle(c, r, kMarkerLight, 20, 1.5f * s);
+ dl->AddCircle(c, r - 1.25f * s, kMarkerDark, 20, 0.75f * s);
+}
+
+// A colour swatch with a 1 px edge and an inner hairline.
+void swatch(ImDrawList* dl, ImVec2 a, ImVec2 b, ImVec4 colour, float rounding, float s, bool hovered) {
+ dl->AddRectFilled(a, b, ImGui::ColorConvertFloat4ToU32(colour), rounding);
+ dl->AddRect(ImVec2(a.x + 1.0f * s, a.y + 1.0f * s), ImVec2(b.x - 1.0f * s, b.y - 1.0f * s),
+ hovered ? kFieldHover : kFieldHairline, std::max(0.0f, rounding - 1.0f * s), 0, 1.0f * s);
+ dl->AddRect(a, b, kFieldEdge, rounding, 0, 1.0f * s);
+}
+
+} // namespace
+
+void App::drawColorWidget(float width) {
+ const float s = uiScale_;
+ const float rounding = 3.0f * s;
+ ImDrawList* dl = ImGui::GetWindowDrawList();
+ ImGui::BeginGroup(); // the whole widget, one item for the shelf
+ ImGui::BeginGroup(); // the field, one item for its help
+ ImGui::PushID("##shelfcolor");
+ ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0.0f, 0.0f));
+
+ // Hue and saturation are kept between frames: a grey or black has none of its own, and dragging through one must
+ // not lose the hue the user chose.
+ glm::vec3 srgb = linearToSrgb(doc_.paintColor);
+ ImGuiStorage* store = ImGui::GetStateStorage();
+ const ImGuiID hueKey = ImGui::GetID("hue.kept"), satKey = ImGui::GetID("sat.kept");
+ float h = 0.0f, sat = 0.0f, val = 0.0f;
+ ImGui::ColorConvertRGBtoHSV(srgb.x, srgb.y, srgb.z, h, sat, val);
+ 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 squareW = width - stripW - gap, squareH = squareW;
+ bool changed = false;
+
+ // Saturation across, value down.
+ const ImVec2 sq = ImGui::GetCursorScreenPos();
+ const ImVec2 sqMax(sq.x + squareW, sq.y + squareH);
+ ImGui::InvisibleButton("sv", ImVec2(squareW, squareH));
+ if (ImGui::IsItemActive()) {
+ const ImVec2 m = ImGui::GetIO().MousePos;
+ sat = std::clamp((m.x - sq.x) / squareW, 0.0f, 1.0f);
+ val = 1.0f - std::clamp((m.y - sq.y) / squareH, 0.0f, 1.0f);
+ changed = true;
+ }
+ 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.
+ 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));
+ if (ImGui::IsItemActive()) {
+ h = std::clamp((ImGui::GetIO().MousePos.y - hs.y) / squareH, 0.0f, 0.9999f);
+ changed = true;
+ }
+ if (ImGui::IsItemHovered() || ImGui::IsItemActive()) ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
+
+ if (changed) {
+ store->SetFloat(hueKey, h);
+ store->SetFloat(satKey, sat);
+ ImGui::ColorConvertHSVtoRGB(h, sat, val, srgb.x, srgb.y, srgb.z);
+ doc_.paintColor = srgbToLinear(srgb);
+ }
+
+ // The square: white to the pure hue across, then clear to black down.
+ float hr = 0, hg = 0, hb = 0;
+ ImGui::ColorConvertHSVtoRGB(h, 1.0f, 1.0f, hr, hg, hb);
+ gradientRect(dl, sq, sqMax, sq, ImVec2(sqMax.x, sq.y), IM_COL32_WHITE, ImGui::ColorConvertFloat4ToU32(ImVec4(hr, hg, hb, 1)),
+ rounding, ImDrawFlags_RoundCornersAll);
+ gradientRect(dl, sq, sqMax, sq, ImVec2(sq.x, sqMax.y), IM_COL32(0, 0, 0, 0), IM_COL32_BLACK, rounding,
+ ImDrawFlags_RoundCornersAll);
+ 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.
+ const float band = squareH / 6.0f;
+ for (int i = 0; i < 6; ++i) {
+ float r0, g0, b0, r1, g1, b1;
+ ImGui::ColorConvertHSVtoRGB(float(i) / 6.0f, 1, 1, r0, g0, b0);
+ ImGui::ColorConvertHSVtoRGB(float(i + 1) / 6.0f, 1, 1, r1, g1, b1);
+ const ImVec2 a(hs.x, hs.y + band * float(i)), b(hsMax.x, i == 5 ? hsMax.y : hs.y + band * float(i + 1));
+ gradientRect(dl, a, b, a, ImVec2(a.x, b.y), ImGui::ColorConvertFloat4ToU32(ImVec4(r0, g0, b0, 1)),
+ ImGui::ColorConvertFloat4ToU32(ImVec4(r1, g1, b1, 1)), stripW * 0.5f,
+ 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,
+ 1.0f * s);
+ dl->AddRectFilled(na, nb, kMarkerLight, 2.0f * 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;
+ const glm::vec3 second = linearToSrgb(secondaryColor_);
+ ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(gap, ImGui::GetStyle().ItemSpacing.y));
+ 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());
+ ui::HelpText("Main colour", nullptr, "Click to swap with the second colour.", "Left shelf");
+ ImGui::SameLine();
+ const ImVec2 pb = ImGui::GetCursorScreenPos();
+ swap |= ImGui::InvisibleButton("##secondary", ImVec2(secondW, swH));
+ 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);
+ ui::HelpAction(*this, "color.fill");
+ ImGui::EndGroup();
+}
+
} // namespace sf
diff --git a/src/app/Shell.cpp b/src/app/Shell.cpp
index 0ba7ec02..877656de 100644
--- a/src/app/Shell.cpp
+++ b/src/app/Shell.cpp
@@ -1630,29 +1630,6 @@ void App::drawMaterialTile(const char* id, ImVec2 size) {
ui::HelpText("Material", "M", "How the model is shaded in the view. Click for the material picker.", "Left shelf");
}
-void App::drawColorWidget(float width) {
- const float s = uiScale_;
- ImGui::BeginGroup();
- glm::vec3 srgb = linearToSrgb(doc_.paintColor);
- ImGui::SetNextItemWidth(width);
- if (ImGui::ColorPicker3("##shelfcolor", glm::value_ptr(srgb),
- ImGuiColorEditFlags_NoSidePreview | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel |
- ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_PickerHueBar))
- doc_.paintColor = srgbToLinear(srgb);
- 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 swaps them ("Alternate").
- const float sw = (width - ImGui::GetStyle().ItemSpacing.x) * 0.5f;
- const glm::vec3 second = linearToSrgb(secondaryColor_);
- bool swap = ImGui::ColorButton("##primary", ImVec4(srgb.x, srgb.y, srgb.z, 1.0f), ImGuiColorEditFlags_NoTooltip, ImVec2(sw, 22.0f * s));
- ui::HelpText("Main colour", nullptr, "Click to swap with the second colour.", "Left shelf");
- ImGui::SameLine();
- swap |= ImGui::ColorButton("##secondary", ImVec4(second.x, second.y, second.z, 1.0f), ImGuiColorEditFlags_NoTooltip,
- ImVec2(sw, 22.0f * s));
- ui::HelpText("Second colour", nullptr, "Click to swap it with the main colour (ZBrush Alternate).", "Left shelf");
- if (swap) std::swap(doc_.paintColor, secondaryColor_);
- ui::ActionButton(*this, "color.fill", ImVec2(width, 0), ui::Look::IconLabel);
- ui::HelpAction(*this, "color.fill");
- ImGui::EndGroup();
-}
+// drawColorWidget (the left tray's colour field) is in Pickers.cpp.
} // namespace sf