From afef2fcb678e9bcf8d67d111ba000dd26325128d Mon Sep 17 00:00:00 2001 From: LiRuoChen <571244399@qq.com> Date: Sat, 7 Nov 2026 10:22:19 +0800 Subject: [PATCH] =?UTF-8?q?fix(ShaderBake):=20=E7=82=B9=E9=80=89=E5=88=AB?= =?UTF-8?q?=E7=9A=84=E6=A0=BC=E5=AD=90=E5=90=8E=20UV=20X/Y=20=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E6=A1=86=E4=B8=8D=E8=B7=9F=E7=9D=80=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这两个框只在 SyncUiFromSettings 里同步,而点选走的是 RefreshFaceUi, 于是选中框、编号都换到新格子了,右边还停在上一格(或刚加的那一格)的数值上。 RefreshFaceUi 里补一次 SetValueWithoutNotify。 --- Editor/ShaderBake/BakeShaderAsImageWindow.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Editor/ShaderBake/BakeShaderAsImageWindow.cs b/Editor/ShaderBake/BakeShaderAsImageWindow.cs index 141ddf5..2722631 100644 --- a/Editor/ShaderBake/BakeShaderAsImageWindow.cs +++ b/Editor/ShaderBake/BakeShaderAsImageWindow.cs @@ -769,9 +769,22 @@ namespace XericUI.ShaderBake.Editor : "第 " + (m_SelectedFace + 1) + " 格 · UV (" + cell.uvX + ", " + cell.uvY + ")"; } SetFaceFieldsEnabled(!meshMode); + // 两个 UV 输入框绑的是"当前选中格",换格就得跟着换; + // 它们只在 SyncUiFromSettings 里同步,点选走的是这条路径,不补这一句就一直停在旧格上 + SetFaceUvFields(cell); UpdateFaceOverlay(); } + private void SetFaceUvFields(ShaderBakeFaceCell cell) + { + int uvX = cell != null ? cell.uvX : 0; + int uvY = cell != null ? cell.uvY : 0; + var x = rootVisualElement.Q("face-uv-x") as INotifyValueChanged; + if (x != null) x.SetValueWithoutNotify(uvX); + var y = rootVisualElement.Q("face-uv-y") as INotifyValueChanged; + if (y != null) y.SetValueWithoutNotify(uvY); + } + private void SetFaceFieldsEnabled(bool enabled) { VisualElement x = rootVisualElement.Q("face-uv-x");