mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2026-02-18 21:47:44 +01:00
.
This commit is contained in:
parent
5e6f797af4
commit
803fd1b247
16 changed files with 521 additions and 132 deletions
|
|
@ -3,11 +3,13 @@ using System.Collections.Generic;
|
|||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Dalamud.Game.ClientState.Objects;
|
||||
using Dalamud.Interface;
|
||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Events;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Interop.Penumbra;
|
||||
using Glamourer.Interop.Structs;
|
||||
|
|
@ -854,11 +856,81 @@ public unsafe class DebugTab : ITab
|
|||
}
|
||||
}
|
||||
|
||||
public void DrawState(ActorData data, ActorState state)
|
||||
{
|
||||
using var table = ImRaii.Table("##state", 7, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit);
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
ImGuiUtil.DrawTableColumn("Name");
|
||||
ImGuiUtil.DrawTableColumn(state.Identifier.ToString());
|
||||
ImGui.TableNextColumn();
|
||||
if (ImGui.Button("Reset"))
|
||||
_state.ResetState(state);
|
||||
|
||||
ImGui.TableNextRow();
|
||||
|
||||
static void PrintRow<T>(string label, T actor, T model, StateChanged.Source source) where T : notnull
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(label);
|
||||
ImGuiUtil.DrawTableColumn(actor.ToString()!);
|
||||
ImGuiUtil.DrawTableColumn(model.ToString()!);
|
||||
ImGuiUtil.DrawTableColumn(source.ToString());
|
||||
}
|
||||
|
||||
static string ItemString(in DesignData data, EquipSlot slot)
|
||||
{
|
||||
var item = data.Item(slot);
|
||||
return $"{item.Name} ({item.ModelId.Value}{(item.WeaponType != 0 ? $"-{item.WeaponType.Value}" : string.Empty)}-{item.Variant})";
|
||||
}
|
||||
|
||||
PrintRow("Model ID", state.BaseData.ModelId, state.ModelData.ModelId, state[ActorState.MetaFlag.ModelId]);
|
||||
ImGui.TableNextRow();
|
||||
PrintRow("Wetness", state.BaseData.IsWet(), state.ModelData.IsWet(), state[ActorState.MetaFlag.Wetness]);
|
||||
ImGui.TableNextRow();
|
||||
|
||||
if (state.BaseData.ModelId == 0 && state.ModelData.ModelId == 0)
|
||||
{
|
||||
PrintRow("Hat Visible", state.BaseData.IsHatVisible(), state.ModelData.IsHatVisible(), state[ActorState.MetaFlag.HatState]);
|
||||
ImGui.TableNextRow();
|
||||
PrintRow("Visor Toggled", state.BaseData.IsVisorToggled(), state.ModelData.IsVisorToggled(),
|
||||
state[ActorState.MetaFlag.VisorState]);
|
||||
ImGui.TableNextRow();
|
||||
PrintRow("Weapon Visible", state.BaseData.IsWeaponVisible(), state.ModelData.IsWeaponVisible(),
|
||||
state[ActorState.MetaFlag.WeaponState]);
|
||||
ImGui.TableNextRow();
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots.Prepend(EquipSlot.OffHand).Prepend(EquipSlot.MainHand))
|
||||
{
|
||||
PrintRow(slot.ToName(), ItemString(state.BaseData, slot), ItemString(state.ModelData, slot), state[slot, false]);
|
||||
ImGuiUtil.DrawTableColumn(state.BaseData.Stain(slot).Value.ToString());
|
||||
ImGuiUtil.DrawTableColumn(state.ModelData.Stain(slot).Value.ToString());
|
||||
ImGuiUtil.DrawTableColumn(state[slot, true].ToString());
|
||||
}
|
||||
|
||||
foreach (var type in Enum.GetValues<CustomizeIndex>())
|
||||
{
|
||||
PrintRow(type.ToDefaultName(), state.BaseData.Customize[type].Value, state.ModelData.Customize[type].Value, state[type]);
|
||||
ImGui.TableNextRow();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ImGuiUtil.DrawTableColumn(string.Join(" ", state.BaseData.GetCustomizeBytes().Select(b => b.ToString("X2"))));
|
||||
ImGuiUtil.DrawTableColumn(string.Join(" ", state.ModelData.GetCustomizeBytes().Select(b => b.ToString("X2"))));
|
||||
ImGui.TableNextRow();
|
||||
ImGuiUtil.DrawTableColumn(string.Join(" ", state.BaseData.GetEquipmentBytes().Select(b => b.ToString("X2"))));
|
||||
ImGuiUtil.DrawTableColumn(string.Join(" ", state.ModelData.GetEquipmentBytes().Select(b => b.ToString("X2"))));
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawDesignData(in DesignData data)
|
||||
{
|
||||
if (data.ModelId == 0)
|
||||
{
|
||||
using var table = ImRaii.Table("##equip", 4, ImGuiTableFlags.RowBg | ImGuiTableFlags.SizingFixedFit);
|
||||
if (!table)
|
||||
return;
|
||||
|
||||
foreach (var slot in EquipSlotExtensions.EqdpSlots.Prepend(EquipSlot.OffHand).Prepend(EquipSlot.MainHand))
|
||||
{
|
||||
var item = data.Item(slot);
|
||||
|
|
@ -1011,7 +1083,7 @@ public unsafe class DebugTab : ITab
|
|||
continue;
|
||||
|
||||
if (_state.GetOrCreate(identifier, actors.Objects[0], out var state))
|
||||
DrawDesignData(state.ModelData);
|
||||
DrawState(actors, state);
|
||||
else
|
||||
ImGui.TextUnformatted("Invalid actor.");
|
||||
}
|
||||
|
|
@ -1026,8 +1098,10 @@ public unsafe class DebugTab : ITab
|
|||
foreach (var (identifier, state) in _state.Where(kvp => !_objectManager.ContainsKey(kvp.Key)))
|
||||
{
|
||||
using var t = ImRaii.TreeNode(identifier.ToString());
|
||||
if (t)
|
||||
DrawDesignData(state.ModelData);
|
||||
if (!t)
|
||||
return;
|
||||
|
||||
DrawState(ActorData.Invalid, state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,21 +1,44 @@
|
|||
using System.Numerics;
|
||||
using Glamourer.Customization;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.Interop.Penumbra;
|
||||
using Glamourer.State;
|
||||
using Glamourer.Structs;
|
||||
using ImGuiNET;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.Api.Enums;
|
||||
using Penumbra.Api.Helpers;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DesignTab;
|
||||
|
||||
public class DesignPanel
|
||||
{
|
||||
private readonly ObjectManager _objects;
|
||||
private readonly DesignFileSystemSelector _selector;
|
||||
private readonly DesignManager _manager;
|
||||
private readonly CustomizationDrawer _customizationDrawer;
|
||||
private readonly StateManager _state;
|
||||
private readonly PenumbraService _penumbra;
|
||||
private readonly UpdateSlotService _updateSlot;
|
||||
private readonly WeaponService _weaponService;
|
||||
private readonly ChangeCustomizeService _changeCustomizeService;
|
||||
|
||||
public DesignPanel(DesignFileSystemSelector selector, CustomizationDrawer customizationDrawer, DesignManager manager)
|
||||
public DesignPanel(DesignFileSystemSelector selector, CustomizationDrawer customizationDrawer, DesignManager manager, ObjectManager objects,
|
||||
StateManager state, PenumbraService penumbra, ChangeCustomizeService changeCustomizeService, WeaponService weaponService,
|
||||
UpdateSlotService updateSlot)
|
||||
{
|
||||
_selector = selector;
|
||||
_customizationDrawer = customizationDrawer;
|
||||
_manager = manager;
|
||||
_selector = selector;
|
||||
_customizationDrawer = customizationDrawer;
|
||||
_manager = manager;
|
||||
_objects = objects;
|
||||
_state = state;
|
||||
_penumbra = penumbra;
|
||||
_changeCustomizeService = changeCustomizeService;
|
||||
_weaponService = weaponService;
|
||||
_updateSlot = updateSlot;
|
||||
}
|
||||
|
||||
public void Draw()
|
||||
|
|
@ -28,6 +51,14 @@ public class DesignPanel
|
|||
if (!child)
|
||||
return;
|
||||
|
||||
if (ImGui.Button("TEST"))
|
||||
{
|
||||
var (id, data) = _objects.PlayerData;
|
||||
|
||||
if (data.Valid && _state.GetOrCreate(id, data.Objects[0], out var state))
|
||||
_state.ApplyDesign(design, state);
|
||||
}
|
||||
|
||||
_customizationDrawer.Draw(design.DesignData.Customize, design.WriteProtected());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Gui.Tabs.DesignTab;
|
||||
using Glamourer.Interop.Penumbra;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
|
|
@ -15,12 +16,14 @@ public class SettingsTab : ITab
|
|||
private readonly Configuration _config;
|
||||
private readonly DesignFileSystemSelector _selector;
|
||||
private readonly StateListener _stateListener;
|
||||
private readonly PenumbraAutoRedraw _autoRedraw;
|
||||
|
||||
public SettingsTab(Configuration config, DesignFileSystemSelector selector, StateListener stateListener)
|
||||
public SettingsTab(Configuration config, DesignFileSystemSelector selector, StateListener stateListener, PenumbraAutoRedraw autoRedraw)
|
||||
{
|
||||
_config = config;
|
||||
_selector = selector;
|
||||
_config = config;
|
||||
_selector = selector;
|
||||
_stateListener = stateListener;
|
||||
_autoRedraw = autoRedraw;
|
||||
}
|
||||
|
||||
public ReadOnlySpan<byte> Label
|
||||
|
|
@ -31,10 +34,14 @@ 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);
|
||||
Checkbox("Auto-Reload Gear",
|
||||
"Automatically reload equipment pieces on your own character when changing any mod options in Penumbra in their associated collection.",
|
||||
_config.AutoRedrawEquipOnChanges, _autoRedraw.SetState);
|
||||
if (Widget.DoubleModifierSelector("Design Deletion Modifier",
|
||||
"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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue