private void DrawPlugin(PluginHolder plugin, float offsetX) { if (plugin.CanBeEnabledInOptions) //for theme plugin { if (plugin.Settings.Enable == null) //If developer forget to init it { plugin.Settings.Enable = false; } plugin.Settings.Enable = ImGuiExtension.Checkbox($"##{plugin.PluginName}Enabled", plugin.Settings.Enable.Value); ImGui.SameLine(); } else { ImGui.Bullet(); ImGui.SameLine(); } var labelSize = ImGui.GetTextSize(plugin.PluginName).X + offsetX; if (PluginNameWidth < labelSize) { PluginNameWidth = labelSize; } if (ImGui.Selectable(plugin.PluginName, SelectedPlugin == plugin)) { if (SelectedPlugin != plugin) { SelectedPlugin = plugin; SelectedPlugin.OnPluginSelectedInMenu(); Settings.LastOpenedPlugin = plugin.PluginName; } } }
protected override void Write(ImGuiMarkdownRenderer renderer, ListItemBlock obj) { foreach (var i in obj) { ImGui.Bullet(); ImGui.SameLine(); renderer.Render(i); } }
private void DrawCustomCommands() { ImGui.Separator(); ImGui.Text("Custom Startup Commands:"); if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Custom chat commands to execute on startup."); } ImGui.SameLine(); if (ImGui.Button("Add")) { Plugin.Configuration.CustomCommands.Add(new Configuration.CustomCommand()); } if (ImGui.IsItemHovered()) { ImGui.SetTooltip("Add a new custom startup command."); } bool updated = false; Configuration.CustomCommand commandToRemove = null; int index = 0; foreach (Configuration.CustomCommand customCommand in Plugin.Configuration.CustomCommands) { string currentChatCommand = customCommand.Command; ImGui.Bullet(); ImGui.SameLine(); ImGui.PushItemWidth(this.WindowSize.X - 105); updated = ImGui.InputText($"###inputText_Command_{index}", ref currentChatCommand, 512); ImGui.SameLine(); if (ImGui.Button($"Remove###button_Remove{index}")) { commandToRemove = customCommand; } if (updated) { Plugin.Configuration.CustomCommands[index].Command = currentChatCommand; Plugin.Configuration.Save(); } index++; } if (commandToRemove != null) { Plugin.Configuration.CustomCommands.Remove(commandToRemove); Plugin.Configuration.Save(); } }
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); } }
protected override void DrawOverride(ref bool isGameViewFocused) { foreach (var aptWindow in Game.Scene2D.AptWindowManager.WindowStack) { ImGui.Bullet(); ImGui.SameLine(); if (ImGui.Selectable(aptWindow.Name, aptWindow == Context.SelectedAptWindow)) { Context.SelectedAptWindow = aptWindow; } } }
void DoNode(LUtfNode node, LUtfNode parent, int idx) { string id = node.Name + "##" + parent.Name + idx; if (node.Children != null) { var flags = selectedNode == node ? TreeNodeFlags.Selected | tflags : tflags; var isOpen = ImGui.TreeNodeEx(id, flags); if (ImGuiNative.igIsItemClicked(0)) { selectedNode = node; SelectedChanged(); } 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.Image((IntPtr)ImGuiHelper.CircleId, new Vector2(15, 19), Vector2.Zero, Vector2.One, Vector4.One, Vector4.Zero); ImGui.SameLine(); } bool selected = selectedNode == node; if (ImGui.SelectableEx(id, ref selected)) { selectedNode = node; SelectedChanged(); } DoNodeMenu(id, node, parent); } }
void DoNode(LUtfNode node, LUtfNode parent, int idx) { string id = 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); } }
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 = string.Format("{0} ({1})##{2}", reference.Node.NodeName, reference.Node.Name, idx); } ImGui.PushStyleColor(ColorTarget.Text, col); if (reference.Children.Count > 0) { if (ImGui.TreeNodeEx(label, TreeNodeFlags.OpenOnDoubleClick | TreeNodeFlags.OpenOnArrow)) { int j = 0; foreach (var child in reference.Children) { DoNode(child, j++, enabled, disabled); } ImGui.TreePop(); } } else { ImGui.Bullet(); ImGui.SameLine(); if (ImGui.Selectable(label, selectedReference == reference)) { selectedReference = reference; } } ImGui.PopStyleColor(); }
void DoNode(LUtfNode node, LUtfNode parent, int idx) { string id = node.Name + "##" + idx; if (node.Children != null) { var flags = selectedNode == node ? TreeNodeFlags.Selected | tflags : tflags; var isOpen = ImGui.TreeNodeEx(id, flags); if (ImGuiNative.igIsItemClicked(0)) { selectedNode = node; } ImGui.PushID(id); DoNodeMenu(id, node, parent); ImGui.PopID(); int i = 0; if (isOpen) { foreach (var c in node.Children) { DoNode(c, node, i++); } ImGui.TreePop(); } } else { ImGui.Bullet(); bool selected = selectedNode == node; if (ImGui.SelectableEx(id, ref selected)) { selectedNode = node; } DoNodeMenu(id, node, parent); } }
private static void DrawModHelpPopup() { ImGui.SetNextWindowPos(ImGui.GetMainViewport().GetCenter(), ImGuiCond.Appearing, Vector2.One / 2); ImGui.SetNextWindowSize(new Vector2(5 * SelectorPanelWidth, 34 * ImGui.GetTextLineHeightWithSpacing()), ImGuiCond.Appearing); var _ = true; if (!ImGui.BeginPopupModal(LabelModHelpPopup, ref _, ImGuiWindowFlags.NoResize | ImGuiWindowFlags.NoMove)) { return; } using var raii = ImGuiRaii.DeferredEnd(ImGui.EndPopup); ImGui.Dummy(Vector2.UnitY * ImGui.GetTextLineHeight()); ImGui.Text("Mod Selector"); ImGui.BulletText("Select a mod to obtain more information."); ImGui.BulletText("Mod names are colored according to their current state in the collection:"); ImGui.Indent(); ImGui.Bullet(); ImGui.SameLine(); ImGui.Text("Enabled in the current collection."); ImGui.Bullet(); ImGui.SameLine(); ImGui.TextColored(ImGui.ColorConvertU32ToFloat4(ModListCache.DisabledModColor), "Disabled in the current collection."); ImGui.Bullet(); ImGui.SameLine(); ImGui.TextColored(ImGui.ColorConvertU32ToFloat4(ModListCache.NewModColor), "Newly imported during this session. Will go away when first enabling a mod or when Penumbra is reloaded."); ImGui.Bullet(); ImGui.SameLine(); ImGui.TextColored(ImGui.ColorConvertU32ToFloat4(ModListCache.HandledConflictModColor), "Enabled and conflicting with another enabled Mod, but on different priorities (i.e. the conflict is solved)."); ImGui.Bullet(); ImGui.SameLine(); ImGui.TextColored(ImGui.ColorConvertU32ToFloat4(ModListCache.ConflictingModColor), "Enabled and conflicting with another enabled Mod on the same priority."); ImGui.Unindent(); ImGui.BulletText("Right-click a mod to enter its sort order, which is its name by default."); ImGui.Indent(); ImGui.BulletText("A sort order differing from the mods name will not be displayed, it will just be used for ordering."); ImGui.BulletText( "If the sort order string contains Forward-Slashes ('/'), the preceding substring will be turned into collapsible folders that can group mods."); ImGui.BulletText( "Collapsible folders can contain further collapsible folders, so \"folder1/folder2/folder3/1\" will produce 3 folders\n" + "\t\t[folder1] -> [folder2] -> [folder3] -> [ModName],\n" + "where ModName will be sorted as if it was the string '1'."); ImGui.Unindent(); ImGui.BulletText( "You can drag and drop mods and subfolders into existing folders. Dropping them onto mods is the same as dropping them onto the parent of the mod."); ImGui.BulletText("Right-clicking a folder opens a context menu."); ImGui.Indent(); ImGui.BulletText( "You can rename folders in the context menu. Leave the text blank and press enter to merge the folder with its parent."); ImGui.BulletText("You can also enable or disable all descendant mods of a folder."); ImGui.Unindent(); ImGui.BulletText("Use the Filter Mods... input at the top to filter the list for mods with names containing the text."); ImGui.Indent(); ImGui.BulletText("You can enter c:[string] to filter for Changed Items instead."); ImGui.BulletText("You can enter a:[string] to filter for Mod Authors instead."); ImGui.Unindent(); ImGui.BulletText("Use the expandable menu beside the input to filter for mods fulfilling specific criteria."); ImGui.Dummy(Vector2.UnitY * ImGui.GetTextLineHeight()); ImGui.Text("Mod Management"); ImGui.BulletText("You can delete the currently selected mod with the trashcan button."); ImGui.BulletText("You can add a completely empty mod with the plus button."); ImGui.BulletText("You can import TTMP-based mods in the import tab."); ImGui.BulletText( "You can import penumbra-based mods by moving the corresponding folder into your mod directory in a file explorer, then rediscovering mods."); ImGui.BulletText( "If you enable Advanced Options in the Settings tab, you can toggle Edit Mode to manipulate your selected mod even further."); ImGui.Dummy(Vector2.UnitY * ImGui.GetTextLineHeight()); ImGui.Dummy(Vector2.UnitX * 2 * SelectorPanelWidth); ImGui.SameLine(); if (ImGui.Button("Understood", Vector2.UnitX * SelectorPanelWidth)) { ImGui.CloseCurrentPopup(); } }
public override void RenderElements() { if (choices.Count == 0) { choices.Add(""); AddOutput(); } Inputs[0].Offset.Y = ImGui.GetCursorPos().Y + InputHalfHeight; ImGui.PushItemWidth(200); if (ImGui.InputText($"##{name}", ref label, 256, ImGuiInputTextFlags.EnterReturnsTrue)) { name = label; } ImGui.SameLine(); var add = ImGui.Button("+##choice"); ImGui.PopItemWidth(); ImGui.Separator(); var i = 0; var toRemove = -1; foreach (var output in Outputs) { var s = choices[i]; output.Offset.Y = ImGui.GetCursorPos().Y + InputHalfHeight; ImGui.Bullet(); ImGui.SameLine(); ImGui.PushItemWidth(200); ImGui.InputText($"##s_{i}", ref s, 512); choices[i] = s; ImGui.PopItemWidth(); if (i > 0) { ImGui.SameLine(); if (ImGui.Button($"-##{i}")) { toRemove = i; } } i++; } if (toRemove > -1) { choices.RemoveAt(toRemove); RemoveConnection(Outputs[toRemove], true); } if (add) { choices.Add(""); AddOutput(); } }