This commit is contained in:
Ottermandias 2023-06-20 18:54:33 +02:00
parent d1d369a56b
commit 65ce391051
19 changed files with 757 additions and 158 deletions

View file

@ -75,7 +75,7 @@ public class ActorPanel
if (!child || _state == null)
return;
if (_customizationDrawer.Draw(_state.Data.Customize, false))
if (_customizationDrawer.Draw(_state.ModelData.Customize, false))
{
}
// if (_currentData.Valid)

View file

@ -41,6 +41,8 @@ public unsafe class DebugTab : ITab
private readonly DesignManager _designManager;
private readonly DesignFileSystem _designFileSystem;
private readonly PenumbraChangedItemTooltip _penumbraTooltip;
private readonly StateManager _state;
private int _gameObjectIndex;
@ -51,7 +53,8 @@ public unsafe class DebugTab : ITab
public DebugTab(ChangeCustomizeService changeCustomizeService, VisorService visorService, ObjectTable objects,
UpdateSlotService updateSlotService, WeaponService weaponService, PenumbraService penumbra,
ActorService actors, ItemManager items, CustomizationService customization, ObjectManager objectManager,
DesignFileSystem designFileSystem, DesignManager designManager, StateManager state, Configuration config)
DesignFileSystem designFileSystem, DesignManager designManager, StateManager state, Configuration config,
PenumbraChangedItemTooltip penumbraTooltip)
{
_changeCustomizeService = changeCustomizeService;
_visorService = visorService;
@ -67,6 +70,7 @@ public unsafe class DebugTab : ITab
_designManager = designManager;
_state = state;
_config = config;
_penumbraTooltip = penumbraTooltip;
}
public ReadOnlySpan<byte> Label
@ -434,6 +438,23 @@ public unsafe class DebugTab : ITab
if (ImGui.SmallButton("Redraw"))
_penumbra.RedrawObject(_objects.GetObjectAddress(_gameObjectIndex), RedrawType.Redraw);
}
ImGuiUtil.DrawTableColumn("Last Tooltip Date");
ImGuiUtil.DrawTableColumn(_penumbraTooltip.LastTooltip > DateTime.MinValue ? _penumbraTooltip.LastTooltip.ToLongTimeString() : "Never");
ImGui.TableNextColumn();
ImGuiUtil.DrawTableColumn("Last Click Date");
ImGuiUtil.DrawTableColumn(_penumbraTooltip.LastClick > DateTime.MinValue ? _penumbraTooltip.LastClick.ToLongTimeString() : "Never");
ImGui.TableNextColumn();
ImGui.Separator();
ImGui.Separator();
foreach (var (slot, item) in _penumbraTooltip.LastItems)
{
ImGuiUtil.DrawTableColumn($"{slot.ToName()} Revert-Item");
ImGuiUtil.DrawTableColumn(item.Valid ? item.Name : "None");
ImGui.TableNextColumn();
}
}
#endregion
@ -990,7 +1011,7 @@ public unsafe class DebugTab : ITab
continue;
if (_state.GetOrCreate(identifier, actors.Objects[0], out var state))
DrawDesignData(state.Data);
DrawDesignData(state.ModelData);
else
ImGui.TextUnformatted("Invalid actor.");
}
@ -1006,7 +1027,7 @@ public unsafe class DebugTab : ITab
{
using var t = ImRaii.TreeNode(identifier.ToString());
if (t)
DrawDesignData(state.Data);
DrawDesignData(state.ModelData);
}
}

View file

@ -35,6 +35,21 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
_event.Unsubscribe(OnDesignChange);
}
public override ISortMode<Design> SortMode
=> _config.SortMode;
protected override uint ExpandedFolderColor
=> ColorId.FolderExpanded.Value();
protected override uint CollapsedFolderColor
=> ColorId.FolderCollapsed.Value();
protected override uint FolderLineColor
=> ColorId.FolderLine.Value();
protected override bool FoldersDefaultOpen
=> _config.OpenFoldersByDefault;
private void OnDesignChange(DesignChanged.Type type, Design design, object? oldData)
{
switch (type)

View file

@ -1,10 +1,10 @@
using System;
using System.Numerics;
using System.Runtime.CompilerServices;
using Dalamud.Interface;
using Glamourer.Gui.Tabs.DesignTab;
using Glamourer.State;
using ImGuiNET;
using OtterGui;
using OtterGui.Classes;
using OtterGui.Raii;
using OtterGui.Widgets;
@ -12,10 +12,16 @@ namespace Glamourer.Gui.Tabs;
public class SettingsTab : ITab
{
private readonly Configuration _config;
private readonly Configuration _config;
private readonly DesignFileSystemSelector _selector;
private readonly StateListener _stateListener;
public SettingsTab(Configuration config)
=> _config = config;
public SettingsTab(Configuration config, DesignFileSystemSelector selector, StateListener stateListener)
{
_config = config;
_selector = selector;
_stateListener = stateListener;
}
public ReadOnlySpan<byte> Label
=> "Settings"u8;
@ -25,7 +31,7 @@ public class SettingsTab : ITab
using var child = ImRaii.Child("MainWindowChild");
if (!child)
return;
Checkbox("Enabled", "Enable main functionality of keeping and applying state.", _stateListener.Enabled, _stateListener.Enable);
Checkbox("Restricted Gear Protection",
"Use gender- and race-appropriate models when detecting certain items not available for a characters current gender and race.",
_config.UseRestrictedGearProtection, v => _config.UseRestrictedGearProtection = v);
@ -33,6 +39,10 @@ public class SettingsTab : ITab
"A modifier you need to hold while clicking the Delete Design button for it to take effect.", 100 * ImGuiHelpers.GlobalScale,
_config.DeleteDesignModifier, v => _config.DeleteDesignModifier = v))
_config.Save();
DrawFolderSortType();
Checkbox("Auto-Open Design Folders",
"Have design folders open or closed as their default state after launching.", _config.OpenFoldersByDefault,
v => _config.OpenFoldersByDefault = v);
Checkbox("Debug Mode", "Show the debug tab. Only useful for debugging or advanced use.", _config.DebugMode, v => _config.DebugMode = v);
DrawColorSettings();
@ -70,4 +80,28 @@ public class SettingsTab : ITab
ImGui.SameLine();
ImGuiUtil.LabeledHelpMarker(label, tooltip);
}
/// <summary> Different supported sort modes as a combo. </summary>
private void DrawFolderSortType()
{
var sortMode = _config.SortMode;
ImGui.SetNextItemWidth(300 * ImGuiHelpers.GlobalScale);
using (var combo = ImRaii.Combo("##sortMode", sortMode.Name))
{
if (combo)
foreach (var val in Configuration.Constants.ValidSortModes)
{
if (ImGui.Selectable(val.Name, val.GetType() == sortMode.GetType()) && val.GetType() != sortMode.GetType())
{
_config.SortMode = val;
_selector.SetFilterDirty();
_config.Save();
}
ImGuiUtil.HoverTooltip(val.Description);
}
}
ImGuiUtil.LabeledHelpMarker("Sort Mode", "Choose the sort mode for the mod selector in the designs tab.");
}
}