Skip to content

Commit 4a4a525

Browse files
committed
feat: frame all on playable graph changed
1 parent d15e74a commit 4a4a525

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Editor/Scripts/GraphView/PlayableGraphView.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using GBG.PlayableGraphMonitor.Editor.Node;
2+
using GBG.PlayableGraphMonitor.Editor.Utility;
23
using System.Collections.Generic;
4+
using UnityEditor;
35
using UnityEditor.Experimental.GraphView;
46
using UnityEngine;
57
using UnityEngine.Playables;
@@ -25,7 +27,10 @@ public PlayableGraphView()
2527

2628
public void Update(PlayableGraph playableGraph)
2729
{
30+
var needFrameAll = !GraphTool.IsEqual(ref _playableGraph, ref playableGraph);
31+
2832
_playableGraph = playableGraph;
33+
2934
if (!_playableGraph.IsValid())
3035
{
3136
ClearView();
@@ -34,6 +39,15 @@ public void Update(PlayableGraph playableGraph)
3439
PopulateView();
3540

3641
CalculateLayout();
42+
43+
if (needFrameAll)
44+
{
45+
// wait for view initialize at least 2 frames
46+
EditorApplication.delayCall += () =>
47+
{
48+
EditorApplication.delayCall += () => { FrameAll(); };
49+
};
50+
}
3751
}
3852

3953

0 commit comments

Comments
 (0)