Add model import support to Poly Haven importer

Browser gets Textures/Models tabs (per-type catalog cache). Model file
JSON is parsed into per-set texture maps (generic set-prefix matching),
FBX is downloaded with resolution fallback, one URP/Lit material is
built per set via the shared PbrMaterialBuilder (which now returns the
created Material), and new ModelImportUtil remaps FBX material slots to
the built materials by set-name matching.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Fable 5 committed 2026-07-16 16:43:24 +02:00
1 parent 2b9a189d58
commit eab5081354
5 files changed
+391 -98

No files matched your search

@@ -19,7 +19,8 @@ namespace Chameleon.Editor.WebAssets
public string AssetPath; // "Assets/Poly Haven/.../foo_diffuse.jpg"
}
public static void Build(string folder, string displayName, string slug, int maxSize,
/// <summary>Builds the material and returns it (null if it could not be created).</summary>
public static Material Build(string folder, string displayName, string slug, int maxSize,
List<Downloaded> maps)
{
var byType = new Dictionary<PbrMapType, string>();
@@ -61,7 +62,7 @@ namespace Chameleon.Editor.WebAssets
if (!shader)
{
Debug.LogError("[PBR Import] URP/Lit shader not found — is URP installed?");
return;
return null;
}
var mat = new Material(shader) { name = displayName };
@@ -105,6 +106,7 @@ namespace Chameleon.Editor.WebAssets
EditorGUIUtility.PingObject(mat);
Selection.activeObject = mat;
Debug.Log($"[PBR Import] Material created: {matPath}");
return mat;
}
private static Texture2D Load(string path) => AssetDatabase.LoadAssetAtPath<Texture2D>(path);