VRM10_Samples/VRM10Viewer BlittableModelLevel ui

This commit is contained in:
ousttrue 2024-10-04 13:24:49 +09:00
parent f643f2befd
commit 896051ced2
2 changed files with 1585 additions and 62 deletions

File diff suppressed because it is too large Load Diff

View File

@ -11,8 +11,6 @@ namespace UniVRM10.VRM10Viewer
{
public class VRM10ViewerUI : MonoBehaviour
{
public BlittableModelLevel SpringBoneMocdelLevel;
[SerializeField]
Text m_version = default;
@ -29,12 +27,6 @@ namespace UniVRM10.VRM10Viewer
[SerializeField]
Toggle m_showBoxMan = default;
[SerializeField]
Toggle m_pauseSpringBone = default;
[SerializeField]
Button m_resetSpringBone = default;
[SerializeField]
Toggle m_enableLipSync = default;
@ -47,15 +39,32 @@ namespace UniVRM10.VRM10Viewer
[SerializeField]
Toggle m_useAsync = default;
[SerializeField]
Toggle m_useSingelton = default;
[SerializeField]
GameObject m_target = default;
[SerializeField]
TextAsset m_motion;
// springbone
[SerializeField]
Toggle m_useSpringboneSingelton = default;
[SerializeField]
Toggle m_springbonePause = default;
[SerializeField]
Toggle m_springboneScaling = default;
[SerializeField]
Slider m_springboneExternalX = default;
[SerializeField]
Slider m_springboneExternalY = default;
[SerializeField]
Slider m_springboneExternalZ = default;
[SerializeField]
Button m_resetSpringBone = default;
GameObject Root = default;
IVrm10Animation m_src = default;
@ -260,7 +269,6 @@ namespace UniVRM10.VRM10Viewer
m_openModel = buttons.First(x => x.name == "OpenModel");
m_openMotion = buttons.First(x => x.name == "OpenMotion");
m_pastePose = buttons.First(x => x.name == "PastePose");
m_resetSpringBone = buttons.First(x => x.name == "ResetSpringBone");
#if UNITY_2022_3_OR_NEWER
var toggles = GameObject.FindObjectsByType<Toggle>(FindObjectsSortMode.InstanceID);
@ -268,12 +276,15 @@ namespace UniVRM10.VRM10Viewer
var toggles = GameObject.FindObjectsOfType<Toggle>();
#endif
m_showBoxMan = toggles.First(x => x.name == "ShowBoxMan");
m_pauseSpringBone = toggles.First(x => x.name == "PauseSpringBone");
m_enableLipSync = toggles.First(x => x.name == "EnableLipSync");
m_enableAutoBlink = toggles.First(x => x.name == "EnableAutoBlink");
m_enableAutoExpression = toggles.First(x => x.name == "EnableAutoExpression");
m_useAsync = toggles.First(x => x.name == "UseAsync");
m_useSingelton = toggles.First(x => x.name == "UseSingleton");
m_useSpringboneSingelton = toggles.First(x => x.name == "UseSingleton");
m_springbonePause = toggles.First(x => x.name == "PauseSpringBone");
m_resetSpringBone = buttons.First(x => x.name == "ResetSpringBone");
#if UNITY_2022_3_OR_NEWER
var texts = GameObject.FindObjectsByType<Text>(FindObjectsSortMode.InstanceID);
@ -417,7 +428,12 @@ namespace UniVRM10.VRM10Viewer
m_loaded.Runtime.VrmAnimation = Motion;
}
m_loaded.Runtime.SpringBone.SetModelLevel(m_loaded.Instance.transform, SpringBoneMocdelLevel);
m_loaded.Runtime.SpringBone.SetModelLevel(m_loaded.Instance.transform, new BlittableModelLevel
{
ExternalForce = new Vector3(m_springboneExternalX.value, m_springboneExternalY.value, m_springboneExternalZ.value),
StopSpringBoneWriteback = m_springbonePause.isOn,
SupportsScalingAtRuntime = m_springboneScaling.isOn,
});
}
}
}
@ -550,7 +566,7 @@ namespace UniVRM10.VRM10Viewer
awaitCaller: m_useAsync.enabled ? new RuntimeOnlyAwaitCaller() : new ImmediateCaller(),
vrmMetaInformationCallback: m_texts.UpdateMeta,
ct: cancellationToken,
springboneRuntime: m_useSingelton.isOn ? new Vrm10FastSpringboneRuntime() : new Vrm10FastSpringboneRuntimeStandalone());
springboneRuntime: m_useSpringboneSingelton.isOn ? new Vrm10FastSpringboneRuntime() : new Vrm10FastSpringboneRuntimeStandalone());
if (cancellationToken.IsCancellationRequested)
{
UnityObjectDestroyer.DestroyRuntimeOrEditor(vrm10Instance.gameObject);