diff --git a/DesktopVRIK/AsserHandler.cs b/DesktopVRIK/AsserHandler.cs deleted file mode 100644 index b5e5c7d..0000000 --- a/DesktopVRIK/AsserHandler.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System.Reflection; -using UnityEngine; -using Object = UnityEngine.Object; - -/* - - Kindly stolen from SDraw's leap motion mod. (MIT) - https://github.com/SDraw/ml_mods_cvr/blob/master/ml_lme/AssetsHandler.cs - - *thank u sdraw, i wont be murderer now* - -*/ - -namespace NAK.Melons.DesktopVRIK; - -static class AssetsHandler -{ - static readonly List ms_assets = new List() - { - "IKPose.assetbundle" - }; - - static Dictionary ms_loadedAssets = new Dictionary(); - static Dictionary ms_loadedObjects = new Dictionary(); - - public static void Load() - { - Assembly l_assembly = Assembly.GetExecutingAssembly(); - string l_assemblyName = l_assembly.GetName().Name; - - foreach (string l_assetName in ms_assets) - { - try - { - Stream l_assetStream = l_assembly.GetManifestResourceStream(l_assemblyName + ".resources." + l_assetName); - if (l_assetStream != null) - { - MemoryStream l_memorySteam = new MemoryStream((int)l_assetStream.Length); - l_assetStream.CopyTo(l_memorySteam); - AssetBundle l_assetBundle = AssetBundle.LoadFromMemory(l_memorySteam.ToArray(), 0); - if (l_assetBundle != null) - { - l_assetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset; - ms_loadedAssets.Add(l_assetName, l_assetBundle); - } - else - MelonLoader.MelonLogger.Warning("Unable to load bundled '" + l_assetName + "' asset"); - } - else - MelonLoader.MelonLogger.Warning("Unable to get bundled '" + l_assetName + "' asset stream"); - } - catch (System.Exception e) - { - MelonLoader.MelonLogger.Warning("Unable to load bundled '" + l_assetName + "' asset, reason: " + e.Message); - } - } - } - - public static Object GetAsset(string p_name) - { - Object l_result = null; - if (ms_loadedObjects.ContainsKey(p_name)) - { - l_result = UnityEngine.Object.Instantiate(ms_loadedObjects[p_name]); - //l_result.SetActive(true); - l_result.hideFlags |= HideFlags.DontUnloadUnusedAsset; - } - else - { - foreach (var l_pair in ms_loadedAssets) - { - if (l_pair.Value.Contains(p_name)) - { - Object l_bundledObject = (Object)l_pair.Value.LoadAsset(p_name, typeof(Object)); - if (l_bundledObject != null) - { - ms_loadedObjects.Add(p_name, l_bundledObject); - l_result = UnityEngine.Object.Instantiate(l_bundledObject); - //l_result.SetActive(true); - l_result.hideFlags |= HideFlags.DontUnloadUnusedAsset; - } - break; - } - } - } - return l_result; - } - - public static void Unload() - { - foreach (var l_pair in ms_loadedAssets) - UnityEngine.Object.Destroy(l_pair.Value); - ms_loadedAssets.Clear(); - } -} \ No newline at end of file diff --git a/DesktopVRIK/DesktopVRIK.cs b/DesktopVRIK/DesktopVRIK.cs index f329628..f00ad95 100644 --- a/DesktopVRIK/DesktopVRIK.cs +++ b/DesktopVRIK/DesktopVRIK.cs @@ -16,9 +16,7 @@ public class DesktopVRIK : MonoBehaviour public static bool Setting_Enabled, Setting_EnforceViewPosition, Setting_EmoteVRIK, - Setting_EmoteLookAtIK, - Setting_AllowRootSlipping, - Setting_TestIKPoseController; + Setting_EmoteLookAtIK; public static float Setting_EmulateVRChatHipMovementWeight; public Transform viewpoint; @@ -27,12 +25,9 @@ public class DesktopVRIK : MonoBehaviour Transform headIKTarget; Transform avatarHeadBone; - RuntimeAnimatorController ikposeController; - void Start() { Instance = this; - ikposeController = (RuntimeAnimatorController)AssetsHandler.GetAsset("Assets/BundledAssets/IKPose/IKPose.controller"); // create the shared Head IK Target headIKTarget = new GameObject("[DesktopVRIK] Head IK Target").transform; headIKTarget.parent = PlayerSetup.Instance.transform; @@ -61,12 +56,9 @@ public class DesktopVRIK : MonoBehaviour headIKTarget.position = new Vector3(headIKTarget.position.x, avatarHeadBone.position.y, headIKTarget.position.z); } - if (!Setting_AllowRootSlipping) - { - //Reset avatar offset (VRIK will literally make you walk away from root otherwise) - IKSystem.vrik.transform.localPosition = Vector3.zero; - IKSystem.vrik.transform.localRotation = Quaternion.identity; - } + //Reset avatar offset (VRIK will literally make you walk away from root otherwise) + IKSystem.vrik.transform.localPosition = Vector3.zero; + IKSystem.vrik.transform.localRotation = Quaternion.identity; //VRChat hip movement emulation if (Setting_EmulateVRChatHipMovementWeight != 0) @@ -96,18 +88,18 @@ public class DesktopVRIK : MonoBehaviour //avatar.transform.rotation = Quaternion.identity; //ikpose layer (specified by avatar author) - int? ikposeLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("IKPose"); - int? locoLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("Locomotion/Emotes"); + //int? ikposeLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("IKPose"); + //int? locoLayerIndex = PlayerSetup.Instance.animatorManager.GetAnimatorLayerIndex("Locomotion/Emotes"); - if (ikposeLayerIndex != -1) - { - PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 1f); - if (locoLayerIndex != -1) - { - PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 0f); - } - IKSystem.Instance.animator.Update(0f); - } + //if (ikposeLayerIndex != -1) + //{ + // PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 1f); + // if (locoLayerIndex != -1) + // { + // PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 0f); + // } + // IKSystem.Instance.animator.Update(0f); + //} //Generic VRIK calibration shit VRIK vrik = avatar.gameObject.AddComponent(); @@ -157,20 +149,14 @@ public class DesktopVRIK : MonoBehaviour vrik.solver.SetToReferences(vrik.references); vrik.solver.Initiate(vrik.transform); - if (ikposeLayerIndex != -1) - { - PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 0f); - if (locoLayerIndex != -1) - { - PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 1f); - } - } - - if (Setting_TestIKPoseController) - { - animator.enabled = false; - return vrik; - } + //if (ikposeLayerIndex != -1) + //{ + // PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("IKPose", 0f); + // if (locoLayerIndex != -1) + // { + // PlayerSetup.Instance.animatorManager.SetAnimatorLayerWeight("Locomotion/Emotes", 1f); + // } + //} //Find eyeoffset initialCamPos = PlayerSetup.Instance.desktopCamera.transform.localPosition; diff --git a/DesktopVRIK/DesktopVRIK.csproj b/DesktopVRIK/DesktopVRIK.csproj index 8442204..c432ed3 100644 --- a/DesktopVRIK/DesktopVRIK.csproj +++ b/DesktopVRIK/DesktopVRIK.csproj @@ -8,14 +8,6 @@ false - - - - - - - - C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\MelonLoader\0Harmony.dll diff --git a/DesktopVRIK/HarmonyPatches.cs b/DesktopVRIK/HarmonyPatches.cs index 9a00ec2..9d8c7b2 100644 --- a/DesktopVRIK/HarmonyPatches.cs +++ b/DesktopVRIK/HarmonyPatches.cs @@ -117,7 +117,7 @@ class IKSystemPatches IKSystem.Instance.ApplyMuscleValue((MuscleIndex)i, IKPoseMuscles[i], ref ___humanPose.muscles); } ____poseHandler.SetHumanPose(ref ___humanPose); - + ____vrik = DesktopVRIK.Instance.AlternativeCalibration(avatar); IKSystem.Instance.ApplyAvatarScaleToIk(avatar.viewPosition.y); } diff --git a/DesktopVRIK/Main.cs b/DesktopVRIK/Main.cs index d77a5ae..8fd3cc4 100644 --- a/DesktopVRIK/Main.cs +++ b/DesktopVRIK/Main.cs @@ -22,7 +22,6 @@ public class DesktopVRIKMod : MelonMod m_entryEnforceViewPosition = m_categoryDesktopVRIK.CreateEntry("Enforce View Position", false, description: "Corrects view position to use VRIK offsets."); m_entryEmoteVRIK = m_categoryDesktopVRIK.CreateEntry("Disable Emote VRIK", true, description: "Disable VRIK while emoting. Only disable if you are ok with looking dumb."); m_entryEmoteLookAtIK = m_categoryDesktopVRIK.CreateEntry("Disable Emote LookAtIK", true, description: "Disable LookAtIK while emoting. This setting doesn't really matter, as LookAtIK isn't networked while doing an emote."); - m_entryAllowRootSlipping = m_categoryDesktopVRIK.CreateEntry("Allow Root Slipping", false, description: "Allows avatar root to slip out from under itself, to emulate more wacky VRChat behavior."); foreach (var setting in m_categoryDesktopVRIK.Entries) { @@ -45,7 +44,6 @@ public class DesktopVRIKMod : MelonMod System.Collections.IEnumerator WaitForLocalPlayer() { - AssetsHandler.Load(); while (PlayerSetup.Instance == null) yield return null; PlayerSetup.Instance.gameObject.AddComponent(); @@ -61,7 +59,6 @@ public class DesktopVRIKMod : MelonMod DesktopVRIK.Setting_EmulateVRChatHipMovementWeight = Mathf.Clamp01(m_entryEmulateVRChatHipMovementWeight.Value); DesktopVRIK.Setting_EmoteVRIK = m_entryEmoteVRIK.Value; DesktopVRIK.Setting_EmoteLookAtIK = m_entryEmoteLookAtIK.Value; - DesktopVRIK.Setting_AllowRootSlipping = m_entryAllowRootSlipping.Value; DesktopVRIK.Instance.ChangeViewpointHandling(m_entryEnforceViewPosition.Value); } diff --git a/DesktopVRIK/format.json b/DesktopVRIK/format.json index ba61c32..b13d3cf 100644 --- a/DesktopVRIK/format.json +++ b/DesktopVRIK/format.json @@ -18,6 +18,6 @@ ], "downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v2.0.0/DesktopVRIK.dll", "sourcelink": "https://github.com/NotAKidOnSteam/DesktopVRIK/", - "changelog": "- Simplified VRIK calibration to avoid low heel issue.\n- Removed rushed compatibility mode.\n- Added checks for valid Humanoid rigs.\n- Added PlantFeet & EnforceViewPosition Settings.\n- Added Weight option for the VRChat-like hip movement.\n- Simplified config, added BTKUILib support.\n- Reworked calibration to support almost every avatar.\n- Added custom avatar-defined IKPose support.", + "changelog": "- Simplified VRIK calibration to avoid low heel issue.\n- Added checks for valid Humanoid rigs.\n- Added PlantFeet & EnforceViewPosition Settings.\n- Added Weight option for the VRChat-like hip movement.\n- Simplified config, added BTKUILib support.\n- Reworked calibration to support almost every avatar.", "embedcolor": "9b59b6" } \ No newline at end of file diff --git a/DesktopVRIK/resources/IKPose.assetbundle b/DesktopVRIK/resources/IKPose.assetbundle deleted file mode 100644 index 156c7e0..0000000 Binary files a/DesktopVRIK/resources/IKPose.assetbundle and /dev/null differ