mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Prevent default-named collection from being renamed and always put it at the top of the selector.
Some checks failed
.NET Build / build (push) Has been cancelled
Some checks failed
.NET Build / build (push) Has been cancelled
This commit is contained in:
parent
6348c4a639
commit
97c8d82b33
2 changed files with 26 additions and 21 deletions
|
|
@ -11,6 +11,7 @@ using OtterGui;
|
|||
using OtterGui.Classes;
|
||||
using OtterGui.Extensions;
|
||||
using OtterGui.Raii;
|
||||
using OtterGui.Text;
|
||||
using Penumbra.Collections;
|
||||
using Penumbra.Collections.Manager;
|
||||
using Penumbra.GameData.Actors;
|
||||
|
|
@ -222,11 +223,11 @@ public sealed class CollectionPanel(
|
|||
ImGui.EndGroup();
|
||||
ImGui.SameLine();
|
||||
ImGui.BeginGroup();
|
||||
var width = ImGui.GetContentRegionAvail().X;
|
||||
using (ImRaii.Disabled(_collections.DefaultNamed == collection))
|
||||
{
|
||||
using var style = ImRaii.PushStyle(ImGuiStyleVar.ButtonTextAlign, new Vector2(0, 0.5f));
|
||||
var name = _newName ?? collection.Identity.Name;
|
||||
var identifier = collection.Identity.Identifier;
|
||||
var width = ImGui.GetContentRegionAvail().X;
|
||||
var fileName = saveService.FileNames.CollectionFile(collection);
|
||||
ImGui.SetNextItemWidth(width);
|
||||
if (ImGui.InputText("##name", ref name, 128))
|
||||
_newName = name;
|
||||
|
|
@ -241,7 +242,12 @@ public sealed class CollectionPanel(
|
|||
{
|
||||
_newName = null;
|
||||
}
|
||||
}
|
||||
if (_collections.DefaultNamed == collection)
|
||||
ImUtf8.HoverTooltip(ImGuiHoveredFlags.AllowWhenDisabled, "The Default collection can not be renamed."u8);
|
||||
|
||||
var identifier = collection.Identity.Identifier;
|
||||
var fileName = saveService.FileNames.CollectionFile(collection);
|
||||
using (ImRaii.PushFont(UiBuilder.MonoFont))
|
||||
{
|
||||
if (ImGui.Button(collection.Identity.Identifier, new Vector2(width, 0)))
|
||||
|
|
@ -375,9 +381,7 @@ public sealed class CollectionPanel(
|
|||
ImGuiUtil.TextWrapped(type.ToDescription());
|
||||
switch (type)
|
||||
{
|
||||
case CollectionType.Default:
|
||||
ImGui.TextUnformatted("Overruled by any other Assignment.");
|
||||
break;
|
||||
case CollectionType.Default: ImGui.TextUnformatted("Overruled by any other Assignment."); break;
|
||||
case CollectionType.Yourself:
|
||||
ImGuiUtil.DrawColoredText(("Overruled by ", 0), ("Individual ", ColorId.NewMod.Value()), ("Assignments.", 0));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -116,7 +116,8 @@ public sealed class CollectionSelector : ItemSelector<ModCollection>, IDisposabl
|
|||
public void RestoreCollections()
|
||||
{
|
||||
Items.Clear();
|
||||
foreach (var c in _storage.OrderBy(c => c.Identity.Name))
|
||||
Items.Add(_storage.DefaultNamed);
|
||||
foreach (var c in _storage.OrderBy(c => c.Identity.Name).Where(c => c != _storage.DefaultNamed))
|
||||
Items.Add(c);
|
||||
SetFilterDirty();
|
||||
SetCurrent(_active.Current);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue