Add blushing setting

This commit is contained in:
左右看
2022-11-11 22:47:48 +08:00
parent e111face9b
commit 116c4a6089
4 changed files with 476 additions and 5 deletions
+5
View File
@@ -28,6 +28,11 @@ public class UmaContainer : MonoBehaviour
public float EyeHeight;
public bool EnableEyeTracking = true;
[Header("Cheek")]
public Texture CheekTex;
public Material CheekMaterial;
[Header("Generic")]
public bool IsGeneric = false;
public string VarCostumeIdShort, VarCostumeIdLong, VarSkin, VarHeight, VarSocks, VarBust;
+15 -2
View File
@@ -2,6 +2,7 @@
using CriWareFormats;
using Gallop;
using NAudio.Wave;
using PlasticGui.Help.Conditions;
using System;
using System.Collections;
using System.Collections.Generic;
@@ -824,6 +825,9 @@ public class UmaViewerBuilder : MonoBehaviour
GameObject head = Instantiate(go, CurrentUMAContainer.transform);
CurrentUMAContainer.Head = head;
//Some setting for Head
CurrentUMAContainer.EnableEyeTracking = UI.EnableEyeTracking;
foreach (Renderer r in head.GetComponentsInChildren<Renderer>())
{
foreach (Material m in r.sharedMaterials)
@@ -863,9 +867,18 @@ public class UmaViewerBuilder : MonoBehaviour
{
m.shader = alphaShader;
}
//Disable cheek
//Blush Setting
if (r.name.Contains("Cheek")){
r.gameObject.SetActive(false);
CurrentUMAContainer.CheekMaterial = m;
CurrentUMAContainer.CheekTex = CurrentUMAContainer.Head.GetComponent<AssetHolder>()._assetTable.list.Find(a => { return a.Key == "cheek1"; }).Value as Texture;
if (UI.IsCheekBlushing)
{
m.SetTexture("_MainTex", CurrentUMAContainer.CheekTex);
}
else
{
m.SetTexture("_MainTex", null);
}
}
switch (m.shader.name)
{
+22
View File
@@ -82,6 +82,8 @@ public class UmaViewerUI : MonoBehaviour
public bool isCriware = false;
public bool isHeadFix = false;
public bool EnableEyeTracking = true;
public bool IsCheekBlushing = false;
public FaceDrivenKeyTarget currentFaceDrivenKeyTarget;
@@ -640,12 +642,32 @@ public class UmaViewerUI : MonoBehaviour
public void SetEyeTrackingEnable(bool isOn)
{
EnableEyeTracking = isOn;
if (Builder.CurrentUMAContainer)
{
Builder.CurrentUMAContainer.EnableEyeTracking = isOn;
}
}
public void SetBlushing(bool isOn)
{
IsCheekBlushing = isOn;
if (Builder.CurrentUMAContainer)
{
if (Builder.CurrentUMAContainer.CheekMaterial)
{
if (isOn)
{
Builder.CurrentUMAContainer.CheekMaterial.SetTexture("_MainTex", Builder.CurrentUMAContainer.CheekTex);
}
else
{
Builder.CurrentUMAContainer.CheekMaterial.SetTexture("_MainTex", null);
}
}
}
}
public void AudioPause()
{
if (Builder.CurrentAudioSources.Count>0)