Move many mods to Deprecated folder, fix spelling

This commit is contained in:
NotAKidoS 2025-04-03 02:57:35 -05:00
parent 5e822cec8d
commit 0042590aa6
539 changed files with 7475 additions and 3120 deletions

View file

@ -0,0 +1,132 @@
using RootMotion.FinalIK;
namespace NAK.AlternateIKSystem.IK.WeightManipulators.BodyParts;
public abstract class BodyPart
{
protected float positionWeight = 1f;
protected float rotationWeight = 1f;
protected bool isEnabled = true;
public void SetPositionWeight(float weight)
{
this.positionWeight *= weight;
}
public void SetRotationWeight(float weight)
{
this.rotationWeight *= weight;
}
public void SetEnabled(bool isEnabled)
{
this.isEnabled = isEnabled;
}
public abstract void ApplyWeightToSolver(IKSolverVR solver);
}
public class Head : BodyPart
{
public override void ApplyWeightToSolver(IKSolverVR solver)
{
if (!isEnabled) return;
solver.spine.positionWeight *= positionWeight;
solver.spine.rotationWeight *= rotationWeight;
}
}
public class Pelvis : BodyPart
{
public override void ApplyWeightToSolver(IKSolverVR solver)
{
if (!isEnabled) return;
solver.spine.pelvisPositionWeight *= positionWeight;
solver.spine.pelvisRotationWeight *= rotationWeight;
}
}
public class LeftArm : BodyPart
{
private float bendGoalWeight = 1f;
public void SetBendGoalWeight(float weight)
{
this.bendGoalWeight *= weight;
}
public override void ApplyWeightToSolver(IKSolverVR solver)
{
if (!isEnabled) return;
solver.leftArm.positionWeight *= positionWeight;
solver.leftArm.rotationWeight *= rotationWeight;
solver.leftArm.bendGoalWeight *= bendGoalWeight;
}
}
public class RightArm : BodyPart
{
private float bendGoalWeight = 1f;
public void SetBendGoalWeight(float weight)
{
this.bendGoalWeight *= weight;
}
public override void ApplyWeightToSolver(IKSolverVR solver)
{
if (!isEnabled) return;
solver.rightArm.positionWeight *= positionWeight;
solver.rightArm.rotationWeight *= rotationWeight;
solver.rightArm.bendGoalWeight *= bendGoalWeight;
}
}
public class LeftLeg : BodyPart
{
private float bendGoalWeight = 1f;
public void SetBendGoalWeight(float weight)
{
this.bendGoalWeight *= weight;
}
public override void ApplyWeightToSolver(IKSolverVR solver)
{
if (!isEnabled) return;
solver.leftLeg.positionWeight *= positionWeight;
solver.leftLeg.rotationWeight *= rotationWeight;
solver.leftLeg.bendGoalWeight *= bendGoalWeight;
}
}
public class RightLeg : BodyPart
{
private float bendGoalWeight = 1f;
public void SetBendGoalWeight(float weight)
{
this.bendGoalWeight *= weight;
}
public override void ApplyWeightToSolver(IKSolverVR solver)
{
if (!isEnabled) return;
solver.rightLeg.positionWeight *= positionWeight;
solver.rightLeg.rotationWeight *= rotationWeight;
solver.rightLeg.bendGoalWeight *= bendGoalWeight;
}
}
public class Locomotion : BodyPart
{
public override void ApplyWeightToSolver(IKSolverVR solver)
{
if (!isEnabled) return;
solver.locomotion.weight *= positionWeight;
}
}

View file

@ -0,0 +1,31 @@
using NAK.AlternateIKSystem.IK.WeightManipulators.Interface;
using RootMotion.FinalIK;
namespace NAK.AlternateIKSystem.IK.WeightManipulators;
public class DeviceControlManipulator : IWeightManipulator
{
public static bool shouldTrackAll = true;
public static bool shouldTrackHead = true;
public static bool shouldTrackPelvis = true;
public static bool shouldTrackLeftArm = true;
public static bool shouldTrackRightArm = true;
public static bool shouldTrackLeftLeg = true;
public static bool shouldTrackRightLeg = true;
public static bool shouldTrackLocomotion = true;
public WeightManipulatorManager Manager { get; set; }
// Manipulator for Connected Devices (Has final say)
public void Update(IKSolverVR solver)
{
Manager.TrackAll &= shouldTrackAll;
Manager.TrackHead &= shouldTrackHead;
Manager.TrackPelvis &= shouldTrackPelvis;
Manager.TrackLeftArm &= shouldTrackLeftArm;
Manager.TrackRightArm &= shouldTrackRightArm;
Manager.TrackLeftLeg &= shouldTrackLeftLeg;
Manager.TrackRightLeg &= shouldTrackRightLeg;
Manager.TrackLocomotion &= shouldTrackLocomotion;
}
}

View file

@ -0,0 +1,9 @@
using RootMotion.FinalIK;
namespace NAK.AlternateIKSystem.IK.WeightManipulators.Interface;
public interface IWeightManipulator
{
WeightManipulatorManager Manager { get; set; }
void Update(IKSolverVR solver);
}

View file

@ -0,0 +1,22 @@
using NAK.AlternateIKSystem.IK.WeightManipulators.Interface;
using RootMotion.FinalIK;
namespace NAK.AlternateIKSystem.IK.WeightManipulators;
public class TrackingControlManipulator : IWeightManipulator
{
public WeightManipulatorManager Manager { get; set; }
// Manipulator for External Control (Auto, State Behaviour)
public void Update(IKSolverVR solver)
{
Manager.TrackAll |= BodyControl.TrackingAll;
Manager.TrackHead |= BodyControl.TrackingHead;
Manager.TrackPelvis |= BodyControl.TrackingPelvis;
Manager.TrackLeftArm |= BodyControl.TrackingLeftArm;
Manager.TrackRightArm |= BodyControl.TrackingRightArm;
Manager.TrackLeftLeg |= BodyControl.TrackingLeftLeg;
Manager.TrackRightLeg |= BodyControl.TrackingRightLeg;
Manager.TrackLocomotion |= BodyControl.TrackingLocomotion;
}
}

View file

@ -0,0 +1,84 @@
using NAK.AlternateIKSystem.IK.WeightManipulators.BodyParts;
using NAK.AlternateIKSystem.IK.WeightManipulators.Interface;
using RootMotion.FinalIK;
namespace NAK.AlternateIKSystem.IK.WeightManipulators;
public enum BodyPartEnum
{
Head,
Pelvis,
LeftArm,
RightArm,
LeftLeg,
RightLeg,
Locomotion,
All
}
public class WeightManipulatorManager
{
private readonly Dictionary<BodyPartEnum, BodyPart> _bodyParts = new Dictionary<BodyPartEnum, BodyPart>();
public WeightManipulatorManager()
{
_bodyParts.Add(BodyPartEnum.Head, new Head());
_bodyParts.Add(BodyPartEnum.Pelvis, new Pelvis());
_bodyParts.Add(BodyPartEnum.LeftArm, new LeftArm());
_bodyParts.Add(BodyPartEnum.RightArm, new RightArm());
_bodyParts.Add(BodyPartEnum.LeftLeg, new LeftLeg());
_bodyParts.Add(BodyPartEnum.RightLeg, new RightLeg());
_bodyParts.Add(BodyPartEnum.Locomotion, new Locomotion());
}
public void SetWeight(BodyPartEnum bodyPartName, float positionWeight, float rotationWeight)
{
var bodyPart = _bodyParts[bodyPartName];
bodyPart.SetPositionWeight(positionWeight);
bodyPart.SetRotationWeight(rotationWeight);
}
public void SetEnabled(BodyPartEnum bodyPartName, bool isEnabled)
{
var bodyPart = _bodyParts[bodyPartName];
bodyPart.SetEnabled(isEnabled);
}
public void ApplyWeightsToSolver(IKSolverVR solver)
{
foreach (var bodyPart in _bodyParts.Values)
{
bodyPart.ApplyWeightToSolver(solver);
}
}
}
public class BodyControl
{
private readonly WeightManipulatorManager _manager;
public BodyControl(WeightManipulatorManager manager)
{
_manager = manager;
}
public void SetWeight(string bodyPartName, float positionWeight, float rotationWeight)
{
_manager.SetWeight(bodyPartName, positionWeight, rotationWeight);
}
}
public class DeviceControl
{
private readonly WeightManipulatorManager _manager;
public DeviceControl(WeightManipulatorManager manager)
{
_manager = manager;
}
public void SetEnabled(string bodyPartName, bool isEnabled)
{
_manager.SetEnabled(bodyPartName, isEnabled);
}
}