mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-16 07:34:05 -05:00
Co-authored-by: Akihiko Odaki <nekomanma@pixiv.co.jp> Co-authored-by: Emiliana <vtemiliana@gmail.com> Co-authored-by: junichi_hirose <junichi_hirose@dwango.co.jp> Co-authored-by: Masataka SUMI <santarh@gmail.com> Co-authored-by: ousttrue <oustrrue@gmail.com> Co-authored-by: ousttrue <ousttrue@gmail.com> Co-authored-by: TORISOUP <tori.birdstrike@gmail.com> Co-authored-by: Yuki Shimada <emadurandal@gmail.com> Co-authored-by: yutopp <yutopp@gmail.com>
53 lines
1.5 KiB
C#
53 lines
1.5 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
|
|
namespace UniGLTF
|
|
{
|
|
public static class gltfImporter
|
|
{
|
|
[Obsolete("Use ImporterContext.Load(path)")]
|
|
public static ImporterContext Load(string path)
|
|
{
|
|
var context = new ImporterContext();
|
|
context.Load(path);
|
|
context.ShowMeshes();
|
|
context.EnableUpdateWhenOffscreen();
|
|
return context;
|
|
}
|
|
|
|
[Obsolete("Use ImporterContext.Parse(path, bytes)")]
|
|
public static ImporterContext Parse(string path, Byte[] bytes)
|
|
{
|
|
var context = new ImporterContext();
|
|
context.Load(path);
|
|
context.ShowMeshes();
|
|
context.EnableUpdateWhenOffscreen();
|
|
return context;
|
|
}
|
|
|
|
[Obsolete("use ImporterContext.Load()")]
|
|
public static void Load(ImporterContext context)
|
|
{
|
|
context.Load();
|
|
context.ShowMeshes();
|
|
context.EnableUpdateWhenOffscreen();
|
|
}
|
|
|
|
public static void LoadVrmAsync(string path, Byte[] bytes, Action<GameObject> onLoaded, Action<Exception> onError = null, bool show = true)
|
|
{
|
|
var context = new ImporterContext();
|
|
context.Parse(path, bytes);
|
|
context.LoadAsync(() =>
|
|
{
|
|
if (show)
|
|
{
|
|
context.ShowMeshes();
|
|
}
|
|
onLoaded(context.Root);
|
|
},
|
|
onError);
|
|
}
|
|
}
|
|
}
|