Skip to content

Commit

Permalink
Add fix for jumpy sliders and joints on headlesses by @LeCloutPanda
Browse files Browse the repository at this point in the history
Add fix for Yellow-Dog-Man/Resonite-Issues#399

Co-authored-by: LeCloutPanda <53411604+LeCloutPanda@users.noreply.github.com>
  • Loading branch information
Banane9 and LeCloutPanda committed Jan 24, 2025
1 parent f397060 commit b02a312
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CommunityBugFixCollection/CommunityBugFixCollection.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageId>CommunityBugFixCollection</PackageId>
<Title>Component Selector Additions</Title>
<Authors>Banane9; Nytra; art0007i</Authors>
<Authors>Banane9; Nytra; art0007i; LeCloutPanda</Authors>
<Version>0.7.0-beta</Version>
<Description>This MonkeyLoader mod for Resonite overhauls the Component Selector / Protoflux Node Selector to have a search, as well as favorites and recents categories.</Description>
<PackageReadmeFile>README.md</PackageReadmeFile>
Expand Down
2 changes: 2 additions & 0 deletions CommunityBugFixCollection/Contributors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ internal static class Contributors

public static string[] Banane9 { get; } = ["Banane9"];

public static string[] LeCloutPanda { get; } = ["LeCloutPanda"];

public static string[] Nytra { get; } = ["Nytra"];
}
}
58 changes: 58 additions & 0 deletions CommunityBugFixCollection/SmoothSlidersAndJoints.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using FrooxEngine;
using HarmonyLib;
using MonkeyLoader.Resonite;
using System;
using System.Collections.Generic;
using System.Text;

// Originally released under MIT by LeCloutPanda here:
// https://github.com/LeCloutPanda/SoNoHeadCrash

namespace CommunityBugFixCollection
{
[HarmonyPatch("OnAwake")]
[HarmonyPatchCategory(nameof(SmoothSlidersAndJoints))]
internal sealed class SmoothSlidersAndJoints : ResoniteMonkey<SmoothSlidersAndJoints>
{
public override IEnumerable<string> Authors => base.Authors;
public override bool CanBeDisabled => true;

[HarmonyPostfix]
[HarmonyPatch(typeof(Joint))]
public static void JointOnAwakePostfix(Joint __instance)
{
if (!Enabled || __instance.LocalUser.HeadDevice != HeadOutputDevice.Headless || !__instance.LocalUser.IsHost)
return;

__instance.RunInUpdates(3, () =>
{
if (__instance.FilterWorldElement() is null)
return;

__instance.DontDrive.Value = true;

Logger.Info(() => $"Set DontDrive to true for Joint:");
Logger.Info(() => __instance.ParentHierarchyToString());
});
}

[HarmonyPostfix]
[HarmonyPatch(typeof(Slider))]
public static void SliderOnAwakePostfix(Slider __instance)
{
if (!Enabled || __instance.LocalUser.HeadDevice != HeadOutputDevice.Headless || !__instance.LocalUser.IsHost)
return;

__instance.RunInUpdates(3, () =>
{
if (__instance.FilterWorldElement() is null)
return;

__instance.DontDrive.Value = true;

Logger.Info(() => $"Set DontDrive to true for Slider:");
Logger.Info(() => __instance.ParentHierarchyToString());
});
}
}
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ just disable them in the settings in the meantime.
* ColorX Luminance calculations being incorrect for non-linear color profiles (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/281)
* Non-HDR variants of Color(X) channel addition not clamping (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/316)
* Color Profile not being preserved on all operations (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/318)
* Sliders and Joints snapping in sessions hosted by a headless (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/399)
* ProtoFlux Node names containing `ColorX` being spaced wrong (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/496)
* The selected Home World in the Inventory not being highlighted as a favorite (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/503)
* The MaterialGizmo being scaled twice when using Edit on the Material Tool (https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/528)
Expand Down

0 comments on commit b02a312

Please sign in to comment.