feat(ShaderBake): 细节面板六个板块改用 Foldout 折叠

原来每个板块标题是个带复选框的 Toggle:功能上能折,但看着像"启用开关",
不容易发现是在折叠。现在换成 Foldout,标题左侧的三角就是状态,整条可点、
悬停有底色,六块各自独立折叠;全局参数仍默认折叠。
组内内容的左右留边挪到 .unity-foldout__content 上,BindSections/Collapsible 一并删掉。
This commit is contained in:
2026-11-07 11:27:39 +08:00
parent 0432c51678
commit 8262d5a5b7
5 changed files with 28 additions and 65 deletions
@@ -174,7 +174,6 @@ namespace XericUI.ShaderBake.Editor
BuildGlobalTable();
BindFaceGrid();
BindToolbar();
BindSections();
BindSettings();
BindDetailSplit();
@@ -414,33 +413,6 @@ namespace XericUI.ShaderBake.Editor
return "BakedImage";
}
// ── 分组折叠 ────────────────────────────────────────────
private void BindSections()
{
// 头部是 Toggle(名字带 -head),外层同名容器只是分组壳,别拿它去 Q<Toggle>
Collapsible("sec-source-head", "sec-source-body");
Collapsible("sec-output-head", "sec-output-body");
Collapsible("sec-surface-head", "sec-surface-body");
Collapsible("sec-camera-head", "sec-camera-body");
Collapsible("sec-globals-head", "sec-globals-body");
Collapsible("sec-props-head", "sec-props-body");
}
private void Collapsible(string headName, string bodyName)
{
Toggle head = rootVisualElement.Q<Toggle>(headName);
VisualElement body = rootVisualElement.Q<VisualElement>(bodyName);
if (head == null || body == null)
{
Debug.LogError("[ShaderBake] 分组节点不成对:" + headName + " / " + bodyName);
return;
}
body.style.display = head.value ? DisplayStyle.Flex : DisplayStyle.None;
head.RegisterValueChangedCallback(evt =>
body.style.display = evt.newValue ? DisplayStyle.Flex : DisplayStyle.None);
}
// ── 输入源 ──────────────────────────────────────────────
private void BindSettings()