mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-11 04:54:17 -05:00
remove CustomerEqualityComparer
This commit is contained in:
parent
8fb64eb6cd
commit
c8228ed2f8
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
||||
namespace VRM
|
||||
{
|
||||
|
|
@ -58,29 +58,24 @@ namespace VRM
|
|||
|
||||
public bool Equals(BlendShapeKey other)
|
||||
{
|
||||
/*
|
||||
if (Preset != BlendShapePreset.Unknown && Preset == other.Preset)
|
||||
{
|
||||
// Unknown以外のPresetが一致したら一致とみなす
|
||||
return true;
|
||||
}
|
||||
// .ToUpper()済み
|
||||
return Name == other.Name;
|
||||
*/
|
||||
return ID == other.ID;
|
||||
}
|
||||
|
||||
public class CustomerEqualityComparer : IEqualityComparer<BlendShapeKey>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
public bool Equals(BlendShapeKey x, BlendShapeKey y)
|
||||
if (obj is BlendShapeKey)
|
||||
{
|
||||
return x.Equals(y);
|
||||
return Equals((BlendShapeKey)obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int GetHashCode(BlendShapeKey obj)
|
||||
{
|
||||
return obj.ToString().GetHashCode();
|
||||
}
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return ID.GetHashCode();
|
||||
}
|
||||
|
||||
public static BlendShapeKey CreateFrom(BlendShapeClip clip)
|
||||
|
|
|
|||
|
|
@ -65,8 +65,8 @@ namespace VRM
|
|||
|
||||
public BlendShapeMerger(IEnumerable<BlendShapeClip> clips, Transform root)
|
||||
{
|
||||
m_clipMap = clips.ToDictionary(x => BlendShapeKey.CreateFrom(x), x => x, new BlendShapeKey.CustomerEqualityComparer());
|
||||
m_valueMap = new Dictionary<BlendShapeKey, float>(new BlendShapeKey.CustomerEqualityComparer());
|
||||
m_clipMap = clips.ToDictionary(x => BlendShapeKey.CreateFrom(x), x => x);
|
||||
m_valueMap = new Dictionary<BlendShapeKey, float>();
|
||||
foreach (var kv in m_clipMap)
|
||||
{
|
||||
foreach (var binding in kv.Value.Values) {
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ public class VRMBlendShapeKeyTest
|
|||
Assert.AreEqual(key, new BlendShapeKey(BlendShapePreset.Blink));
|
||||
Assert.AreEqual(key, new BlendShapeKey("xxx", BlendShapePreset.Blink));
|
||||
|
||||
var dict = new Dictionary<BlendShapeKey, float>(new BlendShapeKey.CustomerEqualityComparer());
|
||||
var dict = new Dictionary<BlendShapeKey, float>();
|
||||
dict[new BlendShapeKey("xxx", BlendShapePreset.Blink)] = 1.0f;
|
||||
|
||||
Assert.IsTrue(dict.ContainsKey(new BlendShapeKey("blink")));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user