Removed compatibility mode & added integrity checks.

Why the fuck did deleting code make the issue better...
This commit is contained in:
NotAKidoS 2022-12-26 00:52:50 -06:00
parent c71036f74f
commit df61830c83
5 changed files with 21 additions and 37 deletions

View file

@ -17,8 +17,6 @@ public class DesktopVRIK : MonoBehaviour
public bool Setting_EmulateVRChatHipMovement;
public bool Setting_EmoteVRIK;
public bool Setting_EmoteLookAtIK;
//fuck
public bool Setting_CompatibilityMode;
void Start()
{

View file

@ -15,20 +15,25 @@ internal class HarmonyPatches
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerSetup), "SetupAvatarGeneral")]
private static void SetupDesktopIKSystem(ref CVRAvatar ____avatarDescriptor)
private static void SetupDesktopIKSystem(ref CVRAvatar ____avatarDescriptor, ref Animator ____animator)
{
if (!MetaPort.Instance.isUsingVr && DesktopVRIK.Instance.Setting_Enabled)
{
if (____avatarDescriptor != null && ____animator != null && ____animator.isHuman)
{
//this will stop at the useless isVr return (the function is only ever called by vr anyways...)
IKSystem.Instance.InitializeAvatar(____avatarDescriptor);
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(IKSystem), "InitializeAvatar")]
private static void InitializeDesktopAvatarVRIK(CVRAvatar avatar, ref VRIK ____vrik, ref HumanPoseHandler ____poseHandler, ref float[] ___HandCalibrationPoseMuscles, ref Vector3 ____referenceRootPosition, ref Quaternion ____referenceRootRotation, ref HumanPose ___humanPose)
{
if (!MetaPort.Instance.isUsingVr && DesktopVRIK.Instance.Setting_Enabled)
{
if (IKSystem.Instance.animator != null && IKSystem.Instance.animator.avatar != null && IKSystem.Instance.animator.avatar.isHuman)
{
//need IKSystem to see VRIK component for setup
if (____vrik == null)
@ -36,36 +41,19 @@ internal class HarmonyPatches
____vrik = avatar.gameObject.AddComponent<VRIK>();
}
//ChilloutVR stuffs that makes sure garbage armatures are supported
//this places heels in the ground... can i just use my own tpose animation
if (DesktopVRIK.Instance.Setting_CompatibilityMode)
{
//why the fuck does this fix bad armatures and heels in ground ???
if (____poseHandler == null)
{
____poseHandler = new HumanPoseHandler(IKSystem.Instance.animator.avatar, IKSystem.Instance.animator.transform);
}
____poseHandler.GetHumanPose(ref ___humanPose);
____referenceRootPosition = IKSystem.Instance.animator.GetBoneTransform(HumanBodyBones.Hips).position;
____referenceRootRotation = IKSystem.Instance.animator.GetBoneTransform(HumanBodyBones.Hips).rotation;
for (int i = 0; i < ___HandCalibrationPoseMuscles.Length; i++)
{
IKSystem.Instance.ApplyMuscleValue((MuscleIndex)i, ___HandCalibrationPoseMuscles[i], ref ___humanPose.muscles);
}
____poseHandler.SetHumanPose(ref ___humanPose);
if (IKSystem.Instance.applyOriginalHipPosition)
{
IKSystem.Instance.animator.GetBoneTransform(HumanBodyBones.Hips).position = ____referenceRootPosition;
}
if (IKSystem.Instance.applyOriginalHipRotation)
{
IKSystem.Instance.animator.GetBoneTransform(HumanBodyBones.Hips).rotation = ____referenceRootRotation;
}
}
//now I calibrate DesktopVRIK
DesktopVRIK.Instance.CalibrateDesktopVRIK(avatar);
}
}
}
private static bool emotePlayed = false;

View file

@ -15,7 +15,6 @@ public class DesktopVRIKMod : MelonMod
m_entryEmulateHipMovement = m_categoryDesktopVRIK.CreateEntry<bool>("Emulate Hip Movement", true, description: "Emulates VRChat-like hip movement when moving head up/down on desktop.");
m_entryEmoteVRIK = m_categoryDesktopVRIK.CreateEntry<bool>("Disable Emote VRIK", true, description: "Disable VRIK while emoting. Only disable if you are ok with looking dumb.");
m_entryEmoteLookAtIK = m_categoryDesktopVRIK.CreateEntry<bool>("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_entryCompatibilityMode = m_categoryDesktopVRIK.CreateEntry<bool>("Compatibility Mode", false, description: "Runs finger muscle calibration- which somehow makes bad armatures work better but also pushes heels into the ground."); ;
m_categoryDesktopVRIK.SaveToFile(false);
foreach (var setting in m_categoryDesktopVRIK.Entries)
@ -43,7 +42,6 @@ public class DesktopVRIKMod : MelonMod
DesktopVRIK.Instance.Setting_EmulateVRChatHipMovement = m_entryEmulateHipMovement.Value;
DesktopVRIK.Instance.Setting_EmoteVRIK = m_entryEmoteVRIK.Value;
DesktopVRIK.Instance.Setting_EmoteLookAtIK = m_entryEmoteLookAtIK.Value;
DesktopVRIK.Instance.Setting_CompatibilityMode = m_entryCompatibilityMode.Value;
}
private void OnUpdateSettings(object arg1, object arg2) => UpdateAllSettings();

View file

@ -25,6 +25,6 @@ using DesktopVRIK.Properties;
namespace DesktopVRIK.Properties;
internal static class AssemblyInfoParams
{
public const string Version = "1.0.0";
public const string Version = "1.0.2";
public const string Author = "NotAKidoS";
}

View file

@ -1,7 +1,7 @@
{
"_id": -1,
"_id": 117,
"name": "DesktopVRIK",
"modversion": "1.0.0",
"modversion": "1.0.2",
"gameversion": "2022r170",
"loaderversion": "0.5.7",
"modtype": "Mod",
@ -16,8 +16,8 @@
"requirements": [
"None"
],
"downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v1.0.0/DesktopVRIK.dll",
"downloadlink": "https://github.com/NotAKidOnSteam/DesktopVRIK/releases/download/v1.0.2/DesktopVRIK.dll",
"sourcelink": "https://github.com/NotAKidOnSteam/DesktopVRIK/",
"changelog": "Simplified VRIK calibration to avoid low heel issue.",
"changelog": "Simplified VRIK calibration to avoid low heel issue.\nRemoved rushed compatibility mode & implemented integrity checks for valid Humanoid rigs.",
"embedcolor": "9b59b6"
}