public void OnGUI()
        {
            Scene curSelected = null;
            var   _selected   = Selector.GetSelected();

            if (_selected?.Count > 0)
            {
                curSelected = _selected[0] as Scene;
            }

            int count = SceneNative.SceneCount();

            if (ImGui.BeginPopupContextWindow("SceneMenu", ImGuiMouseButton.Right))
            {
                OnGUI_RightMenu(null);
                ImGui.EndPopup();
            }

            //if (ImGui.TreeNodeEx("Scenes##Hierachy", flagsBase))
            {
                bool selected = false;
                for (int i = 0; i < count; ++i)
                {
                    SceneNative.SceneHandle handle = SceneNative.SceneFindByIndex(i);
                    string name  = SceneNative.SceneGetName(handle);
                    string label = string.Format("{0}##_Scene_{1}", name, i);
                    SceneNative.ActiveOption active = SceneNative.SceneGetActive(handle);

                    Scene.Open(handle);

                    int childCount = Scene.current.root.children.Count;

                    ImGuiTreeNodeFlags flags = flagsBase
                                               | (childCount == 0 ? ImGuiTreeNodeFlags.Leaf : ImGuiTreeNodeFlags.None);
                    flags |= curSelected == Scene.current ? ImGuiTreeNodeFlags.Selected : ImGuiTreeNodeFlags.None;

                    if (renameing && curSelected == Scene.current)
                    {
                        label = string.Format("###_{0}", label);
                    }
                    if (ImGui.CollapsingHeader(label, flags))
                    {
                        if (renameing && curSelected == Scene.current)
                        {
                            neo_name = name;
                            ImGuiInputTextFlags inputFlags = ImGuiInputTextFlags.EnterReturnsTrue
                                                             | ImGuiInputTextFlags.AutoSelectAll;
                            if (!ImGui.IsAnyItemActive() && !ImGui.IsMouseClicked(0))
                            {
                                ImGui.SetKeyboardFocusHere(0);
                            }

                            ImGui.SameLine(ImGui.GetCursorPosX());
                            Vector2 padding = ImGui.GetStyle().FramePadding;
                            padding.Y = 0;
                            ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, padding);
                            if (ImGui.InputText(string.Format("##Scene_{0}_{1}", name, i), ref neo_name, 64, inputFlags))
                            {
                                SceneNative.SceneSetName(handle, neo_name);
                                renameing = false;
                            }

                            ImGui.PopStyleVar();
                        }

                        OnGUI_SceneMenu(Scene.current, label, active == SceneNative.ActiveOption.Active);

                        bool dragdroped = DragDropManager.DragDropTarget(handle.idx,
                                                                         DragDropWindow.Hierarchy, DragDropTree.Scenes,
                                                                         "_DDTreeWindow", ImGuiDragDropFlags.None,
                                                                         DragDropManager.OnDragDropAction);

                        bool breakif = !OnGUI_TransformTree(Scene.current.root, i, ref selected);

                        //ImGui.TreePop();

                        if (dragdroped || breakif)
                        {
                            break;
                        }
                    }
                    else
                    {
                        OnGUI_SceneMenu(Scene.current, label, active == SceneNative.ActiveOption.Active);
                    }

                    if (!selected)
                    {
                        bool clicked = ImGui.IsItemClicked();
                        //bool focused = childCount == 0 ? ImGui.IsItemFocused() : ImGui.IsItemHovered();
                        if (clicked)
                        {
                            Selector.Select(Scene.current);
                            selected = true;
                        }
                    }

                    if (Scene.current != null)
                    {
                        // F2
                        if (ImGui.GetIO().KeysDown[113])
                        {
                            neo_name  = SceneNative.SceneGetName(Scene.current.handle);
                            renameing = true;
                        }
                    }
                }

                //ImGui.TreePop();
            }
        }
        bool OnGUI_TransformTree(SceneNode scene, int idx, ref bool selected)
        {
            int count = scene.children.Count;

            SceneNode curSelected = null;
            var       _selected   = Selector.GetSelected();

            if (_selected?.Count > 0)
            {
                curSelected = _selected[0] as SceneNode;
            }

            for (var i = 0; i < count; i++)
            {
                SceneNode node  = scene.children[i];
                string    label = string.Format("{0}##_Transform_{1}_{2}", node.name, idx, i);

                int childCount = node.children.Count;

                ImGuiTreeNodeFlags flags = flagsBase
                                           | (childCount == 0 ? ImGuiTreeNodeFlags.Leaf : ImGuiTreeNodeFlags.None);
                flags |= curSelected == node ? ImGuiTreeNodeFlags.Selected : ImGuiTreeNodeFlags.None;

                if (renameing && curSelected == node)
                {
                    label = string.Format("###_{0}", label);
                }
                if (ImGui.TreeNodeEx(label, flags))
                {
                    if (renameing && curSelected == node)
                    {
                        neo_name = node.name;
                        ImGuiInputTextFlags inputFlags = ImGuiInputTextFlags.EnterReturnsTrue
                                                         | ImGuiInputTextFlags.AutoSelectAll;
                        if (!ImGui.IsAnyItemActive() && !ImGui.IsMouseClicked(0))
                        {
                            ImGui.SetKeyboardFocusHere(0);
                        }

                        ImGui.SameLine(ImGui.GetCursorPosX());
                        Vector2 padding = ImGui.GetStyle().FramePadding;
                        padding.Y = 0;
                        ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, padding);

                        if (ImGui.InputText(
                                string.Format("##Transform_{0}_{1}", node.name, i),
                                ref neo_name, 64, inputFlags))
                        {
                            TransformNative.TransformSetName(curSelected.handle, neo_name);
                            renameing = false;
                        }

                        ImGui.PopStyleVar();
                    }
                    if (DragDropManager.DragDrop(node.name, node.handle.idx,
                                                 DragDropWindow.Hierarchy, DragDropTree.Transforms,
                                                 "_DDTreeWindow", ImGuiDragDropFlags.None,
                                                 DragDropManager.OnDragDropAction))
                    {
                        ImGui.TreePop();
                        return(false);
                    }

                    OnGUI_TransfromMenu(node, label);
                    OnGUI_TransformTree(node, i, ref selected);
                    ImGui.TreePop();
                }
                else
                {
                    OnGUI_TransfromMenu(node, label);
                }

                if (!selected)
                {
                    bool clicked = ImGui.IsItemClicked();
                    //bool focused = childCount == 0 ? ImGui.IsItemFocused() : ImGui.IsItemHovered();
                    if (clicked)
                    {
                        curSelected = node;
                        selected    = true;
                        Selector.Select(node);
                    }
                }
            }


            if (curSelected != null)
            {
                // F2
                if (ImGui.GetIO().KeysDown[113])
                {
                    neo_name  = TransformNative.TransformGetName(curSelected.handle);
                    renameing = true;
                }
            }

            return(true);
        }