diff --git a/.gitignore b/.gitignore index be1807252..f7328acdb 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ sysinfo.txt *.unitypackage /VMagicMirror/Logs/ +/VMagicMirror/UserSettings/ # Streaming Assets (now only include DlibFaceLandmarkDetector, so it must be ignored) /VMagicMirror/Assets/StreamingAssets/ diff --git a/Batches/build_unity.cmd b/Batches/build_unity.cmd index 2dc3466d8..4c5d13916 100644 --- a/Batches/build_unity.cmd +++ b/Batches/build_unity.cmd @@ -5,7 +5,7 @@ REM example: `build_unity.cmd full dev` REM use following instead, if editor is NOT from Hub REM set UNITY_EXE="%ProgramFiles%\Unity\Editor\Unity.exe" -set UNITY_EXE="%ProgramFiles%\Unity\Hub\Editor\2020.3.22f1\Editor\Unity.exe" +set UNITY_EXE="%ProgramFiles%\Unity\Hub\Editor\2022.3.7f1\Editor\Unity.exe" cd %~dp0 diff --git a/Batches/version.txt b/Batches/version.txt index e682ea429..56e50151c 100644 --- a/Batches/version.txt +++ b/Batches/version.txt @@ -1 +1 @@ -v3.3.0 \ No newline at end of file +v3.3.1 \ No newline at end of file diff --git a/README.md b/README.md index 922563e92..c68bb7382 100644 --- a/README.md +++ b/README.md @@ -4,10 +4,10 @@ Logo: by [@otama_jacksy](https://twitter.com/otama_jacksy) -v3.3.0 +v3.3.1 * 作成: 獏星(ばくすたー) -* 2023/08/31 +* 2023/09/30 WindowsでVRMを表示し、追加のデバイスなしで動かせるアプリケーションです。 @@ -51,12 +51,12 @@ Windows 10/11環境でお使いいただけます。 適当なフォルダに本レポジトリを配置します。配置先について、空白文字を含むようなフォルダパスは避けて下さい。 -Unity 2020.3系でUnityプロジェクト(本レポジトリの`VMagicMirror`フォルダ)を開き、Visual Studio 2022でWPFプロジェクトを開きます。 +Unity 2022.3系でUnityプロジェクト(本レポジトリの`VMagicMirror`フォルダ)を開き、Visual Studio 2022でWPFプロジェクトを開きます。 メンテナの開発環境は以下の通りです。 -* Unity 2020.3.22f1 Personal -* Visual Studio Community 2022 (17.0.0) +* Unity 2022.3.7f1 Personal +* Visual Studio Community 2022 (17.4.4) * 「.NET Desktop」コンポーネントがインストール済みであること * 「C++によるデスクトップ開発」コンポーネントがインストール済みであること - UnityのBurstコンパイラ向けに必要なセットアップです。 diff --git a/README_en.md b/README_en.md index eb0ca623a..82d7afe65 100644 --- a/README_en.md +++ b/README_en.md @@ -5,10 +5,10 @@ Logo: by [@otama_jacksy](https://twitter.com/otama_jacksy) -v3.3.0 +v3.3.1 * Author: Baxter -* 2023/Aug/31 +* 2023/Sep/30 The VRM avatar application without any special device. @@ -54,12 +54,12 @@ note: Contact in English or Japanese is very helpful for the author. Put the repository on your local folder. folder path should not include space character. -Open Unity project with Unity 2020.3.x, and open WPF project with Visual Studio 2022. +Open Unity project with Unity 2022.3.x, and open WPF project with Visual Studio 2022. Maintainer's environment is as following. -* Unity 2020.3.8f1 Personal -* Visual Studio Community 2022 17.0.0 +* Unity 2022.3.7f1 Personal +* Visual Studio Community 2022 (17.4.4) * Component ".NET Desktop Development" is required. * Also Component "C++ Desktop Development" is required, for Unity Burst compiler. diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/Motion/HandIKIntegrator.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/Motion/HandIKIntegrator.cs index 4289658b6..c239ba33c 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/Motion/HandIKIntegrator.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/Motion/HandIKIntegrator.cs @@ -465,6 +465,12 @@ private void LateUpdate() _arcadeStickHand.LateUpdate(); _penTablet.LateUpdate(); } + + private void OnDestroy() + { + _vmcpHand.Dispose(); + //NOTE: 他でもDisposeしたほうがいいものは追加してOK + } private void UpdateLeftHand() { @@ -538,25 +544,48 @@ private void UpdateRightHand() t ); } - - private void SetLeftHandState(IHandIkState state) + + private bool CanChangeState(HandTargetType current, HandTargetType target) { - var targetType = state.TargetType; - //書いてる通りだが、 // - 同じ状態には遷移できない - // - 手下げモード、ないしVMCProtocolのときは拍手以外に遷移できない - // - 拍手は実行優先度がすごく高い - if (_leftTargetType.Value == targetType || - AlwaysHandDown.Value && targetType != HandTargetType.AlwaysDown && targetType != HandTargetType.ClapMotion || - _vmcpHand.IsActive.Value && targetType != HandTargetType.VMCPReceiveResult && targetType != HandTargetType.ClapMotion || - _leftTargetType.Value == HandTargetType.ClapMotion && ClapMotion.ClapMotionRunning + // - 拍手は実行優先度がすごく高いので、他の状態に遷移できない + // - 手下げモード有効時は手下げ or 拍手にしか遷移できない + // - VMCProtocolが有効だとVMCP or 手下げ or 拍手にしか遷移できない + + if (current == target) + { + return false; + } + + if (current == HandTargetType.ClapMotion && ClapMotion.ClapMotionRunning) + { + return false; + } + + if (AlwaysHandDown.Value && target != HandTargetType.AlwaysDown && + target != HandTargetType.ClapMotion) + { + return false; + } + + if (_vmcpHand.IsActive.Value && target != HandTargetType.VMCPReceiveResult && + target != HandTargetType.ClapMotion && target != HandTargetType.AlwaysDown ) + { + return false; + } + return true; + } + + private void SetLeftHandState(IHandIkState state) + { + if (!CanChangeState(_leftTargetType.Value, state.TargetType)) { return; } - _leftTargetType.Value = targetType; + _leftTargetType.Value = state.TargetType; _prevLeftHand = _currentLeftHand; _currentLeftHand = state; @@ -574,19 +603,12 @@ private void SetLeftHandState(IHandIkState state) private void SetRightHandState(IHandIkState state) { - var targetType = state.TargetType; - - // 優先度の効かせ方はLeftHandと同じ - if (_rightTargetType.Value == targetType || - _vmcpHand.IsActive.Value && targetType != HandTargetType.VMCPReceiveResult && targetType != HandTargetType.ClapMotion || - AlwaysHandDown.Value && targetType != HandTargetType.AlwaysDown && targetType != HandTargetType.ClapMotion || - _rightTargetType.Value == HandTargetType.ClapMotion && ClapMotion.ClapMotionRunning - ) + if (!CanChangeState(_rightTargetType.Value, state.TargetType)) { return; } - _rightTargetType.Value = targetType; + _rightTargetType.Value = state.TargetType; _prevRightHand = _currentRightHand; _currentRightHand = state; diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/Motion/IK/HandIkGeneratorBase.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/Motion/IK/HandIkGeneratorBase.cs index 9da47815b..47a411df8 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/Motion/IK/HandIkGeneratorBase.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/Motion/IK/HandIkGeneratorBase.cs @@ -1,9 +1,10 @@ -using System.Collections; +using System; +using System.Collections; using UnityEngine; namespace Baku.VMagicMirror.IK { - public abstract class HandIkGeneratorBase + public abstract class HandIkGeneratorBase : IDisposable { public HandIkGeneratorBase(HandIkGeneratorDependency dependency) { @@ -32,6 +33,10 @@ public virtual void LateUpdate() { } + public virtual void Dispose() + { + } + protected Coroutine StartCoroutine(IEnumerator i) => Dependency.Component.StartCoroutine(i); protected void StopCoroutine(Coroutine coroutine) => Dependency.Component.StopCoroutine(coroutine); } diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/VMCP/VMCPBodyOffset.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/VMCP/VMCPBodyOffset.cs index f4b070c15..49c9b571a 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/VMCP/VMCPBodyOffset.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/VMCP/VMCPBodyOffset.cs @@ -106,7 +106,7 @@ private void Update() var offset = _vmcpHeadPose.PositionOffset; - var goal = _vmcpHeadPose.Connected.Value + var goal = _vmcpHeadPose.IsConnected.Value ? new Vector3( Mathf.Clamp(offset.x * _scale.x, _min.x, _max.x), Mathf.Clamp(offset.y * _scale.y, _min.y, _max.y), @@ -114,7 +114,7 @@ private void Update() ) : Vector3.zero; - if (_vmcpHeadPose.Connected.Value) + if (_vmcpHeadPose.IsConnected.Value) { var addedLerp = _currentLerpFactor + diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/WordToMotion/V2/WordToMotionRunner.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/WordToMotion/V2/WordToMotionRunner.cs index 289a37ec5..80787d170 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/WordToMotion/V2/WordToMotionRunner.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/AvatarControl/WordToMotion/V2/WordToMotionRunner.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; +using Baku.VMagicMirror.VMCP; using Cysharp.Threading.Tasks; using UnityEngine; using UniVRM10; @@ -16,6 +17,8 @@ public class WordToMotionRunner : PresenterBase private readonly IWordToMotionPlayer[] _players; private readonly WordToMotionBlendShape _blendShape; private readonly TaskBasedIkWeightFader _ikWeightCrossFade; + //NOTE: IKじゃないけどIKと同じくweight fadeの概念がある + private readonly VMCPNaiveBoneTransfer _vmcpNaiveBoneTransfer; private readonly FingerController _fingerController; private readonly WordToMotionAccessoryRequest _accessoryRequest; @@ -24,6 +27,7 @@ public class WordToMotionRunner : PresenterBase IEnumerable players, WordToMotionBlendShape blendShape, TaskBasedIkWeightFader ikWeightCrossFade, + VMCPNaiveBoneTransfer vmcpNaiveBoneTransfer, FingerController fingerController, WordToMotionAccessoryRequest accessoryRequest) { @@ -31,6 +35,7 @@ public class WordToMotionRunner : PresenterBase _players = players.ToArray(); _blendShape = blendShape; _ikWeightCrossFade = ikWeightCrossFade; + _vmcpNaiveBoneTransfer = vmcpNaiveBoneTransfer; _fingerController = fingerController; _accessoryRequest = accessoryRequest; } @@ -110,12 +115,14 @@ public void Run(MotionRequest request) // 直前モーションでIKオフにしてない場合、オフにしたいので実際そうする _fingerController.FadeOutWeight(IkFadeDuration); _ikWeightCrossFade.SetUpperBodyIkWeight(0f, IkFadeDuration); + _vmcpNaiveBoneTransfer.FadeOutWeight(IkFadeDuration); } else if (!playablePlayer.UseIkAndFingerFade && _restoreIkOnMotionEnd) { // IKオフのモーション中にIK有効が期待されたモーションを行う場合、IKがオンになる _fingerController.FadeInWeight(IkFadeDuration); _ikWeightCrossFade.SetUpperBodyIkWeight(1f, IkFadeDuration); + _vmcpNaiveBoneTransfer.FadeInWeight(IkFadeDuration); } } @@ -188,11 +195,13 @@ public void RunAsPreview(MotionRequest request) { _fingerController.FadeOutWeight(IkFadeDuration); _ikWeightCrossFade.SetUpperBodyIkWeight(0f, IkFadeDuration); + _vmcpNaiveBoneTransfer.FadeOutWeight(IkFadeDuration); } else { _fingerController.FadeInWeight(IkFadeDuration); _ikWeightCrossFade.SetUpperBodyIkWeight(1f, IkFadeDuration); + _vmcpNaiveBoneTransfer.FadeInWeight(IkFadeDuration); } } @@ -226,6 +235,7 @@ public void Stop() } _fingerController.FadeInWeight(0f); _ikWeightCrossFade.SetUpperBodyIkWeight(1f, 0f); + _vmcpNaiveBoneTransfer.FadeInWeight(0f); _restoreIkOnMotionEnd = false; } @@ -239,6 +249,7 @@ private async UniTaskVoid ResetMotionAsync(float delay, bool fadeIkAndFinger, Ca { _fingerController.FadeInWeight(IkFadeDuration); _ikWeightCrossFade.SetUpperBodyIkWeight(1f, IkFadeDuration); + _vmcpNaiveBoneTransfer.FadeInWeight(IkFadeDuration); } _restoreIkOnMotionEnd = false; } diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/FaceTracker/DnnFaceAnalyzeRoutine.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/FaceTracker/DnnFaceAnalyzeRoutine.cs index 694e72f7e..a477aed0c 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/FaceTracker/DnnFaceAnalyzeRoutine.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/FaceTracker/DnnFaceAnalyzeRoutine.cs @@ -9,6 +9,7 @@ using OpenCVForUnity.ImgprocModule; using OpenCVForUnity.UtilsModule; using UnityEngine; +using Range = OpenCVForUnity.CoreModule.Range; using Rect = UnityEngine.Rect; #endif diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHandIkGenerator.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHandIkGenerator.cs index 1540ad508..65bc43fc9 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHandIkGenerator.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHandIkGenerator.cs @@ -11,7 +11,8 @@ public class VMCPHandIkGenerator : HandIkGeneratorBase // NOTE: 「未受信」はBarracudaHandとかのトラッキングロスよりは起きにくいのであまり凝った処理はしない。 // 送信元自体がトラッキングロスすることはあるが、その場合のモーション補間は送信元が頑張ってるはずなので信じる private const float ConnectedBlendRate = 2f; - + private const float RaiseRequestInterval = 0.2f; + public VMCPHandIkGenerator( HandIkGeneratorDependency dependency, VMCPHandPose vmcpHandPose, @@ -24,15 +25,24 @@ public class VMCPHandIkGenerator : HandIkGeneratorBase _leftHandState = new VMCPHandIkState(ReactedHand.Left, downHand.LeftHand); _rightHandState = new VMCPHandIkState(ReactedHand.Right, downHand.RightHand); - //オフ -> オンへの切り替え時だけリクエストが出るが、それ以上にバシバシ送ったほうが良ければ頻度を上げてもOK + //NOTE: 定期的にリクエストを飛ばすのは手下げモードのon/offの切り替わりに配慮している vmcpHandPose.IsActive .Subscribe(active => { if (active) { - _leftHandState.RaiseRequest(); - _rightHandState.RaiseRequest(); - } + _raiseRequestDisposable.Disposable = Observable + .Timer(TimeSpan.Zero, TimeSpan.FromSeconds(RaiseRequestInterval)) + .Subscribe(_ => + { + _leftHandState.RaiseRequest(); + _rightHandState.RaiseRequest(); + }); + } + else + { + _raiseRequestDisposable.Disposable = Disposable.Empty; + } }) .AddTo(dependency.Component); @@ -64,10 +74,13 @@ public override void Update() } } + public override void Dispose() + { + _raiseRequestDisposable.Dispose(); + } + private void LateUpdateCallback() { - - //指を適用する: FingerController経由じゃないことには注意 if (_vmcpHandPose.IsActive.Value) { @@ -82,7 +95,8 @@ private void LateUpdateCallback() private readonly VMCPHandIkState _rightHandState; public override IHandIkState RightHandState => _rightHandState; public IReadOnlyReactiveProperty IsActive => _vmcpHandPose.IsActive; - + + private readonly SerialDisposable _raiseRequestDisposable = new SerialDisposable(); private float _connectedRate = 0f; class VMCPHandIkState : IHandIkState diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHandPose.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHandPose.cs index 14a2b8ee7..42945c4f2 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHandPose.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHandPose.cs @@ -17,7 +17,6 @@ public class VMCPHandPose : IInitializable private readonly IVRMLoadable _vrmLoadable; private readonly VMCPBasedFingerSetter _fingerSetter; private Vector3 _defaultHipOffset = Vector3.up; - private VMCPBasedHumanoid _fingerSourceHumanoid = null; private bool _hasModel; public VMCPHandPose( @@ -49,12 +48,13 @@ public void Initialize() public IReadOnlyReactiveProperty IsConnected => _isConnected; public IReadOnlyReactiveProperty LeftHandPose => _leftHandPose; public IReadOnlyReactiveProperty RightHandPose => _rightHandPose; + public VMCPBasedHumanoid Humanoid { get; private set; } public void ApplyFingerLocalPose() { - if (_fingerSourceHumanoid != null) + if (Humanoid != null) { - _fingerSetter.Set(_fingerSourceHumanoid); + _fingerSetter.Set(Humanoid); } } @@ -69,8 +69,7 @@ public void SetActive(bool active) public void SetConnected(bool connected) => _isConnected.Value = connected; - public void SetFingerSourceHumanoid(VMCPBasedHumanoid humanoid) - => _fingerSourceHumanoid = humanoid; + public void SetHumanoid(VMCPBasedHumanoid humanoid) => Humanoid = humanoid; public void SetLeftHandPoseOnHips(Vector3 position, Quaternion rotation) => _leftHandPose.Value = new IKDataStruct(_defaultHipOffset + position, rotation); diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHeadPose.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHeadPose.cs index 87786f5b5..74cd7d76b 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHeadPose.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPHeadPose.cs @@ -11,9 +11,14 @@ public class VMCPHeadPose : IInitializable, ITickable private readonly ReactiveProperty _isActive = new ReactiveProperty(false); public IReadOnlyReactiveProperty IsActive => _isActive; - private readonly ReactiveProperty _connected = new ReactiveProperty(true); - public IReadOnlyReactiveProperty Connected => _connected; - + private readonly ReactiveProperty _isConnected = new ReactiveProperty(true); + public IReadOnlyReactiveProperty IsConnected => _isConnected; + + /// + /// NOTE: がtrueのときだけ非nullになれる + /// + public VMCPBasedHumanoid Humanoid { get; private set; } + private readonly IVRMLoadable _vrmLoadable; //NOTE: 0にはしないでおく、一応 private Vector3 _defaultHeadOffsetOnHips = Vector3.up; @@ -45,7 +50,7 @@ public void Initialize() void ITickable.Tick() { //受信してるはずだけどデータが更新されない -> 直立姿勢に戻す - if (_isActive.Value && !_connected.Value) + if (_isActive.Value && !_isConnected.Value) { var factor = ResetLerpFactor * Time.deltaTime; PositionOffset = Vector3.Lerp(PositionOffset, Vector3.zero, factor); @@ -62,16 +67,28 @@ void ITickable.Tick() /// 正面向きならゼロ回転になるような頭部回転 public Quaternion Rotation { get; private set; } - public void SetActive(bool active) + public void SetActive(VMCPBasedHumanoid humanoid) + { + Humanoid = humanoid; + SetActiveInternal(true); + } + + public void SetInactive() + { + SetActiveInternal(false); + Humanoid = null; + } + + void SetActiveInternal(bool active) { _isActive.Value = active; if (!active) { - _connected.Value = false; + _isConnected.Value = false; } } - public void SetConnected(bool connected) => _connected.Value = connected; + public void SetConnected(bool connected) => _isConnected.Value = connected; public void SetPoseOnHips(Pose pose) { @@ -84,7 +101,7 @@ public void SetPoseOnHips(Pose pose) _rawRotation = pose.rotation; //NOTE: 非接続状態の場合、PositionOffsetやRotationは値をゼロに戻すので、書き込まないでおく - if (_isActive.Value && _connected.Value) + if (_isActive.Value && _isConnected.Value) { PositionOffset = _rawPositionOffset; Rotation = _rawRotation; diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPNaiveBoneTransfer.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPNaiveBoneTransfer.cs new file mode 100644 index 000000000..631a447c8 --- /dev/null +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPNaiveBoneTransfer.cs @@ -0,0 +1,194 @@ +using System.Collections.Generic; +using System.Threading; +using Cysharp.Threading.Tasks; +using UnityEngine; +using Zenject; + +namespace Baku.VMagicMirror.VMCP +{ + //NOTE: このクラスの`Set`はIKの適用より後、かつVRM1.0のRuntimeのProcess()よりは先に呼ばれる必要がある。のでMonoBehaviour。 + public class VMCPNaiveBoneTransfer : MonoBehaviour + { + //NOTE: + // - このクラスの守備範囲はSpine ~ Headまでと両腕のShoulder ~ Handまで。 + // - Headを送ってるSourceがSpine~Headのボーン回転を指定できる + // - Handを送ってるSourceがShoulder~Handのボーン回転を指定できる + // - 指ボーンは取得できている場合、VMCPHandに基づいてVMCPBasedFingerSetterが処理するので、ここでの処理は不要 + private static readonly HumanBodyBones[] UpperBodyBones = new[] + { + HumanBodyBones.Spine, + HumanBodyBones.Chest, + HumanBodyBones.UpperChest, + HumanBodyBones.Neck, + HumanBodyBones.Head, + }; + + private static readonly HumanBodyBones[] ArmBones = new[] + { + HumanBodyBones.LeftShoulder, + HumanBodyBones.LeftUpperArm, + HumanBodyBones.LeftLowerArm, + HumanBodyBones.LeftHand, + HumanBodyBones.RightShoulder, + HumanBodyBones.RightUpperArm, + HumanBodyBones.RightLowerArm, + HumanBodyBones.RightHand, + }; + + //NOTE: 腕以外でSpine ~ Head + private readonly Dictionary _upperBodyBones = new(); + + //Shoulder~Handまでの両腕ぶん + private readonly Dictionary _armBones = new(); + + private bool _hasModel; + private bool _boneTransferEnabled; + + private IMessageReceiver _receiver; + private IVRMLoadable _vrmLoadable; + private VMCPHandPose _vmcpHand; + private VMCPHeadPose _vmcpHead; + + //NOTE: WordToMotionで上半身を動かすときweightを下げる + private CancellationTokenSource _weightCts; + private float _applyWeight = 1f; + + [Inject] + public void Initialize( + IMessageReceiver receiver, IVRMLoadable vrmLoadable, + VMCPHandPose vmcpHand, VMCPHeadPose vmcpHead) + { + _receiver = receiver; + _vrmLoadable = vrmLoadable; + _vmcpHand = vmcpHand; + _vmcpHead = vmcpHead; + + _receiver.AssignCommandHandler( + VmmCommands.SetVMCPNaiveBoneTransfer, + command => _boneTransferEnabled = command.ToBoolean() + ); + + _vrmLoadable.VrmLoaded += info => + { + var a = info.animator; + foreach (var bone in UpperBodyBones) + { + var t = a.GetBoneTransform(bone); + if (t != null) + { + _upperBodyBones[bone.ToString()] = t; + } + } + + foreach (var bone in ArmBones) + { + var t = a.GetBoneTransform(bone); + if (t != null) + { + _armBones[bone.ToString()] = t; + } + } + + _hasModel = true; + }; + + _vrmLoadable.VrmDisposing += () => + { + _hasModel = false; + _upperBodyBones.Clear(); + _armBones.Clear(); + }; + } + + public void FadeInWeight(float duration) => FadeWeight(1f, duration); + public void FadeOutWeight(float duration) => FadeWeight(0f, duration); + + private void LateUpdate() + { + //設定がオフ -> 何もしない + if (!_hasModel || !_boneTransferEnabled) + { + return; + } + + //NOTE: HeadとHandが同一ソースの場合、結果的に単一ソースからボーン回転が読み出される + if (_vmcpHead.IsConnected.Value) + { + SetBoneRotations(_vmcpHead.Humanoid, _upperBodyBones); + } + + if (_vmcpHand.IsConnected.Value) + { + SetBoneRotations(_vmcpHand.Humanoid, _armBones); + } + } + + private void OnDestroy() + { + _weightCts?.Cancel(); + _weightCts?.Dispose(); + } + + //NOTE: 同一ボーンに対して毎フレーム最大1回しか呼ばない…という前提で実装されてる (補間の部分が) + private void SetBoneRotations(VMCPBasedHumanoid source, Dictionary dest) + { + if (_applyWeight <= 0f) + { + return; + } + + if (_applyWeight >= 1f) + { + foreach (var pair in dest) + { + pair.Value.localRotation = source.GetLocalRotation(pair.Key); + } + return; + } + + //補間が必要なケースだけ補間する + foreach (var pair in dest) + { + pair.Value.localRotation = Quaternion.Slerp( + pair.Value.localRotation, + source.GetLocalRotation(pair.Key), + _applyWeight + ); + } + } + + private void FadeWeight(float target, float duration) + { + _weightCts?.Cancel(); + _weightCts?.Dispose(); + _weightCts = new(); + FadeWeightAsync(target, duration, _weightCts.Token).Forget(); + } + + private async UniTaskVoid FadeWeightAsync(float target, float duration, CancellationToken ct) + { + if (duration <= 0f) + { + _applyWeight = target; + return; + } + + if (target > .5f) + { + while (_applyWeight < 1f) + { + _applyWeight = Mathf.Clamp01(_applyWeight + Time.deltaTime / duration); + await UniTask.NextFrame(ct); + } + } + else + { + while (_applyWeight > 0f) + { + _applyWeight = Mathf.Clamp01(_applyWeight - Time.deltaTime / duration); + await UniTask.NextFrame(ct); + } + } + } + } +} \ No newline at end of file diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPNaiveBoneTransfer.cs.meta b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPNaiveBoneTransfer.cs.meta new file mode 100644 index 000000000..44fe35784 --- /dev/null +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPNaiveBoneTransfer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8d74f5b011928464896a7e497055aedd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 10600 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPReceiver.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPReceiver.cs index 97a240f74..9cd335801 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPReceiver.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/InputMonitoring/VMCP/VMCPReceiver.cs @@ -209,9 +209,9 @@ private void RefreshInternal() server.StopServer(); } _blendShape.SetActive(false); - _headPose.SetActive(false); + _headPose.SetInactive(); _handPose.SetActive(false); - _handPose.SetFingerSourceHumanoid(null); + _handPose.SetHumanoid(null); return; } @@ -221,14 +221,23 @@ private void RefreshInternal() humanoid.Clear(); } - _headPose.SetActive(_dataPassSettings.Any(s => s.ReceiveHeadPose)); + var headPoseRefIndex = Array.FindIndex(_dataPassSettings, s => s.ReceiveHeadPose); + if (headPoseRefIndex >= 0) + { + _headPose.SetActive(_receiverHumanoids[headPoseRefIndex]); + } + else + { + _headPose.SetInactive(); + } + _handPose.SetActive(_dataPassSettings.Any(s => s.ReceiveHandPose)); _blendShape.SetActive(_dataPassSettings.Any(s => s.ReceiveFacial)); //指のFK用のリファレンスを決めておく var handSourceHumanoidIndex = Array.FindIndex(_dataPassSettings, s => s.ReceiveHandPose); - _handPose.SetFingerSourceHumanoid(handSourceHumanoidIndex >= 0 + _handPose.SetHumanoid(handSourceHumanoidIndex >= 0 ? _receiverHumanoids[handSourceHumanoidIndex] : null ); diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Installer/VMCPInstaller.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Installer/VMCPInstaller.cs index ffc1d4a50..2f2d7d6c7 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Installer/VMCPInstaller.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Installer/VMCPInstaller.cs @@ -23,6 +23,7 @@ public override void InstallBindings() Container.BindInterfacesAndSelfTo().AsSingle(); Container.BindInterfacesTo().AsSingle(); Container.Bind().FromNewComponentOnNewGameObject().AsSingle(); + Container.Bind().FromNewComponentOnNewGameObject().AsSingle(); } } } diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Interprocess/Model/VmmCommands.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Interprocess/Model/VmmCommands.cs index 1771ccf41..21df37e0a 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Interprocess/Model/VmmCommands.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Interprocess/Model/VmmCommands.cs @@ -223,6 +223,7 @@ public static class VmmCommands // VMCP public const string EnableVMCP = nameof(EnableVMCP); public const string SetVMCPSources = nameof(SetVMCPSources); + public const string SetVMCPNaiveBoneTransfer = nameof(SetVMCPNaiveBoneTransfer); public const string SetDisableCameraDuringVMCPActive = nameof(SetDisableCameraDuringVMCPActive); // VRoidHub diff --git a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Utils/TextureSizeUtil.cs b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Utils/TextureSizeUtil.cs index c01f9e9a4..d66695242 100644 --- a/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Utils/TextureSizeUtil.cs +++ b/VMagicMirror/Assets/Baku/VMagicMirror/Scripts/Utils/TextureSizeUtil.cs @@ -34,7 +34,7 @@ public static void GetSizeLimitedTexture(Texture2D source, int maxSize) //NOTE: アクセサリ画像用のはずなので、ARGB32で読んでるはず var resized = new Texture2D(width, height, TextureFormat.ARGB32, false); Graphics.ConvertTexture(source, resized); - source.Resize(width, height); + source.Reinitialize(width, height); source.Apply(); Graphics.ConvertTexture(resized, source); Object.Destroy(resized); @@ -42,7 +42,7 @@ public static void GetSizeLimitedTexture(Texture2D source, int maxSize) public static void GetSizeLimitedTexture(Texture2D source, Texture2D dest, int maxSize) { - dest.Resize(source.width, source.height); + dest.Reinitialize(source.width, source.height); dest.Apply(); Graphics.ConvertTexture(source, dest); Object.Destroy(source); diff --git a/VMagicMirror/Logs/Packages-Update.log b/VMagicMirror/Logs/Packages-Update.log index 31003e230..7c2c24b85 100644 --- a/VMagicMirror/Logs/Packages-Update.log +++ b/VMagicMirror/Logs/Packages-Update.log @@ -90,3 +90,17 @@ The following packages were added: The following packages were updated: com.unity.ide.rider from version 1.1.4 to 2.0.7 com.unity.textmeshpro from version 2.0.1 to 3.0.6 + +=== Wed Sep 13 22:13:18 2023 + +Packages were changed. +Update Mode: updateDependencies + +The following packages were added: + com.unity.ai.navigation@1.1.4 +The following packages were updated: + com.unity.barracuda from version 2.1.0-preview to 3.0.0 + com.unity.collections from version 0.9.0-preview.6 to 1.2.4 + com.unity.ide.rider from version 2.0.7 to 3.0.24 + com.unity.postprocessing from version 3.1.1 to 3.2.2 + com.unity.probuilder from version 4.5.0 to 5.1.1 diff --git a/VMagicMirror/Packages/manifest.json b/VMagicMirror/Packages/manifest.json index ee15fbc31..247139a60 100644 --- a/VMagicMirror/Packages/manifest.json +++ b/VMagicMirror/Packages/manifest.json @@ -14,11 +14,12 @@ "com.malaybaku.managed-midijack": "https://github.com/malaybaku/MidiJack.git?path=/Assets/MidiJack", "com.neuecc.unirx": "https://github.com/neuecc/UniRx.git?path=Assets/Plugins/UniRx/Scripts", "com.unity.2d.sprite": "1.0.0", - "com.unity.barracuda": "2.1.0-preview", - "com.unity.collections": "0.9.0-preview.6", - "com.unity.ide.rider": "2.0.7", - "com.unity.postprocessing": "3.1.1", - "com.unity.probuilder": "4.5.0", + "com.unity.ai.navigation": "1.1.4", + "com.unity.barracuda": "3.0.0", + "com.unity.collections": "1.2.4", + "com.unity.ide.rider": "3.0.24", + "com.unity.postprocessing": "3.2.2", + "com.unity.probuilder": "5.1.1", "com.unity.textmeshpro": "3.0.6", "com.unity.ugui": "1.0.0", "com.vrmc.gltf": "https://github.com/vrm-c/UniVRM.git?path=/Assets/UniGLTF#v0.107.0", diff --git a/VMagicMirror/Packages/packages-lock.json b/VMagicMirror/Packages/packages-lock.json index 5667f925f..05570d092 100644 --- a/VMagicMirror/Packages/packages-lock.json +++ b/VMagicMirror/Packages/packages-lock.json @@ -37,19 +37,28 @@ "source": "builtin", "dependencies": {} }, + "com.unity.ai.navigation": { + "version": "1.1.4", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.modules.ai": "1.0.0" + }, + "url": "https://packages.unity.com" + }, "com.unity.barracuda": { - "version": "2.1.0-preview", + "version": "3.0.0", "depth": 0, "source": "registry", "dependencies": { - "com.unity.burst": "1.6.0-pre.2", + "com.unity.burst": "1.6.0", "com.unity.modules.jsonserialize": "1.0.0", "com.unity.modules.imageconversion": "1.0.0" }, "url": "https://packages.unity.com" }, "com.unity.burst": { - "version": "1.6.0-pre.2", + "version": "1.8.7", "depth": 1, "source": "registry", "dependencies": { @@ -58,47 +67,40 @@ "url": "https://packages.unity.com" }, "com.unity.collections": { - "version": "0.9.0-preview.6", + "version": "1.2.4", "depth": 0, "source": "registry", "dependencies": { - "com.unity.test-framework.performance": "2.0.8-preview", - "com.unity.burst": "1.3.0-preview.12" + "com.unity.burst": "1.6.6", + "com.unity.test-framework": "1.1.31" }, "url": "https://packages.unity.com" }, "com.unity.ext.nunit": { "version": "1.0.6", - "depth": 2, + "depth": 1, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, "com.unity.ide.rider": { - "version": "2.0.7", + "version": "3.0.24", "depth": 0, "source": "registry", "dependencies": { - "com.unity.test-framework": "1.1.1" + "com.unity.ext.nunit": "1.0.6" }, "url": "https://packages.unity.com" }, "com.unity.mathematics": { - "version": "1.2.1", + "version": "1.2.6", "depth": 1, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, - "com.unity.nuget.newtonsoft-json": { - "version": "2.0.0-preview", - "depth": 2, - "source": "registry", - "dependencies": {}, - "url": "https://packages.unity.com" - }, "com.unity.postprocessing": { - "version": "3.1.1", + "version": "3.2.2", "depth": 0, "source": "registry", "dependencies": { @@ -107,23 +109,25 @@ "url": "https://packages.unity.com" }, "com.unity.probuilder": { - "version": "4.5.0", + "version": "5.1.1", "depth": 0, "source": "registry", "dependencies": { - "com.unity.settings-manager": "1.0.3" + "com.unity.settings-manager": "1.0.3", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.imgui": "1.0.0" }, "url": "https://packages.unity.com" }, "com.unity.settings-manager": { - "version": "1.0.3", + "version": "2.0.1", "depth": 1, "source": "registry", "dependencies": {}, "url": "https://packages.unity.com" }, "com.unity.test-framework": { - "version": "1.1.29", + "version": "1.1.33", "depth": 1, "source": "registry", "dependencies": { @@ -133,16 +137,6 @@ }, "url": "https://packages.unity.com" }, - "com.unity.test-framework.performance": { - "version": "2.0.8-preview", - "depth": 1, - "source": "registry", - "dependencies": { - "com.unity.test-framework": "1.1.0", - "com.unity.nuget.newtonsoft-json": "2.0.0-preview" - }, - "url": "https://packages.unity.com" - }, "com.unity.textmeshpro": { "version": "3.0.6", "depth": 0, @@ -367,17 +361,6 @@ "version": "1.0.0", "depth": 0, "source": "builtin", - "dependencies": { - "com.unity.modules.ui": "1.0.0", - "com.unity.modules.imgui": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0", - "com.unity.modules.uielementsnative": "1.0.0" - } - }, - "com.unity.modules.uielementsnative": { - "version": "1.0.0", - "depth": 1, - "source": "builtin", "dependencies": { "com.unity.modules.ui": "1.0.0", "com.unity.modules.imgui": "1.0.0", diff --git a/VMagicMirror/ProjectSettings/BurstAotSettings_StandaloneWindows.json b/VMagicMirror/ProjectSettings/BurstAotSettings_StandaloneWindows.json index ec0089d85..58cf25f24 100644 --- a/VMagicMirror/ProjectSettings/BurstAotSettings_StandaloneWindows.json +++ b/VMagicMirror/ProjectSettings/BurstAotSettings_StandaloneWindows.json @@ -1,11 +1,18 @@ { - "MonoBehaviour": { - "m_Enabled": true, - "m_EditorHideFlags": 0, - "m_Name": "", - "m_EditorClassIdentifier": "Unity.Burst.Editor:Unity.Burst.Editor:BurstPlatformAotSettings", - "DisableOptimisations": false, - "DisableSafetyChecks": true, - "DisableBurstCompilation": false - } -} \ No newline at end of file + "MonoBehaviour": { + "Version": 4, + "EnableBurstCompilation": true, + "EnableOptimisations": true, + "EnableSafetyChecks": false, + "EnableDebugInAllBuilds": false, + "DebugDataKind": 1, + "EnableArmv9SecurityFeatures": false, + "CpuMinTargetX32": 0, + "CpuMaxTargetX32": 0, + "CpuMinTargetX64": 0, + "CpuMaxTargetX64": 0, + "CpuTargetsX32": 6, + "CpuTargetsX64": 72, + "OptimizeFor": 0 + } +} diff --git a/VMagicMirror/ProjectSettings/CommonBurstAotSettings.json b/VMagicMirror/ProjectSettings/CommonBurstAotSettings.json index 3dffdba7e..0293dafc8 100644 --- a/VMagicMirror/ProjectSettings/CommonBurstAotSettings.json +++ b/VMagicMirror/ProjectSettings/CommonBurstAotSettings.json @@ -1,6 +1,6 @@ { "MonoBehaviour": { - "Version": 3, + "Version": 4, "DisabledWarnings": "" } } diff --git a/VMagicMirror/ProjectSettings/MemorySettings.asset b/VMagicMirror/ProjectSettings/MemorySettings.asset new file mode 100644 index 000000000..5b5faceca --- /dev/null +++ b/VMagicMirror/ProjectSettings/MemorySettings.asset @@ -0,0 +1,35 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!387306366 &1 +MemorySettings: + m_ObjectHideFlags: 0 + m_EditorMemorySettings: + m_MainAllocatorBlockSize: -1 + m_ThreadAllocatorBlockSize: -1 + m_MainGfxBlockSize: -1 + m_ThreadGfxBlockSize: -1 + m_CacheBlockSize: -1 + m_TypetreeBlockSize: -1 + m_ProfilerBlockSize: -1 + m_ProfilerEditorBlockSize: -1 + m_BucketAllocatorGranularity: -1 + m_BucketAllocatorBucketsCount: -1 + m_BucketAllocatorBlockSize: -1 + m_BucketAllocatorBlockCount: -1 + m_ProfilerBucketAllocatorGranularity: -1 + m_ProfilerBucketAllocatorBucketsCount: -1 + m_ProfilerBucketAllocatorBlockSize: -1 + m_ProfilerBucketAllocatorBlockCount: -1 + m_TempAllocatorSizeMain: -1 + m_JobTempAllocatorBlockSize: -1 + m_BackgroundJobTempAllocatorBlockSize: -1 + m_JobTempAllocatorReducedBlockSize: -1 + m_TempAllocatorSizeGIBakingWorker: -1 + m_TempAllocatorSizeNavMeshWorker: -1 + m_TempAllocatorSizeAudioWorker: -1 + m_TempAllocatorSizeCloudWorker: -1 + m_TempAllocatorSizeGfx: -1 + m_TempAllocatorSizeJobWorker: -1 + m_TempAllocatorSizeBackgroundWorker: -1 + m_TempAllocatorSizePreloadManager: -1 + m_PlatformMemorySettings: {} diff --git a/VMagicMirror/ProjectSettings/PackageManagerSettings.asset b/VMagicMirror/ProjectSettings/PackageManagerSettings.asset index efaa82b0b..68111c709 100644 --- a/VMagicMirror/ProjectSettings/PackageManagerSettings.asset +++ b/VMagicMirror/ProjectSettings/PackageManagerSettings.asset @@ -12,7 +12,11 @@ MonoBehaviour: m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} m_Name: m_EditorClassIdentifier: + m_EnablePreReleasePackages: 0 + m_AdvancedSettingsExpanded: 1 m_ScopedRegistriesSettingsExpanded: 1 + m_SeeAllPackageVersions: 0 + m_DismissPreviewPackagesInUse: 0 oneTimeWarningShown: 0 m_Registries: - m_Id: main @@ -20,26 +24,21 @@ MonoBehaviour: m_Url: https://packages.unity.com m_Scopes: [] m_IsDefault: 1 - - m_Id: scoped:Keijiro + m_Capabilities: 7 + m_ConfigSource: 0 + - m_Id: scoped:project:Keijiro m_Name: Keijiro m_Url: https://registry.npmjs.com m_Scopes: - jp.keijiro m_IsDefault: 0 - m_UserSelectedRegistryName: + m_Capabilities: 0 + m_ConfigSource: 4 + m_UserSelectedRegistryName: Keijiro m_UserAddingNewScopedRegistry: 0 m_RegistryInfoDraft: - m_ErrorMessage: - m_Original: - m_Id: scoped:Keijiro - m_Name: Keijiro - m_Url: https://registry.npmjs.com - m_Scopes: - - jp.keijiro - m_IsDefault: 0 m_Modified: 0 - m_Name: Keijiro - m_Url: https://registry.npmjs.com - m_Scopes: - - jp.keijiro - m_SelectedScopeIndex: 0 + m_ErrorMessage: + m_UserModificationsInstanceId: -850 + m_OriginalInstanceId: -854 + m_LoadAssets: 0 diff --git a/VMagicMirror/ProjectSettings/Packages/com.unity.probuilder/Settings.json b/VMagicMirror/ProjectSettings/Packages/com.unity.probuilder/Settings.json index 6a037259a..9c75dcbfb 100644 --- a/VMagicMirror/ProjectSettings/Packages/com.unity.probuilder/Settings.json +++ b/VMagicMirror/ProjectSettings/Packages/com.unity.probuilder/Settings.json @@ -1,6 +1,4 @@ { - "m_Name": "Settings", - "m_Path": "ProjectSettings/Packages/com.unity.probuilder/Settings.json", "m_Dictionary": { "m_DictionaryValues": [ { @@ -26,12 +24,12 @@ { "type": "UnityEngine.ProBuilder.SemVer, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "key": "about.identifier", - "value": "{\"m_Value\":{\"m_Major\":4,\"m_Minor\":5,\"m_Patch\":0,\"m_Build\":-1,\"m_Type\":\"\",\"m_Metadata\":\"\",\"m_Date\":\"\"}}" + "value": "{\"m_Value\":{\"m_Major\":5,\"m_Minor\":1,\"m_Patch\":1,\"m_Build\":-1,\"m_Type\":\"\",\"m_Metadata\":\"\",\"m_Date\":\"\"}}" }, { "type": "UnityEngine.ProBuilder.SemVer, Unity.ProBuilder, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", "key": "preferences.version", - "value": "{\"m_Value\":{\"m_Major\":4,\"m_Minor\":5,\"m_Patch\":0,\"m_Build\":-1,\"m_Type\":\"\",\"m_Metadata\":\"\",\"m_Date\":\"\"}}" + "value": "{\"m_Value\":{\"m_Major\":5,\"m_Minor\":1,\"m_Patch\":1,\"m_Build\":-1,\"m_Type\":\"\",\"m_Metadata\":\"\",\"m_Date\":\"\"}}" }, { "type": "System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", diff --git a/VMagicMirror/ProjectSettings/ProjectSettings.asset b/VMagicMirror/ProjectSettings/ProjectSettings.asset index 2d8e38ecb..a74b2740a 100644 --- a/VMagicMirror/ProjectSettings/ProjectSettings.asset +++ b/VMagicMirror/ProjectSettings/ProjectSettings.asset @@ -3,7 +3,7 @@ --- !u!129 &1 PlayerSettings: m_ObjectHideFlags: 0 - serializedVersion: 22 + serializedVersion: 26 productGUID: 3394916446022534bafb79ba42946d67 AndroidProfiler: 0 AndroidFilterTouchesWhenObscured: 0 @@ -48,14 +48,15 @@ PlayerSettings: defaultScreenHeightWeb: 600 m_StereoRenderingPath: 0 m_ActiveColorSpace: 1 + m_SpriteBatchVertexThreshold: 300 m_MTRendering: 1 mipStripping: 0 numberOfMipsStripped: 0 + numberOfMipsStrippedPerMipmapLimitGroup: {} m_StackTraceTypes: 010000000100000001000000010000000100000001000000 iosShowActivityIndicatorOnLoading: -1 androidShowActivityIndicatorOnLoading: -1 iosUseCustomAppBackgroundBehavior: 0 - iosAllowHTTPDownload: 1 allowedAutorotateToPortrait: 1 allowedAutorotateToPortraitUpsideDown: 1 allowedAutorotateToLandscapeRight: 1 @@ -119,8 +120,11 @@ PlayerSettings: switchNVNShaderPoolsGranularity: 33554432 switchNVNDefaultPoolsGranularity: 16777216 switchNVNOtherPoolsGranularity: 16777216 + switchGpuScratchPoolGranularity: 2097152 + switchAllowGpuScratchShrinking: 0 switchNVNMaxPublicTextureIDCount: 0 switchNVNMaxPublicSamplerIDCount: 0 + switchNVNGraphicsFirmwareMemory: 32 stadiaPresentMode: 0 stadiaTargetFramerate: 0 vulkanNumSwapchainBuffers: 3 @@ -128,12 +132,7 @@ PlayerSettings: vulkanEnablePreTransform: 0 vulkanEnableLateAcquireNextImage: 0 vulkanEnableCommandBufferRecycling: 1 - m_SupportedAspectRatios: - 4:3: 1 - 5:4: 1 - 16:10: 1 - 16:9: 1 - Others: 1 + loadStoreDebugModeEnabled: 0 bundleVersion: 0.1 preloadedAssets: [] metroInputSource: 0 @@ -145,21 +144,24 @@ PlayerSettings: enable360StereoCapture: 0 isWsaHolographicRemotingEnabled: 0 enableFrameTimingStats: 0 + enableOpenGLProfilerGPURecorders: 1 useHDRDisplay: 0 - D3DHDRBitDepth: 0 + hdrBitDepth: 0 m_ColorGamuts: 00000000 targetPixelDensity: 30 resolutionScalingMode: 0 + resetResolutionOnWindowResize: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 applicationIdentifier: {} buildNumber: Standalone: 0 + VisionOS: 0 iPhone: 0 tvOS: 0 overrideDefaultApplicationIdentifier: 0 AndroidBundleVersionCode: 1 - AndroidMinSdkVersion: 19 + AndroidMinSdkVersion: 22 AndroidTargetSdkVersion: 0 AndroidPreferredInstallLocation: 1 aotOptions: @@ -172,12 +174,15 @@ PlayerSettings: APKExpansionFiles: 0 keepLoadedShadersAlive: 0 StripUnusedMeshComponents: 1 + strictShaderVariantMatching: 0 VertexChannelCompressionMask: 4054 iPhoneSdkVersion: 988 - iOSTargetOSVersionString: 11.0 + iOSTargetOSVersionString: 12.0 tvOSSdkVersion: 0 tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: 11.0 + tvOSTargetOSVersionString: 12.0 + VisionOSSdkVersion: 0 + VisionOSTargetOSVersionString: 1.0 uIPrerenderedIcon: 0 uIRequiresPersistentWiFi: 0 uIRequiresFullScreen: 1 @@ -215,6 +220,7 @@ PlayerSettings: iOSLaunchScreeniPadCustomStoryboardPath: iOSDeviceRequirements: [] iOSURLSchemes: [] + macOSURLSchemes: [] iOSBackgroundModes: 0 iOSMetalForceHardShadows: 0 metalEditorSupport: 1 @@ -224,8 +230,10 @@ PlayerSettings: appleDeveloperTeamID: iOSManualSigningProvisioningProfileID: tvOSManualSigningProvisioningProfileID: + VisionOSManualSigningProvisioningProfileID: iOSManualSigningProvisioningProfileType: 0 tvOSManualSigningProvisioningProfileType: 0 + VisionOSManualSigningProvisioningProfileType: 0 appleEnableAutomaticSigning: 0 iOSRequireARKit: 0 iOSAutomaticallyDetectAndAddCapabilities: 1 @@ -240,6 +248,7 @@ PlayerSettings: useCustomLauncherGradleManifest: 0 useCustomBaseGradleTemplate: 0 useCustomGradlePropertiesTemplate: 0 + useCustomGradleSettingsTemplate: 0 useCustomProguardFile: 0 AndroidTargetArchitectures: 5 AndroidTargetDevices: 0 @@ -247,6 +256,7 @@ PlayerSettings: androidSplashScreen: {fileID: 0} AndroidKeystoreName: AndroidKeyaliasName: + AndroidEnableArmv9SecurityFeatures: 0 AndroidBuildApkPerCpuArchitecture: 0 AndroidTVCompatibility: 1 AndroidIsGame: 1 @@ -260,7 +270,6 @@ PlayerSettings: banner: {fileID: 0} androidGamepadSupportLevel: 0 chromeosInputEmulation: 1 - AndroidMinifyWithR8: 0 AndroidMinifyRelease: 0 AndroidMinifyDebug: 0 AndroidValidateAppBundleSize: 1 @@ -320,6 +329,7 @@ PlayerSettings: - m_BuildTarget: WebGL m_StaticBatching: 0 m_DynamicBatching: 0 + m_BuildTargetShaderSettings: [] m_BuildTargetGraphicsJobs: - m_BuildTarget: MacStandaloneSupport m_GraphicsJobs: 0 @@ -355,7 +365,7 @@ PlayerSettings: m_BuildTargetGraphicsAPIs: - m_BuildTarget: AndroidPlayer m_APIs: 0b00000008000000 - m_Automatic: 1 + m_Automatic: 0 - m_BuildTarget: iOSSupport m_APIs: 10000000 m_Automatic: 1 @@ -371,6 +381,8 @@ PlayerSettings: m_Devices: - Oculus - OpenVR + m_DefaultShaderChunkSizeInMB: 16 + m_DefaultShaderChunkCount: 0 openGLRequireES31: 0 openGLRequireES31AEP: 0 openGLRequireES32: 0 @@ -380,8 +392,11 @@ PlayerSettings: iPhone: 1 tvOS: 1 m_BuildTargetGroupLightmapEncodingQuality: [] + m_BuildTargetGroupHDRCubemapEncodingQuality: [] m_BuildTargetGroupLightmapSettings: [] + m_BuildTargetGroupLoadStoreDebugModeSettings: [] m_BuildTargetNormalMapEncoding: [] + m_BuildTargetDefaultTextureCompressionFormat: [] playModeTestRunnerEnabled: 0 runPlayModeTestAsEditModeTest: 0 actionOnDotNetUnhandledException: 1 @@ -392,6 +407,7 @@ PlayerSettings: locationUsageDescription: microphoneUsageDescription: bluetoothUsageDescription: + macOSTargetOSVersion: 10.13.0 switchNMETAOverride: switchNetLibKey: switchSocketMemoryPoolSize: 6144 @@ -400,8 +416,10 @@ PlayerSettings: switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 switchUseGOLDLinker: 0 + switchLTOSetting: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: + switchCompilerFlags: switchTitleNames_0: switchTitleNames_1: switchTitleNames_2: @@ -475,7 +493,6 @@ PlayerSettings: switchReleaseVersion: 0 switchDisplayVersion: 1.0.0 switchStartupUserAccount: 0 - switchTouchScreenUsage: 0 switchSupportedLanguagesMask: 0 switchLogoType: 0 switchApplicationErrorCodeCategory: @@ -517,6 +534,7 @@ PlayerSettings: switchNativeFsCacheSize: 32 switchIsHoldTypeHorizontal: 0 switchSupportedNpadCount: 8 + switchEnableTouchScreen: 1 switchSocketConfigEnabled: 0 switchTcpInitialSendBufferSize: 32 switchTcpInitialReceiveBufferSize: 64 @@ -529,8 +547,11 @@ PlayerSettings: switchNetworkInterfaceManagerInitializeEnabled: 1 switchPlayerConnectionEnabled: 1 switchUseNewStyleFilepaths: 0 + switchUseLegacyFmodPriorities: 0 switchUseMicroSleepForYield: 1 + switchEnableRamDiskSupport: 0 switchMicroSleepForYieldTime: 25 + switchRamDiskSpaceSize: 12 ps4NPAgeRating: 12 ps4NPTitleSecret: ps4NPTrophyPackPath: @@ -614,6 +635,7 @@ PlayerSettings: webGLMemorySize: 256 webGLExceptionSupport: 1 webGLNameFilesAsHashes: 0 + webGLShowDiagnostics: 0 webGLDataCaching: 1 webGLDebugSymbols: 0 webGLEmscriptenArgs: @@ -626,37 +648,57 @@ PlayerSettings: webGLLinkerTarget: 1 webGLThreadsSupport: 0 webGLDecompressionFallback: 0 + webGLInitialMemorySize: 32 + webGLMaximumMemorySize: 2048 + webGLMemoryGrowthMode: 2 + webGLMemoryLinearGrowthStep: 16 + webGLMemoryGeometricGrowthStep: 0.2 + webGLMemoryGeometricGrowthCap: 96 + webGLPowerPreference: 2 scriptingDefineSymbols: - 1: UNITY_POST_PROCESSING_STACK_V2;ENABLE_JOB_SPRING_BONE;DLIB_USE_UNSAFE_CODE;OPENCV_USE_UNSAFE_CODE;VMAGICMIRROR_USE_OPENCV - 4: UNITY_POST_PROCESSING_STACK_V2 - 7: UNITY_POST_PROCESSING_STACK_V2 - 13: UNITY_POST_PROCESSING_STACK_V2 - 14: UNITY_POST_PROCESSING_STACK_V2 - 19: UNITY_POST_PROCESSING_STACK_V2 - 21: UNITY_POST_PROCESSING_STACK_V2 - 25: UNITY_POST_PROCESSING_STACK_V2 - 26: UNITY_POST_PROCESSING_STACK_V2 - 27: UNITY_POST_PROCESSING_STACK_V2 - 28: UNITY_POST_PROCESSING_STACK_V2 - 29: UNITY_POST_PROCESSING_STACK_V2 - 30: UNITY_POST_PROCESSING_STACK_V2 - 32: UNITY_POST_PROCESSING_STACK_V2 - 33: UNITY_POST_PROCESSING_STACK_V2 + Android: UNITY_POST_PROCESSING_STACK_V2 + EmbeddedLinux: UNITY_POST_PROCESSING_STACK_V2 + GameCoreXboxOne: UNITY_POST_PROCESSING_STACK_V2 + LinuxHeadlessSimulation: UNITY_POST_PROCESSING_STACK_V2 + Nintendo Switch: UNITY_POST_PROCESSING_STACK_V2 + PS4: UNITY_POST_PROCESSING_STACK_V2 + PS5: UNITY_POST_PROCESSING_STACK_V2 + QNX: UNITY_POST_PROCESSING_STACK_V2 + Stadia: UNITY_POST_PROCESSING_STACK_V2 + Standalone: UNITY_POST_PROCESSING_STACK_V2;ENABLE_JOB_SPRING_BONE;DLIB_USE_UNSAFE_CODE;OPENCV_USE_UNSAFE_CODE;VMAGICMIRROR_USE_OPENCV;DEV_ENV + VisionOS: UNITY_POST_PROCESSING_STACK_V2 + WebGL: UNITY_POST_PROCESSING_STACK_V2 + Windows Store Apps: UNITY_POST_PROCESSING_STACK_V2 + XboxOne: UNITY_POST_PROCESSING_STACK_V2 + iPhone: UNITY_POST_PROCESSING_STACK_V2 + tvOS: UNITY_POST_PROCESSING_STACK_V2 additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: {} il2cppCompilerConfiguration: {} - managedStrippingLevel: {} + il2cppCodeGeneration: {} + managedStrippingLevel: + EmbeddedLinux: 1 + GameCoreScarlett: 1 + GameCoreXboxOne: 1 + Nintendo Switch: 1 + PS4: 1 + PS5: 1 + QNX: 1 + Stadia: 1 + VisionOS: 1 + WebGL: 1 + Windows Store Apps: 1 + XboxOne: 1 + iPhone: 1 + tvOS: 1 incrementalIl2cppBuild: {} suppressCommonWarnings: 1 allowUnsafeCode: 1 useDeterministicCompilation: 1 - useReferenceAssemblies: 1 - enableRoslynAnalyzers: 1 additionalIl2CppArgs: scriptingRuntimeVersion: 1 gcIncremental: 0 - assemblyVersionValidation: 1 gcWBarrierValidation: 0 apiCompatibilityLevelPerPlatform: {} m_RenderingPath: 1 @@ -688,6 +730,7 @@ PlayerSettings: metroFTAName: metroFTAFileTypes: [] metroProtocolName: + vcxProjDefaultLanguage: XboxOneProductId: XboxOneUpdateKey: XboxOneSandboxId: @@ -729,8 +772,14 @@ PlayerSettings: luminVersion: m_VersionCode: 1 m_VersionName: + hmiPlayerDataPath: + hmiForceSRGBBlit: 1 + embeddedLinuxEnableGamepadInput: 1 + hmiLogStartupTiming: 0 + hmiCpuConfiguration: apiCompatibilityLevel: 6 activeInputHandler: 0 + windowsGamepadBackendHint: 0 cloudProjectId: framebufferDepthMemorylessMode: 0 qualitySettingsNames: [] @@ -738,4 +787,7 @@ PlayerSettings: organizationId: cloudEnabled: 0 legacyClampBlendShapeWeights: 0 + hmiLoadingImage: {fileID: 0} + platformRequiresReadableAssets: 0 virtualTexturingSupportEnabled: 0 + insecureHttpOption: 0 diff --git a/VMagicMirror/ProjectSettings/ProjectVersion.txt b/VMagicMirror/ProjectSettings/ProjectVersion.txt index 2b4e8e575..78a778891 100644 --- a/VMagicMirror/ProjectSettings/ProjectVersion.txt +++ b/VMagicMirror/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.22f1 -m_EditorVersionWithRevision: 2020.3.22f1 (e1a7f79fd887) +m_EditorVersion: 2022.3.7f1 +m_EditorVersionWithRevision: 2022.3.7f1 (b16b3b16c7a0) diff --git a/WPF/VMagicMirrorConfig/Common/AppConsts.cs b/WPF/VMagicMirrorConfig/Common/AppConsts.cs index 55b896486..37cc092a0 100644 --- a/WPF/VMagicMirrorConfig/Common/AppConsts.cs +++ b/WPF/VMagicMirrorConfig/Common/AppConsts.cs @@ -11,6 +11,6 @@ public static class AppConsts public static string AppFullNameWithEnvSuffix => AppFullName + (TargetEnvironmentChecker.CheckDevEnvFlagEnabled() ? "(Dev)" : ""); - public static VmmAppVersion AppVersion => new VmmAppVersion(3, 3, 0); + public static VmmAppVersion AppVersion => new VmmAppVersion(3, 3, 1); } } diff --git a/WPF/VMagicMirrorConfig/Model/Entity/VMCPSetting.cs b/WPF/VMagicMirrorConfig/Model/Entity/VMCPSetting.cs index 5ed852e96..4f7665dea 100644 --- a/WPF/VMagicMirrorConfig/Model/Entity/VMCPSetting.cs +++ b/WPF/VMagicMirrorConfig/Model/Entity/VMCPSetting.cs @@ -5,11 +5,13 @@ public class VMCPSetting : SettingEntityBase public bool VMCPEnabled { get; set; } public string SerializedVMCPSourceSetting { get; set; } = ""; public bool DisableCameraDuringVMCPActive { get; set; } = true; + public bool EnableNaiveBoneTransfer { get; set; } = false; public void Reset() { VMCPEnabled = false; SerializedVMCPSourceSetting = ""; + EnableNaiveBoneTransfer = false; DisableCameraDuringVMCPActive = true; } diff --git a/WPF/VMagicMirrorConfig/Model/InterProcess/Core/MessageFactory.cs b/WPF/VMagicMirrorConfig/Model/InterProcess/Core/MessageFactory.cs index 8ce56c077..57d863293 100644 --- a/WPF/VMagicMirrorConfig/Model/InterProcess/Core/MessageFactory.cs +++ b/WPF/VMagicMirrorConfig/Model/InterProcess/Core/MessageFactory.cs @@ -353,6 +353,7 @@ private static Message WithArg(int content, [CallerMemberName] string command = public Message EnableVMCP(bool enable) => WithArg(enable); public Message SetVMCPSources(string json) => WithArg(json); public Message SetDisableCameraDuringVMCPActive(bool disable) => WithArg(disable); + public Message SetVMCPNaiveBoneTransfer(bool enable) => WithArg(enable); #endregion diff --git a/WPF/VMagicMirrorConfig/Model/SettingModel/VMCPSettingModel.cs b/WPF/VMagicMirrorConfig/Model/SettingModel/VMCPSettingModel.cs index 46e703798..ee864c8db 100644 --- a/WPF/VMagicMirrorConfig/Model/SettingModel/VMCPSettingModel.cs +++ b/WPF/VMagicMirrorConfig/Model/SettingModel/VMCPSettingModel.cs @@ -24,12 +24,17 @@ public VMCPSettingModel(IMessageSender sender, IMessageReceiver receiver) : base defaultSetting.DisableCameraDuringVMCPActive, v => SendMessage(MessageFactory.Instance.SetDisableCameraDuringVMCPActive(v)) ); - + EnableNaiveBoneTransfer = new( + defaultSetting.EnableNaiveBoneTransfer, + v => SendMessage(MessageFactory.Instance.SetVMCPNaiveBoneTransfer(v)) + ); receiver.ReceivedCommand += OnReceiveCommand; } public RProperty VMCPEnabled { get; } public RProperty SerializedVMCPSourceSetting { get; } + + public RProperty EnableNaiveBoneTransfer { get; } public RProperty DisableCameraDuringVMCPActive { get; } private readonly VMCPReceiveStatus _receiveStatus = new(); diff --git a/WPF/VMagicMirrorConfig/Resources/English.xaml b/WPF/VMagicMirrorConfig/Resources/English.xaml index 6378ee45b..7e3142a4d 100644 --- a/WPF/VMagicMirrorConfig/Resources/English.xaml +++ b/WPF/VMagicMirrorConfig/Resources/English.xaml @@ -144,6 +144,10 @@ VMagicMirror supports to receive: *There are unapplied changes. Apply Changes Revert + *Body Motion Style is now "Standing Only." +Use "Default" to apply VMC Protocol based hand pose. + Use "Default" Option + Apply received bone pose without any adjust Disable Camera feature during VMCP is active @@ -157,6 +161,10 @@ Get Full Edition to remove the effect. Show Effect During Hand Tracking Disable Horizontal Flip Show Detection Status (*raw image is not displayed) + *Body Motion Style is now "Standing Only." +Use "Default" to apply hand tracking result. + Use "Default" Option + Detection Status: (Not Detected: Try raising hands next to the face) Tips: @@ -724,7 +732,8 @@ VMCP receive settings is kept after the tab hidden. Selected Mic Disconnected: {0} Selected Mic Detected: {0} Selected Camera Detected: {0} - + Body Motion Style is set to: "Default" + (Do Nothing) (None) diff --git a/WPF/VMagicMirrorConfig/Resources/Japanese.xaml b/WPF/VMagicMirrorConfig/Resources/Japanese.xaml index 571f004c7..f23ec26d5 100644 --- a/WPF/VMagicMirrorConfig/Resources/Japanese.xaml +++ b/WPF/VMagicMirrorConfig/Resources/Japanese.xaml @@ -144,6 +144,10 @@ VMagicMirrorは以下のモーションを受信して適用できます。 *未適用の設定があります 変更を適用 キャンセル + *動きかたのオプションで「つねに手下げ」が選択されています。 +VMC Protocolによる手の姿勢を適用するには「デフォルト」に変更して下さい。 + オプションを「デフォルト」に変更 + 補正なしで送信元ボーンの姿勢を適用 VMCPの受信中はカメラ機能をオフ @@ -156,6 +160,10 @@ VMagicMirrorは以下のモーションを受信して適用できます。 ハンドトラッキングを有効化 トラッキング中にエフェクトを適用 左右反転をオフ + *動きかたのオプションで「つねに手下げ」が選択されています。 +ハンドトラッキングの結果を適用するには「デフォルト」に変更して下さい。 + オプションを「デフォルト」に変更 + 手の検出状況を表示(※カメラ映像は表示されません) 手の検出状況: ヒント: @@ -730,6 +738,7 @@ VMCPのデータが受信中の場合、この操作で受信機能はオフに 選択されたマイクが切断しました: {0} 選択されたマイクの接続を検出しました: {0} 選択されたカメラの接続を検出しました: {0} + 動きかたのオプションを「デフォルト」に変更しました (何もしない) diff --git a/WPF/VMagicMirrorConfig/View/ControlPanel/HandTrackingPanel.xaml b/WPF/VMagicMirrorConfig/View/ControlPanel/HandTrackingPanel.xaml index 679a08b4e..d8d9f20de 100644 --- a/WPF/VMagicMirrorConfig/View/ControlPanel/HandTrackingPanel.xaml +++ b/WPF/VMagicMirrorConfig/View/ControlPanel/HandTrackingPanel.xaml @@ -98,6 +98,25 @@ IsChecked="{Binding EnableSendHandTrackingResult.Value}" /> + + + +