ExporterOutput.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using UnityEditor;
  6. using UnityEngine;
  7. using UnityEngine.SceneManagement;
  8. namespace Unity3D2Babylon
  9. {
  10. public class ExporterOutput : EditorWindow
  11. {
  12. Vector2 scrollPosLog;
  13. public void OnInitialize()
  14. {
  15. }
  16. void OnEnable()
  17. {
  18. titleContent = new GUIContent("Output");
  19. }
  20. public void OnGUI()
  21. {
  22. if (GUILayout.Button("Clear Output Window"))
  23. {
  24. ExporterWindow.logs.Clear();
  25. }
  26. EditorGUILayout.Space();
  27. scrollPosLog = EditorGUILayout.BeginScrollView(scrollPosLog, GUILayout.ExpandWidth(false), GUILayout.ExpandHeight(true));
  28. foreach (var log in ExporterWindow.logs)
  29. {
  30. var bold = log.StartsWith("*");
  31. GUILayout.Label(bold ? log.Remove(0, 1) : log, bold ? (EditorStyles.boldLabel) : EditorStyles.label);
  32. }
  33. EditorGUILayout.EndScrollView();
  34. }
  35. public void OnInspectorUpdate()
  36. {
  37. this.Repaint();
  38. }
  39. }
  40. }