/** constructor */ public Controller(Item a_item, ControllerType a_controllertype) { //raw_context this.raw_context = a_item.GetResultContext(); //raw_animator this.raw_animator = this.raw_context.Root.GetComponent <UnityEngine.Animator>(); //raw_meta this.raw_meta = this.raw_context.Root.GetComponent <VRM.VRMMeta>(); //root_gameobject this.root_gameobject = this.raw_context.Root; //root_transform this.root_transform = this.root_gameobject.GetComponent <UnityEngine.Transform>(); //simpleanimationtion if (a_controllertype == ControllerType.SimpleAnimation) { #if (USE_DEF_FEE_SIMPLEANIMATION) this.controller_simpleanimationtion = new Controller_SimpleAnimation(this.root_gameobject.AddComponent <SimpleAnimation>()); #else this.controller_simpleanimationtion = null; #endif } else { this.controller_simpleanimationtion = null; } }
/** constructor */ public ResultType() { //context this.context = null; //errorstring this.errorstring = null; }
/** constructor */ public Main_Vrm() { this.is_busy = false; this.is_cancel = false; this.is_shutdown = false; //request this.request_binary = null; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_context = null; }
/** constructor */ public Item() { //result_type this.result_type = ResultType.None; //result_progress this.result_progress = 0.0f; //result_errorstring this.result_errorstring = null; //cancel_flag this.cancel_flag = false; //result_context this.result_context = null; }
/** 実行。ロード。 */ private System.Collections.IEnumerator DoLoadVrm() { Coroutine_LoadVrm t_coroutine = new Coroutine_LoadVrm(); yield return(t_coroutine.CoroutineMain(this, this.request_binary)); if (t_coroutine.result.context != null) { this.result_progress = 1.0f; this.result_context = t_coroutine.result.context; this.result_type = ResultType.Context; yield break; } else { this.result_progress = 1.0f; this.result_errorstring = t_coroutine.result.errorstring; this.result_type = ResultType.Error; yield break; } }
/** リクエスト。ロードVRM。 */ public bool RequestLoadVrm(byte[] a_binary) { if (this.is_busy == false) { this.is_busy = true; //is_cancel this.is_cancel = false; //result this.result_progress = 0.0f; this.result_errorstring = null; this.result_type = ResultType.None; this.result_context = null; //request this.request_binary = a_binary; Function.Function.GetInstance().StartCoroutine(this.DoLoadVrm()); return(true); } return(false); }
/** CoroutineMain */ public System.Collections.IEnumerator CoroutineMain(Fee.UniVrm.OnUniVrmCoroutine_CallBackInterface a_callback, byte[] a_binary) { //result this.result = new ResultType(); //is_error this.is_error = false; { VRM.VRMImporterContext t_context = new VRM.VRMImporterContext(); //キャンセル。 if (this.result.errorstring == null) { if (a_callback != null) { if (a_callback.OnUniVrmCoroutine(0.0f) == false) { this.result.errorstring = "Coroutine_Load : Cancel"; } } } //「ParseGlb」。 if (this.result.errorstring == null) { try{ t_context.ParseGlb(a_binary); }catch (System.Exception t_exception) { this.result.errorstring = "Coroutine_Load : ParseGlb : " + t_exception.Message; } } //エラーチェック。 if (this.result.errorstring != null) { if (t_context != null) { t_context.Dispose(); t_context = null; } this.result.context = null; yield break; } //キャンセル。 if (this.result.errorstring == null) { if (a_callback != null) { if (a_callback.OnUniVrmCoroutine(0.5f) == false) { this.result.errorstring = "Coroutine_Load : Cancel"; } } } yield return(null); //「Load」。 if (this.result.errorstring == null) { yield return(t_context.LoadCoroutine(this.OnLoadEnd, this.OnLoadError)); } //エラーチェック。 if (this.result.errorstring == null) { if (this.is_error == true) { this.result.errorstring = "Coroutine_Load : OnLoadError"; } } //エラーチェック。 if (this.result.errorstring != null) { if (t_context != null) { t_context.Dispose(); t_context = null; } this.result.context = null; yield break; } //成功。 this.result.errorstring = null; this.result.context = t_context; yield break; } }
/** 結果。コンテキスト。設定。 */ public void SetResultContext(VRM.VRMImporterContext a_context) { this.result_type = ResultType.Context; this.result_context = a_context; }