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.

AI off: the Generate panel's title is From Image too (header, tray texts), as its menu section

islandmedf4fb1d01cc29
diff --git a/src/app/Palettes.cpp b/src/app/Palettes.cpp
index ee7e1bc8..a167e38f 100644
--- a/src/app/Palettes.cpp
+++ b/src/app/Palettes.cpp
@@ -87,6 +87,10 @@ int taskMenuOf(std::string_view paletteId) {
return -1;
}
+const char* paletteTitle(const PaletteDef& p) {
+ return std::string_view(p.id) == "generate" && !ai::aiEnabled() ? "From Image" : p.name;
+}
+
const char* taskSectionTitle(const TaskMenuDef& menu, int k) {
if (std::string_view(menu.sections[k]) == "generate" && !ai::aiEnabled()) return "From Image";
if (menu.titles[k]) return menu.titles[k];
diff --git a/src/app/Shell.cpp b/src/app/Shell.cpp
index c7259474..390c2966 100644
--- a/src/app/Shell.cpp
+++ b/src/app/Shell.cpp
@@ -1756,13 +1756,13 @@ bool App::paletteHeader(const char* id, bool inTray, bool right) {
const bool iconHovered = ImGui::IsItemHovered();
if (!inTray && ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceNoDisableHover)) {
ImGui::SetDragDropPayload("SF_PALETTE", id, std::strlen(id) + 1);
- ImGui::Text(ICON_LC_PANEL_RIGHT " %s", tr(def->name));
+ ImGui::Text(ICON_LC_PANEL_RIGHT " %s", tr(paletteTitle(*def)));
ImGui::EndDragDropSource();
}
- if (inTray) ui::HelpText("Back to the palette bar", nullptr, "Take this palette out of the tray.", tr(def->name));
+ if (inTray) ui::HelpText("Back to the palette bar", nullptr, "Take this palette out of the tray.", tr(paletteTitle(*def)));
else
ui::HelpText("Move to the tray", nullptr,
- "Keep this palette in the right tray (Shift+click: left tray), or drag the icon onto a tray.", tr(def->name));
+ "Keep this palette in the right tray (Shift+click: left tray), or drag the icon onto a tray.", tr(paletteTitle(*def)));
centredText(dl, nullptr, p, ImVec2(p.x + h, p.y + h), theme::u32(iconHovered ? theme::accentHover : theme::textDim),
inTray ? (right ? ICON_LC_PANEL_RIGHT : ICON_LC_PANEL_LEFT) : ICON_LC_PANEL_RIGHT);
ImGui::SameLine();
@@ -1770,7 +1770,7 @@ bool App::paletteHeader(const char* id, bool inTray, bool right) {
const bool titleHovered = ImGui::IsItemHovered();
if (fontBold_) ImGui::PushFont(fontBold_);
{
- std::string title = tr(def->name);
+ std::string title = tr(paletteTitle(*def));
if (theme::look.upperHeaders)
for (auto& c : title) c = char(std::toupper(static_cast<unsigned char>(c)));
if (headers == Headers::Ascii) title = "[ " + title + " ]";
@@ -1786,7 +1786,7 @@ bool App::paletteHeader(const char* id, bool inTray, bool right) {
dl->AddText(ImVec2(x0, tp.y), theme::u32(theme::accent, 0.55f), run.c_str());
}
}
- ImGui::LogText("%s", tr(def->name));
+ ImGui::LogText("%s", tr(paletteTitle(*def)));
if (fontBold_) ImGui::PopFont();
ImGui::SameLine();
const bool endClicked = ImGui::InvisibleButton(inTray ? "##collapse" : "##close", ImVec2(h, h));
diff --git a/src/app/Shell.h b/src/app/Shell.h
index 9af59d12..e29aa176 100644
--- a/src/app/Shell.h
+++ b/src/app/Shell.h
@@ -27,6 +27,8 @@ struct PaletteDef {
};
const PaletteDef* palettes(int& count); // alphabetical
const PaletteDef* findPalette(std::string_view id);
+// A palette's name on its panel: Generate is "From Image" while Preferences > AI is off (Relief, Inflate, Stamp).
+const char* paletteTitle(const PaletteDef& p);
// The SculptForge layout's menus, grouped by task (File, Edit, Sculpt, Paint, Mesh, View, Render, Help). Each holds
// whole palettes as its sections, so every palette (and so every item) has exactly one menu.
diff --git a/tests/ui/ai_switch.sfui b/tests/ui/ai_switch.sfui
index be23299b..e7e2541c 100644
--- a/tests/ui/ai_switch.sfui
+++ b/tests/ui/ai_switch.sfui
@@ -33,6 +33,8 @@ wait 0.2
click "Mesh##menu.mesh"
expect "From Image##section.generate"
expect_not "Generate 3D##section.generate"
+# The panel's title too, not Generate.
+expect_text "From Image"
expect_not "Generate 3D##ui.generate3d"
shot ai-mesh-menu-off
key escape