Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Documentation~/EXPERIMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
21 changes: 10 additions & 11 deletions Editor/Tools/LightmapTransferTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ static bool HasIncludedTransferTargets(IEnumerable<MeshEntry> 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;
Expand Down Expand Up @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions Tests/Editor/XatlasRepackGroupMergeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }));
}
}
}
Loading