mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-08-25 20:16:05 -05:00
Remove unused classes.
This commit is contained in:
@@ -1,150 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
public class DefaultExpressionAccumulator : IExpressionAccumulator
|
||||
{
|
||||
Dictionary<ExpressionKey, VRM10Expression> m_clipMap;
|
||||
|
||||
Dictionary<ExpressionKey, float> expressionKeyWeights = new Dictionary<ExpressionKey, float>();
|
||||
|
||||
public bool IgnoreBlink { get; private set; }
|
||||
public bool IgnoreLookAt { get; private set; }
|
||||
public bool IgnoreMouth { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// initilaize
|
||||
/// </summary>
|
||||
/// <param name="avatar"></param>
|
||||
public void OnStart(VRM10ExpressionAvatar avatar)
|
||||
{
|
||||
m_clipMap = avatar.Clips.ToDictionary(x => ExpressionKey.CreateFromClip(x), x => x);
|
||||
expressionKeyWeights = m_clipMap.Keys.ToDictionary(x => x, x => 0.0f);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// each frame
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<KeyValuePair<ExpressionKey, float>> FrameExpression()
|
||||
{
|
||||
IgnoreBlink = false;
|
||||
IgnoreLookAt = false;
|
||||
IgnoreMouth = false;
|
||||
|
||||
//
|
||||
// except blink, lookat, mouth
|
||||
//
|
||||
foreach (var kv in expressionKeyWeights)
|
||||
{
|
||||
if (kv.Key.IsProcedual)
|
||||
{
|
||||
// 後で
|
||||
continue;
|
||||
}
|
||||
|
||||
var expression = m_clipMap[kv.Key];
|
||||
|
||||
if (expression.OverrideBlink == VrmLib.ExpressionOverrideType.Block && kv.Value > 0)
|
||||
{
|
||||
IgnoreBlink = true;
|
||||
}
|
||||
if (expression.OverrideLookAt == VrmLib.ExpressionOverrideType.Block && kv.Value > 0)
|
||||
{
|
||||
IgnoreLookAt = true;
|
||||
}
|
||||
if (expression.OverrideMouth == VrmLib.ExpressionOverrideType.Block && kv.Value > 0)
|
||||
{
|
||||
IgnoreMouth = true;
|
||||
}
|
||||
|
||||
yield return kv;
|
||||
}
|
||||
|
||||
//
|
||||
// blink, lookat, mouth
|
||||
//
|
||||
foreach (var kv in expressionKeyWeights)
|
||||
{
|
||||
if (kv.Key.IsBlink)
|
||||
{
|
||||
if (IgnoreBlink)
|
||||
{
|
||||
// skip
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (kv.Key.IsLookAt)
|
||||
{
|
||||
if (IgnoreLookAt)
|
||||
{
|
||||
// skip
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (kv.Key.IsMouth)
|
||||
{
|
||||
if (IgnoreMouth)
|
||||
{
|
||||
// skip
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// already return
|
||||
continue;
|
||||
}
|
||||
|
||||
yield return kv;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a expression value
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public float GetValue(ExpressionKey key)
|
||||
{
|
||||
if (expressionKeyWeights.ContainsKey(key))
|
||||
{
|
||||
return expressionKeyWeights[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<KeyValuePair<ExpressionKey, float>> GetValues()
|
||||
{
|
||||
return expressionKeyWeights.Select(x => new KeyValuePair<ExpressionKey, float>(x.Key, x.Value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// SetValue
|
||||
/// </summary>
|
||||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
public void SetValue(ExpressionKey key, float value)
|
||||
{
|
||||
if (expressionKeyWeights.ContainsKey(key))
|
||||
{
|
||||
expressionKeyWeights[key] = value;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetValues(IEnumerable<KeyValuePair<ExpressionKey, float>> values)
|
||||
{
|
||||
foreach (var keyValue in values)
|
||||
{
|
||||
if (expressionKeyWeights.ContainsKey(keyValue.Key))
|
||||
{
|
||||
expressionKeyWeights[keyValue.Key] = keyValue.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcb5bbef7ed54854d8041988a84fa827
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,58 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace UniVRM10
|
||||
{
|
||||
/// <summary>
|
||||
/// 1フレーム分の Expression を蓄える
|
||||
/// </summary>
|
||||
public interface IExpressionAccumulator
|
||||
{
|
||||
/// <summary>
|
||||
/// 開始時に初期化する
|
||||
/// </summary>
|
||||
/// <param name="avatar"></param>
|
||||
void OnStart(VRM10ExpressionAvatar avatar);
|
||||
|
||||
/// <summary>
|
||||
/// 蓄えて処理(ignoreフラグなど)した結果を得る
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
IEnumerable<KeyValuePair<ExpressionKey, float>> FrameExpression();
|
||||
|
||||
void SetValue(ExpressionKey key, float value);
|
||||
void SetValues(IEnumerable<KeyValuePair<ExpressionKey, float>> values);
|
||||
float GetValue(ExpressionKey key);
|
||||
IEnumerable<KeyValuePair<ExpressionKey, float>> GetValues();
|
||||
|
||||
bool IgnoreBlink { get; }
|
||||
bool IgnoreLookAt { get; }
|
||||
bool IgnoreMouth { get; }
|
||||
}
|
||||
|
||||
public static class ExpressionAccumulatorExtensions
|
||||
{
|
||||
public static float GetPresetValue(this IExpressionAccumulator self, VrmLib.ExpressionPreset key)
|
||||
{
|
||||
var expressionKey = new ExpressionKey(key);
|
||||
return self.GetValue(expressionKey);
|
||||
}
|
||||
|
||||
public static float GetCustomValue(this IExpressionAccumulator self, string key)
|
||||
{
|
||||
var expressionKey = ExpressionKey.CreateCustom(key);
|
||||
return self.GetValue(expressionKey);
|
||||
}
|
||||
|
||||
public static void SetPresetValue(this IExpressionAccumulator self, VrmLib.ExpressionPreset key, float value)
|
||||
{
|
||||
var expressionKey = new ExpressionKey(key);
|
||||
self.SetValue(expressionKey, value);
|
||||
}
|
||||
|
||||
public static void SetCustomValue(this IExpressionAccumulator self, string key, float value)
|
||||
{
|
||||
var expressionKey = ExpressionKey.CreateCustom(key);
|
||||
self.SetValue(expressionKey, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fdd7cdf6d59574348bb7336272ef5edf
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user