vrm-c / UniVRM

UniVRM is a gltf-based VRM format implementation for Unity. English is here https://vrm.dev/en/ . 日本語 はこちら https://vrm.dev/
https://vrm.dev/en
MIT License
2.63k stars 423 forks source link

1回目のVRM出力がエラーになる #191

Closed vyv03354 closed 5 years ago

vyv03354 commented 5 years ago

使用ソフトウェアのバージョン:

再現手順:

  1. 新規プロジェクトを作成する。
  2. UniVRM-0.50をインストールする。
  3. 添付のglbをAssetsにドロップしてインポートする。
  4. 生成されたprefabをHierarchyにドロップして配置する。
  5. 配置したオブジェクトを選択して、InspectorからAdd Component > Miscellaneous > Animator
  6. InspectorからAdd Component > Scripts > UniHumanoid > Bone Mapping
  7. Hipsに"hips"を割り当てる
  8. Guess bone mapping > Ensure T-Pose > Create avatarを順に実行
  9. メニューからVRM > UniVRM-0.50 > Export humanoid
  10. Authorを入力してExport

その結果: 以下のエラーが出てエクスポートできない JsonSchemaValidationException: [allowedUserName.meta.VRM.extensions.glTF] null UniJSON.JsonSchema.Serialize[glTF] (IFormatter f, UniGLTF.glTF o, UniJSON.JsonSchemaValidationContext c) (at Assets/VRM/UniJSON/Scripts/Json/JsonSchema.cs:404) UniJSON.JsonSchemaExtensions.Serialize[glTF] (UniJSON.JsonSchema s, UniGLTF.glTF o, UniJSON.JsonSchemaValidationContext c) (at Assets/VRM/UniJSON/Scripts/Json/JsonSchema.cs:441) UniGLTF.glTF.ToGlbBytes (Boolean UseUniJSONSerializer) (at Assets/VRM/UniGLTF/Scripts/Format/glTF.cs:510) VRM.VRMExportSettings.Export (System.String path, System.Collections.Generic.List`1 destroy) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:273) VRM.VRMExportSettings.Export (System.String path) (at Assets/VRM/UniVRM/Scripts/Format/VRMExportSettings.cs:233) VRM.VRMExporterWizard.OnWizardCreate () (at Assets/VRM/UniVRM/Editor/Format/VRMExporterMenu.cs:42) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.ScriptableWizard.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/ScriptableWizard.cs:79) System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222) Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation. System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:295) UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:288) UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:104) UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:216)

期待される結果: エラーにならず、VRMファイルを出力できること。

1回目の出力ではallowedUserNameはまだ設定されていないはずなのに、スキーマバリデーションが走ってしまっているように見えます。UniVRM-0.48では問題ありませんでした(スキーマバリデーションが未実装?)。

ruler.zip

vyv03354 commented 5 years ago

JsonSchemaValidationException: [allowedUserName.meta.VRM.extensions.glTF]

ところで細かいことですが、このエラーメッセージは正しくは JsonSchemaValidationException: [glTF.extensions.VRM.meta.allowedUserName] ではないでしょうか

yutopp commented 5 years ago

報告ありがとうございます。今週中に調査・修正いたします。

vyv03354 commented 5 years ago

Use Experimental Exporterのチェックを外すとエクスポートできました。出力されたVRMを見ると、やはりallowedUserName(など)は未設定になっています。

yutopp commented 5 years ago

このエラーメッセージは正しくは JsonSchemaValidationException: [glTF.extensions.VRM.meta.allowedUserName] ではないでしょうか

ありがとうございます。階層的にはそちらのほうが分かりやすそうですね... 近いうちに対応します。

Use Experimental Exporterのチェックを外すとエクスポートできました。

情報ありがとうございます。内部の新しいJsonExporter実装は制約に沿って適切にバリエーションをするので、今回この処理に引っかかっていた状態です。

194 にて、制約を満たすようデフォルト値を設定し、問題を解消しました。