From 1fef3fcce818c0b7155712df8de8405f8bcb9dc6 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 18 Jan 2022 15:45:25 +0900 Subject: [PATCH] =?UTF-8?q?vrm-0.x=20=E3=81=AE=E4=BB=95=E6=A7=98=E3=81=A7?= =?UTF-8?q?=E3=80=81preset:=20unknown=20=E3=81=AE=E3=81=A8=E3=81=8D?= =?UTF-8?q?=E3=81=AB=20name=20=E3=82=92=20preset=20=E3=81=A8=E3=81=97?= =?UTF-8?q?=E3=81=A6=E8=A7=A3=E9=87=88=E3=81=99=E3=82=8B=E3=81=AB=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runtime/Migration/MigrationVrmExpression.cs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Assets/VRM10/Runtime/Migration/MigrationVrmExpression.cs b/Assets/VRM10/Runtime/Migration/MigrationVrmExpression.cs index b0eb44603..c2f362817 100644 --- a/Assets/VRM10/Runtime/Migration/MigrationVrmExpression.cs +++ b/Assets/VRM10/Runtime/Migration/MigrationVrmExpression.cs @@ -8,12 +8,17 @@ namespace UniVRM10 { public static class MigrationVrmExpression { - static ExpressionPreset ToPreset(JsonNode json) + static ExpressionPreset ToPreset(JsonNode json, string name) { - switch (json.GetString().ToLower()) + var src = json.GetString().ToLower(); + if (src == "unknown") { - case "unknown": return ExpressionPreset.custom; + // fallback + src = name.ToLower(); + } + switch (src) + { // https://github.com/vrm-c/vrm-specification/issues/185 case "neutral": return ExpressionPreset.neutral; @@ -39,7 +44,7 @@ namespace UniVRM10 case "lookright": return ExpressionPreset.lookRight; } - throw new NotImplementedException(); + return ExpressionPreset.custom; } static IEnumerable ToMorphTargetBinds(JsonNode json, @@ -199,7 +204,7 @@ namespace UniVRM10 { isBinary = isBinaryNode.GetBoolean(); } - var preset = ToPreset(blendShapeClip["presetName"]); + var preset = ToPreset(blendShapeClip["presetName"], name); var expression = new UniGLTF.Extensions.VRMC_vrm.Expression { IsBinary = isBinary,