mirror of
https://github.com/Ottermandias/Glamourer.git
synced 2025-12-12 10:17:23 +01:00
Use current temporary settings for mod associations if they exist.
This commit is contained in:
parent
c83ddf054a
commit
60a1ee728a
4 changed files with 28 additions and 8 deletions
|
|
@ -118,7 +118,7 @@ public class EquipmentDrawer
|
|||
|
||||
public void DrawWeapons(EquipDrawData mainhand, EquipDrawData offhand, bool allWeapons)
|
||||
{
|
||||
if (mainhand.CurrentItem.PrimaryId.Id == 0)
|
||||
if (mainhand.CurrentItem.PrimaryId.Id == 0 && !allWeapons)
|
||||
return;
|
||||
|
||||
if (_config.HideApplyCheckmarks)
|
||||
|
|
|
|||
|
|
@ -149,12 +149,14 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
|||
ImUtf8.IconButton(FontAwesomeIcon.RedoAlt, "Update the settings of this mod association."u8);
|
||||
if (ImGui.IsItemHovered())
|
||||
{
|
||||
var newSettings = penumbra.GetModSettings(mod);
|
||||
var newSettings = penumbra.GetModSettings(mod, out var source);
|
||||
if (ImGui.IsItemClicked())
|
||||
updatedMod = (mod, newSettings);
|
||||
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.PopupBorderSize, 2 * ImGuiHelpers.GlobalScale);
|
||||
using var tt = ImUtf8.Tooltip();
|
||||
if (source.Length > 0)
|
||||
ImUtf8.Text($"Using temporary settings made by {source}.");
|
||||
ImGui.Separator();
|
||||
var namesDifferent = mod.Name != mod.DirectoryName;
|
||||
ImGui.Dummy(new Vector2(300 * ImGuiHelpers.GlobalScale, 0));
|
||||
|
|
@ -162,6 +164,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
|||
{
|
||||
if (namesDifferent)
|
||||
ImUtf8.Text("Directory Name"u8);
|
||||
ImUtf8.Text("Force Inherit"u8);
|
||||
ImUtf8.Text("Enabled"u8);
|
||||
ImUtf8.Text("Priority"u8);
|
||||
ModCombo.DrawSettingsLeft(newSettings);
|
||||
|
|
@ -173,6 +176,7 @@ public class ModAssociationsTab(PenumbraService penumbra, DesignFileSystemSelect
|
|||
if (namesDifferent)
|
||||
ImUtf8.Text(mod.DirectoryName);
|
||||
|
||||
ImUtf8.Text(newSettings.ForceInherit.ToString());
|
||||
ImUtf8.Text(newSettings.Enabled.ToString());
|
||||
ImUtf8.Text(newSettings.Priority.ToString());
|
||||
ModCombo.DrawSettingsRight(newSettings);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ public class PenumbraService : IDisposable
|
|||
public const int RequiredPenumbraBreakingVersion = 5;
|
||||
public const int RequiredPenumbraFeatureVersion = 3;
|
||||
public const int RequiredPenumbraFeatureVersionTemp = 4;
|
||||
public const int RequiredPenumbraFeatureVersionTemp2 = 5;
|
||||
|
||||
private const int Key = -1610;
|
||||
|
||||
|
|
@ -67,6 +68,7 @@ public class PenumbraService : IDisposable
|
|||
private global::Penumbra.Api.IpcSubscribers.RemoveTemporaryModSettingsPlayer? _removeTemporaryModSettingsPlayer;
|
||||
private global::Penumbra.Api.IpcSubscribers.RemoveAllTemporaryModSettings? _removeAllTemporaryModSettings;
|
||||
private global::Penumbra.Api.IpcSubscribers.RemoveAllTemporaryModSettingsPlayer? _removeAllTemporaryModSettingsPlayer;
|
||||
private global::Penumbra.Api.IpcSubscribers.QueryTemporaryModSettings? _queryTemporaryModSettings;
|
||||
private global::Penumbra.Api.IpcSubscribers.OpenMainWindow? _openModPage;
|
||||
|
||||
private readonly IDisposable _initializedEvent;
|
||||
|
|
@ -128,19 +130,30 @@ public class PenumbraService : IDisposable
|
|||
public Dictionary<Guid, string> GetCollections()
|
||||
=> Available ? _collections!.Invoke() : [];
|
||||
|
||||
public ModSettings GetModSettings(in Mod mod)
|
||||
public ModSettings GetModSettings(in Mod mod, out string source)
|
||||
{
|
||||
source = string.Empty;
|
||||
if (!Available)
|
||||
return ModSettings.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
var collection = _currentCollection!.Invoke(ApiCollectionType.Current);
|
||||
if (_queryTemporaryModSettings != null)
|
||||
{
|
||||
var tempEc = _queryTemporaryModSettings.Invoke(collection!.Value.Id, mod.DirectoryName, out var tempTuple, out source);
|
||||
if (tempEc is PenumbraApiEc.Success && tempTuple != null)
|
||||
return new ModSettings(tempTuple.Value.Settings, tempTuple.Value.Priority, tempTuple.Value.Enabled,
|
||||
tempTuple.Value.ForceInherit, false);
|
||||
}
|
||||
|
||||
var (ec, tuple) = _getCurrentSettings!.Invoke(collection!.Value.Id, mod.DirectoryName);
|
||||
if (ec is not PenumbraApiEc.Success)
|
||||
return ModSettings.Empty;
|
||||
|
||||
return tuple.HasValue ? new ModSettings(tuple.Value.Item3, tuple.Value.Item2, tuple.Value.Item1, false, false) : ModSettings.Empty;
|
||||
return tuple.HasValue
|
||||
? new ModSettings(tuple.Value.Item3, tuple.Value.Item2, tuple.Value.Item1, false, false)
|
||||
: ModSettings.Empty;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -441,6 +454,8 @@ public class PenumbraService : IDisposable
|
|||
_removeAllTemporaryModSettings = new global::Penumbra.Api.IpcSubscribers.RemoveAllTemporaryModSettings(_pluginInterface);
|
||||
_removeAllTemporaryModSettingsPlayer =
|
||||
new global::Penumbra.Api.IpcSubscribers.RemoveAllTemporaryModSettingsPlayer(_pluginInterface);
|
||||
if (CurrentMinor >= RequiredPenumbraFeatureVersionTemp2)
|
||||
_queryTemporaryModSettings = new global::Penumbra.Api.IpcSubscribers.QueryTemporaryModSettings(_pluginInterface);
|
||||
}
|
||||
|
||||
Available = true;
|
||||
|
|
@ -485,6 +500,7 @@ public class PenumbraService : IDisposable
|
|||
_removeTemporaryModSettingsPlayer = null;
|
||||
_removeAllTemporaryModSettings = null;
|
||||
_removeAllTemporaryModSettingsPlayer = null;
|
||||
_queryTemporaryModSettings = null;
|
||||
Available = false;
|
||||
Glamourer.Log.Debug("Glamourer detached from Penumbra.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit f60de67d24afe6e175f17d03cd234f493ea91265
|
||||
Subproject commit b4e716f86d94cd4d98d8f58e580ed5f619ea87ae
|
||||
Loading…
Add table
Add a link
Reference in a new issue