Basic ear morph
This commit is contained in:
@@ -276,6 +276,8 @@ public class UmaViewerBuilder : MonoBehaviour
|
||||
{
|
||||
var firsehead = CurrentUMAContainer.Head;
|
||||
var FaceDriven = firsehead.GetComponent<AssetHolder>()._assetTable.list.Find(a => { return a.Key == "facial_target"; }).Value as FaceDrivenKeyTarget;
|
||||
var EarDriven = firsehead.GetComponent<AssetHolder>()._assetTable.list.Find(a => { return a.Key == "ear_target"; }).Value as DrivenKeyTarget;
|
||||
FaceDriven._earTarget = EarDriven._targetFaces;
|
||||
CurrentUMAContainer.FaceDrivenKeyTarget = FaceDriven;
|
||||
CurrentUMAContainer.FaceDrivenKeyTarget.Container = CurrentUMAContainer;
|
||||
FaceDriven.Initialize(firsehead.GetComponentsInChildren<Transform>().ToList());
|
||||
|
||||
@@ -219,6 +219,7 @@ public class UmaViewerUI : MonoBehaviour
|
||||
|
||||
if (target == null) return;
|
||||
List<FacialMorph> tempMorph = new List<FacialMorph>();
|
||||
tempMorph.AddRange(target.EarMorphs);
|
||||
tempMorph.AddRange(target.EyeBrowMorphs);
|
||||
tempMorph.AddRange(target.EyeMorphs);
|
||||
tempMorph.AddRange(target.MouthMorphs);
|
||||
@@ -612,6 +613,17 @@ public class UmaViewerUI : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void SetEarMorphEnable(bool isOn)
|
||||
{
|
||||
if (Builder.CurrentUMAContainer)
|
||||
{
|
||||
foreach (CySpringDataContainer cySpring in Builder.CurrentUMAContainer.GetComponentsInChildren<CySpringDataContainer>())
|
||||
{
|
||||
cySpring.EnableEarPhysics(!isOn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
PlayerPrefs.DeleteAll();
|
||||
|
||||
@@ -158,7 +158,21 @@ namespace Gallop
|
||||
{
|
||||
foreach(DynamicBone dynamic in DynamicBones)
|
||||
{
|
||||
dynamic.enabled = isOn;
|
||||
if (!dynamic.m_Root.name.Contains("Ear"))
|
||||
{
|
||||
dynamic.enabled = isOn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void EnableEarPhysics(bool isOn)
|
||||
{
|
||||
foreach (DynamicBone dynamic in DynamicBones)
|
||||
{
|
||||
if (dynamic.m_Root.name.Contains("Ear"))
|
||||
{
|
||||
dynamic.enabled = isOn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ using UnityEngine;
|
||||
namespace Gallop
|
||||
{
|
||||
|
||||
public class DrivenKeyTarget : MonoBehaviour
|
||||
public class DrivenKeyTarget : ScriptableObject
|
||||
{
|
||||
|
||||
public List<TargetInfomation> _targetFaces { get; set; }
|
||||
public List<TargetInfomation> _targetFaces;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,13 +10,16 @@ namespace Gallop
|
||||
public List<EyeTarget> _eyeTarget;
|
||||
public List<EyebrowTarget> _eyebrowTarget;
|
||||
public List<MouthTarget> _mouthTarget;
|
||||
public List<TargetInfomation> _earTarget;
|
||||
|
||||
public List<Transform> Objs;
|
||||
private FacialMorph BaseLEarMorph, BaseREarMorph;
|
||||
private FacialMorph BaseLEyeBrowMorph, BaseREyeBrowMorph;
|
||||
private FacialMorph BaseLEyeMorph, BaseREyeMorph;
|
||||
private FacialMorph BaseMouthMorph;
|
||||
public FacialMorph LeftEyeXrange, LeftEyeYrange, RightEyeXrange, RightEyeYrange;
|
||||
|
||||
public List<FacialMorph> EarMorphs = new List<FacialMorph>();
|
||||
public List<FacialMorph> EyeBrowMorphs = new List<FacialMorph>();
|
||||
public List<FacialMorph> EyeMorphs = new List<FacialMorph>();
|
||||
public List<FacialMorph> MouthMorphs = new List<FacialMorph>();
|
||||
@@ -31,6 +34,32 @@ namespace Gallop
|
||||
{
|
||||
Objs = objs;
|
||||
|
||||
for (int i = 0; i < _earTarget.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < _earTarget[i]._faceGroupInfo.Count; j++)
|
||||
{
|
||||
FacialMorph morph = new FacialMorph();
|
||||
morph.target = this;
|
||||
morph.direction = j > 0;
|
||||
morph.name = "Ear_" + i + "_" + (morph.direction ? "L" : "R");
|
||||
morph.tag = Enum.GetName(typeof(EarType), i);
|
||||
morph.trsArray = _earTarget[i]._faceGroupInfo[j]._trsArray;
|
||||
foreach (TrsArray trs in morph.trsArray)
|
||||
{
|
||||
trs.transform = Objs.Find(ani => ani.name.Equals(trs._path));
|
||||
}
|
||||
if (i == 0)
|
||||
{
|
||||
if (morph.direction) BaseLEarMorph = morph;
|
||||
else BaseREarMorph = morph;
|
||||
}
|
||||
else
|
||||
{
|
||||
EarMorphs.Add(morph);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < _eyebrowTarget.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < _eyebrowTarget[i]._faceGroupInfo.Count; j++)
|
||||
@@ -159,6 +188,11 @@ namespace Gallop
|
||||
{
|
||||
FacialResetAll();
|
||||
|
||||
foreach (FacialMorph morph in EarMorphs)
|
||||
{
|
||||
ProcessMorph(morph);
|
||||
}
|
||||
|
||||
foreach (FacialMorph morph in EyeBrowMorphs)
|
||||
{
|
||||
ProcessMorph(morph);
|
||||
@@ -179,6 +213,12 @@ namespace Gallop
|
||||
|
||||
public void ClearMorph()
|
||||
{
|
||||
|
||||
foreach (FacialMorph morph in EarMorphs)
|
||||
{
|
||||
morph.weight = 0;
|
||||
}
|
||||
|
||||
foreach (FacialMorph morph in EyeBrowMorphs)
|
||||
{
|
||||
morph.weight = 0;
|
||||
@@ -210,6 +250,8 @@ namespace Gallop
|
||||
|
||||
public void FacialResetAll()
|
||||
{
|
||||
FacialReset(BaseLEarMorph.trsArray);
|
||||
FacialReset(BaseREarMorph.trsArray);
|
||||
FacialReset(BaseLEyeBrowMorph.trsArray);
|
||||
FacialReset(BaseREyeBrowMorph.trsArray);
|
||||
FacialReset(BaseLEyeMorph.trsArray);
|
||||
|
||||
Reference in New Issue
Block a user