mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-09 20:38:56 -05:00
Merge pull request #1144 from ousttrue/feature/springbone_reset
OnResetClicked
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -38,6 +38,9 @@ namespace VRM.Samples
|
||||
[SerializeField]
|
||||
GameObject Root = default;
|
||||
|
||||
[SerializeField]
|
||||
Button m_reset = default;
|
||||
|
||||
[Serializable]
|
||||
class TextFields
|
||||
{
|
||||
@@ -160,6 +163,8 @@ namespace VRM.Samples
|
||||
var buttons = GameObject.FindObjectsOfType<Button>();
|
||||
m_open = buttons.First(x => x.name == "Open");
|
||||
|
||||
m_reset = buttons.First(x => x.name == "ResetSpringBone");
|
||||
|
||||
var toggles = GameObject.FindObjectsOfType<Toggle>();
|
||||
m_enableLipSync = toggles.First(x => x.name == "EnableLipSync");
|
||||
m_enableAutoBlink = toggles.First(x => x.name == "EnableAutoBlink");
|
||||
@@ -211,6 +216,8 @@ namespace VRM.Samples
|
||||
VRMVersion.MAJOR, VRMVersion.MINOR);
|
||||
m_open.onClick.AddListener(OnOpenClicked);
|
||||
|
||||
m_reset.onClick.AddListener(OnResetClicked);
|
||||
|
||||
// load initial bvh
|
||||
LoadMotion(Application.streamingAssetsPath + "/VRM.Samples/Motions/test.txt");
|
||||
|
||||
@@ -267,6 +274,18 @@ namespace VRM.Samples
|
||||
}
|
||||
}
|
||||
|
||||
void OnResetClicked()
|
||||
{
|
||||
if (m_loaded == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (var spring in m_loaded.GetComponentsInChildren<VRMSpringBone>())
|
||||
{
|
||||
spring.Setup();
|
||||
}
|
||||
}
|
||||
|
||||
void OnOpenClicked()
|
||||
{
|
||||
#if UNITY_STANDALONE_WIN
|
||||
|
||||
Reference in New Issue
Block a user