ExposedPropertiesGraphWindow.cs 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEditor;
  5. using GraphProcessor;
  6. public class ExposedPropertiesGraphWindow : BaseGraphWindow
  7. {
  8. BaseGraph tmpGraph;
  9. [MenuItem("Window/04 Exposed Properties")]
  10. public static BaseGraphWindow OpenWithTmpGraph()
  11. {
  12. var graphWindow = CreateWindow< ExposedPropertiesGraphWindow >();
  13. // When the graph is opened from the window, we don't save the graph to disk
  14. graphWindow.tmpGraph = ScriptableObject.CreateInstance<BaseGraph>();
  15. graphWindow.tmpGraph.hideFlags = HideFlags.HideAndDontSave;
  16. graphWindow.InitializeGraph(graphWindow.tmpGraph);
  17. graphWindow.Show();
  18. return graphWindow;
  19. }
  20. protected override void OnDestroy()
  21. {
  22. graphView?.Dispose();
  23. DestroyImmediate(tmpGraph);
  24. }
  25. protected override void InitializeWindow(BaseGraph graph)
  26. {
  27. titleContent = new GUIContent("Properties Graph");
  28. if (graphView == null)
  29. graphView = new ExposedPropertiesGraphView(this);
  30. rootView.Add(graphView);
  31. }
  32. protected override void InitializeGraphView(BaseGraphView view)
  33. {
  34. view.OpenPinned< ExposedParameterView >();
  35. }
  36. }