mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 18:27:24 +01:00
Add Incognito modifier.
This commit is contained in:
parent
2fdafc5c85
commit
c3b2443ab5
8 changed files with 37 additions and 19 deletions
|
|
@ -94,6 +94,7 @@ public class Configuration : IPluginConfiguration, ISavable, IService
|
||||||
public string QuickMoveFolder2 { get; set; } = string.Empty;
|
public string QuickMoveFolder2 { get; set; } = string.Empty;
|
||||||
public string QuickMoveFolder3 { get; set; } = string.Empty;
|
public string QuickMoveFolder3 { get; set; } = string.Empty;
|
||||||
public DoubleModifier DeleteModModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
public DoubleModifier DeleteModModifier { get; set; } = new(ModifierHotkey.Control, ModifierHotkey.Shift);
|
||||||
|
public DoubleModifier IncognitoModifier { get; set; } = new(ModifierHotkey.Control);
|
||||||
public bool PrintSuccessfulCommandsToChat { get; set; } = true;
|
public bool PrintSuccessfulCommandsToChat { get; set; } = true;
|
||||||
public bool AutoDeduplicateOnImport { get; set; } = true;
|
public bool AutoDeduplicateOnImport { get; set; } = true;
|
||||||
public bool AutoReduplicateUiOnImport { get; set; } = true;
|
public bool AutoReduplicateUiOnImport { get; set; } = true;
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@ public class EphemeralConfig : ISavable, IDisposable, IService
|
||||||
public string LastModPath { get; set; } = string.Empty;
|
public string LastModPath { get; set; } = string.Empty;
|
||||||
public bool AdvancedEditingOpen { get; set; } = false;
|
public bool AdvancedEditingOpen { get; set; } = false;
|
||||||
public bool ForceRedrawOnFileChange { get; set; } = false;
|
public bool ForceRedrawOnFileChange { get; set; } = false;
|
||||||
|
public bool IncognitoMode { get; set; } = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load the current configuration.
|
/// Load the current configuration.
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ using Dalamud.Hooking;
|
||||||
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
using FFXIVClientStructs.FFXIV.Client.Graphics.Scene;
|
||||||
using OtterGui.Classes;
|
using OtterGui.Classes;
|
||||||
using OtterGui.Services;
|
using OtterGui.Services;
|
||||||
using Penumbra.UI.AdvancedWindow;
|
|
||||||
|
|
||||||
namespace Penumbra.Interop.Hooks.Objects;
|
namespace Penumbra.Interop.Hooks.Objects;
|
||||||
|
|
||||||
|
|
@ -13,7 +12,7 @@ public sealed unsafe class CharacterBaseDestructor : EventWrapperPtr<CharacterBa
|
||||||
/// <seealso cref="PathResolving.DrawObjectState.OnCharacterBaseDestructor"/>
|
/// <seealso cref="PathResolving.DrawObjectState.OnCharacterBaseDestructor"/>
|
||||||
DrawObjectState = 0,
|
DrawObjectState = 0,
|
||||||
|
|
||||||
/// <seealso cref="ModEditWindow.MtrlTab.UnbindFromDrawObjectMaterialInstances"/>
|
/// <seealso cref="UI.AdvancedWindow.Materials.MtrlTab.UnbindFromDrawObjectMaterialInstances"/>
|
||||||
MtrlTab = -1000,
|
MtrlTab = -1000,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -42,7 +41,7 @@ public sealed unsafe class CharacterBaseDestructor : EventWrapperPtr<CharacterBa
|
||||||
|
|
||||||
private nint Detour(CharacterBase* characterBase)
|
private nint Detour(CharacterBase* characterBase)
|
||||||
{
|
{
|
||||||
Penumbra.Log.Verbose($"[{Name}] Triggered with 0x{(nint)characterBase:X}.");
|
Penumbra.Log.Excessive($"[{Name}] Triggered with 0x{(nint)characterBase:X}.");
|
||||||
Invoke(characterBase);
|
Invoke(characterBase);
|
||||||
return _task.Result.Original(characterBase);
|
return _task.Result.Original(characterBase);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public sealed unsafe class CharacterDestructor : EventWrapperPtr<Character, Char
|
||||||
|
|
||||||
private void Detour(Character* character)
|
private void Detour(Character* character)
|
||||||
{
|
{
|
||||||
Penumbra.Log.Verbose($"[{Name}] Triggered with 0x{(nint)character:X}.");
|
Penumbra.Log.Excessive($"[{Name}] Triggered with 0x{(nint)character:X}.");
|
||||||
Invoke(character);
|
Invoke(character);
|
||||||
_task.Result.Original(character);
|
_task.Result.Original(character);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ public partial class MtrlTab
|
||||||
var hasDkLabel = !string.IsNullOrEmpty(dkData?.Label);
|
var hasDkLabel = !string.IsNullOrEmpty(dkData?.Label);
|
||||||
|
|
||||||
var sampler = Mtrl.GetOrAddSampler(textureId, dkData?.DefaultTexture ?? string.Empty, out var samplerIndex);
|
var sampler = Mtrl.GetOrAddSampler(textureId, dkData?.DefaultTexture ?? string.Empty, out var samplerIndex);
|
||||||
Textures.Add((hasDkLabel ? dkData!.Label : shpkTexture.Value.Name, sampler.TextureIndex, samplerIndex,
|
Textures.Add((hasDkLabel ? dkData!.Label : shpkTexture!.Value.Name, sampler.TextureIndex, samplerIndex,
|
||||||
dkData?.Description ?? string.Empty, !hasDkLabel));
|
dkData?.Description ?? string.Empty, !hasDkLabel));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,7 +161,7 @@ public partial class MtrlTab
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui.TableNextColumn();
|
ImGui.TableNextColumn();
|
||||||
using (var font = ImRaii.PushFont(UiBuilder.MonoFont, monoFont))
|
using (ImRaii.PushFont(UiBuilder.MonoFont, monoFont))
|
||||||
{
|
{
|
||||||
ImGui.AlignTextToFramePadding();
|
ImGui.AlignTextToFramePadding();
|
||||||
if (description.Length > 0)
|
if (description.Length > 0)
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ public class CollectionSelectHeader : IUiService
|
||||||
|
|
||||||
private void DrawTemporaryCheckbox()
|
private void DrawTemporaryCheckbox()
|
||||||
{
|
{
|
||||||
var hold = _config.DeleteModModifier.IsActive();
|
var hold = _config.IncognitoModifier.IsActive();
|
||||||
using (ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, ImUtf8.GlobalScale))
|
using (ImRaii.PushStyle(ImGuiStyleVar.FrameBorderSize, ImUtf8.GlobalScale))
|
||||||
{
|
{
|
||||||
var tint = ImGuiCol.Text.Tinted(ColorId.TemporaryModSettingsTint);
|
var tint = ImGuiCol.Text.Tinted(ColorId.TemporaryModSettingsTint);
|
||||||
|
|
@ -77,9 +77,9 @@ public class CollectionSelectHeader : IUiService
|
||||||
}
|
}
|
||||||
|
|
||||||
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled,
|
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled,
|
||||||
"Toggle the temporary settings mode, where all changes you do create temporary settings first and need to be made permanent if desired.\n"u8);
|
"Toggle the temporary settings mode, where all changes you do create temporary settings first and need to be made permanent if desired."u8);
|
||||||
if (!hold)
|
if (!hold)
|
||||||
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"Hold {_config.DeleteModModifier} while clicking to toggle.");
|
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"\nHold {_config.IncognitoModifier} while clicking to toggle.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum CollectionState
|
private enum CollectionState
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Dalamud.Interface;
|
using Dalamud.Interface;
|
||||||
|
using ImGuiNET;
|
||||||
using Penumbra.UI.Classes;
|
using Penumbra.UI.Classes;
|
||||||
using OtterGui.Raii;
|
using OtterGui.Raii;
|
||||||
using OtterGui.Services;
|
using OtterGui.Services;
|
||||||
|
|
@ -6,19 +7,27 @@ using OtterGui.Text;
|
||||||
|
|
||||||
namespace Penumbra.UI;
|
namespace Penumbra.UI;
|
||||||
|
|
||||||
public class IncognitoService(TutorialService tutorial) : IService
|
public class IncognitoService(TutorialService tutorial, Configuration config) : IService
|
||||||
{
|
{
|
||||||
public bool IncognitoMode;
|
public bool IncognitoMode
|
||||||
|
=> config.Ephemeral.IncognitoMode;
|
||||||
|
|
||||||
public void DrawToggle(float width)
|
public void DrawToggle(float width)
|
||||||
{
|
{
|
||||||
|
var hold = config.IncognitoModifier.IsActive();
|
||||||
var color = ColorId.FolderExpanded.Value();
|
var color = ColorId.FolderExpanded.Value();
|
||||||
using (ImRaii.PushFrameBorder(ImUtf8.GlobalScale, color))
|
using (ImRaii.PushFrameBorder(ImUtf8.GlobalScale, color))
|
||||||
{
|
{
|
||||||
var tt = IncognitoMode ? "Toggle incognito mode off."u8 : "Toggle incognito mode on."u8;
|
var tt = IncognitoMode ? "Toggle incognito mode off."u8 : "Toggle incognito mode on."u8;
|
||||||
var icon = IncognitoMode ? FontAwesomeIcon.EyeSlash : FontAwesomeIcon.Eye;
|
var icon = IncognitoMode ? FontAwesomeIcon.EyeSlash : FontAwesomeIcon.Eye;
|
||||||
if (ImUtf8.IconButton(icon, tt, new Vector2(width, ImUtf8.FrameHeight), false, color))
|
if (ImUtf8.IconButton(icon, tt, new Vector2(width, ImUtf8.FrameHeight), false, color) && hold)
|
||||||
IncognitoMode = !IncognitoMode;
|
{
|
||||||
|
config.Ephemeral.IncognitoMode = !IncognitoMode;
|
||||||
|
config.Ephemeral.Save();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hold)
|
||||||
|
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, $"\nHold {config.IncognitoModifier} while clicking to toggle.");
|
||||||
}
|
}
|
||||||
|
|
||||||
tutorial.OpenTutorial(BasicTutorialSteps.Incognito);
|
tutorial.OpenTutorial(BasicTutorialSteps.Incognito);
|
||||||
|
|
|
||||||
|
|
@ -621,6 +621,14 @@ public class SettingsTab : ITab, IUiService
|
||||||
_config.DeleteModModifier = v;
|
_config.DeleteModModifier = v;
|
||||||
_config.Save();
|
_config.Save();
|
||||||
});
|
});
|
||||||
|
Widget.DoubleModifierSelector("Incognito Modifier",
|
||||||
|
"A modifier you need to hold while clicking the Incognito or Temporary Settings Mode button for it to take effect.", UiHelpers.InputTextWidth.X,
|
||||||
|
_config.IncognitoModifier,
|
||||||
|
v =>
|
||||||
|
{
|
||||||
|
_config.IncognitoModifier = v;
|
||||||
|
_config.Save();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Draw all settings pertaining to import and export of mods. </summary>
|
/// <summary> Draw all settings pertaining to import and export of mods. </summary>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue