bug fix
This commit is contained in:
@@ -67,13 +67,15 @@ namespace Gallop
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
bool changed = false;
|
||||
for (int i = 0; i < EyeBrowMorphs.Count; i++)
|
||||
{
|
||||
if(EyeBrowMorphs[i].LastWeight!= EyeBrowMorphs[i].Weight)
|
||||
{
|
||||
ChangeMorph();
|
||||
changed = true;
|
||||
EyeBrowMorphs[i].LastWeight = EyeBrowMorphs[i].Weight;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +83,7 @@ namespace Gallop
|
||||
{
|
||||
if (EyeMorphs[i].LastWeight != EyeMorphs[i].Weight)
|
||||
{
|
||||
ChangeMorph();
|
||||
changed = true;
|
||||
EyeMorphs[i].LastWeight = EyeMorphs[i].Weight;
|
||||
}
|
||||
}
|
||||
@@ -89,10 +91,12 @@ namespace Gallop
|
||||
{
|
||||
if (MouthMorphs[i].LastWeight != MouthMorphs[i].Weight)
|
||||
{
|
||||
ChangeMorph();
|
||||
changed = true;
|
||||
MouthMorphs[i].LastWeight = MouthMorphs[i].Weight;
|
||||
}
|
||||
}
|
||||
|
||||
if (changed)ChangeMorph();
|
||||
}
|
||||
|
||||
public void ChangeMorph()
|
||||
@@ -105,17 +109,13 @@ namespace Gallop
|
||||
var bone = Objs.Find(ani => ani.name.Equals(trs._path));
|
||||
if (bone)
|
||||
{
|
||||
if (trs.IsOverrideTarget==1)
|
||||
if (!trs.IsOverrideTarget)
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(Vector3.Lerp(OriRots[Objs.IndexOf(bone)].eulerAngles, trs._rotation, morph.Weight));
|
||||
bone.localPosition = Vector3.Lerp(OriTrans[Objs.IndexOf(bone)],trs._position,morph.Weight);
|
||||
bone.localScale = Vector3.Lerp(OriScal[Objs.IndexOf(bone)],trs._scale, morph.Weight);
|
||||
}
|
||||
else
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(bone.localRotation.eulerAngles+ (trs._rotation* morph.Weight));
|
||||
bone.localPosition += trs._position*morph.Weight;
|
||||
bone.localScale += trs._scale* morph.Weight;
|
||||
var tmp = bone.localRotation.eulerAngles;
|
||||
tmp += (trs._rotation * morph.Weight);
|
||||
bone.localRotation = Quaternion.Euler(bone.localRotation.eulerAngles + (trs._rotation * morph.Weight));
|
||||
bone.localPosition += trs._position * morph.Weight;
|
||||
bone.localScale += trs._scale * morph.Weight;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -128,13 +128,7 @@ namespace Gallop
|
||||
var bone = Objs.Find(ani => ani.name.Equals(trs._path));
|
||||
if (bone)
|
||||
{
|
||||
if (trs.IsOverrideTarget == 1)
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(Vector3.Lerp(OriRots[Objs.IndexOf(bone)].eulerAngles, trs._rotation, morph.Weight));
|
||||
bone.localPosition = Vector3.Lerp(OriTrans[Objs.IndexOf(bone)], trs._position, morph.Weight);
|
||||
bone.localScale = Vector3.Lerp(OriScal[Objs.IndexOf(bone)], trs._scale, morph.Weight);
|
||||
}
|
||||
else
|
||||
if (!trs.IsOverrideTarget)
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(bone.localRotation.eulerAngles + (trs._rotation * morph.Weight));
|
||||
bone.localPosition += trs._position * morph.Weight;
|
||||
@@ -151,13 +145,7 @@ namespace Gallop
|
||||
var bone = Objs.Find(ani => ani.name.Equals(trs._path));
|
||||
if (bone)
|
||||
{
|
||||
if (trs.IsOverrideTarget == 1)
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(Vector3.Lerp(OriRots[Objs.IndexOf(bone)].eulerAngles, trs._rotation, morph.Weight));
|
||||
bone.localPosition = Vector3.Lerp(OriTrans[Objs.IndexOf(bone)], trs._position, morph.Weight);
|
||||
bone.localScale = Vector3.Lerp(OriScal[Objs.IndexOf(bone)], trs._scale, morph.Weight);
|
||||
}
|
||||
else
|
||||
if (!trs.IsOverrideTarget)
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(bone.localRotation.eulerAngles + (trs._rotation * morph.Weight));
|
||||
bone.localPosition += trs._position * morph.Weight;
|
||||
@@ -166,6 +154,58 @@ namespace Gallop
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach (FacialMorph morph in EyeBrowMorphs)//´¦Àí¸²¸Ç±íÇé
|
||||
{
|
||||
foreach (TrsArray trs in morph.trsArray)
|
||||
{
|
||||
var bone = Objs.Find(ani => ani.name.Equals(trs._path));
|
||||
if (bone)
|
||||
{
|
||||
if (trs.IsOverrideTarget)
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(Vector3.Lerp(bone.localRotation.eulerAngles, trs._rotation, morph.Weight));
|
||||
bone.localPosition = Vector3.Lerp(bone.localPosition, trs._position, morph.Weight);
|
||||
bone.localScale = Vector3.Lerp(bone.localScale, trs._scale, morph.Weight);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
foreach (FacialMorph morph in EyeMorphs)
|
||||
{
|
||||
foreach (TrsArray trs in morph.trsArray)
|
||||
{
|
||||
var bone = Objs.Find(ani => ani.name.Equals(trs._path));
|
||||
if (bone)
|
||||
{
|
||||
if (trs.IsOverrideTarget)
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(Vector3.Lerp(bone.localRotation.eulerAngles, trs._rotation, morph.Weight));
|
||||
bone.localPosition = Vector3.Lerp(bone.localPosition, trs._position, morph.Weight);
|
||||
bone.localScale = Vector3.Lerp(bone.localScale, trs._scale, morph.Weight);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
foreach (FacialMorph morph in MouthMorphs)
|
||||
{
|
||||
foreach (TrsArray trs in morph.trsArray)
|
||||
{
|
||||
var bone = Objs.Find(ani => ani.name.Equals(trs._path));
|
||||
if (bone)
|
||||
{
|
||||
if (trs.IsOverrideTarget)
|
||||
{
|
||||
bone.localRotation = Quaternion.Euler(Vector3.Lerp(bone.localRotation.eulerAngles, trs._rotation, morph.Weight));
|
||||
bone.localPosition = Vector3.Lerp(bone.localPosition, trs._position, morph.Weight);
|
||||
bone.localScale = Vector3.Lerp(bone.localScale, trs._scale, morph.Weight);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void FacialReset()
|
||||
|
||||
@@ -34,11 +34,11 @@ public class StringValuePair
|
||||
public class TrsArray
|
||||
{
|
||||
public string _path;
|
||||
public int _isValidScaleTransform;
|
||||
public bool _isValidScaleTransform;
|
||||
public Vector3 _position;
|
||||
public Vector3 _scale;
|
||||
public Vector3 _rotation;
|
||||
public int IsOverrideTarget;
|
||||
public bool IsOverrideTarget;
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
// Copyright (c) 2014 Luminary LLC
|
||||
// Licensed under The MIT License (See LICENSE for full text)
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SetPropertyAttribute : PropertyAttribute
|
||||
{
|
||||
public string Name { get; private set; }
|
||||
public bool IsDirty { get; set; }
|
||||
|
||||
public SetPropertyAttribute(string name)
|
||||
{
|
||||
this.Name = name;
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d72052b442fcfe42b1433eeb25729bb
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user