Redesign character areas a bit

This commit is contained in:
RisaDev
2024-10-23 23:20:53 +03:00
parent 8d3da5e3a2
commit 466602c03a
2 changed files with 138 additions and 118 deletions

View File

@@ -154,10 +154,14 @@ public class ProfilePanel
ImGui.Separator();
var isShouldDraw = ImGui.CollapsingHeader("Character settings");
var isShouldDraw = ImGui.CollapsingHeader("Add character");
if (isShouldDraw)
DrawCharacterArea();
DrawAddCharactersArea();
ImGui.Separator();
DrawCharacterListArea();
ImGui.Separator();
@@ -242,7 +246,7 @@ public class ProfilePanel
}
}
private void DrawCharacterArea()
private void DrawAddCharactersArea()
{
using (var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f)))
{
@@ -285,9 +289,11 @@ public class ProfilePanel
if (ImGuiUtil.DrawDisabledButton("Apply to selected NPC", buttonWidth, string.Empty, !_actorAssignmentUi.CanSetNpc))
_manager.AddCharacter(_selector.Selected!, _actorAssignmentUi.NpcIdentifier);
}
}
}
ImGui.Separator();
private void DrawCharacterListArea()
{
var isDefaultLP = _manager.DefaultLocalPlayerProfile == _selector.Selected;
var isDefaultLPOrCurrentProfilesEnabled = (_manager.DefaultLocalPlayerProfile?.Enabled ?? false) || (_selector.Selected?.Enabled ?? false);
using (ImRaii.Disabled(isDefaultLPOrCurrentProfilesEnabled))
@@ -306,6 +312,11 @@ public class ProfilePanel
ImGuiUtil.HoverTooltip("Can only be changed when both currently selected and profile where this checkbox is checked are disabled.");
}
ImGui.SameLine();
using(ImRaii.Disabled(true))
ImGui.Button("##splitter", new Vector2(1, ImGui.GetFrameHeight()));
ImGui.SameLine();
var isDefault = _manager.DefaultProfile == _selector.Selected;
var isDefaultOrCurrentProfilesEnabled = (_manager.DefaultProfile?.Enabled ?? false) || (_selector.Selected?.Enabled ?? false);
using (ImRaii.Disabled(isDefaultOrCurrentProfilesEnabled))
@@ -323,11 +334,12 @@ public class ProfilePanel
ImGui.PopStyleColor();
ImGuiUtil.HoverTooltip("Can only be changed when both currently selected and profile where this checkbox is checked are disabled.");
}
bool appliesToMultiple = _manager.DefaultProfile == _selector.Selected || _manager.DefaultLocalPlayerProfile == _selector.Selected;
ImGui.Separator();
using var dis = ImRaii.Disabled(appliesToMultiple);
using var table = ImRaii.Table("CharacterTable", 2, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY, new Vector2(ImGui.GetContentRegionAvail().X, 150));
using var table = ImRaii.Table("CharacterTable", 2, ImGuiTableFlags.RowBg | ImGuiTableFlags.ScrollX | ImGuiTableFlags.ScrollY, new Vector2(ImGui.GetContentRegionAvail().X, 200));
if (!table)
return;
@@ -344,7 +356,6 @@ public class ProfilePanel
return;
}
//warn: .ToList() might be performance critical at some point
//the copying via ToList is done because manipulations with .Templates list result in "Collection was modified" exception here
var charas = _selector.Selected!.Characters.WithIndex().ToList();
@@ -402,7 +413,6 @@ public class ProfilePanel
"Several profiles are trying to affect this character. This profile is being applied.");
}
}
}
_endAction?.Invoke();
_endAction = null;

View File

@@ -101,7 +101,21 @@ public class BoneEditorPanel
using (var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f)))
{
var isShouldDraw = ImGui.CollapsingHeader("Preview settings");
string characterText = null!;
if (_templateFileSystemSelector.IncognitoMode)
characterText = "Previewing on: incognito active";
else
characterText = _editorManager.Character.IsValid ? $"Previewing on: {(_editorManager.Character.Type == Penumbra.GameData.Enums.IdentifierType.Owned ?
_editorManager.Character.ToNameWithoutOwnerName() : _editorManager.Character.ToString())}" : "No valid character selected";
ImGuiUtil.PrintIcon(FontAwesomeIcon.User);
ImGui.SameLine();
ImGui.Text(characterText);
ImGui.Separator();
var isShouldDraw = ImGui.CollapsingHeader("Change preview character");
if (isShouldDraw)
{
@@ -111,10 +125,6 @@ public class BoneEditorPanel
{
if (!_templateFileSystemSelector.IncognitoMode)
{
ImGui.Text(_editorManager.Character.IsValid ? $"Applies to {(_editorManager.Character.Type == Penumbra.GameData.Enums.IdentifierType.Owned ?
_editorManager.Character.ToNameWithoutOwnerName() : _editorManager.Character.ToString())}" : "No valid character selected");
ImGui.Separator();
_actorAssignmentUi.DrawWorldCombo(width.X / 2);
ImGui.SameLine();
_actorAssignmentUi.DrawPlayerInput(width.X / 2);