Beispiel #1
0
        void ColladaPane()
        {
            var totalH = ImGui.GetWindowHeight();

            ImGuiExt.SplitterV(2f, ref collada_h1, ref collada_h2, 8, 8, -1);
            collada_h1 = totalH - collada_h2 - 6f;
            ImGui.BeginChild("1", new Vector2(-1, collada_h1), false, WindowFlags.Default);
            ImGui.Separator();
            if (ImGui.TreeNode("Scene/"))
            {
                int i = 0;
                foreach (var obj in objs)
                {
                    ColladaTree(obj, ref i);
                }
                ImGui.TreePop();
            }
            CheckSelected();
            ImGui.EndChild();
            ImGui.BeginChild("2", new Vector2(-1, collada_h2), false, WindowFlags.Default);
            //Preview+Properties
            if (selected == null)
            {
                ImGui.Text("No node selected");
            }
            else
            {
                if (selected.Geometry != null)
                {
                    if (ImGuiExt.ToggleButton("Preview", colladaPreview))
                    {
                        colladaPreview = true;
                    }
                    ImGui.SameLine();
                    if (ImGuiExt.ToggleButton("Details", !colladaPreview))
                    {
                        colladaPreview = false;
                    }
                    ImGui.Separator();
                    if (colladaPreview)
                    {
                        ImGui.BeginChild("##colladapreview");
                        Render();
                        ImGui.EndChild();
                    }
                    else
                    {
                        ColladaDetails();
                    }
                }
                else
                {
                    ColladaDetails();
                }
            }
            //
            ImGui.EndChild();
        }
Beispiel #2
0
        void FLPane()
        {
            var totalH = ImGui.GetWindowHeight();

            ImGuiExt.SplitterV(2f, ref fl_h1, ref fl_h2, 8, 8, -1);
            fl_h1 = totalH - fl_h2 - 6f;
            ImGui.BeginChild("1", new Vector2(-1, fl_h1), false, ImGuiWindowFlags.None);
            ImGui.Separator();
            //3DB list
            if (ImGui.TreeNodeEx("Model/"))
            {
                int i = 0;
                foreach (var mdl in output)
                {
                    FLTree(mdl, ref i);
                }
            }
            ImGui.EndChild();
            ImGui.BeginChild("2", new Vector2(-1, fl_h2), false, ImGuiWindowFlags.None);
            if (ImGuiExt.ToggleButton("Options", curTab == 0))
            {
                curTab = 0;
            }
            ImGui.SameLine();
            if (ImGuiExt.ToggleButton("Materials", curTab == 1))
            {
                curTab = 1;
            }
            ImGui.Separator();
            switch (curTab)
            {
            case 0:     //OPTIONS
                ImGui.AlignTextToFramePadding();
                ImGui.Text("Model Name:");
                ImGui.SameLine();
                modelNameBuffer.InputText("##mdlname", ImGuiInputTextFlags.None);
                ImGui.Checkbox("Generate Materials", ref generateMaterials);
                break;

            case 1:     //MATERIALS
                if (selected == null)
                {
                    ImGui.Text("No object selected");
                }
                else
                {
                    MatNameEdit();
                }
                break;
            }
            ImGui.EndChild();
        }
Beispiel #3
0
        void FLPane()
        {
            var totalH = ImGui.GetWindowHeight();

            ImGuiExt.SplitterV(2f, ref fl_h1, ref fl_h2, 8, 8, -1);
            fl_h1 = totalH - fl_h2 - 6f;
            ImGui.BeginChild("1", new Vector2(-1, fl_h1), false, WindowFlags.Default);
            ImGui.Separator();
            //3DB list
            if (ImGui.TreeNodeEx("Model/"))
            {
                int i = 0;
                foreach (var mdl in output)
                {
                    FLTree(mdl, ref i);
                }
            }
            ImGui.EndChild();
            ImGui.BeginChild("2", new Vector2(-1, fl_h2), false, WindowFlags.Default);
            if (ImGuiExt.ToggleButton("Preview", flPreview))
            {
                flPreview = true;
            }
            ImGui.SameLine();
            if (ImGuiExt.ToggleButton("Details", !flPreview))
            {
                flPreview = false;
            }
            ImGui.Separator();
            if (flPreview)
            {
            }
            else
            {
            }
            ImGui.EndChild();
        }
Beispiel #4
0
        public override void Draw()
        {
            ImGui.Columns(2, "cols", true);
            //strings vs infocards
            if (ImGuiExt.ToggleButton("Strings", showStrings))
            {
                showStrings = true;
            }
            ImGui.SameLine();
            if (ImGuiExt.ToggleButton("Infocards", !showStrings))
            {
                showStrings = false;
            }
            ImGui.SameLine();
            ImGui.PushItemWidth(140);
            ImGui.InputInt("##id", ref id, 0, 0);
            ImGui.PopItemWidth();
            ImGui.SameLine();
            int gotoItem = -1;

            if (ImGui.Button("Go"))
            {
                if (showStrings)
                {
                    for (int i = 0; i < stringsIds.Length; i++)
                    {
                        if (id == stringsIds[i])
                        {
                            gotoItem      = i;
                            currentString = i;
                            txt.SetText(manager.GetStringResource(stringsIds[i]));
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < infocardsIds.Length; i++)
                    {
                        if (id == infocardsIds[i])
                        {
                            gotoItem        = i;
                            currentInfocard = i;
                            if (display == null)
                            {
                                display = new InfocardControl(win, RDLParse.Parse(manager.GetXmlResource(infocardsIds[currentInfocard]), win.Fonts), 100);
                            }
                            else
                            {
                                display.SetInfocard(RDLParse.Parse(manager.GetXmlResource(infocardsIds[currentInfocard]), win.Fonts));
                            }
                        }
                    }
                }
            }
            ImGui.Separator();
            //list
            ImGui.BeginChild("##list");
            if (showStrings)
            {
                if (gotoItem == -1)
                {
                    stringClipper.Begin(stringsIds.Length);
                    while (stringClipper.Step())
                    {
                        for (int i = stringClipper.DisplayStart; i < stringClipper.DisplayEnd; i++)
                        {
                            if (ImGui.Selectable(stringsIds[i] + "##" + i, currentString == i))
                            {
                                currentString = i;
                                txt.SetText(manager.GetStringResource(stringsIds[i]));
                            }
                        }
                    }
                    stringClipper.End();
                }
                else
                {
                    for (int i = 0; i < stringsIds.Length; i++)
                    {
                        ImGui.Selectable(stringsIds[i] + "##" + i, currentString == i);
                        if (currentString == i)
                        {
                            ImGui.SetScrollHere();
                        }
                    }
                }
            }
            else
            {
                if (gotoItem == -1)
                {
                    infocardClipper.Begin(infocardsIds.Length);
                    while (infocardClipper.Step())
                    {
                        for (int i = infocardClipper.DisplayStart; i < infocardClipper.DisplayEnd; i++)
                        {
                            if (ImGui.Selectable(infocardsIds[i] + "##" + i, currentInfocard == i))
                            {
                                currentInfocard = i;
                                if (display == null)
                                {
                                    display = new InfocardControl(win, RDLParse.Parse(manager.GetXmlResource(infocardsIds[currentInfocard]), win.Fonts), 100);
                                }
                                else
                                {
                                    display.SetInfocard(RDLParse.Parse(manager.GetXmlResource(infocardsIds[currentInfocard]), win.Fonts));
                                }
                            }
                        }
                    }
                    infocardClipper.End();
                }
                else
                {
                    for (int i = 0; i < infocardsIds.Length; i++)
                    {
                        ImGui.Selectable(infocardsIds[i] + "##" + i, currentInfocard == i);
                        if (currentInfocard == i)
                        {
                            ImGui.SetScrollHere();
                        }
                    }
                }
            }
            ImGui.EndChild();
            ImGui.NextColumn();
            //Display
            if (showStrings)
            {
                if (currentString != -1)
                {
                    ImGui.Text(stringsIds[currentString].ToString());
                    txt.InputTextMultiline("##txt", new Vector2(-1, ImGui.GetWindowHeight() - 70), ImGuiInputTextFlags.ReadOnly);
                }
            }
            else
            {
                if (currentInfocard != -1)
                {
                    ImGui.Text(infocardsIds[currentInfocard].ToString());
                    ImGui.BeginChild("##display");
                    display.Draw(ImGui.GetWindowWidth() - 15);
                    ImGui.EndChild();
                }
            }
        }
Beispiel #5
0
        void HierarchyPanel()
        {
            if (!(drawable is DF.DfmFile) && !(drawable is SphFile))
            {
                //Sur
                if (ImGui.Button("Open Sur"))
                {
                    var file = FileDialog.Open(SurFilters);
                    surname = System.IO.Path.GetFileName(file);
                    LibreLancer.Physics.Sur.SurFile sur;
                    try
                    {
                        using (var f = System.IO.File.OpenRead(file))
                        {
                            sur = new LibreLancer.Physics.Sur.SurFile(f);
                        }
                    }
                    catch (Exception)
                    {
                        sur = null;
                    }
                    if (sur != null)
                    {
                        ProcessSur(sur);
                    }
                }
                if (surs != null)
                {
                    ImGui.Separator();
                    ImGui.Text("Sur: " + surname);
                    ImGui.Checkbox("Show Hull", ref surShowHull);
                    ImGui.Checkbox("Show Hardpoints", ref surShowHps);
                    ImGui.Separator();
                }
            }
            if (ImGuiExt.Button("Apply Hardpoints", _isDirtyHp))
            {
                if (drawable is ModelFile)
                {
                    hprefs.Nodes[0].HardpointsToNodes(vmsModel.Root.Hardpoints);
                }
                else if (drawable is CmpFile)
                {
                    foreach (var mdl in vmsModel.AllParts)
                    {
                        var node = hprefs.Nodes.First((x) => x.Name == mdl.Path);
                        node.HardpointsToNodes(mdl.Hardpoints);
                    }
                }
                if (_isDirtyHp)
                {
                    _isDirtyHp = false;
                    parent.DirtyCountHp--;
                }
                popups.OpenPopup("Apply Complete");
            }
            if (vmsModel.AllParts.Length > 1 && ImGuiExt.Button("Apply Parts", _isDirtyPart))
            {
                WriteConstructs();
                if (_isDirtyPart)
                {
                    _isDirtyPart = false;
                    parent.DirtyCountPart--;
                }
                popups.OpenPopup("Apply Complete##Parts");
            }
            if (ImGuiExt.ToggleButton("Filter", doFilter))
            {
                doFilter = !doFilter;
            }
            if (doFilter)
            {
                ImGui.InputText("##filter", filterText.Pointer, (uint)filterText.Size, ImGuiInputTextFlags.None, filterText.Callback);
                currentFilter = filterText.GetText();
            }
            else
            {
                currentFilter = null;
            }

            ImGui.Separator();
            if (selectedNode != null)
            {
                ImGui.Text(selectedNode.Construct.ChildName);
                ImGui.Text(selectedNode.Construct.GetType().Name);
                ImGui.Text("Origin: " + selectedNode.Construct.Origin.ToString());
                var euler = selectedNode.Construct.Rotation.GetEuler();
                ImGui.Text(string.Format("Rotation: (Pitch {0:0.000}, Yaw {1:0.000}, Roll {2:0.000})",
                                         MathHelper.RadiansToDegrees(euler.X),
                                         MathHelper.RadiansToDegrees(euler.Y),
                                         MathHelper.RadiansToDegrees(euler.Z)));
                ImGui.Separator();
            }

            if (!vmsModel.Root.Active)
            {
                var col = ImGui.GetStyle().Colors[(int)ImGuiCol.TextDisabled];
                ImGui.PushStyleColor(ImGuiCol.Text, col);
            }
            if (ImGui.TreeNodeEx(ImGuiExt.Pad("Root"), ImGuiTreeNodeFlags.DefaultOpen))
            {
                if (!vmsModel.Root.Active)
                {
                    ImGui.PopStyleColor();
                }
                RootModelContext(vmsModel.Root.Active);
                Theme.RenderTreeIcon("Root", "tree", Color4.DarkGreen);
                if (vmsModel.Root.Children != null)
                {
                    foreach (var n in vmsModel.Root.Children)
                    {
                        DoConstructNode(n);
                    }
                }

                DoModel(vmsModel.Root);
                //if (!(drawable is SphFile)) DoModel(rootModel, null);
                ImGui.TreePop();
            }
            else
            {
                if (!vmsModel.Root.Active)
                {
                    ImGui.PopStyleColor();
                }
                RootModelContext(vmsModel.Root.Active);
                Theme.RenderTreeIcon("Root", "tree", Color4.DarkGreen);
            }
        }
 public override void Draw()
 {
     SearchDialog();
     InfocardXmlDialog();
     //strings vs infocards
     if (ImGuiExt.ToggleButton("Strings", showStrings))
     {
         showStrings = true;
         DisplayInfoString();
     }
     ImGui.SameLine();
     if (ImGuiExt.ToggleButton("Infocards", !showStrings))
     {
         showStrings = false;
         DisplayInfoXml();
     }
     ImGui.SameLine();
     ImGui.PushItemWidth(140);
     ImGui.InputInt("##id", ref id, 0, 0);
     ImGui.PopItemWidth();
     ImGui.SameLine();
     if (ImGui.Button("Go"))
     {
         if (showStrings)
         {
             GotoString();
         }
         else
         {
             GotoInfocard();
         }
     }
     ImGui.SameLine();
     if (ImGui.Button("Search..."))
     {
         if (showStrings)
         {
             SearchStrings();
         }
         else
         {
             SearchInfocards();
         }
     }
     ImGui.Separator();
     ImGui.Columns(2, "cols", true);
     //list
     ImGui.BeginChild("##list");
     if (showStrings)
     {
         if (gotoItem == -1)
         {
             stringClipper.Begin(stringsIds.Length);
             while (stringClipper.Step())
             {
                 for (int i = stringClipper.DisplayStart; i < stringClipper.DisplayEnd; i++)
                 {
                     if (ImGui.Selectable(stringsIds[i] + "##" + i, currentString == i))
                     {
                         currentString = i;
                         DisplayInfoString();
                     }
                 }
             }
             stringClipper.End();
         }
         else
         {
             for (int i = 0; i < stringsIds.Length; i++)
             {
                 ImGui.Selectable(stringsIds[i] + "##" + i, currentString == i);
                 if (currentString == i)
                 {
                     ImGui.SetScrollHereY();
                 }
             }
             gotoItem = -1;
         }
     }
     else
     {
         if (gotoItem == -1)
         {
             infocardClipper.Begin(infocardsIds.Length);
             while (infocardClipper.Step())
             {
                 for (int i = infocardClipper.DisplayStart; i < infocardClipper.DisplayEnd; i++)
                 {
                     if (ImGui.Selectable(infocardsIds[i] + "##" + i, currentInfocard == i))
                     {
                         currentInfocard = i;
                         currentXml      = manager.GetXmlResource(infocardsIds[currentInfocard]);
                         DisplayInfoXml();
                     }
                 }
             }
             infocardClipper.End();
         }
         else
         {
             for (int i = 0; i < infocardsIds.Length; i++)
             {
                 ImGui.Selectable(infocardsIds[i] + "##" + i, currentInfocard == i);
                 if (currentInfocard == i)
                 {
                     ImGui.SetScrollHereY();
                 }
             }
             gotoItem = -1;
         }
     }
     ImGui.EndChild();
     ImGui.NextColumn();
     //Display
     if (showStrings)
     {
         if (currentString != -1)
         {
             ImGui.Text(stringsIds[currentString].ToString());
             ImGui.SameLine();
             if (ImGui.Button("Copy Text"))
             {
                 win.SetClipboardText(manager.GetStringResource(stringsIds[currentString]));
             }
             ImGui.BeginChild("##display");
             display.Draw(ImGui.GetWindowWidth() - 15);
             ImGui.EndChild();
         }
     }
     else
     {
         if (currentInfocard != -1)
         {
             ImGui.AlignTextToFramePadding();
             ImGui.Text(infocardsIds[currentInfocard].ToString());
             ImGui.SameLine();
             if (ImGui.Button("View Xml"))
             {
                 doOpenXml = true;
             }
             ImGui.SameLine();
             if (ImGui.Button("Copy Text"))
             {
                 win.SetClipboardText(display.InfocardText);
             }
             ImGui.BeginChild("##display");
             display.Draw(ImGui.GetWindowWidth() - 15);
             ImGui.EndChild();
         }
     }
 }
Beispiel #7
0
        void HierachyPanel()
        {
            if (!(drawable is DF.DfmFile) && !(drawable is SphFile))
            {
                //Sur
                if (ImGui.Button("Open Sur"))
                {
                    var file = FileDialog.Open(SurFilters);
                    surname = System.IO.Path.GetFileName(file);
                    LibreLancer.Physics.Sur.SurFile sur;
                    try
                    {
                        using (var f = System.IO.File.OpenRead(file))
                        {
                            sur = new LibreLancer.Physics.Sur.SurFile(f);
                        }
                    }
                    catch (Exception)
                    {
                        sur = null;
                    }
                    if (sur != null)
                    {
                        ProcessSur(sur);
                    }
                }
                if (surs != null)
                {
                    ImGui.Separator();
                    ImGui.Text("Sur: " + surname);
                    ImGui.Checkbox("Show Hull", ref surShowHull);
                    ImGui.Checkbox("Show Hardpoints", ref surShowHps);
                    ImGui.Separator();
                }
            }
            if (ImGui.Button("Apply Hardpoints"))
            {
                if (drawable is CmpFile)
                {
                    var cmp = (CmpFile)drawable;
                    foreach (var kv in cmp.Models)
                    {
                        var node = hprefs.Nodes.Where((x) => x.Name == kv.Key).First();
                        node.HardpointsToNodes(kv.Value.Hardpoints);
                    }
                }
                else if (drawable is ModelFile)
                {
                    hprefs.Nodes[0].HardpointsToNodes(((ModelFile)drawable).Hardpoints);
                }
                popups.OpenPopup("Apply Complete");
            }
            if ((drawable is CmpFile) && ((CmpFile)drawable).Parts.Count > 1 && ImGui.Button("Apply Parts"))
            {
                WriteConstructs();
                popups.OpenPopup("Apply Complete##Parts");
            }
            if (ImGuiExt.ToggleButton("Filter", doFilter))
            {
                doFilter = !doFilter;
            }
            if (doFilter)
            {
                ImGui.InputText("##filter", filterText.Pointer, (uint)filterText.Size, ImGuiInputTextFlags.None, filterText.Callback);
                currentFilter = filterText.GetText();
            }
            else
            {
                currentFilter = null;
            }

            ImGui.Separator();
            if (selectedNode != null)
            {
                ImGui.Text(selectedNode.Con.ChildName);
                ImGui.Text(selectedNode.Con.GetType().Name);
                ImGui.Text("Origin: " + selectedNode.Con.Origin.ToString());
                var euler = selectedNode.Con.Rotation.GetEuler();
                ImGui.Text(string.Format("Rotation: (Pitch {0:0.000}, Yaw {1:0.000}, Roll {2:0.000})",
                                         MathHelper.RadiansToDegrees(euler.X),
                                         MathHelper.RadiansToDegrees(euler.Y),
                                         MathHelper.RadiansToDegrees(euler.Z)));
                ImGui.Separator();
            }
            if (ImGui.TreeNodeEx(ImGuiExt.Pad("Root"), ImGuiTreeNodeFlags.DefaultOpen))
            {
                Theme.RenderTreeIcon("Root", "tree", Color4.DarkGreen);
                foreach (var n in cons)
                {
                    DoConstructNode(n);
                }
                if (!(drawable is SphFile))
                {
                    DoModel(rootModel, null);
                }
                ImGui.TreePop();
            }
            else
            {
                Theme.RenderTreeIcon("Root", "tree", Color4.DarkGreen);
            }
        }