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(); }
void NewHardpoint(PopupData data) { ImGui.Text("Name: "); ImGui.SameLine(); newHpBuffer.InputText("##hpname", ImGuiInputTextFlags.None); ImGui.SameLine(); if (ImGui.Button("..")) { ImGui.OpenPopup("names"); } if (ImGui.BeginPopupContextItem("names")) { var infos = newIsFixed ? HardpointInformation.Fix : HardpointInformation.Rev; foreach (var item in infos) { if (Theme.IconMenuItem(item.Name, item.Icon, item.Color, true)) { switch (item.Autoname) { case HpNaming.None: newHpBuffer.SetText(item.Name); break; case HpNaming.Number: newHpBuffer.SetText(item.Name + GetHpNumbering(item.Name).ToString("00")); break; case HpNaming.Letter: newHpBuffer.SetText(item.Name + GetHpLettering(item.Name)); break; } } } ImGui.EndPopup(); } ImGui.Text("Type: " + (newIsFixed ? "Fixed" : "Revolute")); if (newErrorTimer > 0) { ImGui.TextColored(new Vector4(1, 0, 0, 1), "Hardpoint with that name already exists."); } if (ImGui.Button("Ok")) { var txt = newHpBuffer.GetText(); if (txt.Length == 0) { return; } if (gizmos.Any((x) => x.Definition.Name.Equals(txt, StringComparison.OrdinalIgnoreCase))) { newErrorTimer = 6; } else { HardpointDefinition def; if (newIsFixed) { def = new FixedHardpointDefinition(txt); } else { def = new RevoluteHardpointDefinition(txt); } gizmos.Add(new HardpointGizmo(def, addConstruct)); addTo.Add(def); ImGui.CloseCurrentPopup(); } } ImGui.SameLine(); if (ImGui.Button("Cancel")) { ImGui.CloseCurrentPopup(); } }
public void Draw(int i) { ImGui.PushID($"__argument_{i}"); switch (Argument.Type) { case ScriptArgumentType.Boolean: ImGui.Checkbox(Argument.Name, ref BooleanValue); break; case ScriptArgumentType.Integer: ImGui.InputInt(Argument.Name, ref IntegerValue, 1); break; case ScriptArgumentType.String: InputText.InputText(Argument.Name, ImGuiInputTextFlags.None, 100); break; case ScriptArgumentType.Dropdown: ImGui.Combo(Argument.Name, ref IntegerValue, Argument.Options.ToArray(), Argument.Options.Count); break; case ScriptArgumentType.Folder: InputText.InputText(Argument.Name, ImGuiInputTextFlags.None, 100); ImGui.SameLine(); if (ImGui.Button("..")) { var result = FileDialog.ChooseFolder(); if (!string.IsNullOrEmpty(result)) { InputText.SetText(result); } } break; case ScriptArgumentType.File: InputText.InputText(Argument.Name, ImGuiInputTextFlags.None, 100); ImGui.SameLine(); if (ImGui.Button("..")) { var result = FileDialog.Open(); if (!string.IsNullOrEmpty(result)) { InputText.SetText(result); } } break; case ScriptArgumentType.FileArray: ImGui.Text(Argument.Name); ImGui.Separator(); if (StringArray.Count == 0) { ImGui.Text("[empty]"); } else { ImGui.Columns(2); List <string> toRemove = new List <string>(); for (int j = 0; j < StringArray.Count; j++) { ImGui.Text(StringArray[j]); ImGui.NextColumn(); if (ImGui.Button($"Remove##{j}")) { toRemove.Add(StringArray[j]); } ImGui.NextColumn(); } foreach (var f in toRemove) { StringArray.Remove(f); } ImGui.Columns(1); } ImGui.Separator(); if (ImGui.Button("Add File")) { var result = FileDialog.Open(); if (!string.IsNullOrEmpty(result)) { StringArray.Add(result); } } break; } ImGui.PopID(); }
void SearchWindow() { ImGui.Text(isSearchInfocards ? "Search Infocards" : "Search Strings"); searchBuffer.InputText("##searchtext", ImGuiInputTextFlags.None, 200); ImGui.Checkbox("Case Sensitive", ref searchCaseSensitive); ImGui.Checkbox("Match Whole World", ref searchWholeWord); if (ImGui.Button("Go")) { var str = searchBuffer.GetText(); if (!string.IsNullOrWhiteSpace(str)) { resultTitle = ImGuiExt.IDSafe($"Results for '{str}'"); dialogState = 1; Regex r; var regOptions = searchCaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase; if (searchWholeWord) { r = new Regex($"\\b{Regex.Escape(str)}\\b", regOptions); } else { r = new Regex(Regex.Escape(str), regOptions); } if (isSearchInfocards) { AsyncManager.RunTask(() => { var results = new List <int>(); var resStrings = new List <string>(); foreach (var kv in manager.AllXml) { if (r.IsMatch(kv.Value)) { results.Add(kv.Key); resStrings.Add(kv.Value); } } searchResults = results.ToArray(); searchStrings = resStrings.ToArray(); searchStringPreviews = new string[searchStrings.Length]; dialogState = 2; }); } else { AsyncManager.RunTask(() => { var results = new List <int>(); var resStrings = new List <string>(); foreach (var kv in manager.AllStrings) { if (r.IsMatch(kv.Value)) { results.Add(kv.Key); resStrings.Add(kv.Value); } } searchResults = results.ToArray(); searchStrings = resStrings.ToArray(); dialogState = 2; }); } } } ImGui.SameLine(); if (ImGui.Button("Cancel")) { ImGui.CloseCurrentPopup(); } }