EditorAnimationExporter

This commit is contained in:
ousttrue
2022-02-28 14:24:33 +09:00
parent 551a828083
commit e19ab9808a
19 changed files with 150 additions and 93 deletions

View File

@@ -0,0 +1,54 @@
namespace UniGLTF
{
class AnimationKeyframeData
{
#if UNITY_EDITOR
public float Time { get; set; }
public delegate float[] ConverterFunc(float[] values);
private ConverterFunc _converter;
private float[] _values;
public float[] Values
{
get { return _values; }
}
private bool[] _enterValues;
public bool[] EnterValues
{
get { return _enterValues; }
}
public AnimationKeyframeData(int elementCount, ConverterFunc converter)
{
_values = new float[elementCount];
_enterValues = new bool[elementCount];
for (int i = 0; i < _enterValues.Length; i++)
{
_enterValues[i] = false;
}
_converter = converter;
}
public void SetValue(float src, int offset)
{
if (_values.Length > offset)
{
_values[offset] = src;
_enterValues[offset] = true;
}
}
public virtual float[] GetRightHandCoordinate()
{
if (_converter != null)
{
return _converter(_values);
}
else
{
return _values;
}
}
#endif
}
}