(Feat) Tools Update

This commit is contained in:
2026-06-23 14:52:45 +02:00
parent 6527f559e1
commit c9b085ebea
4 changed files with 42 additions and 3 deletions
@@ -1,3 +1,4 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.UIElements;
using Ashwild.Inventory;
@@ -60,6 +61,29 @@ namespace Ashwild.EditorTools
return badge;
}
/// <summary>
/// Wraps a name text field in a row prefixed by a small pencil icon, signalling that the title
/// is editable. The field grows to fill the remaining width.
/// </summary>
public static VisualElement EditableNameRow(TextField nameField)
{
VisualElement row = new VisualElement();
row.AddToClassList("ash-namerow");
Texture pencil = EditorGUIUtility.IconContent("d_editicon.sml").image;
if (pencil == null) pencil = EditorGUIUtility.IconContent("editicon.sml").image;
if (pencil != null)
{
Image icon = new Image { image = pencil, scaleMode = ScaleMode.ScaleToFit };
icon.AddToClassList("ash-namerow__pencil");
row.Add(icon);
}
nameField.style.flexGrow = 1;
row.Add(nameField);
return row;
}
#endregion
}
}