From 43777d9a66de44c84db2b99cfeb527ed060d6a43 Mon Sep 17 00:00:00 2001 From: ousttrue Date: Mon, 18 Jun 2018 23:16:16 +0900 Subject: [PATCH] Added errorHandler to VRMImporter.LoadVrmAsync --- Scripts/Format/VRMImporter.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/Scripts/Format/VRMImporter.cs b/Scripts/Format/VRMImporter.cs index 5ba2f2abb..9b8230f48 100644 --- a/Scripts/Format/VRMImporter.cs +++ b/Scripts/Format/VRMImporter.cs @@ -183,7 +183,7 @@ namespace VRM } LoadBlendShapeMaster(context); - VRMSpringUtility.LoadSecondary(context.Root.transform, context.Nodes, + VRMSpringUtility.LoadSecondary(context.Root.transform, context.Nodes, context.VRM.extensions.VRM.secondaryAnimation); LoadFirstPerson(context); @@ -407,7 +407,7 @@ namespace VRM #region LoadVrmAsync static IEnumerator LoadTextures(VRMImporterContext context, IStorage storage) { - for(int i=0; i onLoaded) + public static void LoadVrmAsync(string path, Action onLoaded, Action onError = null) { var context = new VRMImporterContext(path); context.ParseVrm(File.ReadAllBytes(path)); - LoadVrmAsync(context, onLoaded); + LoadVrmAsync(context, onLoaded, onError); } - public static void LoadVrmAsync(Byte[] bytes, Action onLoaded) + public static void LoadVrmAsync(Byte[] bytes, Action onLoaded, Action onError = null) { var context = new VRMImporterContext(); context.ParseVrm(bytes); - LoadVrmAsync(context, onLoaded); + LoadVrmAsync(context, onLoaded, onError); } - public static void LoadVrmAsync(VRMImporterContext ctx, Action onLoaded) - { - LoadVrmAsync(ctx, onLoaded, Debug.LogError); - } - - public static void LoadVrmAsync(VRMImporterContext ctx, Action onLoaded, Action onError) + public static void LoadVrmAsync(VRMImporterContext ctx, Action onLoaded, Action onError = null) { + if (onError == null) + { + onError = Debug.LogError; + } LoadVrmAsyncInternal(ctx) .Subscribe(Scheduler.MainThread, onLoaded, onError); }