mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
.
This commit is contained in:
parent
c505286220
commit
5e410d8786
9 changed files with 148 additions and 54 deletions
|
|
@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.2.32210.308
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GlamourerOld", "GlamourerOld\GlamourerOld.csproj", "{A5439F6B-83C1-4078-9371-354A147FF554}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{383AEE76-D423-431C-893A-7AB3DEA13630}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
.editorconfig = .editorconfig
|
||||
|
|
@ -25,10 +23,6 @@ Global
|
|||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{A5439F6B-83C1-4078-9371-354A147FF554}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A5439F6B-83C1-4078-9371-354A147FF554}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A5439F6B-83C1-4078-9371-354A147FF554}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A5439F6B-83C1-4078-9371-354A147FF554}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{51F4DDB0-1FA0-4629-9CFE-C55B6062907B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{51F4DDB0-1FA0-4629-9CFE-C55B6062907B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{51F4DDB0-1FA0-4629-9CFE-C55B6062907B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ public class Configuration : IPluginConfiguration, ISavable
|
|||
public bool OpenFoldersByDefault { get; set; } = false;
|
||||
public bool AutoRedrawEquipOnChanges { get; set; } = false;
|
||||
public bool EnableAutoDesigns { get; set; } = true;
|
||||
public bool IncognitoMode { get; set; } = false;
|
||||
public MainWindow.TabType SelectedTab { get; set; } = MainWindow.TabType.Settings;
|
||||
public DoubleModifier DeleteDesignModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,6 +35,9 @@ public class Design : ISavable
|
|||
|
||||
internal DesignData DesignData;
|
||||
|
||||
public string Incognito
|
||||
=> Identifier.ToString()[..8];
|
||||
|
||||
/// <summary> Unconditionally apply a design to a designdata. </summary>
|
||||
/// <returns>Whether a redraw is required for the changes to take effect.</returns>
|
||||
public (bool, CustomizeFlag, EquipFlag) ApplyDesign(ref DesignData data)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Events;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Gui.Equipment;
|
||||
|
|
@ -36,42 +37,52 @@ public class ActorPanel
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
if (!_selector.HasSelection)
|
||||
return;
|
||||
|
||||
(_identifier, _data) = _selector.Selection;
|
||||
if (_data.Valid)
|
||||
{
|
||||
_actorName = _data.Label;
|
||||
_actor = _data.Objects[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
_actorName = _identifier.ToString();
|
||||
_actor = Actor.Null;
|
||||
}
|
||||
|
||||
if (!_stateManager.GetOrCreate(_identifier, _actor, out _state))
|
||||
return;
|
||||
|
||||
using var group = ImRaii.Group();
|
||||
(_identifier, _data) = _selector.Selection;
|
||||
(_actorName, _actor) = GetHeaderName();
|
||||
DrawHeader();
|
||||
DrawPanel();
|
||||
}
|
||||
|
||||
private void DrawHeader()
|
||||
{
|
||||
var color = _data.Valid ? ColorId.ActorAvailable.Value() : ColorId.ActorUnavailable.Value();
|
||||
var frameHeight = ImGui.GetFrameHeightWithSpacing();
|
||||
var color = !_identifier.IsValid ? ImGui.GetColorU32(ImGuiCol.Text) : _data.Valid ? ColorId.ActorAvailable.Value() : ColorId.ActorUnavailable.Value();
|
||||
var buttonColor = ImGui.GetColorU32(ImGuiCol.FrameBg);
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
|
||||
.Push(ImGuiStyleVar.FrameRounding, 0);
|
||||
ImGuiUtil.DrawTextButton($"{(_data.Valid ? _data.Label : _identifier.ToString())}##playerHeader", -Vector2.UnitX, buttonColor, color);
|
||||
ImGuiUtil.DrawTextButton($"{_actorName}##playerHeader", new Vector2(-frameHeight, ImGui.GetFrameHeight()), buttonColor, color);
|
||||
ImGui.SameLine();
|
||||
style.Push(ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale);
|
||||
using (var c = ImRaii.PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value())
|
||||
.Push(ImGuiCol.Border, ColorId.FolderExpanded.Value()))
|
||||
{
|
||||
if (ImGuiUtil.DrawDisabledButton(
|
||||
$"{(_selector.IncognitoMode ? FontAwesomeIcon.Eye : FontAwesomeIcon.EyeSlash).ToIconString()}###IncognitoMode",
|
||||
new Vector2(frameHeight, ImGui.GetFrameHeight()), string.Empty, false, true))
|
||||
_selector.IncognitoMode = !_selector.IncognitoMode;
|
||||
}
|
||||
|
||||
var hovered = ImGui.IsItemHovered();
|
||||
if (hovered)
|
||||
ImGui.SetTooltip(_selector.IncognitoMode ? "Toggle incognito mode off." : "Toggle incognito mode on.");
|
||||
}
|
||||
|
||||
private (string, Actor) GetHeaderName()
|
||||
{
|
||||
if (!_identifier.IsValid)
|
||||
return ("No Selection", Actor.Null);
|
||||
|
||||
if (_data.Valid)
|
||||
return (_selector.IncognitoMode ? _identifier.Incognito(_data.Label) : _data.Label, _data.Objects[0]);
|
||||
|
||||
return (_selector.IncognitoMode ? _identifier.Incognito(null) : _identifier.ToString(), Actor.Null);
|
||||
}
|
||||
|
||||
private unsafe void DrawPanel()
|
||||
{
|
||||
using var child = ImRaii.Child("##ActorPanel", -Vector2.One, true);
|
||||
if (!child || _state == null)
|
||||
using var child = ImRaii.Child("##Panel", -Vector2.One, true);
|
||||
if (!child || !_selector.HasSelection || !_stateManager.GetOrCreate(_identifier, _actor, out _state))
|
||||
return;
|
||||
|
||||
if (_customizationDrawer.Draw(_state.ModelData.Customize, false))
|
||||
|
|
|
|||
|
|
@ -16,17 +16,29 @@ namespace Glamourer.Gui.Tabs.ActorTab;
|
|||
|
||||
public class ActorSelector
|
||||
{
|
||||
private readonly Configuration _config;
|
||||
private readonly ObjectManager _objects;
|
||||
private readonly ActorService _actors;
|
||||
private readonly TargetManager _targets;
|
||||
|
||||
private ActorIdentifier _identifier = ActorIdentifier.Invalid;
|
||||
|
||||
public ActorSelector(ObjectManager objects, TargetManager targets, ActorService actors)
|
||||
public ActorSelector(ObjectManager objects, TargetManager targets, ActorService actors, Configuration config)
|
||||
{
|
||||
_objects = objects;
|
||||
_targets = targets;
|
||||
_actors = actors;
|
||||
_config = config;
|
||||
}
|
||||
|
||||
public bool IncognitoMode
|
||||
{
|
||||
get => _config.IncognitoMode;
|
||||
set
|
||||
{
|
||||
_config.IncognitoMode = value;
|
||||
_config.Save();
|
||||
}
|
||||
}
|
||||
|
||||
private LowerString _actorFilter = LowerString.Empty;
|
||||
|
|
@ -55,7 +67,7 @@ public class ActorSelector
|
|||
|
||||
private void DrawSelector()
|
||||
{
|
||||
using var child = ImRaii.Child("##actorSelector", new Vector2(_width, -ImGui.GetFrameHeight()), true);
|
||||
using var child = ImRaii.Child("##Selector", new Vector2(_width, -ImGui.GetFrameHeight()), true);
|
||||
if (!child)
|
||||
return;
|
||||
|
||||
|
|
@ -72,7 +84,7 @@ public class ActorSelector
|
|||
private void DrawSelectable(KeyValuePair<ActorIdentifier, ActorData> pair)
|
||||
{
|
||||
var equals = pair.Key.Equals(_identifier);
|
||||
if (ImGui.Selectable(pair.Value.Label, equals) && !equals)
|
||||
if (ImGui.Selectable(IncognitoMode ? pair.Key.Incognito(pair.Value.Label) : pair.Value.Label, equals) && !equals)
|
||||
_identifier = pair.Key.CreatePermanent();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,9 +40,6 @@ public class SetPanel
|
|||
|
||||
public void Draw()
|
||||
{
|
||||
if (!_selector.HasSelection)
|
||||
return;
|
||||
|
||||
using var group = ImRaii.Group();
|
||||
DrawHeader();
|
||||
DrawPanel();
|
||||
|
|
@ -51,15 +48,28 @@ public class SetPanel
|
|||
private void DrawHeader()
|
||||
{
|
||||
var buttonColor = ImGui.GetColorU32(ImGuiCol.FrameBg);
|
||||
var frameHeight = ImGui.GetFrameHeightWithSpacing();
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
|
||||
.Push(ImGuiStyleVar.FrameRounding, 0);
|
||||
ImGuiUtil.DrawTextButton(Selection.Name, -Vector2.UnitX, buttonColor);
|
||||
ImGuiUtil.DrawTextButton(_selector.SelectionName, new Vector2(-frameHeight, ImGui.GetFrameHeight()), buttonColor);
|
||||
ImGui.SameLine();
|
||||
style.Push(ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale);
|
||||
using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value())
|
||||
.Push(ImGuiCol.Border, ColorId.FolderExpanded.Value());
|
||||
if (ImGuiUtil.DrawDisabledButton(
|
||||
$"{(_selector.IncognitoMode ? FontAwesomeIcon.Eye : FontAwesomeIcon.EyeSlash).ToIconString()}###IncognitoMode",
|
||||
new Vector2(frameHeight, ImGui.GetFrameHeight()), string.Empty, false, true))
|
||||
_selector.IncognitoMode = !_selector.IncognitoMode;
|
||||
var hovered = ImGui.IsItemHovered();
|
||||
color.Pop(2);
|
||||
if (hovered)
|
||||
ImGui.SetTooltip(_selector.IncognitoMode ? "Toggle incognito mode off." : "Toggle incognito mode on.");
|
||||
}
|
||||
|
||||
private void DrawPanel()
|
||||
{
|
||||
using var child = ImRaii.Child("##SetPanel", -Vector2.One, true);
|
||||
if (!child)
|
||||
using var child = ImRaii.Child("##Panel", -Vector2.One, true);
|
||||
if (!child || !_selector.HasSelection)
|
||||
return;
|
||||
|
||||
var name = _tempName ?? Selection.Name;
|
||||
|
|
@ -104,7 +114,7 @@ public class SetPanel
|
|||
ImGui.Selectable($"#{idx + 1:D2}");
|
||||
DrawDragDrop(Selection, idx);
|
||||
ImGui.TableNextColumn();
|
||||
_designCombo.Draw(Selection, design, idx);
|
||||
_designCombo.Draw(Selection, design, idx, _selector.IncognitoMode);
|
||||
DrawDragDrop(Selection, idx);
|
||||
ImGui.TableNextColumn();
|
||||
DrawApplicationTypeBoxes(Selection, design, idx);
|
||||
|
|
@ -117,7 +127,7 @@ public class SetPanel
|
|||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextUnformatted("New");
|
||||
ImGui.TableNextColumn();
|
||||
_designCombo.Draw(Selection, null, -1);
|
||||
_designCombo.Draw(Selection, null, -1, _selector.IncognitoMode);
|
||||
ImGui.TableNextColumn();
|
||||
ImGui.TableNextColumn();
|
||||
|
||||
|
|
@ -219,11 +229,12 @@ public class SetPanel
|
|||
_manager = manager;
|
||||
}
|
||||
|
||||
public void Draw(AutoDesignSet set, AutoDesign? design, int autoDesignIndex)
|
||||
public void Draw(AutoDesignSet set, AutoDesign? design, int autoDesignIndex, bool incognito)
|
||||
{
|
||||
CurrentSelection = design?.Design ?? (Items.Count > 0 ? Items[0] : null);
|
||||
CurrentSelectionIdx = design?.Design.Index ?? (Items.Count > 0 ? 0 : -1);
|
||||
if (Draw("##design", CurrentSelection?.Name.Text ?? string.Empty, string.Empty, 220 * ImGuiHelpers.GlobalScale,
|
||||
var name = (incognito ? CurrentSelection?.Incognito : CurrentSelection?.Name.Text) ?? string.Empty;
|
||||
if (Draw("##design", name, string.Empty, 220 * ImGuiHelpers.GlobalScale,
|
||||
ImGui.GetTextLineHeight())
|
||||
&& CurrentSelection != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Automation;
|
||||
using Glamourer.Events;
|
||||
|
|
@ -12,7 +11,6 @@ using OtterGui;
|
|||
using OtterGui.Classes;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.String;
|
||||
using Vector2 = FFXIVClientStructs.FFXIV.Common.Math.Vector2;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.AutomationTab;
|
||||
|
||||
|
|
@ -28,7 +26,16 @@ public class SetSelector : IDisposable
|
|||
public AutoDesignSet? Selection { get; private set; }
|
||||
public int SelectionIndex { get; private set; } = -1;
|
||||
|
||||
private bool IncognitoMode;
|
||||
public bool IncognitoMode
|
||||
{
|
||||
get => _config.IncognitoMode;
|
||||
set
|
||||
{
|
||||
_config.IncognitoMode = value;
|
||||
_config.Save();
|
||||
}
|
||||
}
|
||||
|
||||
private int _dragIndex = -1;
|
||||
private Action? _endAction;
|
||||
|
||||
|
|
@ -47,6 +54,12 @@ public class SetSelector : IDisposable
|
|||
_event.Unsubscribe(OnAutomationChanged);
|
||||
}
|
||||
|
||||
public string SelectionName
|
||||
=> GetSetName(Selection, SelectionIndex);
|
||||
|
||||
public string GetSetName(AutoDesignSet? set, int index)
|
||||
=> set == null ? "No Selection" : IncognitoMode ? $"Auto Design Set #{index + 1}" : set.Name;
|
||||
|
||||
private void OnAutomationChanged(AutomationChanged.Type type, AutoDesignSet? set, object? data)
|
||||
{
|
||||
switch (type)
|
||||
|
|
@ -151,7 +164,7 @@ public class SetSelector : IDisposable
|
|||
|
||||
private void DrawSelector()
|
||||
{
|
||||
using var child = ImRaii.Child("##actorSelector", new Vector2(_width, -ImGui.GetFrameHeight()), true);
|
||||
using var child = ImRaii.Child("##Selector", new Vector2(_width, -ImGui.GetFrameHeight()), true);
|
||||
if (!child)
|
||||
return;
|
||||
|
||||
|
|
@ -169,13 +182,17 @@ public class SetSelector : IDisposable
|
|||
using var id = ImRaii.PushId(index);
|
||||
using (var color = ImRaii.PushColor(ImGuiCol.Text, set.Enabled ? ColorId.EnabledAutoSet.Value() : ColorId.DisabledAutoSet.Value()))
|
||||
{
|
||||
if (ImGui.Selectable(set.Name, set == Selection, ImGuiSelectableFlags.None, _selectableSize))
|
||||
if (ImGui.Selectable(GetSetName(set, index), set == Selection, ImGuiSelectableFlags.None, _selectableSize))
|
||||
{
|
||||
Selection = set;
|
||||
SelectionIndex = index;
|
||||
}
|
||||
}
|
||||
|
||||
var lineEnd = ImGui.GetItemRectMax();
|
||||
var lineStart = new Vector2(ImGui.GetItemRectMin().X, lineEnd.Y);
|
||||
ImGui.GetWindowDrawList().AddLine(lineStart, lineEnd, ImGui.GetColorU32(ImGuiCol.Border), ImGuiHelpers.GlobalScale);
|
||||
|
||||
DrawDragDrop(set, index);
|
||||
|
||||
var text = set.Identifier.ToString();
|
||||
|
|
@ -252,7 +269,7 @@ public class SetSelector : IDisposable
|
|||
if (source.Success && ImGui.SetDragDropPayload(dragDropLabel, nint.Zero, 0))
|
||||
{
|
||||
_dragIndex = index;
|
||||
ImGui.TextUnformatted($"Moving design set {set.Name} from position {index + 1}...");
|
||||
ImGui.TextUnformatted($"Moving design set {GetSetName(set, index)} from position {index + 1}...");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,9 +3,11 @@ using Dalamud.Game.ClientState.Keys;
|
|||
using Dalamud.Interface;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Events;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Filesystem;
|
||||
using OtterGui.FileSystem.Selector;
|
||||
using OtterGui.Raii;
|
||||
|
||||
namespace Glamourer.Gui.Tabs.DesignTab;
|
||||
|
||||
|
|
@ -15,6 +17,16 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
|||
private readonly DesignChanged _event;
|
||||
private readonly Configuration _config;
|
||||
|
||||
public bool IncognitoMode
|
||||
{
|
||||
get => _config.IncognitoMode;
|
||||
set
|
||||
{
|
||||
_config.IncognitoMode = value;
|
||||
_config.Save();
|
||||
}
|
||||
}
|
||||
|
||||
public struct DesignState
|
||||
{ }
|
||||
|
||||
|
|
@ -29,6 +41,13 @@ public sealed class DesignFileSystemSelector : FileSystemSelector<Design, Design
|
|||
AddButton(DeleteButton, 1000);
|
||||
}
|
||||
|
||||
protected override void DrawLeafName(FileSystem<Design>.Leaf leaf, in DesignState state, bool selected)
|
||||
{
|
||||
var flag = selected ? ImGuiTreeNodeFlags.Selected | LeafFlags : LeafFlags;
|
||||
var name = IncognitoMode ? leaf.Value.Incognito : leaf.Name;
|
||||
using var _ = ImRaii.TreeNode(name, flag);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
base.Dispose();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
using System.Numerics;
|
||||
using Dalamud.Interface;
|
||||
using Glamourer.Designs;
|
||||
using Glamourer.Gui.Customization;
|
||||
using Glamourer.Gui.Equipment;
|
||||
using Glamourer.Interop;
|
||||
using Glamourer.State;
|
||||
using ImGuiNET;
|
||||
using OtterGui;
|
||||
using OtterGui.Raii;
|
||||
using Penumbra.GameData.Enums;
|
||||
|
||||
|
|
@ -30,14 +32,38 @@ public class DesignPanel
|
|||
_equipmentDrawer = equipmentDrawer;
|
||||
}
|
||||
|
||||
private void DrawHeader()
|
||||
{
|
||||
var buttonColor = ImGui.GetColorU32(ImGuiCol.FrameBg);
|
||||
var frameHeight = ImGui.GetFrameHeightWithSpacing();
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero)
|
||||
.Push(ImGuiStyleVar.FrameRounding, 0);
|
||||
ImGuiUtil.DrawTextButton(SelectionName, new Vector2(-frameHeight, ImGui.GetFrameHeight()), buttonColor);
|
||||
ImGui.SameLine();
|
||||
style.Push(ImGuiStyleVar.FrameBorderSize, ImGuiHelpers.GlobalScale);
|
||||
using var color = ImRaii.PushColor(ImGuiCol.Text, ColorId.FolderExpanded.Value())
|
||||
.Push(ImGuiCol.Border, ColorId.FolderExpanded.Value());
|
||||
if (ImGuiUtil.DrawDisabledButton(
|
||||
$"{(_selector.IncognitoMode ? FontAwesomeIcon.Eye : FontAwesomeIcon.EyeSlash).ToIconString()}###IncognitoMode",
|
||||
new Vector2(frameHeight, ImGui.GetFrameHeight()), string.Empty, false, true))
|
||||
_selector.IncognitoMode = !_selector.IncognitoMode;
|
||||
var hovered = ImGui.IsItemHovered();
|
||||
color.Pop(2);
|
||||
if (hovered)
|
||||
ImGui.SetTooltip(_selector.IncognitoMode ? "Toggle incognito mode off." : "Toggle incognito mode on.");
|
||||
}
|
||||
|
||||
private string SelectionName
|
||||
=> _selector.Selected == null ? "No Selection" : _selector.IncognitoMode ? _selector.Selected.Incognito : _selector.Selected.Name.Text;
|
||||
|
||||
public void Draw()
|
||||
{
|
||||
var design = _selector.Selected;
|
||||
if (design == null)
|
||||
return;
|
||||
|
||||
using var child = ImRaii.Child("##panel", -Vector2.One, true);
|
||||
if (!child)
|
||||
using var group = ImRaii.Group();
|
||||
DrawHeader();
|
||||
|
||||
var design = _selector.Selected;
|
||||
using var child = ImRaii.Child("##Panel", -Vector2.One, true);
|
||||
if (!child || design == null)
|
||||
return;
|
||||
|
||||
if (ImGui.Button("TEST"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue