void SearchDialog()
 {
     if (doOpenSearch)
     {
         ImGui.OpenPopup(ImGuiExt.IDWithExtra("Search", Unique));
         doOpenSearch      = false;
         searchDlgOpen     = true;
         searchResultsOpen = false;
     }
     if (searchResultsOpen)
     {
         SearchResults();
     }
     if (ImGui.BeginPopupModal(ImGuiExt.IDWithExtra("Search", Unique), ref searchDlgOpen, ImGuiWindowFlags.AlwaysAutoResize))
     {
         if (dialogState == 0)
         {
             SearchWindow();
         }
         else if (dialogState == 1)
         {
             SearchStatus();
         }
         else
         {
             searchResultsOpen = true;
             ImGui.CloseCurrentPopup();
         }
         ImGui.EndPopup();
     }
 }
Ejemplo n.º 2
0
        void AnimationPanel()
        {
            var anm = ((CmpFile)drawable).Animation;
            int j   = 0;

            foreach (var sc in anm.Scripts)
            {
                var popup = $"{sc.Key}$Popup{j}";
                if (ImGui.Button(ImGuiExt.IDWithExtra(sc.Key, j++)))
                {
                    animator.StartAnimation(sc.Key, false);
                }
                if (ImGui.IsItemClicked(1))
                {
                    ImGui.OpenPopup(popup);
                }
                if (ImGui.BeginPopupContextItem(popup))
                {
                    if (ImGui.MenuItem("Copy Nickname"))
                    {
                        _window.SetClipboardText(sc.Key);
                    }
                    ImGui.EndPopup();
                }
            }
            ImGui.Separator();
            if (ImGui.Button("Reset"))
            {
                animator.ResetAnimations();
            }
        }
Ejemplo n.º 3
0
        void DoNode(LUtfNode node, LUtfNode parent, int idx)
        {
            string id = ImGuiExt.IDWithExtra(node.Name, parent.Name + idx);

            if (node.Children != null)
            {
                var flags  = selectedNode == node ? ImGuiTreeNodeFlags.Selected | tflags : tflags;
                var isOpen = ImGui.TreeNodeEx(id, flags);
                if (ImGui.IsItemClicked(0))
                {
                    selectedNode = node;
                }
                if (node.ResolvedName != null)
                {
                    ImGui.SameLine();
                    ImGui.TextDisabled("(" + ImGuiExt.IDSafe(node.ResolvedName) + ")");
                }
                ImGui.PushID(id);
                DoNodeMenu(id, node, parent);
                ImGui.PopID();
                //int i = 0;
                if (isOpen)
                {
                    for (int i = 0; i < node.Children.Count; i++)
                    {
                        DoNode(node.Children[i], node, (idx * 1024) + i);
                    }
                    ImGui.TreePop();
                }
            }
            else
            {
                if (node.Data != null)
                {
                    ImGui.Bullet();
                }
                else
                {
                    ImGui.Text($"  {Icons.BulletEmpty}");
                    ImGui.SameLine();
                }
                bool selected = selectedNode == node;
                if (ImGui.Selectable(id, ref selected))
                {
                    selectedNode = node;
                }
                if (node.ResolvedName != null)
                {
                    ImGui.SameLine();
                    ImGui.TextDisabled("(" + ImGuiExt.IDSafe(node.ResolvedName) + ")");
                }
                DoNodeMenu(id, node, parent);
            }
        }
Ejemplo n.º 4
0
        public override void Draw()
        {
            ImGui.BeginTabBar("##tabs");
            int idx = typeIndex;

            ImGui.Combo("Type", ref typeIndex, typeNames, typeNames.Length);
            if (idx != typeIndex)
            {
                RecreateCurve();
            }
            if (ImGui.BeginTabItem("Points"))
            {
                ImGui.InputFloat4("Point", ref p);
                if (ImGui.Button("Add"))
                {
                    points.Add(p);
                    p = Vector4.Zero;
                    RecreateCurve();
                }

                ImGui.SameLine();
                if (ImGui.Button("Clear"))
                {
                    points.Clear();
                    RecreateCurve();
                }
                var height = ImGui.GetWindowHeight() - 110;
                ImGui.BeginChild("##points", new Vector2(-1, height), true);
                int ik = 0;
                foreach (var p in points)
                {
                    ImGui.Selectable(ImGuiExt.IDWithExtra(p.ToString(), ik++));
                }
                ImGui.EndChild();


                ImGui.EndTabItem();
            }

            if (ImGui.BeginTabItem("Graph"))
            {
                var gWidth  = ImGui.GetWindowContentRegionWidth() - 40;
                var gHeight = ImGui.GetWindowHeight() - 60;
                ImGui.PlotLines("##graph", ref values[0], values.Length, 0, "", scaleMin, scaleMax, new Vector2(gWidth, gHeight));
                ImGui.EndTabItem();
            }
            ImGui.EndTabBar();
        }
 void SearchResults()
 {
     ImGui.Begin(ImGuiExt.IDWithExtra("Search", Unique), ref searchResultsOpen, ImGuiWindowFlags.AlwaysAutoResize);
     ImGui.Text(resultTitle);
     ImGui.BeginChild("##results", new Vector2(200, 200), true);
     for (int i = 0; i < searchResults.Length; i++)
     {
         if (ImGui.Selectable(searchResults[i].ToString()))
         {
             id = searchResults[i];
             if (isSearchInfocards)
             {
                 GotoInfocard();
             }
             else
             {
                 GotoString();
             }
             ImGui.CloseCurrentPopup();
         }
         if (ImGui.IsItemHovered())
         {
             if (isSearchInfocards)
             {
                 if (searchStringPreviews[i] == null)
                 {
                     try
                     {
                         searchStringPreviews[i] =
                             EllipseIfNeeded(RDLParse.Parse(searchStrings[i], fonts).ExtractText());
                     }
                     catch (Exception)
                     {
                         searchStringPreviews[i] = EllipseIfNeeded(searchStrings[i]);
                     }
                 }
                 ImGui.SetTooltip(searchStringPreviews[i]);
             }
             else
             {
                 ImGui.SetTooltip(EllipseIfNeeded(searchStrings[i]));
             }
         }
     }
     ImGui.EndChild();
     ImGui.End();
 }
Ejemplo n.º 6
0
        void DoNode(NodeReference reference, int idx, Vector4 enabled, Vector4 disabled)
        {
            var    col   = instance.NodeEnabled(reference) ? enabled : disabled;
            string label = null;

            if (reference.IsAttachmentNode)
            {
                label = string.Format("Attachment##{0}", idx);
            }
            else
            {
                label = ImGuiExt.IDWithExtra(reference.Node.NodeName, idx);
            }
            ImGui.PushStyleColor(ImGuiCol.Text, col);
            string icon;
            Color4 color;

            NodeIcon(reference.Node, out icon, out color);
            if (reference.Children.Count > 0)
            {
                if (ImGui.TreeNodeEx(ImGuiExt.Pad(label), ImGuiTreeNodeFlags.OpenOnDoubleClick | ImGuiTreeNodeFlags.OpenOnArrow))
                {
                    Theme.RenderTreeIcon(label.Split('#')[0], icon, color);
                    int j = 0;
                    foreach (var child in reference.Children)
                    {
                        DoNode(child, j++, enabled, disabled);
                    }
                    ImGui.TreePop();
                }
                else
                {
                    Theme.RenderTreeIcon(label.Split('#')[0], icon, color);
                }
            }
            else
            {
                Theme.Icon(icon, color);
                ImGui.SameLine();

                if (ImGui.Selectable(label, selectedReference == reference))
                {
                    selectedReference = reference;
                }
            }
            ImGui.PopStyleColor();
        }
Ejemplo n.º 7
0
        void AnimationPanel()
        {
            var anm = ((CmpFile)drawable).Animation;
            int j   = 0;

            foreach (var sc in anm.Scripts)
            {
                if (ImGui.Button(ImGuiExt.IDWithExtra(sc.Key, j++)))
                {
                    animator.StartAnimation(sc.Key, false);
                }
            }
            ImGui.Separator();
            if (ImGui.Button("Reset"))
            {
                animator.ResetAnimations();
            }
        }
Ejemplo n.º 8
0
        void DoNode(LUtfNode node, LUtfNode parent, int idx)
        {
            string id = ImGuiExt.IDWithExtra(node.Name, parent.Name + idx);

            if (node.Children != null)
            {
                var flags  = selectedNode == node ? ImGuiTreeNodeFlags.Selected | tflags : tflags;
                var isOpen = ImGui.TreeNodeEx(id, flags);
                if (ImGui.IsItemClicked(0))
                {
                    selectedNode = node;
                }
                ImGui.PushID(id);
                DoNodeMenu(id, node, parent);
                ImGui.PopID();
                //int i = 0;
                if (isOpen)
                {
                    for (int i = 0; i < node.Children.Count; i++)
                    {
                        DoNode(node.Children[i], node, (idx * 1024) + i);
                    }
                    ImGui.TreePop();
                }
            }
            else
            {
                if (node.Data != null)
                {
                    ImGui.Bullet();
                }
                else
                {
                    Theme.Icon("node_empty", Color4.White);
                    ImGui.SameLine();
                }
                bool selected = selectedNode == node;
                if (ImGui.Selectable(id, ref selected))
                {
                    selectedNode = node;
                }
                DoNodeMenu(id, node, parent);
            }
        }
Ejemplo n.º 9
0
        void DoNode(NodeReference reference, int idx, Vector4 enabled, Vector4 disabled)
        {
            var    col   = instance.NodeEnabled(reference) ? enabled : disabled;
            string label = null;

            if (reference.IsAttachmentNode)
            {
                label = string.Format("Attachment##{0}", idx);
            }
            else
            {
                label = ImGuiExt.IDWithExtra(reference.Node.NodeName, idx);
            }
            ImGui.PushStyleColor(ImGuiCol.Text, col);
            char icon;

            NodeIcon(reference.Node, out icon);
            if (reference.Children.Count > 0)
            {
                if (Theme.IconTreeNode(icon, label, ImGuiTreeNodeFlags.OpenOnDoubleClick | ImGuiTreeNodeFlags.OpenOnArrow))
                {
                    int j = 0;
                    foreach (var child in reference.Children)
                    {
                        DoNode(child, j++, enabled, disabled);
                    }
                    ImGui.TreePop();
                }
            }
            else
            {
                if (ImGui.Selectable($"{icon}  {label}", selectedReference == reference))
                {
                    selectedReference = reference;
                }
            }
            ImGui.PopStyleColor();
        }
        void InfocardXmlDialog()
        {
            if (doOpenXml)
            {
                ImGui.OpenPopup(ImGuiExt.IDWithExtra("Xml", Unique));
                doOpenXml  = false;
                xmlDlgOpen = true;
            }

            if (ImGui.BeginPopupModal(ImGuiExt.IDWithExtra("Xml", Unique), ref xmlDlgOpen,
                                      ImGuiWindowFlags.AlwaysAutoResize))
            {
                if (ImGui.Button("Copy To Clipboard"))
                {
                    win.SetClipboardText(currentXml);
                }

                ImGui.PushFont(ImGuiHelper.SystemMonospace);
                ImGui.InputTextMultiline("##xml", ref currentXml, UInt32.MaxValue, new Vector2(400),
                                         ImGuiInputTextFlags.ReadOnly);
                ImGui.PopFont();
                ImGui.EndPopup();
            }
        }
        public bool Draw()
        {
            ImGui.SetNextWindowSize(new Vector2(420, 420), ImGuiCond.FirstUseEver);
            if (ImGui.Begin(ImGuiExt.IDWithExtra($"{name}: {scriptName}", unique), ref open))
            {
                if (string.IsNullOrEmpty(map.ChildName))
                {
                    ImGui.Text($"Target: {map.ParentName}");
                }
                else
                {
                    ImGui.Text($"Parent Name: {map.ParentName}");
                    ImGui.Text($"Child Name: {map.ChildName}");
                }
                ImGui.Text($"Interval: {map.Channel.Interval}");
                ImGui.Text($"Frame Count: {map.Channel.FrameCount}");
                ImGui.Text($"Type: {map.Channel.InterpretedType} (0x{map.Channel.ChannelType.ToString("x")})");
                if (map.Channel.InterpretedType == FrameType.Quaternion ||
                    map.Channel.InterpretedType == FrameType.VecWithQuat)
                {
                    ImGui.Text($"Quaternion Storage: {map.Channel.QuaternionMethod}");
                }
                ImGui.Separator();
                ImGui.BeginChild("##values");
                ImGui.Columns(2);
                float iT = 0;
                for (int i = 0; i < map.Channel.FrameCount; i++)
                {
                    float t = 0;
                    if (map.Channel.Interval > 0)
                    {
                        t   = iT;
                        iT += map.Channel.Interval;
                    }
                    else
                    {
                        t = map.Channel.Times[i];
                    }
                    ImGui.Text(t.ToString());
                    ImGui.NextColumn();
                    switch (map.Channel.InterpretedType)
                    {
                    case FrameType.Float:
                        ImGui.Text(map.Channel.Angles[i].ToString());
                        break;

                    case FrameType.Vector3:
                        ImGui.Text(map.Channel.Positions[i].ToString());
                        break;

                    case FrameType.Quaternion:
                        ImGui.Text(map.Channel.Quaternions[i].ToString());
                        break;

                    case FrameType.VecWithQuat:
                        ImGui.Text($"{map.Channel.Positions[i]} {map.Channel.Quaternions[i]}");
                        break;
                    }
                    ImGui.NextColumn();
                }
                ImGui.EndChild();
                ImGui.End();
            }
            else
            {
                return(false);
            }
            return(open);
        }
Ejemplo n.º 12
0
        protected override void Draw(double elapsed)
        {
            //Don't process all the imgui stuff when it isn't needed
            if (!loadingSpinnerActive && !guiHelper.DoRender(elapsed))
            {
                if (lastFrame != null)
                {
                    lastFrame.BlitToScreen();
                }
                WaitForEvent(); //Yield like a regular GUI program
                return;
            }
            TimeStep = elapsed;
            RenderContext.ReplaceViewport(0, 0, Width, Height);
            RenderContext.ClearColor = new Color4(0.2f, 0.2f, 0.2f, 1f);
            RenderContext.ClearAll();
            guiHelper.NewFrame(elapsed);
            ImGui.PushFont(ImGuiHelper.Noto);
            ImGui.BeginMainMenuBar();
            if (ImGui.BeginMenu("File"))
            {
                var lst = ImGui.GetWindowDrawList();
                if (Theme.IconMenuItem(Icons.File, "New", true))
                {
                    var t = new UtfTab(this, new EditableUtf(), "Untitled");
                    ActiveTab = t;
                    AddTab(t);
                }
                if (Theme.IconMenuItem(Icons.Open, "Open", true))
                {
                    var f = FileDialog.Open(UtfFilters);
                    OpenFile(f);
                }

                recentFiles.Menu();
                if (ActiveTab == null)
                {
                    Theme.IconMenuItem(Icons.Save, "Save", false);
                    Theme.IconMenuItem(Icons.Save, "Save As", false);
                }
                else
                {
                    if (Theme.IconMenuItem(Icons.Save, string.Format("Save '{0}'", ActiveTab.DocumentName), true))
                    {
                        Save();
                    }
                    if (Theme.IconMenuItem(Icons.Save, "Save As", true))
                    {
                        SaveAs();
                    }
                }
                if (Theme.IconMenuItem(Icons.Quit, "Quit", true))
                {
                    Exit();
                }
                ImGui.EndMenu();
            }
            if (ImGui.BeginMenu("View"))
            {
                Theme.IconMenuToggle(Icons.Log, "Log", ref showLog, true);
                ImGui.EndMenu();
            }
            if (ImGui.BeginMenu("Tools"))
            {
                if (Theme.IconMenuItem(Icons.Cog, "Options", true))
                {
                    options.Show();
                }

                if (Theme.IconMenuItem(Icons.Palette, "Resources", true))
                {
                    AddTab(new ResourcesTab(this, Resources, MissingResources, ReferencedMaterials, ReferencedTextures));
                }
                if (Theme.IconMenuItem(Icons.FileImport, "Import Model", true))
                {
                    string input;
                    if ((input = FileDialog.Open(ImportModelFilters)) != null)
                    {
                        StartLoadingSpinner();
                        new Thread(() =>
                        {
                            SimpleMesh.Model model = null;
                            try
                            {
                                using var stream = File.OpenRead(input);
                                model            = SimpleMesh.Model.FromStream(stream).AutoselectRoot(out _).ApplyRootTransforms(false).CalculateBounds();
                                foreach (var x in model.Geometries)
                                {
                                    if (x.Vertices.Length >= 65534)
                                    {
                                        throw new Exception("Too many vertices");
                                    }
                                    if (x.Indices.Length >= 65534)
                                    {
                                        throw new Exception("Too many indices");
                                    }
                                }
                                EnsureUIThread(() => FinishImporterLoad(model, System.IO.Path.GetFileName(input)));
                            }
                            catch (Exception ex)
                            {
                                EnsureUIThread(() => ImporterError(ex));
                            }
                        }).Start();
                    }
                }
                if (Theme.IconMenuItem(Icons.SprayCan, "Generate Icon", true))
                {
                    string input;
                    if ((input = FileDialog.Open(ImageFilter)) != null)
                    {
                        Make3dbDlg.Open(input);
                    }
                }
                if (Theme.IconMenuItem(Icons.BookOpen, "Infocard Browser", true))
                {
                    string input;
                    if ((input = FileDialog.Open(FreelancerIniFilter)) != null)
                    {
                        AddTab(new InfocardBrowserTab(input, this));
                    }
                }
                if (ImGui.MenuItem("Projectile Viewer"))
                {
                    if (ProjectileViewer.Create(this, out var pj))
                    {
                        tabs.Add(pj);
                    }
                }

                if (ImGui.MenuItem("ParamCurve Visualiser"))
                {
                    tabs.Add(new ParamCurveVis());
                }
                ImGui.EndMenu();
            }
            if (ImGui.BeginMenu("Window"))
            {
                if (ImGui.MenuItem("Close All Tabs", tabs.Count > 0))
                {
                    Confirm("Are you sure you want to close all tabs?", () =>
                    {
                        selected = null;
                        foreach (var t in tabs)
                        {
                            t.Dispose();
                        }
                        tabs.Clear();
                    });
                }
                ImGui.EndMenu();
            }
            if (ImGui.BeginMenu("Scripts"))
            {
                if (ImGui.MenuItem("Refresh"))
                {
                    LoadScripts();
                }
                ImGui.Separator();
                int k = 0;
                foreach (var sc in Scripts)
                {
                    var n = ImGuiExt.IDWithExtra(sc.Info.Name, k++);
                    if (ImGui.MenuItem(n))
                    {
                        RunScript(sc);
                    }
                }
                ImGui.EndMenu();
            }
            if (ImGui.BeginMenu("Help"))
            {
                if (Theme.IconMenuItem(Icons.Book, "Topics", true))
                {
                    var selfPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location);
                    var helpFile = Path.Combine(selfPath, "Docs", "index.html");
                    Shell.OpenCommand(helpFile);
                }
                if (Theme.IconMenuItem(Icons.Info, "About", true))
                {
                    openAbout = true;
                }
                ImGui.EndMenu();
            }

            options.Draw();

            if (openAbout)
            {
                ImGui.OpenPopup("About");
                openAbout = false;
            }
            if (openError)
            {
                ImGui.OpenPopup("Error");
                openError = false;
            }

            if (openLoading)
            {
                ImGui.OpenPopup("Processing");
                openLoading = false;
            }

            for (int i = activeScripts.Count - 1; i >= 0; i--)
            {
                if (!activeScripts[i].Draw())
                {
                    activeScripts.RemoveAt(i);
                }
            }
            bool pOpen = true;

            if (ImGui.BeginPopupModal("Error", ref pOpen, ImGuiWindowFlags.AlwaysAutoResize))
            {
                ImGui.Text("Error:");
                errorText.InputTextMultiline("##etext", new Vector2(430, 200), ImGuiInputTextFlags.ReadOnly);
                if (ImGui.Button("OK"))
                {
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
            recentFiles.DrawErrors();
            pOpen = true;
            if (ImGui.BeginPopupModal("About", ref pOpen, ImGuiWindowFlags.AlwaysAutoResize))
            {
                ImGui.SameLine(ImGui.GetWindowWidth() / 2 - 64);
                ImGui.Image((IntPtr)logoTexture, new Vector2(128), new Vector2(0, 1), new Vector2(1, 0));
                CenterText(Version);
                CenterText("Callum McGing 2018-2022");
                ImGui.Separator();
                var btnW = ImGui.CalcTextSize("OK").X + ImGui.GetStyle().FramePadding.X * 2;
                ImGui.Dummy(Vector2.One);
                ImGui.SameLine(ImGui.GetWindowWidth() / 2 - (btnW / 2));
                if (ImGui.Button("OK"))
                {
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
            pOpen = true;
            if (ImGuiExt.BeginModalNoClose("Processing", ImGuiWindowFlags.AlwaysAutoResize))
            {
                ImGuiExt.Spinner("##spinner", 10, 2, ImGui.GetColorU32(ImGuiCol.ButtonHovered, 1));
                ImGui.SameLine();
                ImGui.Text("Processing");
                if (finishLoading)
                {
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
            //Confirmation
            if (doConfirm)
            {
                ImGui.OpenPopup("Confirm?##mainwindow");
                doConfirm = false;
            }
            pOpen = true;
            if (ImGui.BeginPopupModal("Confirm?##mainwindow", ref pOpen, ImGuiWindowFlags.AlwaysAutoResize))
            {
                ImGui.Text(confirmText);
                if (ImGui.Button("Yes"))
                {
                    confirmAction();
                    ImGui.CloseCurrentPopup();
                }
                ImGui.SameLine();
                if (ImGui.Button("No"))
                {
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
            var menu_height = ImGui.GetWindowSize().Y;

            ImGui.EndMainMenuBar();
            var size = ImGui.GetIO().DisplaySize;

            size.Y -= menu_height;
            //Window
            MissingResources.Clear();
            ReferencedMaterials.Clear();
            ReferencedTextures.Clear();
            foreach (var tab in tabs)
            {
                ((EditorTab)tab).DetectResources(MissingResources, ReferencedMaterials, ReferencedTextures);
            }
            ImGui.SetNextWindowSize(new Vector2(size.X, size.Y - (25 * ImGuiHelper.Scale)), ImGuiCond.Always);
            ImGui.SetNextWindowPos(new Vector2(0, menu_height), ImGuiCond.Always, Vector2.Zero);
            bool childopened = true;

            ImGui.Begin("tabwindow", ref childopened,
                        ImGuiWindowFlags.NoTitleBar |
                        ImGuiWindowFlags.NoSavedSettings |
                        ImGuiWindowFlags.NoBringToFrontOnFocus |
                        ImGuiWindowFlags.NoMove |
                        ImGuiWindowFlags.NoResize);
            TabHandler.TabLabels(tabs, ref selected);
            var totalH = ImGui.GetWindowHeight();

            if (showLog)
            {
                ImGuiExt.SplitterV(2f, ref h1, ref h2, 8, 8, -1);
                h1 = totalH - h2 - 24f * ImGuiHelper.Scale;
                if (tabs.Count > 0)
                {
                    h1 -= 20f * ImGuiHelper.Scale;
                }
                ImGui.BeginChild("###tabcontent" + (selected != null ? selected.RenderTitle : ""), new Vector2(-1, h1), false, ImGuiWindowFlags.None);
            }
            else
            {
                ImGui.BeginChild("###tabcontent" + (selected != null ? selected.RenderTitle : ""));
            }
            if (selected != null)
            {
                selected.Draw();
                ((EditorTab)selected).SetActiveTab(this);
            }
            else
            {
                ActiveTab = null;
            }
            ImGui.EndChild();
            if (showLog)
            {
                ImGui.BeginChild("###log", new Vector2(-1, h2), false, ImGuiWindowFlags.None);
                ImGui.Text("Log");
                ImGui.SameLine(ImGui.GetWindowWidth() - 30 * ImGuiHelper.Scale);
                ImGui.PushStyleVar(ImGuiStyleVar.FramePadding, Vector2.Zero);
                if (ImGui.Button(Icons.X.ToString()))
                {
                    showLog = false;
                }
                ImGui.PopStyleVar();
                logBuffer.InputTextMultiline("##logtext", new Vector2(-1, h2 - 28 * ImGuiHelper.Scale), ImGuiInputTextFlags.ReadOnly);
                ImGui.EndChild();
            }
            ImGui.End();
            Make3dbDlg.Draw();
            //Status bar
            ImGui.SetNextWindowSize(new Vector2(size.X, 25f * ImGuiHelper.Scale), ImGuiCond.Always);
            ImGui.SetNextWindowPos(new Vector2(0, size.Y - 6f), ImGuiCond.Always, Vector2.Zero);
            bool sbopened = true;

            ImGui.Begin("statusbar", ref sbopened,
                        ImGuiWindowFlags.NoTitleBar |
                        ImGuiWindowFlags.NoSavedSettings |
                        ImGuiWindowFlags.NoBringToFrontOnFocus |
                        ImGuiWindowFlags.NoMove |
                        ImGuiWindowFlags.NoResize);
            if (updateTime > 9)
            {
                updateTime = 0;
                frequency  = RenderFrequency;
            }
            else
            {
                updateTime++;
            }
            string activename = ActiveTab == null ? "None" : ActiveTab.DocumentName;
            string utfpath    = ActiveTab == null ? "None" : ActiveTab.GetUtfPath();

            #if DEBUG
            const string statusFormat = "FPS: {0} | {1} Materials | {2} Textures | Active: {3} - {4}";
            #else
            const string statusFormat = "{1} Materials | {2} Textures | Active: {3} - {4}";
            #endif
            ImGui.Text(string.Format(statusFormat,
                                     (int)Math.Round(frequency),
                                     Resources.MaterialDictionary.Count,
                                     Resources.TextureDictionary.Count,
                                     activename,
                                     utfpath));
            ImGui.End();
            if (errorTimer > 0)
            {
                ImGuiExt.ToastText("An error has occurred\nCheck the log for details",
                                   new Color4(21, 21, 22, 128),
                                   Color4.Red);
            }
            ImGui.PopFont();
            if (lastFrame == null ||
                lastFrame.Width != Width ||
                lastFrame.Height != Height)
            {
                if (lastFrame != null)
                {
                    lastFrame.Dispose();
                }
                lastFrame = new RenderTarget2D(Width, Height);
            }
            RenderContext.RenderTarget = lastFrame;
            RenderContext.ClearColor   = new Color4(0.2f, 0.2f, 0.2f, 1f);
            RenderContext.ClearAll();
            guiHelper.Render(RenderContext);
            RenderContext.RenderTarget = null;
            lastFrame.BlitToScreen();
            foreach (var tab in toAdd)
            {
                tabs.Add(tab);
                selected = tab;
            }
            toAdd.Clear();
        }