optimize performance
This commit is contained in:
@@ -154,7 +154,6 @@ namespace Gallop
|
||||
{
|
||||
morph._weight = 0;
|
||||
}
|
||||
ChangeMorph();
|
||||
}
|
||||
|
||||
private void ProcessMorph(FacialMorph morph)
|
||||
@@ -206,15 +205,7 @@ namespace Gallop
|
||||
morph.Weight = val;
|
||||
ChangeMorph();
|
||||
}
|
||||
|
||||
public void ChangeMorphWeights(Dictionary<FacialMorph, float> morphs)
|
||||
{
|
||||
foreach(var item in morphs)
|
||||
{
|
||||
item.Key.Weight = item.Value;
|
||||
}
|
||||
ChangeMorph();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,25 +71,20 @@ public class FaceEmotionKeyTarget : ScriptableObject
|
||||
{
|
||||
if (FaceDrivenKeyTarget == null) return;
|
||||
FaceDrivenKeyTarget.ClearMorph();
|
||||
Dictionary<FacialMorph, float> morphs = new Dictionary<FacialMorph, float>();
|
||||
|
||||
foreach (var emotion in FaceEmotionKey)
|
||||
{
|
||||
if (emotion.emotionKeys != null)
|
||||
{
|
||||
foreach (var key in emotion.emotionKeys)
|
||||
{
|
||||
if (morphs.ContainsKey(key.morph))
|
||||
{
|
||||
morphs[key.morph] = key.morph.Weight + key.weight / 100 * emotion.Weight;
|
||||
}
|
||||
else
|
||||
{
|
||||
morphs.Add(key.morph, key.morph.Weight + key.weight / 100 * emotion.Weight);
|
||||
}
|
||||
key.morph.Weight += key.weight / 100 * emotion.Weight;
|
||||
}
|
||||
}
|
||||
FaceDrivenKeyTarget.ChangeMorphWeights(morphs);
|
||||
|
||||
}
|
||||
|
||||
FaceDrivenKeyTarget.ChangeMorph();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user