mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-26 21:04:14 -05:00
@@ -5,7 +5,7 @@ namespace UniGLTF
|
||||
{
|
||||
public const int MAJOR = 0;
|
||||
public const int MINOR = 127;
|
||||
public const int PATCH = 0;
|
||||
public const string VERSION = "0.127.0";
|
||||
public const int PATCH = 1;
|
||||
public const string VERSION = "0.127.1";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace UniGLTF
|
||||
{
|
||||
public const int MAJOR = 2;
|
||||
public const int MINOR = 63;
|
||||
public const int PATCH = 0;
|
||||
public const string VERSION = "2.63.0";
|
||||
public const int PATCH = 1;
|
||||
public const string VERSION = "2.63.1";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.vrmc.gltf",
|
||||
"version": "0.127.0",
|
||||
"version": "0.127.1",
|
||||
"displayName": "UniGLTF",
|
||||
"description": "GLTF importer and exporter",
|
||||
"unity": "2021.3",
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using UniGLTF;
|
||||
using UniGLTF.SpringBoneJobs.Blittables;
|
||||
using UniHumanoid;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -40,9 +41,12 @@ namespace VRM.SimpleViewer
|
||||
}
|
||||
}
|
||||
|
||||
public Loaded(RuntimeGltfInstance instance, HumanPoseTransfer src, Transform lookAtTarget)
|
||||
IVrm0XSpringBoneRuntime _springbone;
|
||||
|
||||
public Loaded(RuntimeGltfInstance instance, HumanPoseTransfer src, Transform lookAtTarget, IVrm0XSpringBoneRuntime springbone)
|
||||
{
|
||||
_instance = instance;
|
||||
_springbone = springbone;
|
||||
|
||||
var lookAt = instance.GetComponent<VRMLookAtHead>();
|
||||
if (lookAt != null)
|
||||
@@ -104,15 +108,19 @@ namespace VRM.SimpleViewer
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetSpring()
|
||||
public void ResetSpringbone()
|
||||
{
|
||||
if (_pose != null)
|
||||
{
|
||||
foreach (var spring in _pose.GetComponentsInChildren<VRMSpringBone>())
|
||||
{
|
||||
spring.Setup();
|
||||
}
|
||||
}
|
||||
_springbone.RestoreInitialTransform();
|
||||
}
|
||||
|
||||
public void ReconstructSpringbone()
|
||||
{
|
||||
_springbone.ReconstructSpringBone();
|
||||
}
|
||||
|
||||
public void SetSpringboneModelLevel(BlittableModelLevel modelSettings)
|
||||
{
|
||||
_springbone.SetModelLevel(_instance.transform, modelSettings);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,8 +39,28 @@ namespace VRM.SimpleViewer
|
||||
[SerializeField]
|
||||
Toggle m_loadAnimation = default;
|
||||
|
||||
// SpringBone
|
||||
[SerializeField]
|
||||
Toggle m_useFastSpringBone = default;
|
||||
|
||||
[SerializeField]
|
||||
Toggle m_springBonePause = default;
|
||||
|
||||
[SerializeField]
|
||||
Toggle m_springBoneScaling = default;
|
||||
|
||||
[SerializeField]
|
||||
Slider m_springExternalX = default;
|
||||
[SerializeField]
|
||||
Slider m_springExternalY = default;
|
||||
[SerializeField]
|
||||
Slider m_springExternalZ = default;
|
||||
|
||||
[SerializeField]
|
||||
Button m_reset = default;
|
||||
|
||||
[SerializeField]
|
||||
Button m_reconstruct = default;
|
||||
#endregion
|
||||
|
||||
[SerializeField]
|
||||
@@ -52,9 +72,6 @@ namespace VRM.SimpleViewer
|
||||
[SerializeField]
|
||||
GameObject Root = default;
|
||||
|
||||
[SerializeField]
|
||||
Button m_reset = default;
|
||||
|
||||
[SerializeField]
|
||||
TextAsset m_motion;
|
||||
|
||||
@@ -280,10 +297,9 @@ namespace VRM.SimpleViewer
|
||||
m_version.text = string.Format("VRMViewer {0}.{1}",
|
||||
PackageVersion.MAJOR, PackageVersion.MINOR);
|
||||
m_open.onClick.AddListener(OnOpenClicked);
|
||||
m_useFastSpringBone.onValueChanged.AddListener(OnUseFastSpringBoneValueChanged);
|
||||
OnUseFastSpringBoneValueChanged(m_useFastSpringBone.isOn);
|
||||
|
||||
m_reset.onClick.AddListener(() => m_loaded?.ResetSpring());
|
||||
m_reset.onClick.AddListener(() => m_loaded?.ResetSpringbone());
|
||||
m_reconstruct.onClick.AddListener(() => m_loaded?.ReconstructSpringbone());
|
||||
|
||||
// load initial bvh
|
||||
if (m_motion != null)
|
||||
@@ -327,6 +343,16 @@ namespace VRM.SimpleViewer
|
||||
{
|
||||
m_loaded.EnableLipSyncValue = m_enableLipSync.isOn;
|
||||
m_loaded.EnableBlinkValue = m_enableAutoBlink.isOn;
|
||||
m_loaded.SetSpringboneModelLevel(new UniGLTF.SpringBoneJobs.Blittables.BlittableModelLevel
|
||||
{
|
||||
ExternalForce = new Vector3(
|
||||
m_springExternalX.value,
|
||||
m_springExternalY.value,
|
||||
m_springExternalZ.value
|
||||
),
|
||||
StopSpringBoneWriteback = m_springBonePause.isOn,
|
||||
SupportsScalingAtRuntime = m_springBoneScaling.isOn,
|
||||
});
|
||||
m_loaded.Update();
|
||||
}
|
||||
}
|
||||
@@ -392,21 +418,17 @@ namespace VRM.SimpleViewer
|
||||
// vrm
|
||||
VrmUtility.MaterialGeneratorCallback materialCallback = (glTF_VRM_extensions vrm) => GetVrmMaterialGenerator(m_useUrpMaterial.isOn, vrm);
|
||||
VrmUtility.MetaCallback metaCallback = m_texts.UpdateMeta;
|
||||
IVrm0XSpringBoneRuntime springboneRuntime = m_useFastSpringBone.isOn ? new Vrm0XFastSpringboneRuntime() : new Vrm0XSpringBoneDefaultRuntime();
|
||||
var instance = await VrmUtility.LoadBytesAsync(path, bytes, GetIAwaitCaller(m_useAsync.isOn),
|
||||
materialCallback, metaCallback,
|
||||
loadAnimation: m_loadAnimation.isOn,
|
||||
springboneRuntime: m_useFastSpringBone.isOn ? new Vrm0XFastSpringboneRuntime() : new Vrm0XSpringBoneDefaultRuntime()
|
||||
springboneRuntime: springboneRuntime
|
||||
);
|
||||
|
||||
instance.EnableUpdateWhenOffscreen();
|
||||
instance.ShowMeshes();
|
||||
|
||||
m_loaded = new Loaded(instance, m_src, m_target.transform);
|
||||
}
|
||||
|
||||
void OnUseFastSpringBoneValueChanged(bool flag)
|
||||
{
|
||||
m_reset.gameObject.SetActive(!flag);
|
||||
m_loaded = new Loaded(instance, m_src, m_target.transform, springboneRuntime);
|
||||
}
|
||||
|
||||
static IMaterialDescriptorGenerator GetGltfMaterialGenerator(bool useUrp)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.vrmc.univrm",
|
||||
"version": "0.127.0",
|
||||
"version": "0.127.1",
|
||||
"displayName": "VRM",
|
||||
"description": "VRM importer",
|
||||
"unity": "2021.3",
|
||||
@@ -14,7 +14,7 @@
|
||||
"name": "VRM Consortium"
|
||||
},
|
||||
"dependencies": {
|
||||
"com.vrmc.gltf": "0.127.0",
|
||||
"com.vrmc.gltf": "0.127.1",
|
||||
"com.unity.ugui": "1.0.0"
|
||||
},
|
||||
"samples": [
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:b7aa47b240b57de44a4b2021c143c9bf",
|
||||
"GUID:da3e51d19d51a544fa14d43fee843098",
|
||||
"GUID:8d76e605759c3f64a957d63ef96ada7c",
|
||||
"GUID:e47c917724578cc43b5506c17a27e9a0",
|
||||
"GUID:1cd941934d098654fa21a13f28346412"
|
||||
"GUID:1cd941934d098654fa21a13f28346412",
|
||||
"GUID:3e5d614bc16b50d41bd94c8d7444ca46"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace UniVRM10.VRM10Viewer
|
||||
{
|
||||
RuntimeGltfInstance m_instance;
|
||||
Vrm10Instance m_controller;
|
||||
public Vrm10Instance Instance => m_controller;
|
||||
public Vrm10RuntimeControlRig ControlRig => m_controller.Runtime.ControlRig;
|
||||
public Vrm10Runtime Runtime => m_controller.Runtime;
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using UniGLTF;
|
||||
using UniGLTF.SpringBoneJobs.Blittables;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -26,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;
|
||||
|
||||
@@ -44,15 +39,34 @@ 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;
|
||||
[SerializeField]
|
||||
Button m_reconstructSpringBone = default;
|
||||
|
||||
GameObject Root = default;
|
||||
|
||||
IVrm10Animation m_src = default;
|
||||
@@ -257,7 +271,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);
|
||||
@@ -265,12 +278,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);
|
||||
@@ -355,6 +371,7 @@ namespace UniVRM10.VRM10Viewer
|
||||
m_openMotion.onClick.AddListener(OnOpenMotionClicked);
|
||||
m_pastePose.onClick.AddListener(OnPastePoseClicked);
|
||||
m_resetSpringBone.onClick.AddListener(OnResetSpringBoneClicked);
|
||||
m_reconstructSpringBone.onClick.AddListener(OnReconstructSpringBoneClicked);
|
||||
|
||||
// load initial bvh
|
||||
if (m_motion != null)
|
||||
@@ -414,7 +431,12 @@ namespace UniVRM10.VRM10Viewer
|
||||
m_loaded.Runtime.VrmAnimation = Motion;
|
||||
}
|
||||
|
||||
m_loaded.Runtime.SpringBone.IsSpringBoneEnabled = !m_pauseSpringBone.isOn;
|
||||
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,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -505,6 +527,17 @@ namespace UniVRM10.VRM10Viewer
|
||||
}
|
||||
}
|
||||
|
||||
void OnReconstructSpringBoneClicked()
|
||||
{
|
||||
if (m_loaded != null)
|
||||
{
|
||||
if (m_loaded.Runtime != null)
|
||||
{
|
||||
m_loaded.Runtime.SpringBone.ReconstructSpringBone();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static IMaterialDescriptorGenerator GetVrmMaterialDescriptorGenerator(bool useUrp)
|
||||
{
|
||||
if (useUrp)
|
||||
@@ -547,7 +580,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);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "com.vrmc.vrm",
|
||||
"version": "0.127.0",
|
||||
"version": "0.127.1",
|
||||
"displayName": "VRM-1.0",
|
||||
"description": "VRM-1.0 importer",
|
||||
"unity": "2021.3",
|
||||
@@ -14,7 +14,7 @@
|
||||
"name": "VRM Consortium"
|
||||
},
|
||||
"dependencies": {
|
||||
"com.vrmc.gltf": "0.127.0"
|
||||
"com.vrmc.gltf": "0.127.1"
|
||||
},
|
||||
"samples": [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user