mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-10-01 15:22:53 -05:00
StandardMap の AssetKey の比較を修正
This commit is contained in:
@@ -63,10 +63,14 @@ namespace UniGLTF
|
||||
case TextureImportTypes.StandardMap:
|
||||
{
|
||||
// write converted texture
|
||||
var (_, subAsset) = m_subAssets.FirstOrDefault(x => x.Equals(key));
|
||||
var (_, subAsset) = m_subAssets.FirstOrDefault(kv => kv.Key.Equals(key));
|
||||
if (subAsset == null)
|
||||
{
|
||||
throw new KeyNotFoundException();
|
||||
}
|
||||
targetPath = m_textureDirectory.Child($"{key.Name}.png");
|
||||
File.WriteAllBytes(targetPath.FullPath, subAsset.EncodeToPNG().ToArray());
|
||||
// targetPath.ImportAsset();
|
||||
targetPath.ImportAsset();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -75,7 +79,7 @@ namespace UniGLTF
|
||||
// write original bytes
|
||||
targetPath = m_textureDirectory.Child($"{key.Name}{param.Ext}");
|
||||
File.WriteAllBytes(targetPath.FullPath, param.Index0().Result.ToArray());
|
||||
// targetPath.ImportAsset();
|
||||
targetPath.ImportAsset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
@@ -92,7 +93,8 @@ namespace UniGLTF
|
||||
// extractor
|
||||
var extractor = new TextureExtractor(parser, UnityPath.FromUnityPath(""), loader.TextureFactory.Textures.Select(x => (new SubAssetKey(typeof(Texture2D), x.Texture.name), x.Texture)).ToArray());
|
||||
var m = GltfTextureEnumerator.EnumerateTexturesForMaterial(parser, 0).FirstOrDefault(x => x.Item1.Name == "texture_1.standard");
|
||||
extractor.Extract(m.Item1, m.Item2);
|
||||
|
||||
Assert.Catch<NotImplementedException>(() => extractor.Extract(m.Item1, m.Item2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user