/// <summary> 从GraphAsset打开Graph </summary> public static TimelineWindow Open(ITimelineGraphAsset graphAsset) { if (graphAsset == null) { return(null); } var window = GetGraphWindow(graphAsset.GraphType); window.Load(graphAsset); return(window); }
public static bool OnOpen(int instanceID, int line) { UnityObject go = EditorUtility.InstanceIDToObject(instanceID); if (go == null) { return(false); } ITimelineGraphAsset graphAsset = go as ITimelineGraphAsset; if (graphAsset == null) { return(false); } Open(graphAsset); return(true); }
private void Load(ITimelineGraphAsset graphAsset) { if (Graph != null) { if (Graph.Go != null) { GameObject.DestroyImmediate(Graph.Go); } } GraphAsset = graphAsset as UnityObject; Graph = graphAsset.DeserializeGraph(); CreateTimelineGo(); for (int i = 0; i < PartialViews.Count; i++) { PartialViews[i].Init(this, Graph); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); if (!ContextDataCache.TryGetContextData <GUIStyle>("BigLabel", out var bigLabel)) { bigLabel.value = new GUIStyle(GUI.skin.label); bigLabel.value.fontSize = 18; bigLabel.value.fontStyle = FontStyle.Bold; bigLabel.value.alignment = TextAnchor.MiddleLeft; bigLabel.value.stretchWidth = true; } ITimelineGraphAsset graphAsset = target as ITimelineGraphAsset; if (GUILayout.Button("Open", GUILayout.Height(30))) { TimelineWindow.Open(graphAsset); } }