static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string path in importedAssets) { if (IsStreamingAsset(path)) { Debug.LogFormat("Skip StreamingAssets: {0}", path); continue; } var ext = Path.GetExtension(path).ToLower(); if (ext == ".bvh") { Debug.LogFormat("ImportBvh: {0}", path); var context = new BvhImporterContext(); try { context.Parse(path); context.Load(); context.SaveAsAsset(); context.Destroy(false); } catch (Exception ex) { Debug.LogError(ex); context.Destroy(true); } } } }
private void LoadMotion(string path) { var context = new UniHumanoid.BvhImporterContext(); context.Parse(path); context.Load(); SetMotion(context.Root.GetComponent <HumanPoseTransfer>()); }
async Task LoadMotionAsync(string path) { var bvh = await Task.Run(() => { var context = new UniHumanoid.BvhImporterContext(); context.Parse(path); return(context); }); bvh.Load(); SetMotion(bvh.Root.GetComponent <HumanPoseTransfer>()); }
private void LoadMotion(string path) { try { // Trigger BVH _bvhLoadingTrigger = true; // Save current path _bvhPathLocal = path; var previous_motion = _bvhMotion; if (previous_motion != null) { Destroy(previous_motion.Root); } var context = new UniHumanoid.BvhImporterContext(); _bvhMotion = context; context.Parse(path); context.Load(); if (context.Avatar == null || context.Avatar.isValid == false) { if (context.Root != null) { Destroy(context.Root); } throw new Exception("BVH importer failed"); } // Send BVH _informationUpdate.SetBVH(_bvhMotion.Root); SetMotion(context.Root.GetComponent <HumanPoseTransfer>()); } catch (Exception e) { if (_bvhMotion.Root == true) { Destroy(_bvhMotion.Root); } _errorMessagePanel.SetMessage(MultipleLanguageSupport.BvhLoadErrorMessage + "\nError message: " + e.Message); throw; } }
void Open(string path) { Debug.LogFormat("Open: {0}", path); if (m_context != null) { m_context.Destroy(true); m_context = null; } m_context = new BvhImporterContext(); m_context.Parse(path); m_context.Load(); var src = m_context.Root.AddComponent <HumanPoseTransfer>(); if (m_dst != null) { m_dst.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer; m_dst.Source = src; } }
void Open(string path) { // Debug.LogFormat("Open: {0}", path); if (m_context == null) { m_context = new BvhImporterContext(); } m_context.Parse(path); m_context.Load(); if (!flag) { var src = m_context.Root.AddComponent <HumanPoseTransfer>(); m_context.Root.AddComponent <AnimationBlending>(); if (m_dst != null) { m_dst.SourceType = HumanPoseTransfer.HumanPoseTransferSourceType.HumanPoseTransfer; m_dst.Source = src; } flag = true; } }
public static void Import(BvhImporterContext context) { context.Parse(context.Path); context.Load(); }