// Draw the text input for the mod directory, // as well as the directory picker button and the enter warning. private void DrawRootFolder() { _newModDirectory ??= Penumbra.Config.ModDirectory; var spacing = 3 * ImGuiHelpers.GlobalScale; using var group = ImRaii.Group(); ImGui.SetNextItemWidth(_window._inputTextWidth.X - spacing - _window._iconButtonSize.X); var save = ImGui.InputText("##rootDirectory", ref _newModDirectory, 64, ImGuiInputTextFlags.EnterReturnsTrue); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, new Vector2(spacing, 0)); ImGui.SameLine(); DrawDirectoryPickerButton(); style.Pop(); ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Root Directory", "This is where Penumbra will store your extracted mod files.\n" + "TTMP files are not copied, just extracted.\n" + "This directory needs to be accessible and you need write access here.\n" + "It is recommended that this directory is placed on a fast hard drive, preferably an SSD.\n" + "It should also be placed near the root of a logical drive - the shorter the total path to this folder, the better.\n" + "Definitely do not place it in your Dalamud directory or any sub-directory thereof."); group.Dispose(); ImGui.SameLine(); var pos = ImGui.GetCursorPosX(); ImGui.NewLine(); if (Penumbra.Config.ModDirectory != _newModDirectory && _newModDirectory.Length != 0 && DrawPressEnterWarning(_newModDirectory, Penumbra.Config.ModDirectory, pos, save)) { Penumbra.ModManager.DiscoverMods(_newModDirectory); } }
private void DrawDefaultCollectionSelector() { DrawCollectionSelector("##default", _window._inputTextWidth.X, ModCollection.Type.Default, true, null); ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Default Collection", "Mods in the default collection are loaded for any character that is not explicitly named in the character collections below.\n"); }
// Draw a single group selector as a combo box. // If a description is provided, add a help marker besides it. private void DrawSingleGroup(IModGroup group, int groupIdx) { if (group.Type != SelectType.Single || !group.IsOption) { return; } using var id = ImRaii.PushId(groupIdx); var selectedOption = _emptySetting ? 0 : ( int )_settings.Settings[groupIdx]; ImGui.SetNextItemWidth(_window._inputTextWidth.X * 3 / 4); using var combo = ImRaii.Combo(string.Empty, group[selectedOption].Name); if (combo) { for (var idx2 = 0; idx2 < group.Count; ++idx2) { if (ImGui.Selectable(group[idx2].Name, idx2 == selectedOption)) { Penumbra.CollectionManager.Current.SetModSetting(_mod.Index, groupIdx, ( uint )idx2); } } } combo.Dispose(); ImGui.SameLine(); if (group.Description.Length > 0) { ImGuiUtil.LabeledHelpMarker(group.Name, group.Description); } else { ImGui.TextUnformatted(group.Name); } }
// Toggling audio streaming will need to apply to the music manager // and rediscover mods due to determining whether .scds will be loaded or not. private void DrawDisableSoundStreamingBox() { var tmp = Penumbra.Config.DisableSoundStreaming; if (ImGui.Checkbox("##streaming", ref tmp) && tmp != Penumbra.Config.DisableSoundStreaming) { Penumbra.Config.DisableSoundStreaming = tmp; Penumbra.Config.Save(); if (tmp) { _window._penumbra.MusicManager.DisableStreaming(); } else { _window._penumbra.MusicManager.EnableStreaming(); } Penumbra.ModManager.DiscoverMods(); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Enable Sound Modification", "Disable streaming in the games audio engine. The game enables this by default, and Penumbra should disable it.\n" + "If this is unchecked, you can not replace sound files in the game (*.scd files), they will be ignored by Penumbra.\n\n" + "Only touch this if you experience sound problems like audio stuttering.\n" + "If you toggle this, make sure no modified or to-be-modified sound file is currently playing or was recently playing, else you might crash.\n" + "You might need to restart your game for this to fully take effect."); }
// Sets the resource logger state when toggled, // and the filter when entered. private void DrawRequestedResourceLogging() { var tmp = Penumbra.Config.EnableResourceLogging; if (ImGui.Checkbox("##resourceLogging", ref tmp)) { _window._penumbra.ResourceLogger.SetState(tmp); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Enable Requested Resource Logging", "Log all game paths FFXIV requests to the plugin log.\n" + "You can filter the logged paths for those containing the entered string or matching the regex, if the entered string compiles to a valid regex.\n" + "Red boundary indicates invalid regex."); ImGui.SameLine(); // Red borders if the string is not a valid regex. var tmpString = Penumbra.Config.ResourceLoggingFilter; using var color = ImRaii.PushColor(ImGuiCol.Border, Colors.RegexWarningBorder, !_window._penumbra.ResourceLogger.ValidRegex); using var style = ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale, !_window._penumbra.ResourceLogger.ValidRegex); ImGui.SetNextItemWidth(-1); if (ImGui.InputTextWithHint("##ResourceLogFilter", "Filter...", ref tmpString, Utf8GamePath.MaxGamePathLength)) { _window._penumbra.ResourceLogger.SetFilter(tmpString); } }
// Different supported sort modes as a combo. private void DrawFolderSortType() { var sortMode = Penumbra.Config.SortMode; ImGui.SetNextItemWidth(_window._inputTextWidth.X); using var combo = ImRaii.Combo("##sortMode", sortMode.Data().Name); if (combo) { foreach (var val in Enum.GetValues <SortMode>()) { var(name, desc) = val.Data(); if (ImGui.Selectable(name, val == sortMode) && val != sortMode) { Penumbra.Config.SortMode = val; _window._selector.SetFilterDirty(); Penumbra.Config.Save(); } ImGuiUtil.HoverTooltip(desc); } } combo.Dispose(); ImGuiUtil.LabeledHelpMarker("Sort Mode", "Choose the sort mode for the mod selector in the mods tab."); }
private void DrawCurrentCollectionSelector() { DrawCollectionSelector("##current", _window._inputTextWidth.X, ModCollection.Type.Current, false, null); ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Current Collection", "This collection will be modified when using the Installed Mods tab and making changes. It does not apply to anything by itself."); }
// Absolute size in pixels. private void DrawAbsoluteSizeSelector() { if (ImGuiUtil.DragFloat("##absoluteSize", ref _absoluteSelectorSize, _window._inputTextWidth.X, 1, Configuration.Constants.MinAbsoluteSize, Configuration.Constants.MaxAbsoluteSize, "%.0f") && _absoluteSelectorSize != Penumbra.Config.ModSelectorAbsoluteSize) { Penumbra.Config.ModSelectorAbsoluteSize = _absoluteSelectorSize; Penumbra.Config.Save(); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Mod Selector Absolute Size", "The minimal absolute size of the mod selector in the mod tab in pixels."); }
private static void Checkbox(string label, string tooltip, bool current, Action <bool> setter) { using var id = ImRaii.PushId(label); var tmp = current; if (ImGui.Checkbox(string.Empty, ref tmp) && tmp != current) { setter(tmp); Penumbra.Config.Save(); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker(label, tooltip); }
private static void DrawShowAdvancedBox() { var showAdvanced = Penumbra.Config.ShowAdvanced; if (ImGui.Checkbox("##showAdvanced", ref showAdvanced)) { Penumbra.Config.ShowAdvanced = showAdvanced; Penumbra.Config.Save(); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Show Advanced Settings", "Enable some advanced options in this window and in the mod selector.\n" + "This is required to enable manually editing any mod information."); }
private void DrawDefaultModAuthor() { var tmp = Penumbra.Config.DefaultModAuthor; ImGui.SetNextItemWidth(_window._inputTextWidth.X); if (ImGui.InputText("##defaultAuthor", ref tmp, 64)) { Penumbra.Config.DefaultModAuthor = tmp; } if (ImGui.IsItemDeactivatedAfterEdit()) { Penumbra.Config.Save(); } ImGuiUtil.LabeledHelpMarker("Default Mod Author", "Set the default author stored for newly created mods."); }
private void DrawDefaultModImportFolder() { var tmp = Penumbra.Config.DefaultImportFolder; ImGui.SetNextItemWidth(_window._inputTextWidth.X); if (ImGui.InputText("##defaultImportFolder", ref tmp, 64)) { Penumbra.Config.DefaultImportFolder = tmp; } if (ImGui.IsItemDeactivatedAfterEdit()) { Penumbra.Config.Save(); } ImGuiUtil.LabeledHelpMarker("Default Mod Import Folder", "Set the default Penumbra mod folder to place newly imported mods into.\nLeave blank to import into Root."); }
private void DrawDefaultModImportPath() { var tmp = Penumbra.Config.DefaultModImportPath; var spacing = new Vector2(3 * ImGuiHelpers.GlobalScale); using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, spacing); ImGui.SetNextItemWidth(_window._inputTextWidth.X - _window._iconButtonSize.X - spacing.X); if (ImGui.InputText("##defaultModImport", ref tmp, 256)) { Penumbra.Config.DefaultModImportPath = tmp; } if (ImGui.IsItemDeactivatedAfterEdit()) { Penumbra.Config.Save(); } ImGui.SameLine(); if (ImGuiUtil.DrawDisabledButton($"{FontAwesomeIcon.Folder.ToIconString()}##import", _window._iconButtonSize, "Select a directory via dialog.", false, true)) { if (_dialogOpen) { _dialogManager.Reset(); _dialogOpen = false; } else { var startDir = Directory.Exists(Penumbra.Config.ModDirectory) ? Penumbra.Config.ModDirectory : "."; _dialogManager.OpenFolderDialog("Choose Default Import Directory", (b, s) => { Penumbra.Config.DefaultModImportPath = b ? s : Penumbra.Config.DefaultModImportPath; Penumbra.Config.Save(); _dialogOpen = false; }, startDir); _dialogOpen = true; } } style.Pop(); ImGuiUtil.LabeledHelpMarker("Default Mod Import Directory", "Set the directory that gets opened when using the file picker to import mods for the first time."); }
// Should only be used for debugging. private static void DrawEnableFullResourceLoggingBox() { var tmp = Penumbra.Config.EnableFullResourceLogging; if (ImGui.Checkbox("##fullLogging", ref tmp) && tmp != Penumbra.Config.EnableFullResourceLogging) { if (tmp) { Penumbra.ResourceLoader.EnableFullLogging(); } else { Penumbra.ResourceLoader.DisableFullLogging(); } Penumbra.Config.EnableFullResourceLogging = tmp; Penumbra.Config.Save(); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Enable Full Resource Logging", "[DEBUG] Enable the logging of all ResourceLoader events indiscriminately."); }
// Creates and destroys the web server when toggled. private void DrawEnableHttpApiBox() { var http = Penumbra.Config.EnableHttpApi; if (ImGui.Checkbox("##http", ref http)) { if (http) { _window._penumbra.CreateWebServer(); } else { _window._penumbra.ShutdownWebServer(); } Penumbra.Config.EnableHttpApi = http; Penumbra.Config.Save(); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Enable HTTP API", "Enables other applications, e.g. Anamnesis, to use some Penumbra functions, like requesting redraws."); }
// Relative size toggle and percentage. private void DrawRelativeSizeSelector() { var scaleModSelector = Penumbra.Config.ScaleModSelector; if (ImGui.Checkbox("Scale Mod Selector With Window Size", ref scaleModSelector)) { Penumbra.Config.ScaleModSelector = scaleModSelector; Penumbra.Config.Save(); } ImGui.SameLine(); if (ImGuiUtil.DragInt("##relativeSize", ref _relativeSelectorSize, _window._inputTextWidth.X - ImGui.GetCursorPosX(), 0.1f, Configuration.Constants.MinScaledSize, Configuration.Constants.MaxScaledSize, "%i%%") && _relativeSelectorSize != Penumbra.Config.ModSelectorScaledSize) { Penumbra.Config.ModSelectorScaledSize = _relativeSelectorSize; Penumbra.Config.Save(); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Mod Selector Relative Size", "Instead of keeping the mod-selector in the Installed Mods tab a fixed width, this will let it scale with the total size of the Penumbra window."); }
// Draw a priority input. // Priority is changed on deactivation of the input box. private void DrawPriorityInput() { var priority = _currentPriority ?? _settings.Priority; ImGui.SetNextItemWidth(50 * ImGuiHelpers.GlobalScale); if (ImGui.InputInt("##Priority", ref priority, 0, 0)) { _currentPriority = priority; } if (ImGui.IsItemDeactivatedAfterEdit() && _currentPriority.HasValue) { if (_currentPriority != _settings.Priority) { Penumbra.CollectionManager.Current.SetModPriority(_mod.Index, _currentPriority.Value); } _currentPriority = null; } ImGuiUtil.LabeledHelpMarker("Priority", "Mods with higher priority take precedence before Mods with lower priority.\n" + "That means, if Mod A should overwrite changes from Mod B, Mod A should have higher priority than Mod B."); }
// Should only be used for debugging. private static void DrawEnableDebugModeBox() { var tmp = Penumbra.Config.DebugMode; if (ImGui.Checkbox("##debugMode", ref tmp) && tmp != Penumbra.Config.DebugMode) { if (tmp) { Penumbra.ResourceLoader.EnableDebug(); } else { Penumbra.ResourceLoader.DisableDebug(); } Penumbra.Config.DebugMode = tmp; Penumbra.Config.Save(); } ImGui.SameLine(); ImGuiUtil.LabeledHelpMarker("Enable Debug Mode", "[DEBUG] Enable the Debug Tab and Resource Manager Tab as well as some additional data collection. Also open the config window on plugin load."); }