mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-07-23 10:41:26 -05:00
targetName
This commit is contained in:
parent
d66256d082
commit
09287cddd1
|
|
@ -78,7 +78,7 @@ namespace UniVRM10.VRM10Viewer
|
|||
|
||||
root.Q<Button>("OpenModel").clicked += () =>
|
||||
{
|
||||
m_controller.OnOpenModelClicked(MakeLoadOptions());
|
||||
m_controller.OnOpenModelClicked(MakeLoadOptions(), name, nameof(FileSelected));
|
||||
};
|
||||
|
||||
root.Q<Button>("OpenMotion").clicked += () =>
|
||||
|
|
@ -370,5 +370,15 @@ namespace UniVRM10.VRM10Viewer
|
|||
Debug.LogException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// for WebGL
|
||||
/// call from OpenFile.jslib
|
||||
/// </summary>
|
||||
public void FileSelected(string url)
|
||||
{
|
||||
UniGLTFLogger.Log($"FileSelected: {url}");
|
||||
StartCoroutine(m_controller.LoadCoroutine(url, MakeLoadOptions()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -138,7 +138,7 @@ namespace UniVRM10.VRM10Viewer
|
|||
[DllImport("__Internal")]
|
||||
public static extern void WebGL_VRM10_VRM10Viewer_FileDialog(string target, string message);
|
||||
|
||||
string FileDialog()
|
||||
string FileDialog(string callbackObject, string callbackMethod)
|
||||
{
|
||||
#if UNITY_EDITOR
|
||||
return UnityEditor.EditorUtility.OpenFilePanel("Open VRM", "", "vrm,glb,gltf,zip");
|
||||
|
|
@ -146,8 +146,8 @@ namespace UniVRM10.VRM10Viewer
|
|||
return VRM10FileDialogForWindows.FileDialog("open VRM", "vrm", "glb", "gltf", "zip");
|
||||
#elif UNITY_WEBGL
|
||||
// Open WebGL_VRM10_VRM10Viewer_FileDialog
|
||||
// see: Assets/UniGLTF/Runtime/Utils/Plugins/OpenFile.jslib
|
||||
WebGL_VRM10_VRM10Viewer_FileDialog("Canvas", "FileSelected");
|
||||
// see: Assets\VRM10_Samples\VRM10Viewer\Plugins\WebGL_VRM10_VRM10Viewer.jslib
|
||||
WebGL_VRM10_VRM10Viewer_FileDialog(callbackObject, callbackMethod);
|
||||
// Control flow does not return here. return empty string with dummy
|
||||
return null;
|
||||
#else
|
||||
|
|
@ -162,9 +162,9 @@ namespace UniVRM10.VRM10Viewer
|
|||
var _ = LoadModelBytes("WebGL.vrm", www.bytes, opts);
|
||||
}
|
||||
|
||||
public void OnOpenModelClicked(LoadOptions opts)
|
||||
public void OnOpenModelClicked(LoadOptions opts, string callbackObject, string callbackMethod)
|
||||
{
|
||||
var path = FileDialog();
|
||||
var path = FileDialog(callbackObject, callbackMethod);
|
||||
_ = LoadModelPath(path, opts);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ namespace UniVRM10.VRM10Viewer
|
|||
|
||||
m_version.text = string.Format("VRM10ViewerUI {0}", PackageVersion.VERSION);
|
||||
|
||||
m_openModel.onClick.AddListener(() => m_controller.OnOpenModelClicked(MakeLoadOptions()));
|
||||
m_openModel.onClick.AddListener(() => m_controller.OnOpenModelClicked(MakeLoadOptions(), name, nameof(FileSelected)));
|
||||
m_openMotion.onClick.AddListener(m_controller.OnOpenMotionClicked);
|
||||
m_pastePose.onClick.AddListener(m_controller.OnPastePoseClicked);
|
||||
m_resetSpringBone.onClick.AddListener(m_controller.OnResetSpringBoneClicked);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user