diff --git a/Documentation~/EXPERIMENTS.md b/Documentation~/EXPERIMENTS.md index 54ed2b86..1c88eeb2 100644 --- a/Documentation~/EXPERIMENTS.md +++ b/Documentation~/EXPERIMENTS.md @@ -351,3 +351,11 @@ - EditMode red/green: `TransferTargetDetection_IgnoresSourceOnlySelection`. - EditMode red/green: `Uv2PixelMargin_ScalesFromResolvedAtlasSize`. - Full model benchmark (Carousel/Playground/WateringCan) в этом checkout не прогнан: тестовые FBX/`BenchmarkReports/` отсутствуют в репозитории. Нужен ручной Unity прогон на suite для финального сравнения `repackMs`, `density spread`, `overlapShellPairs`, `invertedCount`, `texelDensityBadCount`. + +## Эксперимент 2026-08-06 — Apply UV2 после source-only repack + +**Проблема:** оптимизация source-only pipeline корректно пропускала transfer, но оставляла `HasTransfer = false`. Из-за общего UI-gate результат repack нельзя было применить к FBX. + +**Изменение:** Quality Report и Validation Overlay по-прежнему требуют завершённого transfer, а Apply/Reset actions теперь доступны после repack или transfer. Transfer и auto-tune для source-only workflow остаются пропущенными. + +**Проверка:** EditMode-тест `ApplyUv2_IsAvailable_AfterSourceOnlyRepack` фиксирует доступность Apply при `HasRepack = true` и `HasTransfer = false`. diff --git a/Editor/Tools/LightmapTransferTool.cs b/Editor/Tools/LightmapTransferTool.cs index 4e680229..0f3d92e0 100644 --- a/Editor/Tools/LightmapTransferTool.cs +++ b/Editor/Tools/LightmapTransferTool.cs @@ -44,6 +44,11 @@ static bool HasIncludedTransferTargets(IEnumerable entries, int sourc return false; } + static bool CanApplyUv2(bool hasRepack, bool hasTransfer) + { + return hasRepack || hasTransfer; + } + // ── Internal tab ── enum Tab { Setup, Repack, Transfer } Tab tab = Tab.Setup; @@ -1259,19 +1264,13 @@ void DrawTransfer() EditorStyles.miniLabel); EditorGUI.indentLevel--; } + } + if (CanApplyUv2(ctx.HasRepack, ctx.HasTransfer)) + { EditorGUILayout.Space(6); - // Post-transfer actions — what you do immediately after a - // successful UV2 transfer (apply to FBX / reset). - // - // FBX export ("Overwrite FBX" / "Export New FBX" / - // "Backup from main") and "Save Mesh Assets" live in the - // sidebar footer for any tab; duplicating them here was - // confusing redundancy. - // - // "Generate LODs" was rendered here too, but LOD generation - // is the job of the dedicated LOD Gen tab — keeping it on - // Transfer made the tab feel scope-creepy. + // The source LOD can be applied immediately after repack, + // even when there are no included target LODs to transfer. H("Apply UV2"); ColorBtn(new Color(.3f,.85f,.4f), "Apply UV2 to FBX", 26, ApplyUv2ToFbx); EditorGUILayout.Space(2); diff --git a/Tests/Editor/XatlasRepackGroupMergeTests.cs b/Tests/Editor/XatlasRepackGroupMergeTests.cs index d86c0c6f..7cfee03e 100644 --- a/Tests/Editor/XatlasRepackGroupMergeTests.cs +++ b/Tests/Editor/XatlasRepackGroupMergeTests.cs @@ -224,5 +224,19 @@ public void TransferTargetDetection_IgnoresSourceOnlySelection() Object.DestroyImmediate(e.originalMesh); } } + + [Test] + public void ApplyUv2_IsAvailable_AfterSourceOnlyRepack() + { + var method = typeof(LightmapTransferTool).GetMethod( + "CanApplyUv2", + System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static); + Assert.IsNotNull(method, "LightmapTransferTool should expose the Apply UV2 availability rule as a testable helper"); + + Assert.IsTrue((bool)method.Invoke(null, new object[] { true, false }), + "A source-only repack must remain applyable when transfer is skipped."); + Assert.IsTrue((bool)method.Invoke(null, new object[] { false, true })); + Assert.IsFalse((bool)method.Invoke(null, new object[] { false, false })); + } } }