HierarchyWindow.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using BansheeEngine;
  2. namespace BansheeEditor
  3. {
  4. /// <summary>
  5. /// Editor window that displays the scene hierarchy tree view, displaying all scene objects in the current scene.
  6. /// </summary>
  7. public class HierarchyWindow : EditorWindow
  8. {
  9. private GUISceneTreeView treeView;
  10. /// <summary>
  11. /// Opens the hierarchy window.
  12. /// </summary>
  13. [MenuItem("Windows/Hierarchy", ButtonModifier.CtrlAlt, ButtonCode.H, 6000)]
  14. private static void OpenHierarchyWindow()
  15. {
  16. OpenWindow<HierarchyWindow>();
  17. }
  18. /// <inheritdoc/>
  19. protected override LocString GetDisplayName()
  20. {
  21. return new LocEdString("Hierarchy");
  22. }
  23. /// <summary>
  24. /// Cuts the currently selected scene object.
  25. /// </summary>
  26. public void CutSelection()
  27. {
  28. treeView.CutSelection();
  29. }
  30. /// <summary>
  31. /// Copies the currently selected scene object.
  32. /// </summary>
  33. public void CopySelection()
  34. {
  35. treeView.CopySelection();
  36. }
  37. /// <summary>
  38. /// Pastes the scene object(s) that were previously cut or copied.
  39. /// </summary>
  40. public void PasteToSelection()
  41. {
  42. treeView.PasteToSelection();
  43. }
  44. /// <summary>
  45. /// Deletes currently selected scene objects.
  46. /// </summary>
  47. public void DeleteSelection()
  48. {
  49. treeView.DeleteSelection();
  50. }
  51. /// <summary>
  52. /// Duplicates currently selected scene objects.
  53. /// </summary>
  54. public void DuplicateSelection()
  55. {
  56. treeView.DuplicateSelection();
  57. }
  58. private void OnInitialize()
  59. {
  60. GUIScrollArea scrollArea = new GUIScrollArea();
  61. GUI.AddElement(scrollArea);
  62. treeView = new GUISceneTreeView();
  63. scrollArea.Layout.AddElement(treeView);
  64. }
  65. private void OnEditorUpdate()
  66. {
  67. treeView.Update();
  68. }
  69. }
  70. }