From eae03f0ec2a7a6ba174efe3e1da86ee00242c39a Mon Sep 17 00:00:00 2001
From: NotAKidoS <37721153+NotAKidOnSteam@users.noreply.github.com>
Date: Tue, 28 Feb 2023 08:31:23 -0600
Subject: [PATCH] add back btkui addon
---
DesktopVRIK/DesktopVRIK.cs | 5 +--
DesktopVRIK/DesktopVRIK.csproj | 3 ++
DesktopVRIK/Integrations/BTKUIAddon.cs | 52 ++++++++++++++++++++++++++
DesktopVRIK/Main.cs | 10 ++---
4 files changed, 61 insertions(+), 9 deletions(-)
create mode 100644 DesktopVRIK/Integrations/BTKUIAddon.cs
diff --git a/DesktopVRIK/DesktopVRIK.cs b/DesktopVRIK/DesktopVRIK.cs
index 47e1a5d..f402744 100644
--- a/DesktopVRIK/DesktopVRIK.cs
+++ b/DesktopVRIK/DesktopVRIK.cs
@@ -16,10 +16,7 @@ public class DesktopVRIK : MonoBehaviour
// DesktopVRIK Settings
public bool
Setting_Enabled = true,
- Setting_HipMovement = true,
- Setting_ResetOnLand = true,
- Setting_PlantFeet = true,
- Setting_EnforceViewPosition;
+ Setting_PlantFeet = true;
public float
Setting_BodyLeanWeight,
Setting_BodyHeadingLimit,
diff --git a/DesktopVRIK/DesktopVRIK.csproj b/DesktopVRIK/DesktopVRIK.csproj
index ea97a04..592135f 100644
--- a/DesktopVRIK/DesktopVRIK.csproj
+++ b/DesktopVRIK/DesktopVRIK.csproj
@@ -18,6 +18,9 @@
C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp-firstpass.dll
+
+ ..\..\..\..\..\..\..\..\Program Files (x86)\Steam\steamapps\common\ChilloutVR\Mods\BTKUILib.dll
+
C:\Program Files (x86)\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Cohtml.Runtime.dll
diff --git a/DesktopVRIK/Integrations/BTKUIAddon.cs b/DesktopVRIK/Integrations/BTKUIAddon.cs
new file mode 100644
index 0000000..7fd4f52
--- /dev/null
+++ b/DesktopVRIK/Integrations/BTKUIAddon.cs
@@ -0,0 +1,52 @@
+using BTKUILib;
+using BTKUILib.UIObjects;
+using System.Runtime.CompilerServices;
+
+namespace NAK.Melons.DesktopVRIK;
+
+public static class BTKUIAddon
+{
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ public static void Init()
+ {
+ //Add myself to the Misc Menu
+
+ Page miscPage = QuickMenuAPI.MiscTabPage;
+ Category miscCategory = miscPage.AddCategory(DesktopVRIKMod.SettingsCategory);
+
+ AddMelonToggle(ref miscCategory, DesktopVRIKMod.m_entryEnabled);
+
+ //Add my own page to not clog up Misc Menu
+
+ Page desktopVRIKPage = miscCategory.AddPage("DesktopVRIK Settings", "", "Configure the settings for DesktopVRIK.", "DesktopVRIK");
+ desktopVRIKPage.MenuTitle = "DesktopVRIK Settings";
+ desktopVRIKPage.MenuSubtitle = "Simplified settings for VRIK on Desktop.";
+
+ Category desktopVRIKCategory = desktopVRIKPage.AddCategory("DesktopVRIK");
+
+ // General Settings
+ AddMelonToggle(ref desktopVRIKCategory, DesktopVRIKMod.m_entryEnabled);
+ AddMelonToggle(ref desktopVRIKCategory, DesktopVRIKMod.m_entryPlantFeet);
+
+ // Calibration Settings
+ AddMelonToggle(ref desktopVRIKCategory, DesktopVRIKMod.m_entryUseVRIKToes);
+ AddMelonToggle(ref desktopVRIKCategory, DesktopVRIKMod.m_entryFindUnmappedToes);
+
+ // Body Leaning Weight
+ AddMelonSlider(ref desktopVRIKPage, DesktopVRIKMod.m_entryBodyLeanWeight, 0, 1f, 1);
+
+ // Max Root Heading Limit & Weights
+ AddMelonSlider(ref desktopVRIKPage, DesktopVRIKMod.m_entryBodyHeadingLimit, 0, 90f, 0);
+ AddMelonSlider(ref desktopVRIKPage, DesktopVRIKMod.m_entryPelvisHeadingWeight, 0, 1f, 1);
+ AddMelonSlider(ref desktopVRIKPage, DesktopVRIKMod.m_entryChestHeadingWeight, 0, 1f, 1);
+ }
+ private static void AddMelonToggle(ref Category category, MelonLoader.MelonPreferences_Entry entry)
+ {
+ category.AddToggle(entry.DisplayName, entry.Description, entry.Value).OnValueUpdated += b => entry.Value = b;
+ }
+
+ private static void AddMelonSlider(ref Page page, MelonLoader.MelonPreferences_Entry entry, float min, float max, int decimalPlaces = 2)
+ {
+ page.AddSlider(entry.DisplayName, entry.Description, entry.Value, min, max, decimalPlaces).OnValueUpdated += f => entry.Value = f;
+ }
+}
\ No newline at end of file
diff --git a/DesktopVRIK/Main.cs b/DesktopVRIK/Main.cs
index 4f2aec4..5425782 100644
--- a/DesktopVRIK/Main.cs
+++ b/DesktopVRIK/Main.cs
@@ -23,8 +23,7 @@ public class DesktopVRIKMod : MelonMod
{
m_categoryDesktopVRIK = MelonPreferences.CreateCategory(SettingsCategory);
m_entryEnabled = m_categoryDesktopVRIK.CreateEntry("Enabled", true, description: "Toggle DesktopVRIK entirely. Requires avatar reload.");
- m_entryEnforceViewPosition = m_categoryDesktopVRIK.CreateEntry("Enforce View Position", false, description: "Corrects view position to use VRIK offsets.");
- m_entryResetIKOnLand = m_categoryDesktopVRIK.CreateEntry("Reset IK On Land", true, description: "Reset Solver IK when landing on the ground.");
+ //m_entryEnforceViewPosition = m_categoryDesktopVRIK.CreateEntry("Enforce View Position", false, description: "Corrects view position to use VRIK offsets.");
m_entryPlantFeet = m_categoryDesktopVRIK.CreateEntry("Enforce Plant Feet", true, description: "Forces VRIK Plant Feet enabled. This prevents the little hover when you stop moving.");
m_entryUseVRIKToes = m_categoryDesktopVRIK.CreateEntry("Use VRIK Toes", false, description: "Should VRIK use your humanoid toes for IK solving? This can cause your feet to idle behind you.");
m_entryFindUnmappedToes = m_categoryDesktopVRIK.CreateEntry("Find Unmapped Toes", false, description: "Should DesktopVRIK look for unmapped toe bones if humanoid rig does not have any?");
@@ -50,12 +49,13 @@ public class DesktopVRIKMod : MelonMod
if (!DesktopVRIK.Instance) return;
// DesktopVRIK Settings
DesktopVRIK.Instance.Setting_Enabled = m_entryEnabled.Value;
- DesktopVRIK.Instance.Setting_BodyLeanWeight = Mathf.Clamp01(m_entryBodyLeanWeight.Value);
- DesktopVRIK.Instance.Setting_ResetOnLand = m_entryResetIKOnLand.Value;
DesktopVRIK.Instance.Setting_PlantFeet = m_entryPlantFeet.Value;
+
+ DesktopVRIK.Instance.Setting_BodyLeanWeight = Mathf.Clamp01(m_entryBodyLeanWeight.Value);
DesktopVRIK.Instance.Setting_BodyHeadingLimit = Mathf.Clamp(m_entryBodyHeadingLimit.Value, 0f, 90f);
DesktopVRIK.Instance.Setting_PelvisHeadingWeight = (1f - Mathf.Clamp01(m_entryPelvisHeadingWeight.Value));
DesktopVRIK.Instance.Setting_ChestHeadingWeight = (1f - Mathf.Clamp01(m_entryChestHeadingWeight.Value));
+
// Calibration Settings
DesktopVRIK.Instance.Calibrator.Setting_UseVRIKToes = m_entryUseVRIKToes.Value;
DesktopVRIK.Instance.Calibrator.Setting_FindUnmappedToes = m_entryFindUnmappedToes.Value;
@@ -68,7 +68,7 @@ public class DesktopVRIKMod : MelonMod
if (MelonMod.RegisteredMelons.Any(it => it.Info.Name == "BTKUILib"))
{
MelonLogger.Msg("Initializing BTKUILib support.");
- //BTKUIAddon.Init();
+ BTKUIAddon.Init();
}
}