VisualCloneFix: Fixed FPRExclusion support

This commit is contained in:
NotAKidoS 2024-07-10 22:10:00 -05:00
parent c8c9dd89aa
commit 9e3edf9241
3 changed files with 20 additions and 6 deletions

View file

@ -26,9 +26,14 @@ public static class Patches
ref Dictionary<Transform, FPRExclusion> __result) ref Dictionary<Transform, FPRExclusion> __result)
{ {
// add an fpr exclusion to the head bone // add an fpr exclusion to the head bone
FPRExclusion headExclusion = headBone.gameObject.AddComponent<FPRExclusion>(); if (!headBone.TryGetComponent(out FPRExclusion headExclusion))
{
headExclusion = headBone.gameObject.AddComponent<FPRExclusion>();
headExclusion.isShown = false; // default to hidden
headExclusion.target = headBone;
}
MeshHiderExclusion headExclusionBehaviour = new(); MeshHiderExclusion headExclusionBehaviour = new();
headExclusion.target = headBone;
headExclusion.behaviour = headExclusionBehaviour; headExclusion.behaviour = headExclusionBehaviour;
headExclusionBehaviour.id = 1; // head bone is always 1 headExclusionBehaviour.id = 1; // head bone is always 1
@ -128,4 +133,13 @@ public static class Patches
__result = vertexIndices; __result = vertexIndices;
return false; return false;
} }
[HarmonyPrefix]
[HarmonyPatch(typeof(MeshHiderExclusion), nameof(MeshHiderExclusion.UpdateExclusions))]
private static bool OnUpdateExclusions(bool isShown, bool shrinkToZero, ref int ___id)
{
if (isShown) LocalCloneManager.cullingMask &= ~(1 << ___id);
else LocalCloneManager.cullingMask |= 1 << ___id;
return false;
}
} }

View file

@ -27,6 +27,6 @@ using System.Reflection;
namespace NAK.VisualCloneFix.Properties; namespace NAK.VisualCloneFix.Properties;
internal static class AssemblyInfoParams internal static class AssemblyInfoParams
{ {
public const string Version = "1.0.0"; public const string Version = "1.0.1";
public const string Author = "NotAKidoS"; public const string Author = "NotAKidoS";
} }

View file

@ -1,7 +1,7 @@
{ {
"_id": 221, "_id": 221,
"name": "VisualCloneFix", "name": "VisualCloneFix",
"modversion": "1.0.0", "modversion": "1.0.1",
"gameversion": "2024r175", "gameversion": "2024r175",
"loaderversion": "0.6.1", "loaderversion": "0.6.1",
"modtype": "Mod", "modtype": "Mod",
@ -16,8 +16,8 @@
"requirements": [ "requirements": [
"None" "None"
], ],
"downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r34/VisualCloneFix.dll", "downloadlink": "https://github.com/NotAKidoS/NAK_CVR_Mods/releases/download/r36/VisualCloneFix.dll",
"sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/VisualCloneFix/", "sourcelink": "https://github.com/NotAKidoS/NAK_CVR_Mods/tree/main/VisualCloneFix/",
"changelog": "- Initial release", "changelog": "- Fixed FPRExclusions IsShown state being inverted when toggled.\n- Fixed head FPRExclusion generation not checking for existing exclusion.",
"embedcolor": "#f61963" "embedcolor": "#f61963"
} }