fix facial stencil problem, add static tear morph
This commit is contained in:
@@ -51,6 +51,7 @@ namespace Gallop
|
||||
FacialOtherMorph CheekMorph;
|
||||
FacialOtherMorph ShadeMorph;
|
||||
FacialOtherMorph MangaMorph;
|
||||
FacialOtherMorph StaticTearMorph;
|
||||
List<FacialOtherMorph> TearMorphs = new List<FacialOtherMorph>();
|
||||
|
||||
public void Initialize(Dictionary<string, Transform> objs)
|
||||
@@ -289,17 +290,43 @@ namespace Gallop
|
||||
{
|
||||
Part = BindProperty.LocatorPart.ScaY,
|
||||
Type = BindProperty.BindType.EyeSelect,
|
||||
BindPrefab = mangaObjects
|
||||
BindPrefabs = mangaObjects
|
||||
});
|
||||
FaceMangaMorph.BindProperties.Add(new BindProperty()
|
||||
{
|
||||
Part = BindProperty.LocatorPart.ScaX,
|
||||
Type = BindProperty.BindType.Enable,
|
||||
BindPrefab = mangaObjects
|
||||
BindPrefabs = mangaObjects
|
||||
});
|
||||
OtherMorphs.Add(FaceMangaMorph);
|
||||
MangaMorph = FaceMangaMorph;
|
||||
|
||||
if(Container.StaticTear_L && Container.StaticTear_R)
|
||||
{
|
||||
FacialOtherMorph StaticTearMorph = new FacialOtherMorph()
|
||||
{
|
||||
name = "StaticTear_Ctrl",
|
||||
locator = DrivenKeyLocator.Find("Cheek_Ctrl")
|
||||
};
|
||||
|
||||
StaticTearMorph.BindProperties.Add(new BindProperty()
|
||||
{
|
||||
Part = BindProperty.LocatorPart.PosX,
|
||||
Type = BindProperty.BindType.Enable,
|
||||
BindPrefabs = new List<GameObject>() { Container.StaticTear_L }
|
||||
});
|
||||
|
||||
StaticTearMorph.BindProperties.Add(new BindProperty()
|
||||
{
|
||||
Part = BindProperty.LocatorPart.PosY,
|
||||
Type = BindProperty.BindType.Enable,
|
||||
BindPrefabs = new List<GameObject>() { Container.StaticTear_R }
|
||||
});
|
||||
|
||||
this.StaticTearMorph = StaticTearMorph;
|
||||
OtherMorphs.Add(StaticTearMorph);
|
||||
}
|
||||
|
||||
foreach (var tear in Container.TearControllers)
|
||||
{
|
||||
var index = Container.TearControllers.IndexOf(tear);
|
||||
@@ -499,18 +526,22 @@ namespace Gallop
|
||||
property.BindMaterial.SetFloat(property.PropertyName, property.Value);
|
||||
break;
|
||||
case BindProperty.BindType.Select:
|
||||
property.BindPrefab.ForEach(a => a.SetActive((int)property.Value == property.BindPrefab.IndexOf(a)));
|
||||
property.BindPrefabs.ForEach(a => a.SetActive((int)property.Value == property.BindPrefabs.IndexOf(a)));
|
||||
break;
|
||||
case BindProperty.BindType.EyeSelect:
|
||||
var count = property.BindPrefab.Count / 2;
|
||||
var count = property.BindPrefabs.Count / 2;
|
||||
var val = (int)property.Value;
|
||||
property.BindPrefab.ForEach(a =>
|
||||
a.SetActive(val + count < property.BindPrefab.Count && (val == property.BindPrefab.IndexOf(a) || val + count == property.BindPrefab.IndexOf(a))));
|
||||
property.BindPrefabs.ForEach(a =>
|
||||
a.SetActive(val + count < property.BindPrefabs.Count && (val == property.BindPrefabs.IndexOf(a) || val + count == property.BindPrefabs.IndexOf(a))));
|
||||
break;
|
||||
case BindProperty.BindType.Enable:
|
||||
if (property.Value <= 0)
|
||||
if(property.BindPrefabs.Count == 1)
|
||||
{
|
||||
property.BindPrefab.ForEach(a => a.SetActive(false));
|
||||
property.BindPrefabs.ForEach(a => a.SetActive(property.Value > 0));
|
||||
}
|
||||
else if(property.Value <= 0)
|
||||
{
|
||||
property.BindPrefabs.ForEach(a => a.SetActive(false));
|
||||
}
|
||||
break;
|
||||
case BindProperty.BindType.TearSide:
|
||||
@@ -942,7 +973,8 @@ namespace Gallop
|
||||
MangaMorph.BindProperties[1].Value = 1;
|
||||
}
|
||||
|
||||
//TODO Support Tear effect
|
||||
var tearytype = info.tearyType;
|
||||
StaticTearMorph.BindProperties.ForEach(p => p.Value = tearytype);
|
||||
|
||||
ChangeMorphEffect();
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Gallop
|
||||
public List<BindProperty> BindProperties = new List<BindProperty>();
|
||||
public float GetLocatorValue(BindProperty.LocatorPart part)
|
||||
{
|
||||
if (!locator) return 0;
|
||||
switch (part)
|
||||
{
|
||||
case BindProperty.LocatorPart.PosX: return locator.localPosition.x;
|
||||
@@ -76,7 +77,7 @@ namespace Gallop
|
||||
public Material BindMaterial;
|
||||
public Texture BindTexture;
|
||||
public TearController BindTearController;
|
||||
public List<GameObject> BindPrefab = new List<GameObject>();
|
||||
public List<GameObject> BindPrefabs = new List<GameObject>();
|
||||
public string PropertyName;
|
||||
public LocatorPart Part;
|
||||
public BindType Type;
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TearController
|
||||
private AssetHolder AssetHolder1;
|
||||
|
||||
bool intialized;
|
||||
public TearController(Transform headBone, GameObject tearPrefab_0, GameObject tearPrefab_1, int dir, int currentObject)
|
||||
public TearController(int id ,Transform headBone, GameObject tearPrefab_0, GameObject tearPrefab_1, int dir, int currentObject)
|
||||
{
|
||||
AttachBone_2_L = headBone.transform.Find("Eye_tear_attach_02_L");
|
||||
AttachBone_2_R = headBone.transform.Find("Eye_tear_attach_02_R");
|
||||
@@ -40,6 +40,10 @@ public class TearController
|
||||
AssetHolder0 = TearObject_0.GetComponent<AssetHolder>();
|
||||
TearMaterial_0 = TearObject_0.GetComponentInChildren<SkinnedMeshRenderer>().material;
|
||||
TearMaterial_0.SetFloat("_OffsetFactor", -1000);
|
||||
TearMaterial_0.SetFloat("_StencilMask", id);
|
||||
TearMaterial_0.SetFloat("_StencilComp", (float)UnityEngine.Rendering.CompareFunction.Equal);
|
||||
TearMaterial_0.SetFloat("_StencilOp", (float)UnityEngine.Rendering.StencilOp.Keep);
|
||||
TearMaterial_0.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
|
||||
Animator_0 = TearObject_0.GetComponent<Animator>();
|
||||
var clip = AssetHolder0._assetTable["default_animation"] as AnimationClip;
|
||||
var controller = new AnimatorOverrideController(Animator_0.runtimeAnimatorController);
|
||||
@@ -50,6 +54,10 @@ public class TearController
|
||||
AssetHolder1 = TearObject_1.GetComponent<AssetHolder>();
|
||||
TearMaterial_1 = TearObject_1.GetComponentInChildren<SkinnedMeshRenderer>().material;
|
||||
TearMaterial_1.SetFloat("_OffsetFactor", -1000);
|
||||
TearMaterial_1.SetFloat("_StencilMask", id);
|
||||
TearMaterial_1.SetFloat("_StencilComp", (float)UnityEngine.Rendering.CompareFunction.Equal);
|
||||
TearMaterial_1.SetFloat("_StencilOp", (float)UnityEngine.Rendering.StencilOp.Keep);
|
||||
TearMaterial_1.renderQueue = (int)UnityEngine.Rendering.RenderQueue.AlphaTest;
|
||||
Animator_1 = TearObject_1.GetComponent<Animator>();
|
||||
clip = AssetHolder1._assetTable["default_animation"] as AnimationClip;
|
||||
controller = new AnimatorOverrideController(Animator_1.runtimeAnimatorController);
|
||||
|
||||
Reference in New Issue
Block a user