From cc122c6b7b4f4546444f652c8c2f431773b6bdff Mon Sep 17 00:00:00 2001 From: RisaDev <151885272+RisaDev@users.noreply.github.com> Date: Sun, 4 Feb 2024 23:11:38 +0300 Subject: [PATCH] Do not lock UI in GPose --- .../UI/Windows/Controls/PluginStateBlock.cs | 2 +- .../MainWindow/Tabs/Profiles/ProfilePanel.cs | 47 ++++++++----------- .../Tabs/Templates/TemplatePanel.cs | 5 +- 3 files changed, 22 insertions(+), 32 deletions(-) diff --git a/CustomizePlus/UI/Windows/Controls/PluginStateBlock.cs b/CustomizePlus/UI/Windows/Controls/PluginStateBlock.cs index e70dacf..889bbed 100644 --- a/CustomizePlus/UI/Windows/Controls/PluginStateBlock.cs +++ b/CustomizePlus/UI/Windows/Controls/PluginStateBlock.cs @@ -54,7 +54,7 @@ public class PluginStateBlock else if (_gameStateService.GameInPosingMode()) { severity = PluginStateSeverity.Warning; - message = $"GPose active. Most editor features are unavailable while you're in this mode."; + message = $"GPose active. Compatibility with posing tools is limited."; } else if (!_configuration.PluginEnabled) { diff --git a/CustomizePlus/UI/Windows/MainWindow/Tabs/Profiles/ProfilePanel.cs b/CustomizePlus/UI/Windows/MainWindow/Tabs/Profiles/ProfilePanel.cs index d5bf9b2..f540652 100644 --- a/CustomizePlus/UI/Windows/MainWindow/Tabs/Profiles/ProfilePanel.cs +++ b/CustomizePlus/UI/Windows/MainWindow/Tabs/Profiles/ProfilePanel.cs @@ -20,7 +20,6 @@ public class ProfilePanel private readonly ProfileManager _manager; private readonly PluginConfiguration _configuration; private readonly TemplateCombo _templateCombo; - private readonly GameStateService _gameStateService; private string? _newName; private string? _newCharacterName; @@ -37,14 +36,12 @@ public class ProfilePanel ProfileFileSystemSelector selector, ProfileManager manager, PluginConfiguration configuration, - TemplateCombo templateCombo, - GameStateService gameStateService) + TemplateCombo templateCombo) { _selector = selector; _manager = manager; _configuration = configuration; _templateCombo = templateCombo; - _gameStateService = gameStateService; } public void Draw() @@ -197,40 +194,36 @@ public class ProfilePanel name = _newCharacterName ?? _selector.Selected!.CharacterName; ImGui.SetNextItemWidth(width.X); - using (var disabled = ImRaii.Disabled(_gameStateService.GameInPosingMode())) + if (!_selector.IncognitoMode) { - if (!_selector.IncognitoMode) + if (ImGui.InputText("##CharacterName", ref name, 128)) { - if (ImGui.InputText("##CharacterName", ref name, 128)) - { - _newCharacterName = name; - _changedProfile = _selector.Selected; - } - - if (ImGui.IsItemDeactivatedAfterEdit() && _changedProfile != null) - { - _manager.ChangeCharacterName(_changedProfile, name); - _newCharacterName = null; - _changedProfile = null; - } + _newCharacterName = name; + _changedProfile = _selector.Selected; } - else - ImGui.TextUnformatted("Incognito active"); - ImGui.SameLine(); - var enabled = _selector.Selected?.LimitLookupToOwnedObjects ?? false; - if (ImGui.Checkbox("##LimitLookupToOwnedObjects", ref enabled)) - _manager.SetLimitLookupToOwned(_selector.Selected!, enabled); - ImGuiUtil.LabeledHelpMarker("Limit to my creatures", - "When enabled limits the character search to only your own summons, mounts and minions.\nUseful when there is possibility there will be another character with that name owned by another player.\n* For battle chocobo use \"Chocobo\" as character name.\n** If you are changing root scale for mount and want to keep your scale make sure your own scale is set to anything other than default value."); + if (ImGui.IsItemDeactivatedAfterEdit() && _changedProfile != null) + { + _manager.ChangeCharacterName(_changedProfile, name); + _newCharacterName = null; + _changedProfile = null; + } } + else + ImGui.TextUnformatted("Incognito active"); + + ImGui.SameLine(); + var enabled = _selector.Selected?.LimitLookupToOwnedObjects ?? false; + if (ImGui.Checkbox("##LimitLookupToOwnedObjects", ref enabled)) + _manager.SetLimitLookupToOwned(_selector.Selected!, enabled); + ImGuiUtil.LabeledHelpMarker("Limit to my creatures", + "When enabled limits the character search to only your own summons, mounts and minions.\nUseful when there is possibility there will be another character with that name owned by another player.\n* For battle chocobo use \"Chocobo\" as character name.\n** If you are changing root scale for mount and want to keep your scale make sure your own scale is set to anything other than default value."); } } } private void DrawTemplateArea() { - using var disabled = ImRaii.Disabled(_gameStateService.GameInPosingMode()); using var table = ImRaii.Table("SetTable", 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY); if (!table) return; diff --git a/CustomizePlus/UI/Windows/MainWindow/Tabs/Templates/TemplatePanel.cs b/CustomizePlus/UI/Windows/MainWindow/Tabs/Templates/TemplatePanel.cs index 84525c1..ead6ed8 100644 --- a/CustomizePlus/UI/Windows/MainWindow/Tabs/Templates/TemplatePanel.cs +++ b/CustomizePlus/UI/Windows/MainWindow/Tabs/Templates/TemplatePanel.cs @@ -22,7 +22,6 @@ public class TemplatePanel { private readonly TemplateFileSystemSelector _selector; private readonly TemplateManager _manager; - private readonly GameStateService _gameStateService; private readonly BoneEditorPanel _boneEditor; private readonly PluginConfiguration _configuration; private readonly MessageService _messageService; @@ -38,7 +37,6 @@ public class TemplatePanel public TemplatePanel( TemplateFileSystemSelector selector, TemplateManager manager, - GameStateService gameStateService, BoneEditorPanel boneEditor, PluginConfiguration configuration, MessageService messageService, @@ -47,7 +45,6 @@ public class TemplatePanel { _selector = selector; _manager = manager; - _gameStateService = gameStateService; _boneEditor = boneEditor; _configuration = configuration; _messageService = messageService; @@ -173,7 +170,7 @@ public class TemplatePanel { if (ImGuiUtil.DrawDisabledButton($"{(_boneEditor.IsEditorActive ? "Finish" : "Start")} bone editing", Vector2.Zero, "Toggle the bone editor for this template", - (_selector.Selected?.IsWriteProtected ?? true) || _gameStateService.GameInPosingMode() || !_configuration.PluginEnabled)) + (_selector.Selected?.IsWriteProtected ?? true) || !_configuration.PluginEnabled)) { if (!_boneEditor.IsEditorActive) _boneEditor.EnableEditor(_selector.Selected!);