Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5e01237
Create FontIconSetDefinition
keveleigh Nov 11, 2025
4523a80
Add MRTK default asset
keveleigh Nov 11, 2025
e60f255
Fix race condition where the deserialized value was being read before…
keveleigh Nov 11, 2025
df4c686
Update field naming and general formatting
keveleigh Nov 11, 2025
3884ac3
Fix issue where the wrong color param was being set
keveleigh Nov 11, 2025
103f5f7
Disable buttons if the icon has already been added
keveleigh Nov 11, 2025
9c30861
Update to use Foldout instead of BeginFoldoutHeaderGroup
keveleigh Nov 11, 2025
3540916
Update FontIconSetInspector.cs
keveleigh Nov 11, 2025
2425c00
Update selected icons display for improved flow and usage
keveleigh Nov 11, 2025
80c2d81
Add FontIconSetDefinition to FontIconSet
keveleigh Nov 11, 2025
ec94cdf
Fix asset not being marked dirty when changed
keveleigh Nov 11, 2025
41cd564
Simplify CRUD method implementations
keveleigh Nov 11, 2025
c252997
Sort the added symbols by unicode value
keveleigh Nov 11, 2025
40ca649
Update FontIconSetDefinition.cs
keveleigh Nov 11, 2025
f592b4e
Create dropdown for accessing icon set definition names
keveleigh Nov 11, 2025
370bfbd
Update Selawik-Semibold-MRTKIcons.asset
keveleigh Nov 11, 2025
eef3a6c
Add more icon names
keveleigh Nov 12, 2025
d418788
Add migration path for FontIconSelector
keveleigh Nov 12, 2025
b6a195c
Update FontIconSelectorInspector.cs
keveleigh Nov 12, 2025
18a9a49
Update Selawik-Semibold-MRTKIcons.asset
keveleigh Nov 12, 2025
0e49eab
stash
keveleigh Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// Copyright (c) Mixed Reality Toolkit Contributors
// Licensed under the BSD 3-Clause

Expand All @@ -13,12 +12,6 @@ namespace MixedReality.Toolkit.Editor
[CanEditMultipleObjects]
class FontIconSelectorInspector : UnityEditor.Editor
{

private const string defaultShaderName = "TextMeshPro/Distance Field SSD";
private float fontTileSize = 32;

private static Material fontRenderMaterial;

private const string noFontIconsMessage = "No IconFontSet profile selected. No icons available.";
private const string emptyFontIconSetMessage = "The selected IconFontSet profile has no icons defined. Please edit the IconFontSet.";

Expand All @@ -29,6 +22,7 @@ class FontIconSelectorInspector : UnityEditor.Editor
private GUIStyle currentButtonStyle;

private bool initializedStyle = false;
private float fontTileSize = 32;

/// <summary>
/// A Unity event function that is called when the script component has been enabled.
Expand All @@ -38,14 +32,15 @@ private void OnEnable()
fontIconsProp = serializedObject.FindProperty("fontIcons");
currentIconNameProp = serializedObject.FindProperty("currentIconName");
tmProProp = serializedObject.FindProperty("textMeshProComponent");

}

/// <summary>
/// Called by the Unity editor to render custom inspector UI for this component.
/// </summary>
public override void OnInspectorGUI()
{
serializedObject.Update();

if (!initializedStyle)
{
currentButtonStyle = new GUIStyle(GUI.skin.button);
Expand All @@ -64,6 +59,9 @@ public override void OnInspectorGUI()
EditorGUILayout.PropertyField(tmProProp);
EditorGUILayout.Space();

EditorGUILayout.PropertyField(serializedObject.FindProperty("migratedSuccessfully"));
EditorGUILayout.Space();

if (fontIconsProp.objectReferenceValue == null)
{
EditorGUILayout.HelpBox(noFontIconsMessage, MessageType.Warning);
Expand All @@ -90,7 +88,6 @@ public override void OnInspectorGUI()
}

private int numColumns = 4;

private Vector2 scrollAmount;

public void DrawIconGrid(FontIconSelector fontIconSelector, float tileSize)
Expand All @@ -101,45 +98,42 @@ public void DrawIconGrid(FontIconSelector fontIconSelector, float tileSize)

scrollAmount = EditorGUILayout.BeginScrollView(scrollAmount, GUILayout.MaxHeight(128), GUILayout.MinHeight(64));
EditorGUILayout.BeginHorizontal();

foreach (string iconName in fontIconSet.GlyphIconsByName.Keys)
{
uint unicodeValue = fontIconSet.GlyphIconsByName[iconName];
bool selected = (iconName == fontIconSelector.CurrentIconName);

if (column >= numColumns)
{
column = 0;
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
}

if (GUILayout.Button(" ",
GUILayout.MinHeight(tileSize),
GUILayout.MaxHeight(tileSize),
GUILayout.MinWidth(tileSize),
GUILayout.MaxWidth(tileSize)))
GUILayout.Height(tileSize),
GUILayout.Width(tileSize)))
{
Undo.RecordObjects(new UnityEngine.Object[]{fontIconSelector, fontIconSelector.TextMeshProComponent}, "Changed icon");
Undo.RecordObjects(new Object[] { fontIconSelector, fontIconSelector.TextMeshProComponent }, "Changed icon");
fontIconSelector.CurrentIconName = iconName;
PrefabUtility.RecordPrefabInstancePropertyModifications(fontIconSelector);
PrefabUtility.RecordPrefabInstancePropertyModifications(fontIconSelector.TextMeshProComponent);
}

Rect textureRect = GUILayoutUtility.GetLastRect();
if (textureRect.yMin + 8 < scrollAmount.y || textureRect.yMax - 8 > scrollAmount.y + 128)
{
unicodeValue = 0;
}

textureRect.width = tileSize;
textureRect.height = tileSize;
FontIconSetInspector.EditorDrawTMPGlyph(textureRect, unicodeValue, fontAsset, selected);
FontIconSetInspector.EditorDrawTMPGlyph(textureRect, unicodeValue, fontAsset, iconName == fontIconSelector.CurrentIconName);

column++;
}

if (column > 0)
{
EditorGUILayout.EndHorizontal();
}

EditorGUILayout.EndHorizontal();

if (Event.current.type == EventType.Repaint)
{
float editorWindowWidth = GUILayoutUtility.GetLastRect().width;
Expand Down
Loading
Loading