From 553dd75e5061d98deefedfc0b11dad098d91f0e7 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 25 May 2018 16:33:28 +0900 Subject: [PATCH 01/10] Fix VRMBone.upperChest for Unity-5.5 --- Scripts/Format/glTF_VRM_Humanoid.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Scripts/Format/glTF_VRM_Humanoid.cs b/Scripts/Format/glTF_VRM_Humanoid.cs index 08b03e471..d0426934c 100644 --- a/Scripts/Format/glTF_VRM_Humanoid.cs +++ b/Scripts/Format/glTF_VRM_Humanoid.cs @@ -77,7 +77,8 @@ namespace VRM } public static HumanBodyBones ToHumanBodyBone(this VRMBone bone) { -#if UNITY_5_6_OR_NEWER +#if UNITY_5_6_OR_NEWER +#else if (bone == VRMBone.upperChest) { return HumanBodyBones.LastBone; From 689fbe3ca9f2e4335f2e375ee6f598ffe77e15b3 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 25 May 2018 16:44:42 +0900 Subject: [PATCH 02/10] IncrementVersion --- Scripts/Format/Editor/VRMVersionMenu.cs | 2 +- Scripts/Format/VRMVersion.cs | 55 +++--------------------- Scripts/Format/VRMVersionPartial.cs | 51 ++++++++++++++++++++++ Scripts/Format/VRMVersionPartial.cs.meta | 13 ++++++ 4 files changed, 70 insertions(+), 51 deletions(-) create mode 100644 Scripts/Format/VRMVersionPartial.cs create mode 100644 Scripts/Format/VRMVersionPartial.cs.meta diff --git a/Scripts/Format/Editor/VRMVersionMenu.cs b/Scripts/Format/Editor/VRMVersionMenu.cs index f6f778644..ed794222e 100644 --- a/Scripts/Format/Editor/VRMVersionMenu.cs +++ b/Scripts/Format/Editor/VRMVersionMenu.cs @@ -10,7 +10,7 @@ namespace VRM const string template = @" namespace VRM {{ - public static class VRMVersion + public static partial class VRMVersion {{ public const int MAJOR = {0}; public const int MINOR = {1}; diff --git a/Scripts/Format/VRMVersion.cs b/Scripts/Format/VRMVersion.cs index db5fea0e2..a72db0e3f 100644 --- a/Scripts/Format/VRMVersion.cs +++ b/Scripts/Format/VRMVersion.cs @@ -1,59 +1,14 @@ -using System; - namespace VRM { - public static class VRMVersion + public static partial class VRMVersion { public const int MAJOR = 0; - public const int MINOR = 36; + public const int MINOR = 37; - public const string VERSION = "0.36"; + public const string VERSION = "0.37"; - public const string DecrementMenuName = "VRM/Version(0.36) Decrement"; - public const string IncrementMenuName = "VRM/Version(0.36) Increment"; - - public static bool IsNewer(string version) - { - if (string.IsNullOrEmpty(version)) - { - return false; - } - - var prefix = "UniVRM-"; - if (version.StartsWith(prefix)) - { - version = version.Substring(prefix.Length); - } - - var splited = version.Split('.'); - if (splited.Length < 2) - { - return false; - } - - try - { - var major = int.Parse(splited[0]); - var minor = int.Parse(splited[1]); - - if (major < MAJOR) - { - return false; - } - else if (major > MAJOR) - { - return true; - } - else - { - return minor > MINOR; - } - } - catch (Exception) - { - return false; - } - } + public const string DecrementMenuName = "VRM/Version(0.37) Decrement"; + public const string IncrementMenuName = "VRM/Version(0.37) Increment"; } } diff --git a/Scripts/Format/VRMVersionPartial.cs b/Scripts/Format/VRMVersionPartial.cs new file mode 100644 index 000000000..623d3df01 --- /dev/null +++ b/Scripts/Format/VRMVersionPartial.cs @@ -0,0 +1,51 @@ + +using System; + +namespace VRM +{ + public static partial class VRMVersion + { + public static bool IsNewer(string version) + { + if (string.IsNullOrEmpty(version)) + { + return false; + } + + var prefix = "UniVRM-"; + if (version.StartsWith(prefix)) + { + version = version.Substring(prefix.Length); + } + + var splited = version.Split('.'); + if (splited.Length < 2) + { + return false; + } + + try + { + var major = int.Parse(splited[0]); + var minor = int.Parse(splited[1]); + + if (major < MAJOR) + { + return false; + } + else if (major > MAJOR) + { + return true; + } + else + { + return minor > MINOR; + } + } + catch (Exception) + { + return false; + } + } + } +} diff --git a/Scripts/Format/VRMVersionPartial.cs.meta b/Scripts/Format/VRMVersionPartial.cs.meta new file mode 100644 index 000000000..b505fdb09 --- /dev/null +++ b/Scripts/Format/VRMVersionPartial.cs.meta @@ -0,0 +1,13 @@ +fileFormatVersion: 2 +guid: 4ab9ac9856a4d4c4aa652c07c5b496e6 +timeCreated: 1522130257 +licenseType: Free +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From 11304b71d5e4ff52a931daecb4f2b3273e2cb3b9 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 25 May 2018 17:29:58 +0900 Subject: [PATCH 03/10] Update UniGLTF --- Scripts/Format/VRMImporter.cs | 12 +++++++++--- UniGLTF | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Scripts/Format/VRMImporter.cs b/Scripts/Format/VRMImporter.cs index 248d6bce4..5642a728f 100644 --- a/Scripts/Format/VRMImporter.cs +++ b/Scripts/Format/VRMImporter.cs @@ -456,9 +456,10 @@ namespace VRM #region LoadVrmAsync static IEnumerator LoadTextures(VRMImporterContext context) { - foreach (var gltfTexture in context.GLTF.textures) + for(int i=0; i gltfImporter.ImportTexture(ctx.GLTF, index)) + () => + { + var texture = new TextureItem(ctx.GLTF, index); + texture.Process(); + return texture; + }) .ContinueWith(Scheduler.ThreadPool, x => ctx.Textures.Add(x)); } }) diff --git a/UniGLTF b/UniGLTF index 04f8a4cea..e4ccadd84 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit 04f8a4cea3f33a080236342d8a5c95eec9cd8f50 +Subproject commit e4ccadd84c75530cac5e54158144bc534f64ff1a From 0a48a1700fbff7b2f2a455eb7ad5da8018b7fa43 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Fri, 25 May 2018 19:10:59 +0900 Subject: [PATCH 04/10] Update UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index e4ccadd84..8c664d7fd 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit e4ccadd84c75530cac5e54158144bc534f64ff1a +Subproject commit 8c664d7fdc05988e092ecf6fe919457e22bfe81c From 0dbb40bd50156b639e5cae9390bd9266404e39f0 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 28 May 2018 16:13:37 +0900 Subject: [PATCH 05/10] Add createThumbnail argument to VRMImporterContext.ReadMeta --- Scripts/Format/VRMImporterContext.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Scripts/Format/VRMImporterContext.cs b/Scripts/Format/VRMImporterContext.cs index 71899779e..cf81780de 100644 --- a/Scripts/Format/VRMImporterContext.cs +++ b/Scripts/Format/VRMImporterContext.cs @@ -34,7 +34,7 @@ namespace VRM ParseGlb(bytes); } - public VRMMetaObject ReadMeta() + public VRMMetaObject ReadMeta(bool createThumbnail=false) { var meta=ScriptableObject.CreateInstance(); meta.name = "Meta"; @@ -46,9 +46,15 @@ namespace VRM meta.ContactInformation = gltfMeta.contactInformation; meta.Reference = gltfMeta.reference; meta.Title = gltfMeta.title; - if (gltfMeta.texture >=0 && gltfMeta.texture< Textures.Count) + + if (createThumbnail) { - meta.Thumbnail = Textures[gltfMeta.texture].Texture; + if(gltfMeta.texture >= 0 && gltfMeta.texture < VRM.textures.Count) + { + var t = new TextureItem(VRM, gltfMeta.texture); + t.Process(); + meta.Thumbnail=t.Texture; + } } meta.AllowedUser = gltfMeta.allowedUser; From ef91c2b5ba356569b44e32ac6701ca6582fed182 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 29 May 2018 17:19:56 +0900 Subject: [PATCH 06/10] VRMExporter.cs to Runtime from Editor --- Scripts/Format/{Editor => }/VRMExporter.cs | 0 Scripts/Format/{Editor => }/VRMExporter.cs.meta | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename Scripts/Format/{Editor => }/VRMExporter.cs (100%) rename Scripts/Format/{Editor => }/VRMExporter.cs.meta (100%) diff --git a/Scripts/Format/Editor/VRMExporter.cs b/Scripts/Format/VRMExporter.cs similarity index 100% rename from Scripts/Format/Editor/VRMExporter.cs rename to Scripts/Format/VRMExporter.cs diff --git a/Scripts/Format/Editor/VRMExporter.cs.meta b/Scripts/Format/VRMExporter.cs.meta similarity index 100% rename from Scripts/Format/Editor/VRMExporter.cs.meta rename to Scripts/Format/VRMExporter.cs.meta From 4b734259331908a4ce3d0fccdff5a9c208ec1c58 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 29 May 2018 17:52:47 +0900 Subject: [PATCH 07/10] Update UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index 8c664d7fd..229c28615 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit 8c664d7fdc05988e092ecf6fe919457e22bfe81c +Subproject commit 229c28615050ffe67d0ef747e3a932443879291c From 839f2ca0bb560682f194f38242962cfe89e6206b Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 29 May 2018 17:52:56 +0900 Subject: [PATCH 08/10] Add Stopwatch --- Scripts/Format/Editor/VRMExporterMenu.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Scripts/Format/Editor/VRMExporterMenu.cs b/Scripts/Format/Editor/VRMExporterMenu.cs index cc6fb3019..0d11ad553 100644 --- a/Scripts/Format/Editor/VRMExporterMenu.cs +++ b/Scripts/Format/Editor/VRMExporterMenu.cs @@ -99,6 +99,8 @@ namespace VRM Undo.PerformUndo(); } + var sw = System.Diagnostics.Stopwatch.StartNew(); + VRMExporter.Export(target, path, gltf => { gltf.extensions.VRM.meta.title = Title; @@ -106,6 +108,8 @@ namespace VRM }); + Debug.LogFormat("Export elapsed {0}", sw.Elapsed); + if (Target.gameObject!=target) { GameObject.DestroyImmediate(target); From 97a0e116137b2a8f683bed2bedb42b0b1c0b1e3d Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 30 May 2018 15:05:10 +0900 Subject: [PATCH 09/10] fix ReadMeta --- Scripts/Format/VRMImporterContext.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Scripts/Format/VRMImporterContext.cs b/Scripts/Format/VRMImporterContext.cs index cf81780de..20acf4a93 100644 --- a/Scripts/Format/VRMImporterContext.cs +++ b/Scripts/Format/VRMImporterContext.cs @@ -47,8 +47,14 @@ namespace VRM meta.Reference = gltfMeta.reference; meta.Title = gltfMeta.title; - if (createThumbnail) + if (gltfMeta.texture >= 0 && gltfMeta.texture < Textures.Count) { + // ロード済み + meta.Thumbnail = Textures[gltfMeta.texture].Texture; + } + else if (createThumbnail) + { + // 作成する(先行ロード用) if(gltfMeta.texture >= 0 && gltfMeta.texture < VRM.textures.Count) { var t = new TextureItem(VRM, gltfMeta.texture); From 99bd2ab74f1e7bcb8187c85e712a9f81cd3b71e9 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 30 May 2018 16:33:20 +0900 Subject: [PATCH 10/10] Update UniGLTF --- UniGLTF | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UniGLTF b/UniGLTF index 229c28615..038b9900b 160000 --- a/UniGLTF +++ b/UniGLTF @@ -1 +1 @@ -Subproject commit 229c28615050ffe67d0ef747e3a932443879291c +Subproject commit 038b9900be72da4af4aced100e1f7994fcad8f69