mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
[BetterShadowClone] Add FPR stuff from exp
This commit is contained in:
parent
540dc679fe
commit
829ad55195
2 changed files with 16 additions and 8 deletions
|
@ -118,14 +118,12 @@ public class SkinnedShadowClone : IShadowClone
|
|||
{
|
||||
// Cleanup instanced Mesh & Materials
|
||||
GameObject shadowMeshObject = _shadowMesh.gameObject;
|
||||
UnityEngine.Object.Destroy(_shadowMeshFilter.sharedMesh);
|
||||
UnityEngine.Object.Destroy(_shadowMeshFilter.mesh);
|
||||
UnityEngine.Object.Destroy(_shadowMeshFilter);
|
||||
|
||||
if (!_hasShadowMaterials)
|
||||
{
|
||||
var materials = _shadowMesh.sharedMaterials;
|
||||
foreach (Material mat in materials) UnityEngine.Object.Destroy(mat);
|
||||
}
|
||||
// explain why this works
|
||||
if (_hasShadowMaterials) _shadowMesh.sharedMaterials = _mainMesh.sharedMaterials;
|
||||
foreach (Material mat in _shadowMesh.sharedMaterials) UnityEngine.Object.Destroy(mat);
|
||||
|
||||
UnityEngine.Object.Destroy(_shadowMesh);
|
||||
UnityEngine.Object.Destroy(shadowMeshObject);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ABI_RC.Core;
|
||||
using ABI.CCK.Components;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using Object = UnityEngine.Object;
|
||||
|
@ -69,6 +70,14 @@ public static class ShadowCloneHelper
|
|||
// add an fpr exclusion to the head bone
|
||||
headBone.gameObject.AddComponent<FPRExclusion>().target = headBone;
|
||||
|
||||
// add an FPRExclusion for all target entries on CVRAvatar (Experimental feature)
|
||||
CVRAvatar avatar = root.GetComponent<CVRAvatar>();
|
||||
if (avatar != null)
|
||||
{
|
||||
foreach (CVRAvatarFPREntry fprEntry in avatar.fprSettingsList.Where(fprEntry => fprEntry.transform != null))
|
||||
fprEntry.transform.gameObject.AddComponent<FPRExclusion>().target = fprEntry.transform;
|
||||
}
|
||||
|
||||
// get all FPRExclusions
|
||||
var fprExclusions = root.GetComponentsInChildren<FPRExclusion>(true).ToList();
|
||||
|
||||
|
@ -83,7 +92,8 @@ public static class ShadowCloneHelper
|
|||
continue;
|
||||
}
|
||||
|
||||
exclusionTargets.Add(exclusion.target, exclusion);
|
||||
// first to add wins
|
||||
exclusionTargets.TryAdd(exclusion.target, exclusion);
|
||||
}
|
||||
|
||||
// process each FPRExclusion (recursive)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue