From bc7b6ffda16f0e26f42e267404b47cd5b96720fe Mon Sep 17 00:00:00 2001 From: ousttrue Date: Tue, 18 Jan 2022 21:07:26 +0900 Subject: [PATCH] =?UTF-8?q?Vrm10Importer=20=E3=81=A7=20Neutral=20=E3=82=92?= =?UTF-8?q?=E3=80=80Custom=20=E3=81=8B=E3=82=89=E6=95=91=E5=87=BA=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=B3=E3=83=BC=E3=83=89=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/VRM10Object/VRM10ObjectExpression.cs | 2 ++ Assets/VRM10/Runtime/IO/Vrm10Importer.cs | 8 ++++++++ Assets/VRM10/Runtime/Migration/MigrationVrm.cs | 4 +--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ObjectExpression.cs b/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ObjectExpression.cs index e9a99e213..ca4b8bc99 100644 --- a/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ObjectExpression.cs +++ b/Assets/VRM10/Runtime/Components/VRM10Object/VRM10ObjectExpression.cs @@ -9,6 +9,8 @@ namespace UniVRM10 [Serializable] public sealed class VRM10ObjectExpression { + public const string NEUTRAL_KEY = "Neutral"; + #region Preset [SerializeField, Header("Emotion")] public VRM10Expression Happy; diff --git a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs index 0468fd08a..82dcc4a3b 100644 --- a/Assets/VRM10/Runtime/IO/Vrm10Importer.cs +++ b/Assets/VRM10/Runtime/IO/Vrm10Importer.cs @@ -427,6 +427,14 @@ namespace UniVRM10 { var key = ExpressionKey.CreateCustom(name); var preset = ExpressionPreset.custom; + if (preset == ExpressionPreset.custom && name == VRM10ObjectExpression.NEUTRAL_KEY) + { + // TODO: + // 注意!JsonSchema の更新待ち? + key = ExpressionKey.CreateFromPreset(ExpressionPreset.neutral); + Debug.Log($"set neutral"); + preset = ExpressionPreset.neutral; + } var clip = GetOrLoadExpression(key.SubAssetKey, preset, expression); if (clip != null) { diff --git a/Assets/VRM10/Runtime/Migration/MigrationVrm.cs b/Assets/VRM10/Runtime/Migration/MigrationVrm.cs index 6bfe09f92..294ac93dd 100644 --- a/Assets/VRM10/Runtime/Migration/MigrationVrm.cs +++ b/Assets/VRM10/Runtime/Migration/MigrationVrm.cs @@ -10,8 +10,6 @@ namespace UniVRM10 /// public static class MigrationVrm { - const string NEUTRAL_KEY = "Neutral"; - public static byte[] Migrate(byte[] src) { var data = new GlbBinaryParser(src, "migration").Parse(); @@ -101,7 +99,7 @@ namespace UniVRM10 case ExpressionPreset.neutral: // TODO: 仕様確定待ち // Presetに格上げするか、小文字にする - vrm1.Expressions.Custom[NEUTRAL_KEY] = expression; + vrm1.Expressions.Custom[VRM10ObjectExpression.NEUTRAL_KEY] = expression; break; case ExpressionPreset.custom: if (vrm1.Expressions.Custom.ContainsKey(customName))