Fix stack overflow when using recursion with nested scene animations

#519
This commit is contained in:
Wojtek Figat
2021-07-30 14:29:40 +02:00
parent 563eecebda
commit 25487c17e3
5 changed files with 42 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ namespace FlaxEditor.GUI.Timeline
private SceneAnimationPlayer _player;
private bool _showSelected3dTrack = true;
internal Guid _id;
/// <summary>
/// Gets or sets the animation player actor used for the timeline preview.

View File

@@ -2,6 +2,7 @@
using System;
using System.IO;
using System.Linq;
using FlaxEngine;
namespace FlaxEditor.GUI.Timeline.Tracks
@@ -122,5 +123,22 @@ namespace FlaxEditor.GUI.Timeline.Tracks
: base(ref options)
{
}
/// <inheritdoc />
protected override void OnAssetChanged()
{
if (Asset)
{
var refs = Asset.GetReferences();
var id = ((SceneAnimationTimeline)Timeline)._id;
if (Asset.ID == id || refs.Contains(id))
{
Asset = null;
throw new Exception("Cannot use nested scene animation (recursion).");
}
}
base.OnAssetChanged();
}
}
}