mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-24 23:18:04 -05:00
GlbGltfZipFileParser が AmbiguousGltfFileParser と同じ内容だった。
* GlbGltfZipFileParser 削除 * AmbiguousGltfFileParser を AutoGltfFileParser に改名(うーむ)
This commit is contained in:
parent
75d0c3d507
commit
872888a35a
|
|
@ -52,7 +52,7 @@ namespace UniGLTF
|
|||
//
|
||||
// Parse(parse glb, parser gltf json)
|
||||
//
|
||||
var data = new AmbiguousGltfFileParser(scriptedImporter.assetPath).Parse();
|
||||
var data = new AutoGltfFileParser(scriptedImporter.assetPath).Parse();
|
||||
|
||||
|
||||
//
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace UniGLTF
|
|||
base.OnEnable();
|
||||
|
||||
m_importer = target as GltfScriptedImporter;
|
||||
m_data = new AmbiguousGltfFileParser(m_importer.assetPath).Parse();
|
||||
m_data = new AutoGltfFileParser(m_importer.assetPath).Parse();
|
||||
|
||||
var materialGenerator = new GltfMaterialDescriptorGenerator();
|
||||
var materialKeys = m_data.GLTF.materials.Select((_, i) => materialGenerator.Get(m_data, i).SubAssetKey);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ namespace UniGLTF
|
|||
base.OnEnable();
|
||||
|
||||
m_importer = target as ZipArchivedGltfScriptedImporter;
|
||||
m_data = new AmbiguousGltfFileParser(m_importer.assetPath).Parse();
|
||||
m_data = new AutoGltfFileParser(m_importer.assetPath).Parse();
|
||||
|
||||
var materialGenerator = new GltfMaterialDescriptorGenerator();
|
||||
var materialKeys = m_data.GLTF.materials.Select((_, i) => materialGenerator.Get(m_data, i).SubAssetKey);
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 3a36dcb5732b467598919c0ed66f0c5a
|
||||
timeCreated: 1624802689
|
||||
|
|
@ -3,14 +3,15 @@
|
|||
namespace UniGLTF
|
||||
{
|
||||
/// <summary>
|
||||
/// Ambiguous file parser.
|
||||
/// Auto detection file parser.
|
||||
/// Determine parsing method from the file extension.
|
||||
/// Detects `gltf`` zip`, others as` glb`
|
||||
/// </summary>
|
||||
public sealed class AmbiguousGltfFileParser
|
||||
public sealed class AutoGltfFileParser
|
||||
{
|
||||
private readonly string _path;
|
||||
|
||||
public AmbiguousGltfFileParser(string path)
|
||||
public AutoGltfFileParser(string path)
|
||||
{
|
||||
_path = path;
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 98f146563e4117246b39f51db89de6a3
|
||||
guid: bc9d157827565c84f9ad41c907fd12e5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
using System.IO;
|
||||
|
||||
namespace UniGLTF
|
||||
{
|
||||
/// <summary>
|
||||
/// Parse file and detect file type by file extension.
|
||||
/// </summary>
|
||||
public sealed class GltfZipOrGlbFileParser
|
||||
{
|
||||
private readonly string _path;
|
||||
|
||||
public GltfZipOrGlbFileParser(string glbFilePath)
|
||||
{
|
||||
_path = glbFilePath;
|
||||
}
|
||||
|
||||
public GltfData Parse()
|
||||
{
|
||||
var ext = Path.GetExtension(_path).ToLower();
|
||||
switch (ext)
|
||||
{
|
||||
case ".gltf":
|
||||
return new GltfFileWithResourceFilesParser(_path).Parse();
|
||||
|
||||
case ".zip":
|
||||
return new ZipArchivedGltfFileParser(_path).Parse();
|
||||
|
||||
default:
|
||||
// or glb
|
||||
return new GlbFileParser(_path).Parse();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -81,7 +81,7 @@ namespace UniGLTF
|
|||
GltfData data = null;
|
||||
try
|
||||
{
|
||||
data = new AmbiguousGltfFileParser(gltf.FullName).Parse();
|
||||
data = new AutoGltfFileParser(gltf.FullName).Parse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -127,7 +127,7 @@ namespace UniGLTF
|
|||
GltfData data = null;
|
||||
try
|
||||
{
|
||||
data = new AmbiguousGltfFileParser(gltf.FullName).Parse();
|
||||
data = new AutoGltfFileParser(gltf.FullName).Parse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -205,7 +205,7 @@ namespace UniGLTF
|
|||
|
||||
{
|
||||
var path = Path.Combine(root.FullName, "DamagedHelmet/glTF-Binary/DamagedHelmet.glb");
|
||||
var data = new AmbiguousGltfFileParser(path).Parse();
|
||||
var data = new AutoGltfFileParser(path).Parse();
|
||||
|
||||
var matDesc = new GltfMaterialDescriptorGenerator().Get(data, 0);
|
||||
Assert.AreEqual("Standard", matDesc.ShaderName);
|
||||
|
|
|
|||
|
|
@ -407,7 +407,7 @@ namespace VRM.SimpleViewer
|
|||
GltfData data;
|
||||
try
|
||||
{
|
||||
data = new GltfZipOrGlbFileParser(path).Parse();
|
||||
data = new AutoGltfFileParser(path).Parse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -425,7 +425,7 @@ namespace UniVRM10.VRM10Viewer
|
|||
GltfData data;
|
||||
try
|
||||
{
|
||||
data = new GltfZipOrGlbFileParser(path).Parse();
|
||||
data = new AutoGltfFileParser(path).Parse();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -439,7 +439,7 @@ namespace UniVRM10.VRM10Viewer
|
|||
using (var loader = new Vrm10Importer(vrm, materialGenerator: GetVrmMaterialDescriptorGenerator(m_useUrpMaterial.isOn)))
|
||||
{
|
||||
// migrate しても thumbnail は同じ
|
||||
var thumbnail = await loader.LoadVrmThumbnailAsync();
|
||||
var thumbnail = await loader.LoadVrmThumbnailAsync();
|
||||
|
||||
if (vrm.OldMeta != null)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user