diff --git a/Scripts/Format/VRMImporter.cs b/Scripts/Format/VRMImporter.cs index 34a86b32a..e40c70041 100644 --- a/Scripts/Format/VRMImporter.cs +++ b/Scripts/Format/VRMImporter.cs @@ -487,53 +487,53 @@ namespace VRM #if (NET_4_6 && UNITY_2018_1_OR_NEWER) - public static Task LoadVrmAsync(string path) + public static Task LoadVrmAsync(string path, bool show=true) { var context = new VRMImporterContext(path); context.ParseVrm(File.ReadAllBytes(path)); - return LoadVrmAsyncInternal(context).ToTask(); + return LoadVrmAsyncInternal(context, show).ToTask(); } - public static Task LoadVrmAsync(Byte[] bytes) + public static Task LoadVrmAsync(Byte[] bytes, bool show=true) { var context = new VRMImporterContext(); context.ParseVrm(bytes); - return LoadVrmAsync(context); + return LoadVrmAsync(context, show); } - public static Task LoadVrmAsync(VRMImporterContext ctx) + public static Task LoadVrmAsync(VRMImporterContext ctx, bool show=true) { - return LoadVrmAsyncInternal(ctx).ToTask(); + return LoadVrmAsyncInternal(ctx, show).ToTask(); } #endif - public static void LoadVrmAsync(string path, Action onLoaded, Action onError = null) + public static void LoadVrmAsync(string path, Action onLoaded, Action onError = null, bool show = true) { var context = new VRMImporterContext(path); context.ParseVrm(File.ReadAllBytes(path)); - LoadVrmAsync(context, onLoaded, onError); + LoadVrmAsync(context, onLoaded, onError, show); } - public static void LoadVrmAsync(Byte[] bytes, Action onLoaded, Action onError = null) + public static void LoadVrmAsync(Byte[] bytes, Action onLoaded, Action onError = null, bool show = true) { var context = new VRMImporterContext(); context.ParseVrm(bytes); - LoadVrmAsync(context, onLoaded, onError); + LoadVrmAsync(context, onLoaded, onError, show); } - public static void LoadVrmAsync(VRMImporterContext ctx, Action onLoaded, Action onError = null) + public static void LoadVrmAsync(VRMImporterContext ctx, Action onLoaded, Action onError = null, bool show = true) { if (onError == null) { onError = Debug.LogError; } - LoadVrmAsyncInternal(ctx) + LoadVrmAsyncInternal(ctx, show) .Subscribe(Scheduler.MainThread, onLoaded, onError); } - private static Schedulable LoadVrmAsyncInternal(VRMImporterContext ctx) + private static Schedulable LoadVrmAsyncInternal(VRMImporterContext ctx, bool show) { var schedulable = Schedulable.Create(); @@ -588,18 +588,12 @@ namespace VRM .ContinueWith(Scheduler.CurrentThread, _ => { - /* - Debug.LogFormat("task end: {0}/{1}/{2}/{3}", - ctx.Textures.Count, - ctx.Materials.Count, - ctx.Meshes.Count, - ctx.Nodes.Count - ); - */ ctx.Root.name = Path.GetFileNameWithoutExtension(ctx.Path); - // 非表示のメッシュを表示する - ctx.ShowMeshes(); + if (show) + { + ctx.ShowMeshes(); + } return ctx.Root; });