Exemplo n.º 1
0
        public override void Draw()
        {
            bool doTabs = false;

            popups.Run();
            HardpointEditor();
            PartEditor();
            foreach (var t in openTabs)
            {
                if (t)
                {
                    doTabs = true; break;
                }
            }
            var contentw = ImGui.GetWindowContentRegionWidth();

            if (doTabs)
            {
                ImGui.Columns(2, "##panels", true);
                if (firstTab)
                {
                    ImGui.SetColumnWidth(0, contentw * 0.23f);
                    firstTab = false;
                }
                ImGui.BeginChild("##tabchild");
                if (openTabs[0])
                {
                    HierarchyPanel();
                }
                if (openTabs[1])
                {
                    AnimationPanel();
                }
                if (openTabs[2])
                {
                    SkeletonPanel();
                }
                if (openTabs[3])
                {
                    RenderPanel();
                }
                ImGui.EndChild();
                ImGui.NextColumn();
            }
            TabButtons();
            ImGui.BeginChild("##main");
            ViewerControls.DropdownButton("View Mode", ref viewMode, viewModes);
            ImGui.SameLine();
            ImGui.Checkbox("Background", ref doBackground);
            ImGui.SameLine();
            if (!(drawable is SphFile)) //Grid too small for planets lol
            {
                ImGui.Checkbox("Grid", ref showGrid);
                ImGui.SameLine();
            }
            if (hasVWire)
            {
                ImGui.Checkbox("VMeshWire", ref drawVMeshWire);
                ImGui.SameLine();
            }
            ImGui.Checkbox("Wireframe", ref doWireframe);
            DoViewport();
            //
            var camModes = (cameraPart != null) ? camModesCockpit : camModesNormal;

            ViewerControls.DropdownButton("Camera Mode", ref selectedCam, camModes);
            modelViewport.Mode = (CameraModes)(camModes[selectedCam].Tag);
            ImGui.SameLine();
            if (ImGui.Button("Reset Camera (Ctrl+R)"))
            {
                ResetCamera();
            }
            ImGui.SameLine();
            //
            if (!(drawable is SphFile) && !(drawable is DF.DfmFile))
            {
                ImGui.AlignTextToFramePadding();
                ImGui.Text("Level of Detail:");
                ImGui.SameLine();
                ImGui.Checkbox("Use Distance", ref useDistance);
                ImGui.SameLine();
                ImGui.PushItemWidth(-1);
                if (useDistance)
                {
                    ImGui.SliderFloat("Distance", ref levelDistance, 0, maxDistance, "%f", 1);
                }
                else
                {
                    ImGui.Combo("Level", ref level, levels, levels.Length);
                }
                ImGui.PopItemWidth();
            }
            ImGui.EndChild();

            if (_window.Config.ViewButtons)
            {
                ImGui.SetNextWindowPos(new Vector2(_window.Width - viewButtonsWidth, 90));
                ImGui.Begin("viewButtons#" + Unique, ImGuiWindowFlags.AlwaysAutoResize |
                            ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoMove);
                ImGui.Dummy(new Vector2(120, 2));
                ImGui.Columns(2, "##border", false);
                if (ImGui.Button("Top", new Vector2(55, 0)))
                {
                    modelViewport.GoTop();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Bottom", new Vector2(55, 0)))
                {
                    modelViewport.GoBottom();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Left", new Vector2(55, 0)))
                {
                    modelViewport.GoLeft();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Right", new Vector2(55, 0)))
                {
                    modelViewport.GoRight();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Front", new Vector2(55, 0)))
                {
                    modelViewport.GoFront();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Back", new Vector2(55, -1)))
                {
                    modelViewport.GoBack();
                }
                viewButtonsWidth = ImGui.GetWindowWidth() + 60;
                ImGui.End();
            }
        }
Exemplo n.º 2
0
        public override void Draw()
        {
            bool doTabs = false;

            popups.Run();
            HardpointEditor();
            PartEditor();
            foreach (var t in openTabs)
            {
                if (t)
                {
                    doTabs = true; break;
                }
            }
            var contentw = ImGui.GetWindowContentRegionWidth();

            if (doTabs)
            {
                ImGui.Columns(2, "##panels", true);
                if (firstTab)
                {
                    ImGui.SetColumnWidth(0, contentw * 0.23f);
                    firstTab = false;
                }
                ImGui.BeginChild("##tabchild");
                if (openTabs[0])
                {
                    HierarchyPanel();
                }
                if (openTabs[1])
                {
                    AnimationPanel();
                }
                if (openTabs[2])
                {
                    SkeletonPanel();
                }
                if (openTabs[3])
                {
                    RenderPanel();
                }
                ImGui.EndChild();
                ImGui.NextColumn();
            }
            TabButtons();
            ImGui.BeginChild("##main");
            if (ImGui.ColorButton("Background Color", new Vector4(background.R, background.G, background.B, 1),
                                  ImGuiColorEditFlags.NoAlpha, new Vector2(22, 22)))
            {
                ImGui.OpenPopup("Background Color###" + Unique);
                editCol = new System.Numerics.Vector3(background.R, background.G, background.B);
            }
            bool wOpen = true;

            if (ImGui.BeginPopupModal("Background Color###" + Unique, ref wOpen, ImGuiWindowFlags.AlwaysAutoResize))
            {
                ImGui.ColorPicker3("###a", ref editCol);
                if (ImGui.Button("OK"))
                {
                    background = new Color4(editCol.X, editCol.Y, editCol.Z, 1);
                    ImGui.CloseCurrentPopup();
                }
                ImGui.SameLine();
                if (ImGui.Button("Default"))
                {
                    var def = Color4.CornflowerBlue * new Color4(0.3f, 0.3f, 0.3f, 1f);
                    editCol = new System.Numerics.Vector3(def.R, def.G, def.B);
                }
                ImGui.SameLine();
                if (ImGui.Button("Cancel"))
                {
                    ImGui.CloseCurrentPopup();
                }
                ImGui.EndPopup();
            }
            ImGui.SameLine();
            ImGui.AlignTextToFramePadding();
            ImGui.Text("Background");
            ImGui.SameLine();
            ImGui.Checkbox("Starsphere", ref isStarsphere);
            ImGui.SameLine();
            if (hasVWire)
            {
                ImGui.Checkbox("VMeshWire", ref drawVMeshWire);
                ImGui.SameLine();
            }
            if (cameraPart != null)
            {
                ImGui.Checkbox("Cockpit Cam", ref doCockpitCam);
                ImGui.SameLine();
            }
            ImGui.Checkbox("Wireframe", ref doWireframe);
            ImGui.SameLine();
            ImGui.Text("View Mode:");
            ImGui.SameLine();
            ImGui.PushItemWidth(-1);
            ImGui.Combo("##modes", ref viewMode, viewModes, viewModes.Length);
            ImGui.PopItemWidth();
            DoViewport();
            //
            if (ImGui.Button("Reset Camera (Ctrl+R)"))
            {
                ResetCamera();
            }
            ImGui.SameLine();
            //
            if (!(drawable is SphFile) && !(drawable is DF.DfmFile))
            {
                ImGui.AlignTextToFramePadding();
                ImGui.Text("Level of Detail:");
                ImGui.SameLine();
                ImGui.Checkbox("Use Distance", ref useDistance);
                ImGui.SameLine();
                ImGui.PushItemWidth(-1);
                if (useDistance)
                {
                    ImGui.SliderFloat("Distance", ref levelDistance, 0, maxDistance, "%f", 1);
                }
                else
                {
                    ImGui.Combo("Level", ref level, levels, levels.Length);
                }
                ImGui.PopItemWidth();
            }
            ImGui.EndChild();

            if (_window.Config.ViewButtons)
            {
                ImGui.SetNextWindowPos(new Vector2(_window.Width - viewButtonsWidth, 90));
                ImGui.Begin("viewButtons#" + Unique, ImGuiWindowFlags.AlwaysAutoResize |
                            ImGuiWindowFlags.NoTitleBar | ImGuiWindowFlags.NoMove);
                ImGui.Dummy(new Vector2(120, 2));
                ImGui.Columns(2, "##border", false);
                if (ImGui.Button("Top", new Vector2(55, 0)))
                {
                    modelViewport.GoTop();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Bottom", new Vector2(55, 0)))
                {
                    modelViewport.GoBottom();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Left", new Vector2(55, 0)))
                {
                    modelViewport.GoLeft();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Right", new Vector2(55, 0)))
                {
                    modelViewport.GoRight();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Front", new Vector2(55, 0)))
                {
                    modelViewport.GoFront();
                }
                ImGui.NextColumn();
                if (ImGui.Button("Back", new Vector2(55, -1)))
                {
                    modelViewport.GoBack();
                }
                viewButtonsWidth = ImGui.GetWindowWidth() + 60;
                ImGui.End();
            }
        }