mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-04-25 07:28:51 -05:00
Change namespaces from VRM/global to VRM.Samples for all scripts in VRM.Samples
This commit is contained in:
parent
8a952874e5
commit
ea224d3911
|
|
@ -4,7 +4,7 @@ using UniJSON;
|
|||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public static class JsonExtensions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public class VRMMaterialTests
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public class AIUEO : MonoBehaviour
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using UnityEngine;
|
|||
using UnityEngine.UI;
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public class CanvasManager : MonoBehaviour
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
|
|||
#endif
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public static class FileDialogForWindows
|
||||
{
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public class RokuroCamera : MonoBehaviour
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public class TargetMover : MonoBehaviour
|
||||
{
|
||||
|
|
|
|||
|
|
@ -3,97 +3,102 @@ using UnityEngine;
|
|||
using UnityEngine.UI;
|
||||
using VRM;
|
||||
|
||||
|
||||
public class VRMRuntimeExporter : MonoBehaviour
|
||||
namespace VRM.Samples
|
||||
{
|
||||
[SerializeField]
|
||||
Button m_loadButton;
|
||||
|
||||
[SerializeField]
|
||||
Button m_exportButton;
|
||||
|
||||
GameObject m_model;
|
||||
|
||||
private void Awake()
|
||||
public class VRMRuntimeExporter : MonoBehaviour
|
||||
{
|
||||
m_loadButton.onClick.AddListener(OnLoadClicked);
|
||||
[SerializeField] Button m_loadButton;
|
||||
|
||||
m_exportButton.onClick.AddListener(OnExportClicked);
|
||||
}
|
||||
[SerializeField] Button m_exportButton;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
m_exportButton.interactable = (m_model != null);
|
||||
}
|
||||
GameObject m_model;
|
||||
|
||||
#region Load
|
||||
void OnLoadClicked()
|
||||
{
|
||||
private void Awake()
|
||||
{
|
||||
m_loadButton.onClick.AddListener(OnLoadClicked);
|
||||
|
||||
m_exportButton.onClick.AddListener(OnExportClicked);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
m_exportButton.interactable = (m_model != null);
|
||||
}
|
||||
|
||||
#region Load
|
||||
|
||||
void OnLoadClicked()
|
||||
{
|
||||
#if UNITY_STANDALONE_WIN
|
||||
var path = FileDialogForWindows.FileDialog("open VRM", ".vrm");
|
||||
var path = FileDialogForWindows.FileDialog("open VRM", ".vrm");
|
||||
#else
|
||||
var path = Application.dataPath + "/default.vrm";
|
||||
#endif
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return;
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var bytes = File.ReadAllBytes(path);
|
||||
// なんらかの方法でByte列を得た
|
||||
|
||||
var context = new VRMImporterContext();
|
||||
|
||||
// GLB形式でJSONを取得しParseします
|
||||
context.ParseGlb(bytes);
|
||||
|
||||
|
||||
// metaを取得(todo: thumbnailテクスチャのロード)
|
||||
var meta = context.ReadMeta();
|
||||
Debug.LogFormat("meta: title:{0}", meta.Title);
|
||||
|
||||
// ParseしたJSONをシーンオブジェクトに変換していく
|
||||
context.LoadAsync(_ => OnLoaded(context));
|
||||
}
|
||||
|
||||
var bytes = File.ReadAllBytes(path);
|
||||
// なんらかの方法でByte列を得た
|
||||
|
||||
var context = new VRMImporterContext();
|
||||
|
||||
// GLB形式でJSONを取得しParseします
|
||||
context.ParseGlb(bytes);
|
||||
|
||||
|
||||
// metaを取得(todo: thumbnailテクスチャのロード)
|
||||
var meta = context.ReadMeta();
|
||||
Debug.LogFormat("meta: title:{0}", meta.Title);
|
||||
|
||||
// ParseしたJSONをシーンオブジェクトに変換していく
|
||||
context.LoadAsync(_ => OnLoaded(context));
|
||||
}
|
||||
|
||||
void OnLoaded(VRMImporterContext context)
|
||||
{
|
||||
if (m_model != null)
|
||||
void OnLoaded(VRMImporterContext context)
|
||||
{
|
||||
GameObject.Destroy(m_model.gameObject);
|
||||
if (m_model != null)
|
||||
{
|
||||
GameObject.Destroy(m_model.gameObject);
|
||||
}
|
||||
|
||||
m_model = context.Root;
|
||||
m_model.transform.rotation = Quaternion.Euler(0, 180, 0);
|
||||
|
||||
context.ShowMeshes();
|
||||
context.EnableUpdateWhenOffscreen();
|
||||
}
|
||||
|
||||
m_model = context.Root;
|
||||
m_model.transform.rotation = Quaternion.Euler(0, 180, 0);
|
||||
#endregion
|
||||
|
||||
context.ShowMeshes();
|
||||
context.EnableUpdateWhenOffscreen();
|
||||
}
|
||||
#endregion
|
||||
#region Export
|
||||
|
||||
#region Export
|
||||
void OnExportClicked()
|
||||
{
|
||||
//#if UNITY_STANDALONE_WIN
|
||||
void OnExportClicked()
|
||||
{
|
||||
//#if UNITY_STANDALONE_WIN
|
||||
#if false
|
||||
var path = FileDialogForWindows.SaveDialog("save VRM", Application.dataPath + "/export.vrm");
|
||||
#else
|
||||
var path = Application.dataPath + "/../export.vrm";
|
||||
var path = Application.dataPath + "/../export.vrm";
|
||||
#endif
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return;
|
||||
if (string.IsNullOrEmpty(path))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var vrm = VRMExporter.Export(m_model);
|
||||
var bytes = vrm.ToGlbBytes();
|
||||
File.WriteAllBytes(path, bytes);
|
||||
Debug.LogFormat("export to {0}", path);
|
||||
}
|
||||
|
||||
var vrm = VRMExporter.Export(m_model);
|
||||
var bytes = vrm.ToGlbBytes();
|
||||
File.WriteAllBytes(path, bytes);
|
||||
Debug.LogFormat("export to {0}", path);
|
||||
}
|
||||
void OnExported(UniGLTF.glTF vrm)
|
||||
{
|
||||
Debug.LogFormat("exported");
|
||||
}
|
||||
|
||||
void OnExported(UniGLTF.glTF vrm)
|
||||
{
|
||||
Debug.LogFormat("exported");
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
|
|||
using UnityEngine;
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public class VRMRuntimeLoader : MonoBehaviour
|
||||
{
|
||||
|
|
@ -195,7 +195,7 @@ namespace VRM
|
|||
|
||||
//メッシュを表示します
|
||||
context.ShowMeshes();
|
||||
|
||||
|
||||
// add motion
|
||||
var humanPoseTransfer = root.AddComponent<UniHumanoid.HumanPoseTransfer>();
|
||||
if (m_target != null)
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ using System.Threading.Tasks;
|
|||
#endif
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public class VRMRuntimeLoaderNet4 : MonoBehaviour
|
||||
{
|
||||
|
|
@ -104,7 +104,7 @@ namespace VRM
|
|||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var context = new VRMImporterContext();
|
||||
|
||||
var bytes = await ReadBytesAsync(path);
|
||||
|
|
@ -123,7 +123,7 @@ namespace VRM
|
|||
var delta = Time.time - now;
|
||||
Debug.LogFormat("LoadVrmAsync {0:0.0} seconds", delta);
|
||||
OnLoaded(context);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void LoadBVHClicked()
|
||||
|
|
@ -160,11 +160,11 @@ namespace VRM
|
|||
void LoadBvh(string path)
|
||||
{
|
||||
Debug.LogFormat("ImportBvh: {0}", path);
|
||||
|
||||
|
||||
var context = new UniHumanoid.BvhImporterContext();
|
||||
|
||||
context.Parse(path);
|
||||
|
||||
|
||||
context.Load();
|
||||
|
||||
if (m_source != null)
|
||||
|
|
@ -177,4 +177,4 @@ namespace VRM
|
|||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using UnityEngine;
|
|||
using UnityEngine.UI;
|
||||
|
||||
|
||||
namespace VRM
|
||||
namespace VRM.Samples
|
||||
{
|
||||
public class ViewerUI : MonoBehaviour
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user