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
|
// Cleanup instanced Mesh & Materials
|
||||||
GameObject shadowMeshObject = _shadowMesh.gameObject;
|
GameObject shadowMeshObject = _shadowMesh.gameObject;
|
||||||
UnityEngine.Object.Destroy(_shadowMeshFilter.sharedMesh);
|
UnityEngine.Object.Destroy(_shadowMeshFilter.mesh);
|
||||||
UnityEngine.Object.Destroy(_shadowMeshFilter);
|
UnityEngine.Object.Destroy(_shadowMeshFilter);
|
||||||
|
|
||||||
if (!_hasShadowMaterials)
|
// explain why this works
|
||||||
{
|
if (_hasShadowMaterials) _shadowMesh.sharedMaterials = _mainMesh.sharedMaterials;
|
||||||
var materials = _shadowMesh.sharedMaterials;
|
foreach (Material mat in _shadowMesh.sharedMaterials) UnityEngine.Object.Destroy(mat);
|
||||||
foreach (Material mat in materials) UnityEngine.Object.Destroy(mat);
|
|
||||||
}
|
|
||||||
|
|
||||||
UnityEngine.Object.Destroy(_shadowMesh);
|
UnityEngine.Object.Destroy(_shadowMesh);
|
||||||
UnityEngine.Object.Destroy(shadowMeshObject);
|
UnityEngine.Object.Destroy(shadowMeshObject);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ABI_RC.Core;
|
using ABI_RC.Core;
|
||||||
|
using ABI.CCK.Components;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Rendering;
|
using UnityEngine.Rendering;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
@ -69,6 +70,14 @@ public static class ShadowCloneHelper
|
||||||
// add an fpr exclusion to the head bone
|
// add an fpr exclusion to the head bone
|
||||||
headBone.gameObject.AddComponent<FPRExclusion>().target = headBone;
|
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
|
// get all FPRExclusions
|
||||||
var fprExclusions = root.GetComponentsInChildren<FPRExclusion>(true).ToList();
|
var fprExclusions = root.GetComponentsInChildren<FPRExclusion>(true).ToList();
|
||||||
|
|
||||||
|
@ -83,7 +92,8 @@ public static class ShadowCloneHelper
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
exclusionTargets.Add(exclusion.target, exclusion);
|
// first to add wins
|
||||||
|
exclusionTargets.TryAdd(exclusion.target, exclusion);
|
||||||
}
|
}
|
||||||
|
|
||||||
// process each FPRExclusion (recursive)
|
// process each FPRExclusion (recursive)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue