- [Core] Fix bug with assets parsing.
This commit is contained in:
@@ -26,12 +26,12 @@ namespace AssetStudio
|
||||
private readonly Dictionary<FloatCurve, List<Keyframe<Float>>> m_floats = new Dictionary<FloatCurve, List<Keyframe<Float>>>();
|
||||
private readonly Dictionary<PPtrCurve, List<PPtrKeyframe>> m_pptrs = new Dictionary<PPtrCurve, List<PPtrKeyframe>>();
|
||||
|
||||
public Vector3Curve[] Translations { get; private set; }
|
||||
public QuaternionCurve[] Rotations { get; private set; }
|
||||
public Vector3Curve[] Scales { get; private set; }
|
||||
public Vector3Curve[] Eulers { get; private set; }
|
||||
public FloatCurve[] Floats { get; private set; }
|
||||
public PPtrCurve[] PPtrs { get; private set; }
|
||||
public List<Vector3Curve> Translations { get; private set; }
|
||||
public List<QuaternionCurve> Rotations { get; private set; }
|
||||
public List<Vector3Curve> Scales { get; private set; }
|
||||
public List<Vector3Curve> Eulers { get; private set; }
|
||||
public List<FloatCurve> Floats { get; private set; }
|
||||
public List<PPtrCurve> PPtrs { get; private set; }
|
||||
|
||||
public AnimationClipConverter(AnimationClip clip)
|
||||
{
|
||||
@@ -81,17 +81,17 @@ namespace AssetStudio
|
||||
private void CreateCurves()
|
||||
{
|
||||
m_translations.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||
Translations = m_translations.Keys.ToArray();
|
||||
Translations = m_translations.Keys.ToList();
|
||||
m_rotations.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||
Rotations = m_rotations.Keys.ToArray();
|
||||
Rotations = m_rotations.Keys.ToList();
|
||||
m_scales.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||
Scales = m_scales.Keys.ToArray();
|
||||
Scales = m_scales.Keys.ToList();
|
||||
m_eulers.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||
Eulers = m_eulers.Keys.ToArray();
|
||||
Eulers = m_eulers.Keys.ToList();
|
||||
m_floats.AsEnumerable().ToList().ForEach(x => x.Key.curve.m_Curve.AddRange(x.Value));
|
||||
Floats = m_floats.Keys.ToArray();
|
||||
Floats = m_floats.Keys.ToList();
|
||||
m_pptrs.AsEnumerable().ToList().ForEach(x => x.Key.curve.AddRange(x.Value));
|
||||
PPtrs = m_pptrs.Keys.ToArray();
|
||||
PPtrs = m_pptrs.Keys.ToList();
|
||||
}
|
||||
|
||||
private void ProcessStreams(List<StreamedClip.StreamedFrame> streamFrames, AnimationClipBindingConstant bindings, Dictionary<uint, string> tos, float sampleRate)
|
||||
@@ -107,7 +107,7 @@ namespace AssetStudio
|
||||
for (var frameIndex = 1; frameIndex < streamFrames.Count - 1; frameIndex++)
|
||||
{
|
||||
var frame = streamFrames[frameIndex];
|
||||
for (var curveIndex = 0; curveIndex < frame.keyList.Length;)
|
||||
for (var curveIndex = 0; curveIndex < frame.keyList.Count;)
|
||||
{
|
||||
var curve = frame.keyList[curveIndex];
|
||||
var index = curve.index;
|
||||
@@ -496,7 +496,7 @@ namespace AssetStudio
|
||||
for (frameIndex = currentFrame - 1; frameIndex >= 0; frameIndex--)
|
||||
{
|
||||
var frame = streamFrames[frameIndex];
|
||||
for (curveIndex = 0; curveIndex < frame.keyList.Length; curveIndex++)
|
||||
for (curveIndex = 0; curveIndex < frame.keyList.Count; curveIndex++)
|
||||
{
|
||||
var curve = frame.keyList[curveIndex];
|
||||
if (curve.index == curveID)
|
||||
@@ -512,7 +512,7 @@ namespace AssetStudio
|
||||
{
|
||||
var curve = frame.keyList[currentCurve];
|
||||
int i = currentCurve + 1;
|
||||
for (; i < frame.keyList.Length; i++)
|
||||
for (; i < frame.keyList.Count; i++)
|
||||
{
|
||||
if (frame.keyList[i].index != curve.index)
|
||||
{
|
||||
|
||||
@@ -112,10 +112,10 @@ namespace AssetStudio
|
||||
}
|
||||
private static bool AddTOS(this AnimationClip clip, Dictionary<uint, string> src, Dictionary<uint, string> dest)
|
||||
{
|
||||
int tosCount = clip.m_ClipBindingConstant.genericBindings.Length;
|
||||
int tosCount = clip.m_ClipBindingConstant.genericBindings.Count;
|
||||
for (int i = 0; i < tosCount; i++)
|
||||
{
|
||||
ref GenericBinding binding = ref clip.m_ClipBindingConstant.genericBindings[i];
|
||||
var binding = clip.m_ClipBindingConstant.genericBindings[i];
|
||||
if (src.TryGetValue(binding.path, out string path))
|
||||
{
|
||||
dest[binding.path] = path;
|
||||
@@ -147,12 +147,12 @@ namespace AssetStudio
|
||||
if (!clip.m_Legacy || clip.m_MuscleClip != null)
|
||||
{
|
||||
var converter = AnimationClipConverter.Process(clip);
|
||||
clip.m_RotationCurves = converter.Rotations.Union(clip.m_RotationCurves).ToArray();
|
||||
clip.m_EulerCurves = converter.Eulers.Union(clip.m_EulerCurves).ToArray();
|
||||
clip.m_PositionCurves = converter.Translations.Union(clip.m_PositionCurves).ToArray();
|
||||
clip.m_ScaleCurves = converter.Scales.Union(clip.m_ScaleCurves).ToArray();
|
||||
clip.m_FloatCurves = converter.Floats.Union(clip.m_FloatCurves).ToArray();
|
||||
clip.m_PPtrCurves = converter.PPtrs.Union(clip.m_PPtrCurves).ToArray();
|
||||
clip.m_RotationCurves = converter.Rotations.Union(clip.m_RotationCurves).ToList();
|
||||
clip.m_EulerCurves = converter.Eulers.Union(clip.m_EulerCurves).ToList();
|
||||
clip.m_PositionCurves = converter.Translations.Union(clip.m_PositionCurves).ToList();
|
||||
clip.m_ScaleCurves = converter.Scales.Union(clip.m_ScaleCurves).ToList();
|
||||
clip.m_FloatCurves = converter.Floats.Union(clip.m_FloatCurves).ToList();
|
||||
clip.m_PPtrCurves = converter.PPtrs.Union(clip.m_PPtrCurves).ToList();
|
||||
}
|
||||
return ConvertSerializedAnimationClip(clip);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user