mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-07 03:17:25 -05:00
follow material name in migration unlit
This commit is contained in:
@@ -9,10 +9,11 @@ namespace UniVRM10
|
||||
/// </summary>
|
||||
public static class MigrationLegacyUnlitMaterial
|
||||
{
|
||||
public static glTFMaterial Migrate(JsonNode vrm0XMaterial)
|
||||
public static glTFMaterial Migrate(JsonNode vrm0XMaterial, string materialName)
|
||||
{
|
||||
var unlitMaterial = new glTFMaterial
|
||||
{
|
||||
name = materialName,
|
||||
pbrMetallicRoughness = new glTFPbrMetallicRoughness
|
||||
{
|
||||
metallicFactor = 0f,
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace UniVRM10
|
||||
}
|
||||
|
||||
// 2. VRM 拡張のうち、古い Unlit 情報からの取得を試みる.
|
||||
var unlitMaterial = MigrationLegacyUnlitMaterial.Migrate(vrm0XMaterial);
|
||||
var unlitMaterial = MigrationLegacyUnlitMaterial.Migrate(vrm0XMaterial, gltf.materials[materialIdx].name);
|
||||
if (unlitMaterial != null)
|
||||
{
|
||||
gltf.materials[materialIdx] = unlitMaterial;
|
||||
@@ -40,8 +40,15 @@ namespace UniVRM10
|
||||
}
|
||||
}
|
||||
|
||||
// 3. VRM 拡張のうち、MToon 情報からの取得を試みる.
|
||||
MigrationMToonMaterial.Migrate(gltf, vrm0);
|
||||
try
|
||||
{
|
||||
// 3. VRM 拡張のうち、MToon 情報からの取得を試みる.
|
||||
MigrationMToonMaterial.Migrate(gltf, vrm0);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user