Minor code changes

This commit is contained in:
SDraw 2024-03-29 15:19:00 +03:00
parent 19606527fc
commit 11287e7dc5
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
36 changed files with 329 additions and 273 deletions

View file

@ -332,8 +332,7 @@ namespace ml_pam
if(PlayerSetup.Instance._animator.isHuman)
{
if(!m_inVR)
PoseHelper.ForceTPose(PlayerSetup.Instance._animator);
Utils.SetAvatarTPose();
Transform l_leftHand = PlayerSetup.Instance._animator.GetBoneTransform(HumanBodyBones.LeftHand);
if(l_leftHand != null)

View file

@ -1,26 +0,0 @@
using UnityEngine;
using ABI_RC.Systems.IK;
namespace ml_pam
{
static class PoseHelper
{
public static void ForceTPose(Animator p_animator)
{
if(p_animator.isHuman)
{
HumanPoseHandler l_handler = new HumanPoseHandler(p_animator.avatar, p_animator.transform);
HumanPose l_pose = new HumanPose();
l_handler.GetHumanPose(ref l_pose);
for(int i = 0, j = Mathf.Min(l_pose.muscles.Length, MusclePoses.TPoseMuscles.Length); i < j; i++)
l_pose.muscles[i] = MusclePoses.TPoseMuscles[i];
l_pose.bodyPosition = Vector3.up;
l_pose.bodyRotation = Quaternion.identity;
l_handler.SetHumanPose(ref l_pose);
l_handler.Dispose();
}
}
}
}

View file

@ -28,10 +28,10 @@ namespace ml_pam
static MelonLoader.MelonPreferences_Category ms_category = null;
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
static public event Action<bool> EnabledChange;
static public event Action<float> GrabOffsetChange;
static public event Action<LeadHand> LeadingHandChange;
static public event Action<bool> HandsExtensionChange;
public static event Action<bool> EnabledChange;
public static event Action<float> GrabOffsetChange;
public static event Action<LeadHand> LeadingHandChange;
public static event Action<bool> HandsExtensionChange;
internal static void Init()
{

View file

@ -1,5 +1,7 @@
using ABI_RC.Core.Savior;
using ABI_RC.Core.Player;
using ABI_RC.Core.Savior;
using ABI_RC.Core.UI;
using ABI_RC.Systems.IK;
using System.Reflection;
using UnityEngine;
@ -11,7 +13,14 @@ namespace ml_pam
public static bool IsInVR() => ((MetaPort.Instance != null) && MetaPort.Instance.isUsingVr);
static public void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);
public static void ExecuteScript(this CohtmlControlledViewWrapper p_instance, string p_script) => ((cohtml.Net.View)ms_view.GetValue(p_instance)).ExecuteScript(p_script);
public static void SetAvatarTPose()
{
IKSystem.Instance.SetAvatarPose(IKSystem.AvatarPose.TPose);
PlayerSetup.Instance._avatar.transform.localPosition = Vector3.zero;
PlayerSetup.Instance._avatar.transform.localRotation = Quaternion.identity;
}
// Extensions
public static Matrix4x4 GetMatrix(this Transform p_transform, bool p_pos = true, bool p_rot = true, bool p_scl = false)