mirror of
https://github.com/hanetzer/sdraw_mods_cvr.git
synced 2025-09-04 10:59:22 +00:00
Fully working animation override fix
This commit is contained in:
parent
3940802858
commit
fc60219a4e
3 changed files with 42 additions and 15 deletions
|
@ -75,16 +75,16 @@ namespace ml_amt
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
// AAS overriding "fix"
|
// AAS overriding fix
|
||||||
HarmonyInstance.Patch(
|
HarmonyInstance.Patch(
|
||||||
typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.SetOverrideAnimation), BindingFlags.Instance),
|
typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.SetOverrideAnimation)),
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnAnimationOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||||
null
|
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
);
|
);
|
||||||
HarmonyInstance.Patch(
|
HarmonyInstance.Patch(
|
||||||
typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.RestoreOverrideAnimation)),
|
typeof(CVRAnimatorManager).GetMethod(nameof(CVRAnimatorManager.RestoreOverrideAnimation)),
|
||||||
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnAnimationOverrideRestore_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Prefix), BindingFlags.Static | BindingFlags.NonPublic)),
|
||||||
null
|
new HarmonyLib.HarmonyMethod(typeof(AvatarMotionTweaker).GetMethod(nameof(OnOverride_Postfix), BindingFlags.Static | BindingFlags.NonPublic))
|
||||||
);
|
);
|
||||||
|
|
||||||
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
|
MelonLoader.MelonCoroutines.Start(WaitForLocalPlayer());
|
||||||
|
@ -256,14 +256,41 @@ namespace ml_amt
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool OnAnimationOverride_Prefix()
|
static void OnOverride_Prefix(ref CVRAnimatorManager __instance)
|
||||||
{
|
{
|
||||||
return !Settings.OverrideFix;
|
try
|
||||||
|
{
|
||||||
|
if(Settings.OverrideFix)
|
||||||
|
{
|
||||||
|
if(__instance.animator != null)
|
||||||
|
{
|
||||||
|
__instance.animator.enabled = false;
|
||||||
|
__instance.animator.WriteDefaultValues();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
static bool OnAnimationOverrideRestore_Prefix()
|
}
|
||||||
|
catch(System.Exception l_exception)
|
||||||
{
|
{
|
||||||
return !Settings.OverrideFix;
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void OnOverride_Postfix(ref CVRAnimatorManager __instance)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if(Settings.OverrideFix)
|
||||||
|
{
|
||||||
|
if(__instance.animator != null)
|
||||||
|
{
|
||||||
|
__instance.animator.enabled = true;
|
||||||
|
__instance.animator.Update(0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(System.Exception l_exception)
|
||||||
|
{
|
||||||
|
MelonLoader.MelonLogger.Error(l_exception);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace ml_amt
|
||||||
static bool ms_followHips = true;
|
static bool ms_followHips = true;
|
||||||
static bool ms_collisionScale = true;
|
static bool ms_collisionScale = true;
|
||||||
static bool ms_massCenter = true;
|
static bool ms_massCenter = true;
|
||||||
static bool ms_overrideFix = false;
|
static bool ms_overrideFix = true;
|
||||||
|
|
||||||
static MelonLoader.MelonPreferences_Category ms_category = null;
|
static MelonLoader.MelonPreferences_Category ms_category = null;
|
||||||
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
|
static List<MelonLoader.MelonPreferences_Entry> ms_entries = null;
|
||||||
|
@ -73,7 +73,7 @@ namespace ml_amt
|
||||||
ms_category.CreateEntry(ModSetting.FollowHips.ToString(), true),
|
ms_category.CreateEntry(ModSetting.FollowHips.ToString(), true),
|
||||||
ms_category.CreateEntry(ModSetting.CollisionScale.ToString(), true),
|
ms_category.CreateEntry(ModSetting.CollisionScale.ToString(), true),
|
||||||
ms_category.CreateEntry(ModSetting.MassCenter.ToString(), true),
|
ms_category.CreateEntry(ModSetting.MassCenter.ToString(), true),
|
||||||
ms_category.CreateEntry(ModSetting.OverrideFix.ToString(), false)
|
ms_category.CreateEntry(ModSetting.OverrideFix.ToString(), true)
|
||||||
};
|
};
|
||||||
|
|
||||||
Load();
|
Load();
|
||||||
|
|
|
@ -265,9 +265,9 @@ function inp_toggle_mod_amt(_obj, _callbackName) {
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class ="row-wrapper">
|
<div class ="row-wrapper">
|
||||||
<div class ="option-caption">Prevent Unity animation override (chairs, etc.): </div>
|
<div class ="option-caption">Fix animation overrides (chairs, etc.): </div>
|
||||||
<div class ="option-input">
|
<div class ="option-input">
|
||||||
<div id="OverrideFix" class ="inp_toggle no-scroll" data-current="false"></div>
|
<div id="OverrideFix" class ="inp_toggle no-scroll" data-current="true"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue