Fix stack overflow when using recursion with nested scene animations
#519
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user