From dc731a9941b790d67b8ddd8a8ec17e949706bacb Mon Sep 17 00:00:00 2001 From: MelekTaus Moribundus Date: Thu, 16 Jul 2026 14:47:49 +0200 Subject: [PATCH] Auto-delete consumed roughness source after metallic-smoothness repack PolyHavenMaterialBuilder now removes the separate roughness map (asset + meta) once its data has been packed into the generated _metallic_smoothness.png; skipped when the repack fails or roughness came from the ARM texture. Co-Authored-By: Claude Fable 5 --- .../Scripts/Editor/PolyHaven/PolyHavenMaterialBuilder.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Assets/Scripts/Editor/PolyHaven/PolyHavenMaterialBuilder.cs b/Assets/Scripts/Editor/PolyHaven/PolyHavenMaterialBuilder.cs index b3e1de9..158f6e7 100644 --- a/Assets/Scripts/Editor/PolyHaven/PolyHavenMaterialBuilder.cs +++ b/Assets/Scripts/Editor/PolyHaven/PolyHavenMaterialBuilder.cs @@ -40,6 +40,15 @@ namespace Chameleon.Editor.PolyHaven if (!string.IsNullOrEmpty(roughPath) || !string.IsNullOrEmpty(armPath)) metallicGlossPath = BuildMetallicSmoothness(folder, slug, roughPath, metalPath, armPath, maxSize); + // The roughness source is fully consumed into the packed map and never + // referenced by the material — drop it once the repack succeeded. + if (!string.IsNullOrEmpty(metallicGlossPath) && !string.IsNullOrEmpty(roughPath)) + { + AssetDatabase.DeleteAsset(roughPath); + byType.Remove(PolyHavenMapType.Rough); + Debug.Log($"[PolyHaven] Deleted consumed roughness source: {roughPath}"); + } + // AO comes from the dedicated map, or the ARM red channel as a fallback. string occlusionPath = null; if (byType.TryGetValue(PolyHavenMapType.AO, out var aoSeparate))