//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using BansheeEngine;
namespace BansheeEditor
{
///
/// Editor window that displays the scene hierarchy tree view, displaying all scene objects in the current scene.
///
public class HierarchyWindow : EditorWindow, IGlobalShortcuts
{
private GUISceneTreeView treeView;
///
/// Opens the hierarchy window.
///
[MenuItem("Windows/Hierarchy", ButtonModifier.CtrlAlt, ButtonCode.H, 6000)]
private static void OpenHierarchyWindow()
{
OpenWindow();
}
///
protected override LocString GetDisplayName()
{
return new LocEdString("Hierarchy");
}
///
void IGlobalShortcuts.OnDeletePressed()
{
treeView.DeleteSelection();
}
///
void IGlobalShortcuts.OnRenamePressed()
{
treeView.RenameSelection();
}
///
void IGlobalShortcuts.OnDuplicatePressed()
{
treeView.DuplicateSelection();
}
///
void IGlobalShortcuts.OnCopyPressed()
{
treeView.CopySelection();
}
///
void IGlobalShortcuts.OnCutPressed()
{
treeView.CutSelection();
}
///
void IGlobalShortcuts.OnPastePressed()
{
treeView.PasteToSelection();
}
private void OnInitialize()
{
GUIScrollArea scrollArea = new GUIScrollArea();
GUI.AddElement(scrollArea);
treeView = new GUISceneTreeView(GUIOption.FlexibleHeight(20), GUIOption.FlexibleWidth(20));
scrollArea.Layout.AddElement(treeView);
}
private void OnEditorUpdate()
{
treeView.Update();
}
}
}