Пример #1
0
        // Draw a tab to iterate over the main resource maps and see what resources are currently loaded.
        public void Draw()
        {
            if (!Penumbra.Config.DebugMode)
            {
                return;
            }

            using var tab = ImRaii.TabItem("Resource Manager");
            if (!tab)
            {
                return;
            }

            // Filter for resources containing the input string.
            ImGui.SetNextItemWidth(-1);
            ImGui.InputTextWithHint("##resourceFilter", "Filter...", ref _resourceManagerFilter, Utf8GamePath.MaxGamePathLength);

            using var child = ImRaii.Child("##ResourceManagerTab", -Vector2.One);
            if (!child)
            {
                return;
            }

            unsafe
            {
                ResourceLoader.IterateGraphs(DrawCategoryContainer);
            }
        }
Пример #2
0
        // Draw the whole settings tab as well as its contents.
        private void DrawSettingsTab()
        {
            using var tab = DrawTab(SettingsTabHeader, Tabs.Settings);
            if (!tab)
            {
                return;
            }

            using var child = ImRaii.Child("##settings");
            if (!child)
            {
                return;
            }

            DrawInheritedWarning();
            ImGui.Dummy(_window._defaultSpace);
            DrawEnabledInput();
            ImGui.SameLine();
            DrawPriorityInput();
            DrawRemoveSettings();
            ImGui.Dummy(_window._defaultSpace);
            for (var idx = 0; idx < _mod.Groups.Count; ++idx)
            {
                DrawSingleGroup(_mod.Groups[idx], idx);
            }

            ImGui.Dummy(_window._defaultSpace);
            for (var idx = 0; idx < _mod.Groups.Count; ++idx)
            {
                DrawMultiGroup(_mod.Groups[idx], idx);
            }
        }
Пример #3
0
        // Draw the edit tab that contains all things concerning editing the mod.
        private void DrawEditModTab()
        {
            using var tab = DrawTab(EditModTabHeader, Tabs.Edit);
            if (!tab)
            {
                return;
            }

            using var child = ImRaii.Child("##editChild", -Vector2.One);
            if (!child)
            {
                return;
            }

            _cellPadding = ImGui.GetStyle().CellPadding with {
                X = 2 * ImGuiHelpers.GlobalScale
            };
            _itemSpacing = ImGui.GetStyle().CellPadding with {
                X = 4 * ImGuiHelpers.GlobalScale
            };

            EditButtons();
            EditRegularMeta();
            ImGui.Dummy(_window._defaultSpace);

            if (Input.Text("Mod Path", Input.Path, Input.None, _leaf.FullName(), out var newPath, 256,
                           _window._inputTextWidth.X))
            {
                try
                {
                    _window._penumbra.ModFileSystem.RenameAndMove(_leaf, newPath);
                }
                catch (Exception e)
                {
                    PluginLog.Warning(e.Message);
                }
            }

            ImGui.Dummy(_window._defaultSpace);
            AddOptionGroup.Draw(_window, _mod);
            ImGui.Dummy(_window._defaultSpace);

            for (var groupIdx = 0; groupIdx < _mod.Groups.Count; ++groupIdx)
            {
                EditGroup(groupIdx);
            }

            EndActions();
            DescriptionEdit.DrawPopup(_window);
        }
Пример #4
0
        // Just a simple text box with the wrapped description, if it exists.
        private void DrawDescriptionTab()
        {
            using var tab = DrawTab(DescriptionTabHeader, Tabs.Description);
            if (!tab)
            {
                return;
            }

            using var child = ImRaii.Child("##description");
            if (!child)
            {
                return;
            }

            ImGui.TextWrapped(_mod.Description);
        }
Пример #5
0
    private void DrawMetaTab()
    {
        using var tab = ImRaii.TabItem("Meta Manipulations");
        if (!tab)
        {
            return;
        }

        DrawOptionSelectHeader();

        var setsEqual = !_editor !.Meta.Changes;
        var tt        = setsEqual ? "No changes staged." : "Apply the currently staged changes to the option.";

        ImGui.NewLine();
        if (ImGuiUtil.DrawDisabledButton("Apply Changes", Vector2.Zero, tt, setsEqual))
        {
            _editor.ApplyManipulations();
        }

        ImGui.SameLine();
        tt = setsEqual ? "No changes staged." : "Revert all currently staged changes.";
        if (ImGuiUtil.DrawDisabledButton("Revert Changes", Vector2.Zero, tt, setsEqual))
        {
            _editor.RevertManipulations();
        }

        ImGui.SameLine();
        AddFromClipboardButton();
        ImGui.SameLine();
        SetFromClipboardButton();
        ImGui.SameLine();
        CopyToClipboardButton("Copy all current manipulations to clipboard.", _iconSize, _editor.Meta.Recombine());

        using var child = ImRaii.Child("##meta", -Vector2.One, true);
        if (!child)
        {
            return;
        }

        DrawEditHeader(_editor.Meta.Eqp, "Equipment Parameter Edits (EQP)###EQP", 5, EqpRow.Draw, EqpRow.DrawNew);
        DrawEditHeader(_editor.Meta.Eqdp, "Racial Model Edits (EQDP)###EQDP", 7, EqdpRow.Draw, EqdpRow.DrawNew);
        DrawEditHeader(_editor.Meta.Imc, "Variant Edits (IMC)###IMC", 9, ImcRow.Draw, ImcRow.DrawNew);
        DrawEditHeader(_editor.Meta.Est, "Extra Skeleton Parameters (EST)###EST", 7, EstRow.Draw, EstRow.DrawNew);
        DrawEditHeader(_editor.Meta.Gmp, "Visor/Gimmick Edits (GMP)###GMP", 7, GmpRow.Draw, GmpRow.DrawNew);
        DrawEditHeader(_editor.Meta.Rsp, "Racial Scaling Edits (RSP)###RSP", 5, RspRow.Draw, RspRow.DrawNew);
    }
Пример #6
0
    private void DrawModsTab()
    {
        if (!Penumbra.ModManager.Valid)
        {
            return;
        }

        try
        {
            using var tab = ImRaii.TabItem("Mods");
            if (!tab)
            {
                return;
            }

            _selector.Draw(GetModSelectorSize());
            ImGui.SameLine();
            using var group = ImRaii.Group();
            DrawHeaderLine();

            using var child = ImRaii.Child("##ModsTabMod", -Vector2.One, true, ImGuiWindowFlags.HorizontalScrollbar);
            if (child)
            {
                _modPanel.Draw(_selector);
            }
        }
        catch (Exception e)
        {
            PluginLog.Error($"Exception thrown during ModPanel Render:\n{e}");
            PluginLog.Error($"{Penumbra.ModManager.Count} Mods\n"
                            + $"{Penumbra.CollectionManager.Current.Name} Current Collection\n"
                            + $"{Penumbra.CollectionManager.Current.Settings.Count} Settings\n"
                            + $"{_selector.SortMode} Sort Mode\n"
                            + $"{_selector.SelectedLeaf?.Name ?? "NULL"} Selected Leaf\n"
                            + $"{_selector.Selected?.Name     ?? "NULL"} Selected Mod\n"
                            + $"{string.Join( ", ", Penumbra.CollectionManager.Current.Inheritance )} Inheritances\n"
                            + $"{_selector.SelectedSettingCollection.Name} Collection\n");
        }
    }
Пример #7
0
        // Draw the effective tab if ShowAdvanced is on.
        public void Draw()
        {
            if (!Penumbra.Config.ShowAdvanced)
            {
                return;
            }

            using var tab = ImRaii.TabItem("Effective Changes");
            if (!tab)
            {
                return;
            }

            SetupEffectiveSizes();
            DrawFilters();
            using var child = ImRaii.Child("##EffectiveChangesTab", -Vector2.One, false);
            if (!child)
            {
                return;
            }

            var height = ImGui.GetTextLineHeightWithSpacing() + 2 * ImGui.GetStyle().CellPadding.Y;
            var skips  = ImGuiClip.GetNecessarySkips(height);

            using var table = ImRaii.Table("##EffectiveChangesTable", 3, ImGuiTableFlags.RowBg);
            if (!table)
            {
                return;
            }

            ImGui.TableSetupColumn("##gamePath", ImGuiTableColumnFlags.WidthFixed, _effectiveLeftTextLength);
            ImGui.TableSetupColumn(string.Empty, ImGuiTableColumnFlags.WidthFixed, _effectiveArrowLength);
            ImGui.TableSetupColumn("##file", ImGuiTableColumnFlags.WidthFixed, _effectiveRightTextLength);

            DrawEffectiveRows(Penumbra.CollectionManager.Current, skips, height,
                              _effectiveFilePathFilter.Length > 0 || _effectiveGamePathFilter.Length > 0);
        }
Пример #8
0
        public void Draw()
        {
            if (!Penumbra.Config.DebugMode)
            {
                return;
            }

            using var tab = ImRaii.TabItem("Debug");
            if (!tab)
            {
                return;
            }

            using var child = ImRaii.Child("##DebugTab", -Vector2.One);
            if (!child)
            {
                return;
            }

            DrawDebugTabGeneral();
            ImGui.NewLine();
            DrawDebugTabReplacedResources();
            ImGui.NewLine();
            DrawPathResolverDebug();
            ImGui.NewLine();
            DrawDebugCharacterUtility();
            ImGui.NewLine();
            DrawDebugResidentResources();
            ImGui.NewLine();
            DrawResourceProblems();
            ImGui.NewLine();
            DrawPlayerModelInfo();
            ImGui.NewLine();
            DrawDebugTabIpc();
            ImGui.NewLine();
        }
Пример #9
0
        public void Draw()
        {
            using var tab = ImRaii.TabItem("Settings");
            if (!tab)
            {
                return;
            }

            using var child = ImRaii.Child("##SettingsTab", -Vector2.One, false);
            if (!child)
            {
                return;
            }

            DrawEnabledBox();
            DrawShowAdvancedBox();
            Checkbox("Fix Main Window", "Prevent the main window from being resized or moved.", Penumbra.Config.FixMainWindow, v =>
            {
                Penumbra.Config.FixMainWindow = v;
                _window.Flags = v
                    ? _window.Flags | ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize
                    : _window.Flags & ~(ImGuiWindowFlags.NoMove | ImGuiWindowFlags.NoResize);
            });

            ImGui.NewLine();
            DrawRootFolder();
            DrawRediscoverButton();
            ImGui.NewLine();

            DrawModSelectorSettings();
            DrawColorSettings();
            DrawAdvancedSettings();

            _dialogManager.Draw();
            DrawSupportButtons();
        }
    // Draw a simple clipped table containing all changed items.
    private void DrawChangedItemTab()
    {
        // Functions in here for less pollution.
        bool FilterChangedItem(KeyValuePair <string, (SingleArray <IMod>, object?)> item)
        => (_changedItemFilter.IsEmpty ||
            ChangedItemName(item.Key, item.Value.Item2)
            .Contains(_changedItemFilter.Lower, StringComparison.InvariantCultureIgnoreCase)) &&
        (_changedItemModFilter.IsEmpty || item.Value.Item1.Any(m => m.Name.Contains(_changedItemModFilter)));

        void DrawChangedItemColumn(KeyValuePair <string, (SingleArray <IMod>, object?)> item)
        {
            ImGui.TableNextColumn();
            DrawChangedItem(item.Key, item.Value.Item2, false);
            ImGui.TableNextColumn();
            if (item.Value.Item1.Count > 0)
            {
                ImGui.TextUnformatted(item.Value.Item1[0].Name);
                if (item.Value.Item1.Count > 1)
                {
                    ImGuiUtil.HoverTooltip(string.Join("\n", item.Value.Item1.Skip(1).Select(m => m.Name)));
                }
            }

            ImGui.TableNextColumn();
            if (item.Value.Item2 is Item it)
            {
                using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.ItemId.Value());
                ImGuiUtil.RightAlign($"({( ( Quad )it.ModelMain ).A})");
            }
        }

        using var tab = ImRaii.TabItem("Changed Items");
        if (!tab)
        {
            return;
        }

        // Draw filters.
        var varWidth = ImGui.GetContentRegionAvail().X
                       - 400 * ImGuiHelpers.GlobalScale
                       - ImGui.GetStyle().ItemSpacing.X;

        ImGui.SetNextItemWidth(400 * ImGuiHelpers.GlobalScale);
        LowerString.InputWithHint("##changedItemsFilter", "Filter Item...", ref _changedItemFilter, 128);
        ImGui.SameLine();
        ImGui.SetNextItemWidth(varWidth);
        LowerString.InputWithHint("##changedItemsModFilter", "Filter Mods...", ref _changedItemModFilter, 128);

        using var child = ImRaii.Child("##changedItemsChild", -Vector2.One);
        if (!child)
        {
            return;
        }

        // Draw table of changed items.
        var height = ImGui.GetTextLineHeightWithSpacing() + 2 * ImGui.GetStyle().CellPadding.Y;
        var skips  = ImGuiClip.GetNecessarySkips(height);

        using var list = ImRaii.Table("##changedItems", 3, ImGuiTableFlags.RowBg, -Vector2.One);
        if (!list)
        {
            return;
        }

        const ImGuiTableColumnFlags flags = ImGuiTableColumnFlags.NoResize | ImGuiTableColumnFlags.WidthFixed;

        ImGui.TableSetupColumn("items", flags, 400 * ImGuiHelpers.GlobalScale);
        ImGui.TableSetupColumn("mods", flags, varWidth - 100 * ImGuiHelpers.GlobalScale);
        ImGui.TableSetupColumn("id", flags, 100 * ImGuiHelpers.GlobalScale);

        var items = Penumbra.CollectionManager.Current.ChangedItems;
        var rest  = _changedItemFilter.IsEmpty && _changedItemModFilter.IsEmpty
            ? ImGuiClip.ClippedDraw(items, skips, DrawChangedItemColumn, items.Count)
            : ImGuiClip.FilteredClippedDraw(items, skips, FilterChangedItem, DrawChangedItemColumn);

        ImGuiClip.DrawEndDummy(rest, height);
    }