From bd69975abd8185bcba411e5176d72ee49e9062c2 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 23 Mar 2021 15:45:47 +0900 Subject: [PATCH] =?UTF-8?q?uri=20=E3=82=92=E5=89=8D=E5=87=A6=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UniGLTF/Runtime/UniGLTF/IO/GltfParser.cs | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfParser.cs b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfParser.cs index 723b6ef5d..d08aad586 100644 --- a/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfParser.cs +++ b/Assets/UniGLTF/Runtime/UniGLTF/IO/GltfParser.cs @@ -175,6 +175,10 @@ namespace UniGLTF RestoreOlderVersionValues(); FixMeshNameUnique(); + foreach(var image in GLTF.images) + { + image.uri = PrepareUri(image.uri); + } FixTextureNameUnique(); FixMaterialNameUnique(); FixNodeName(); @@ -230,6 +234,29 @@ namespace UniGLTF } } + /// + /// image.uri を前理 + /// + /// + /// + public static string PrepareUri(string uri) + { + if (string.IsNullOrEmpty(uri)) + { + return uri; + } + + if (uri.StartsWith("./")) + { + // skip + uri = uri.Substring(2); + } + + // %20 to ' ' etc... + var unescape = Uri.UnescapeDataString(uri); + return unescape; + } + /// /// gltfTexture.name を Unity Asset 名として運用する。 /// ユニークである必要がある。