public override void DrawMutable() { bool isOpen = ImGui.CollapsingHeader($"{_name}", ImGuiTreeNodeFlags.FramePadding); if (AllowsEffectRemoval) { NezImGui.ShowContextMenuTooltip(); } if (AllowsEffectRemoval && ImGui.BeginPopupContextItem()) { if (ImGui.Selectable("Remove Effect")) { SetValue(null); _isTargetDestroyed = true; } ImGui.EndPopup(); } if (isOpen && !_isTargetDestroyed) { foreach (AbstractTypeInspector i in _inspectors) { i.Draw(); } } }
public static bool BeginComboFixed(string label, string previewValue) { string labelOnly = label.Contains("##") ? label.Split("##")[0] : label; ImGui.Text(labelOnly); ImGui.SameLine(); string popupId = label + "Popup"; var popupPos = ImGui.GetMousePosOnOpeningCurrentPopup(); ImGui.ArrowButton("##" + label + "ButtonArrow", ImGuiDir.Right); ImGui.OpenPopupOnItemClick(popupId, ImGuiPopupFlags.MouseButtonLeft); ImGui.SameLine(); var cursorPosAfterArrowButton = ImGui.GetCursorPos(); ImGui.SetCursorPos(new Vector2(cursorPosAfterArrowButton.X - 10, cursorPosAfterArrowButton.Y)); ButtonGradient(previewValue + "##" + label + "ButtonMain"); ImGui.OpenPopupOnItemClick(popupId, ImGuiPopupFlags.MouseButtonLeft); if (ImGui.IsPopupOpen(popupId)) { ImGui.SetNextWindowPos(popupPos, ImGuiCond.Appearing); ImGui.SetNextWindowSize(new Vector2(300, 400)); return(ImGui.BeginPopupContextItem(popupId)); } return(false); }
private void PropertyRowVirtualRefContextMenu(string field, string vref, object searchValue) { if (ImGui.BeginPopupContextItem(vref)) { // Add Goto statements foreach (var param in ParamBank.Params) { PARAMDEF.Field foundfield = null; foreach (PARAMDEF.Field f in param.Value.AppliedParamdef.Fields) { if (FieldMetaData.Get(f).VirtualRef != null && FieldMetaData.Get(f).VirtualRef.Equals(vref)) { foundfield = f; break; } } if (foundfield == null) { continue; } if (ImGui.Selectable($@"Go to first in {param.Key}")) { foreach (PARAM.Row row in param.Value.Rows) { if (row[foundfield.InternalName].Value.Equals(searchValue)) { EditorCommandQueue.AddCommand($@"param/select/{param.Key}/{row.ID}"); break; } } } } ImGui.EndPopup(); } }
public void Draw() { ImGui.PushID(_scopeId); var isOpen = ImGui.CollapsingHeader(_postProcessor.GetType().Name.Replace("PostProcessor", string.Empty)); NezImGui.ShowContextMenuTooltip(); if (ImGui.BeginPopupContextItem()) { if (ImGui.Selectable("Remove PostProcessor")) { isOpen = false; Core.Scene.RemovePostProcessor(_postProcessor); ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } if (isOpen) { ImGui.Indent(); foreach (var inspector in _inspectors) { inspector.Draw(); } ImGui.Unindent(); } ImGui.PopID(); }
private void PropertyRowValueContextMenu(string visualName, string VirtualRef, dynamic oldval) { if (ImGui.BeginPopupContextItem("quickMEdit")) { if (ImGui.Selectable("Edit all selected...")) { EditorCommandQueue.AddCommand($@"param/menu/massEditRegex/selection: {visualName}: "); } if (VirtualRef != null) { PropertyRowVirtualRefContextItems(VirtualRef, oldval); } if (ParamEditorScreen.EditorMode && ImGui.BeginMenu("Find rows with this value...")) { foreach (KeyValuePair <string, PARAM> p in ParamBank.Params) { int v = (int)oldval; PARAM.Row r = p.Value[v]; if (r != null && ImGui.Selectable($@"{p.Key}: {(r.Name != null ? r.Name : "null")}")) { EditorCommandQueue.AddCommand($@"param/select/-1/{p.Key}/{v}"); } } ImGui.EndMenu(); } ImGui.EndPopup(); } }
ContextActions NewHpMenu(string n) { var retval = ContextActions.None; if (ImGui.IsItemClicked(ImGuiMouseButton.Right)) { ImGui.OpenPopup(n + "_HardpointContext"); } if (ImGui.BeginPopupContextItem(n + "_HardpointContext")) { if (Theme.BeginIconMenu(Icons.PlusCircle, "New")) { if (Theme.IconMenuItem(Icons.Cube_Purple, "Fixed Hardpoint", true)) { retval = ContextActions.NewFixed; } if (Theme.IconMenuItem(Icons.Rev_LightSeaGreen, "Revolute Hardpoint", true)) { retval = ContextActions.NewRevolute; } ImGui.EndMenu(); } ImGui.EndPopup(); } return(retval); }
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(); } }
public override void Draw() { if (ImGui.BeginPopupContextItem(ACCOUNT_SWITCHER_POPUP_ID)) { if (this.manager.Accounts.Count == 0) { ImGui.Text("No saved accounts..."); } foreach (XivAccount account in this.manager.Accounts) { if (ImGui.Button(account.Id)) { this.AccountChanged?.Invoke(this, account); } } ImGui.EndPopup(); } if (this.doOpen) { this.doOpen = false; ImGui.OpenPopup(ACCOUNT_SWITCHER_POPUP_ID); } base.Draw(); }
public void Draw() { ImGui.PushID(_scopeId); var isOpen = ImGui.CollapsingHeader(_name); NezImGui.ShowContextMenuTooltip(); if (ImGui.BeginPopupContextItem()) { if (ImGui.Selectable("Remove Renderer")) { if (Core.Scene is ECScene s) { isOpen = false; s.RemoveRenderer(_renderer); ImGui.CloseCurrentPopup(); } } ImGui.EndPopup(); } if (isOpen) { ImGui.Indent(); _materialInspector.Draw(); ImGui.Checkbox("shouldDebugRender", ref Renderer.ShouldDebugRender); var value = Renderer.RenderTargetClearColor.ToNumerics(); if (ImGui.ColorEdit4("renderTargetClearColor", ref value)) { Renderer.RenderTargetClearColor = value.ToXNAColor(); } if (Renderer.Camera != null) { if (NezImGui.LabelButton("Camera", Renderer.Camera.Entity.Name)) { Core.GetGlobalManager <ImGuiManager>().StartInspectingEntity(Renderer.Camera.Entity); } } ImGui.PushStyleVar(ImGuiStyleVar.Alpha, ImGui.GetStyle().Alpha * 0.5f); NezImGui.DisableNextWidget(); var tempBool = Renderer.WantsToRenderToSceneRenderTarget; ImGui.Checkbox("wantsToRenderToSceneRenderTarget", ref tempBool); NezImGui.DisableNextWidget(); tempBool = Renderer.WantsToRenderAfterPostProcessors; ImGui.Checkbox("wantsToRenderAfterPostProcessors", ref tempBool); ImGui.PopStyleVar(); ImGui.Unindent(); } ImGui.PopID(); }
private void DrawModAddButton() { if (ImGui.BeginPopupContextItem(LabelAddModPopup)) { if (_keyboardFocus) { ImGui.SetKeyboardFocusHere(); _keyboardFocus = false; } var newName = ""; if (ImGui.InputTextWithHint("##AddMod", "New Mod Name...", ref newName, 64, ImGuiInputTextFlags.EnterReturnsTrue)) { try { var newDir = TexToolsImport.CreateModFolder(new DirectoryInfo(_base._plugin.Configuration !.CurrentCollection), newName); var modMeta = new ModMeta { Author = "Unknown", Name = newName, Description = string.Empty, }; var metaPath = Path.Combine(newDir.FullName, "meta.json"); File.WriteAllText(metaPath, JsonConvert.SerializeObject(modMeta, Formatting.Indented)); _base.ReloadMods(); SelectModByDir(newDir.Name); } catch (Exception e) { PluginLog.Error($"Could not create directory for new Mod {newName}:\n{e}"); } ImGui.CloseCurrentPopup(); } if (ImGui.IsKeyPressed(ImGui.GetKeyIndex(ImGuiKey.Escape))) { ImGui.CloseCurrentPopup(); } ImGui.EndPopup(); } ImGui.PushFont(UiBuilder.IconFont); if (ImGui.Button(FontAwesomeIcon.Plus.ToIconString(), SelectorButtonSizes)) { _keyboardFocus = true; ImGui.OpenPopup(LabelAddModPopup); } ImGui.PopFont(); if (ImGui.IsItemHovered()) { ImGui.SetTooltip(TooltipAdd); } }
private void PropertyRowWikiContextMenu(string wiki) { if (ImGui.BeginPopupContextItem("Wiki")) { ImGui.Text(wiki); ImGui.EndPopup(); } }
void OnGUI_SceneMenu(Scene scene, string label, bool active) { if (ImGui.BeginPopupContextItem(label)) { OnGUI_RightMenu(scene.root); ImGui.EndPopup(); } }
void OnGUI_TransfromMenu(SceneNode scene, string label) { if (ImGui.BeginPopupContextItem(label)) { OnGUI_RightMenu(scene); ImGui.EndPopup(); } }
public override void OnGui() { if (ImGui.BeginPopupContextItem(ViewID, PopupFlags)) { DrawContent(); ImGui.EndPopup(); } }
public void DrawChatChannelEntry(int index) { this.currentEntry = this.configuration.ChatTypeConfigurations[index]; ulong guildID = currentEntry.Channel.GuildId; // string guildIDInput = guildID.ToString(); ulong channelID = currentEntry.Channel.ChannelId; Dalamud.Game.Chat.XivChatType type = currentEntry.ChatType; Configuration.ChannelType chanType = currentEntry.Channel.Type; // Making colors work is the worst shit. byte[] colorvals = BitConverter.GetBytes(currentEntry.Color); int red = (int)(currentEntry.Color >> 16) & 0xFF; int green = (int)(currentEntry.Color >> 8) & 0xFF; int blue = (int)currentEntry.Color & 0xFF; Vector4 colors = new Vector4(colorvals[2] / 255.0f, colorvals[1] / 255.0f, colorvals[0] / 255.0f, 1.0f); ImGui.Separator(); //ImGui.PushStyleColor(ImGuiCol.Button, buttoncolor); //ImGui.ColorButton($"", buttoncolor); if (ImGui.ColorButton($"##colorpicker-{type}-{guildID}-{channelID}", colors)) { // currentEntry.Color = ImGui.ColorConvertFloat4ToU32(buttoncolor); } ImGui.SameLine(); ImGui.PushItemWidth(-1); ImGui.SetNextItemWidth(-100); string buttonlabel = $"{type} (Chat type {(int)type}##{index})"; if (ImGui.Button(buttonlabel, new Vector2((int)Math.Truncate(ImGui.GetScrollMaxY()) != 0 ? ElementSizeX - 16 : ElementSizeX, 25))) { this.selectedChannelConfig = this.configuration.ChatTypeConfigurations[index]; channelEditWindowVisible = true; } ImGui.PopItemWidth(); //ImGui.PopStyleColor(); if (ImGui.BeginPopupContextItem($"Popup item###{buttonlabel}")) { if (ImGui.Selectable("Delete")) { // this.currentNote = note; // this.deletionWindowVisible = true; DeleteConfirmationVisible = true; //DrawDeletionConfirmationWindow(); //PluginLog.Information($"Loaded Delete confirm window? {DrawDeletionConfirmationWindow()}"); if (DrawDeletionConfirmationWindow()) { } } ImGui.EndPopup(); } }
private void RecursivelyRender(Entity en) { ImGui.PushID(en.GetHashCode()); ImGuiTreeNodeFlags nodeFlags = ImGuiTreeNodeFlags.OpenOnArrow; if (SelectedEntity == en) { nodeFlags |= ImGuiTreeNodeFlags.Selected; } if (!en.Active) { ImGui.PushStyleColor(ImGuiCol.Text, new System.Numerics.Vector4(0.4f, 0.4f, 0.4f, 1f)); } bool nodeOpen = ImGui.TreeNodeEx(en.Name, nodeFlags); if (ImGui.IsItemClicked()) { SelectedEntity = en; } //new entity delete menu if (ImGui.BeginPopupContextItem("Entity Popup")) { if (ImGui.MenuItem("New Entity")) { _ = new Entity("New Entity", parent: en); } if (ImGui.MenuItem("Delete")) { en.Destroy(); } ImGui.EndPopup(); } if (nodeOpen) { for (int i = 0; i < en.Children.Count; i++) { RecursivelyRender(en.Children[i]); } ImGui.TreePop(); } if (!en.Active) { ImGui.PopStyleColor(); } ImGui.PopID(); }
public override void Draw() { ImGui.TextUnformatted(_fileText); if (ImGui.BeginPopupContextItem()) { if (ImGui.Selectable("Copy to clipboard")) { ImGui.SetClipboardText(_fileText); } ImGui.EndPopup(); } }
private void DrawTextMode() { ImGui.TextUnformatted(_iniString); if (ImGui.BeginPopupContextItem()) { if (ImGui.Selectable("Copy to clipboard")) { ImGui.SetClipboardText(_iniString); } ImGui.EndPopup(); } }
public void Render() { if (ImGui.BeginPopupContextItem()) { foreach (var item in MenuItems) { if (ImGui.Selectable(item.Key)) { item.Value(); } } ImGui.EndPopup(); } }
public void DecorateContextMenu(PARAM.Row row) { if (!_entryCache.ContainsKey((int)row.ID)) { return; } if (ImGui.BeginPopupContextItem(row.ID.ToString())) { if (ImGui.Selectable($@"Goto {_category.ToString()} Text")) { EditorCommandQueue.AddCommand($@"text/select/{_category.ToString()}/{row.ID}"); } ImGui.EndPopup(); } }
void ContextView(string name, Action onView) { if (ImGui.IsItemClicked(1)) { ImGui.OpenPopup(name); } if (ImGui.BeginPopupContextItem(name)) { if (ImGui.MenuItem("View")) { onView(); } ImGui.EndPopup(); } }
public static void Display(string Id, double value, ValueType inputType, ref DisplayType displayType, ref string displayFormat) { //ImGui.GetID(Id); ImGui.Text(StringifyValue(value, displayFormat)); if (ImGui.BeginPopupContextItem(Id, 1)) { if (ImGui.SmallButton("Set Display Type")) { } if (ImGui.SmallButton("Set Display Format")) { } } }
private void PropertyContextMenu(object obj, PropertyInfo propinfo) { if (ImGui.BeginPopupContextItem(propinfo.Name)) { var att = propinfo.GetCustomAttribute <MSBParamReference>(); if (att != null) { if (ImGui.Selectable($@"Goto {att.ParamName}")) { var id = (int)propinfo.GetValue(obj); EditorCommandQueue.AddCommand($@"param/select/-1/{att.ParamName}/{id}"); } } ImGui.EndPopup(); } }
private bool PropertyRowRefsContextMenu(List <string> reftypes, dynamic oldval, ref object newval) { if (ImGui.BeginPopupContextItem(String.Join(',', reftypes))) { // Add Goto statements foreach (string rt in reftypes) { if (!ParamBank.Params.ContainsKey(rt)) { continue; } if (ParamBank.Params[rt][(int)oldval] != null && ImGui.Selectable($@"Go to {rt}")) { EditorCommandQueue.AddCommand($@"param/select/{rt}/{oldval}"); } } // Add searchbar for named editing ImGui.InputText("##value", ref _refContextCurrentAutoComplete, 128); // Unordered scanthrough search for matching param entries. // This should be replaced by a proper search box with a scroll and everything if (_refContextCurrentAutoComplete != "") { foreach (string rt in reftypes) { int maxResultsPerRefType = 15 / reftypes.Count; List <PARAM.Row> rows = MassParamEditRegex.GetMatchingParamRowsByName(ParamBank.Params[rt], _refContextCurrentAutoComplete, true, false); foreach (PARAM.Row r in rows) { if (maxResultsPerRefType <= 0) { break; } if (ImGui.Selectable(r.Name)) { newval = (int)r.ID; _refContextCurrentAutoComplete = ""; ImGui.EndPopup(); return(true); } maxResultsPerRefType--; } } } ImGui.EndPopup(); } return(false); }
public static void GuiSettingFloatSlider(string label, string setting, float def, float min, float max) { float value = float.Parse(SettingManager.GetSetting(setting, def.ToString())); ImGui.SliderFloat(label, ref value, min, max, "%.1f"); if (ImGui.BeginPopupContextItem(setting)) { if (ImGui.Selectable($"Set to default ({def})")) { value = def; } ImGui.SetNextItemWidth(150); ImGui.InputFloat("", ref value, 0.1f, 1f, "%.1f"); ImGui.EndPopup(); } SettingManager.SetSetting(setting, value.ToString()); }
void RootModelContext(bool rootVisible) { if (vmsModel.Root != null && ImGui.IsItemClicked(ImGuiMouseButton.Right)) { ImGui.OpenPopup(Unique + "_mdl_rootpopup"); } if (ImGui.BeginPopupContextItem(Unique + "_mdl_rootpopup")) { bool visibleVar = rootVisible; Theme.IconMenuToggle(Icons.Eye, "Visible", ref visibleVar, true); if (visibleVar != rootVisible) { vmsModel.Root.Active = visibleVar; } ImGui.EndPopup(); } }
void RootModelContext(bool rootVisible) { if (vmsModel.Root != null && ImGui.IsItemClicked(1)) { ImGui.OpenPopup(Unique + "_mdl_rootpopup"); } if (ImGui.BeginPopupContextItem(Unique + "_mdl_rootpopup")) { bool visibleVar = rootVisible; Theme.IconMenuToggle("Visible", "eye", Color4.White, ref visibleVar, true); if (visibleVar != rootVisible) { vmsModel.Root.Active = visibleVar; } ImGui.EndPopup(); } }
public override void Draw() { ImGui.PushID(_scopeId); var isHeaderOpen = ImGui.CollapsingHeader(_name); // context menu has to be outside the isHeaderOpen block so it works open or closed if (ImGui.BeginPopupContextItem()) { if (ImGui.Selectable("Remove Component")) { _component.RemoveComponent(); } ImGui.EndPopup(); } if (isHeaderOpen) { var enabled = _component.Enabled; if (ImGui.Checkbox("Enabled", ref enabled)) { _component.SetEnabled(enabled); } for (var i = _inspectors.Count - 1; i >= 0; i--) { if (_inspectors[i].IsTargetDestroyed) { _inspectors.RemoveAt(i); continue; } _inspectors[i].Draw(); } foreach (var action in _componentDelegateMethods) { action(); } } ImGui.PopID(); }
ContextActions EditDeleteHpMenu(string n) { if (ImGui.IsItemClicked(1)) { ImGui.OpenPopup(n + "_HardpointEditCtx"); } if (ImGui.BeginPopupContextItem(n + "_HardpointEditCtx")) { if (Theme.IconMenuItem("Edit", "edit", Color4.White, true)) { return(ContextActions.Edit); } if (Theme.IconMenuItem("Delete", "delete", Color4.White, true)) { return(ContextActions.Delete); } ImGui.EndPopup(); } return(ContextActions.None); }
public static void RenderMenu(bool window = false) { if (window ? ImGui.BeginPopupContextWindow("window_node_menu", 1) : ImGui.BeginPopupContextItem("node_menu", 1)) { if (ImGui.Selectable("Copy (Ctrl+C)")) { Copy(); } RenderPaste(); if (ImGui.Selectable("Delete (Ctrl+D)")) { CurrentMenu.Remove(); } RenderAddNew(); ImGui.EndPopup(); } }