Do not lock UI in GPose

This commit is contained in:
RisaDev
2024-02-04 23:11:38 +03:00
parent 6aa64e43ef
commit cc122c6b7b
3 changed files with 22 additions and 32 deletions

View File

@@ -54,7 +54,7 @@ public class PluginStateBlock
else if (_gameStateService.GameInPosingMode()) else if (_gameStateService.GameInPosingMode())
{ {
severity = PluginStateSeverity.Warning; 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) else if (!_configuration.PluginEnabled)
{ {

View File

@@ -20,7 +20,6 @@ public class ProfilePanel
private readonly ProfileManager _manager; private readonly ProfileManager _manager;
private readonly PluginConfiguration _configuration; private readonly PluginConfiguration _configuration;
private readonly TemplateCombo _templateCombo; private readonly TemplateCombo _templateCombo;
private readonly GameStateService _gameStateService;
private string? _newName; private string? _newName;
private string? _newCharacterName; private string? _newCharacterName;
@@ -37,14 +36,12 @@ public class ProfilePanel
ProfileFileSystemSelector selector, ProfileFileSystemSelector selector,
ProfileManager manager, ProfileManager manager,
PluginConfiguration configuration, PluginConfiguration configuration,
TemplateCombo templateCombo, TemplateCombo templateCombo)
GameStateService gameStateService)
{ {
_selector = selector; _selector = selector;
_manager = manager; _manager = manager;
_configuration = configuration; _configuration = configuration;
_templateCombo = templateCombo; _templateCombo = templateCombo;
_gameStateService = gameStateService;
} }
public void Draw() public void Draw()
@@ -197,8 +194,6 @@ public class ProfilePanel
name = _newCharacterName ?? _selector.Selected!.CharacterName; name = _newCharacterName ?? _selector.Selected!.CharacterName;
ImGui.SetNextItemWidth(width.X); 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))
@@ -226,11 +221,9 @@ public class ProfilePanel
} }
} }
} }
}
private void DrawTemplateArea() private void DrawTemplateArea()
{ {
using var disabled = ImRaii.Disabled(_gameStateService.GameInPosingMode());
using var table = ImRaii.Table("SetTable", 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY); using var table = ImRaii.Table("SetTable", 3, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY);
if (!table) if (!table)
return; return;

View File

@@ -22,7 +22,6 @@ public class TemplatePanel
{ {
private readonly TemplateFileSystemSelector _selector; private readonly TemplateFileSystemSelector _selector;
private readonly TemplateManager _manager; private readonly TemplateManager _manager;
private readonly GameStateService _gameStateService;
private readonly BoneEditorPanel _boneEditor; private readonly BoneEditorPanel _boneEditor;
private readonly PluginConfiguration _configuration; private readonly PluginConfiguration _configuration;
private readonly MessageService _messageService; private readonly MessageService _messageService;
@@ -38,7 +37,6 @@ public class TemplatePanel
public TemplatePanel( public TemplatePanel(
TemplateFileSystemSelector selector, TemplateFileSystemSelector selector,
TemplateManager manager, TemplateManager manager,
GameStateService gameStateService,
BoneEditorPanel boneEditor, BoneEditorPanel boneEditor,
PluginConfiguration configuration, PluginConfiguration configuration,
MessageService messageService, MessageService messageService,
@@ -47,7 +45,6 @@ public class TemplatePanel
{ {
_selector = selector; _selector = selector;
_manager = manager; _manager = manager;
_gameStateService = gameStateService;
_boneEditor = boneEditor; _boneEditor = boneEditor;
_configuration = configuration; _configuration = configuration;
_messageService = messageService; _messageService = messageService;
@@ -173,7 +170,7 @@ public class TemplatePanel
{ {
if (ImGuiUtil.DrawDisabledButton($"{(_boneEditor.IsEditorActive ? "Finish" : "Start")} bone editing", Vector2.Zero, if (ImGuiUtil.DrawDisabledButton($"{(_boneEditor.IsEditorActive ? "Finish" : "Start")} bone editing", Vector2.Zero,
"Toggle the bone editor for this template", "Toggle the bone editor for this template",
(_selector.Selected?.IsWriteProtected ?? true) || _gameStateService.GameInPosingMode() || !_configuration.PluginEnabled)) (_selector.Selected?.IsWriteProtected ?? true) || !_configuration.PluginEnabled))
{ {
if (!_boneEditor.IsEditorActive) if (!_boneEditor.IsEditorActive)
_boneEditor.EnableEditor(_selector.Selected!); _boneEditor.EnableEditor(_selector.Selected!);