From 18ccff10cbae9866c0dc73ffb9d3dbc6f4333edf Mon Sep 17 00:00:00 2001 From: AnnulusGames Date: Wed, 21 Feb 2024 10:01:29 +0900 Subject: [PATCH] Change: CreateListViewFromSettingsAttribute -> CreateListViewFromFieldInfo --- Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs | 2 +- Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs b/Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs index 0f8ce0a..c6786bc 100644 --- a/Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs +++ b/Alchemy/Assets/Alchemy/Editor/Elements/PropertyListView.cs @@ -18,7 +18,7 @@ namespace Alchemy.Editor.Elements var settings = property.GetAttribute(true); - var listView = GUIHelper.CreateListViewFromSettingsAttribute(settings); + var listView = GUIHelper.CreateListViewFromFieldInfo(property.GetFieldInfo()); listView.headerTitle = ObjectNames.NicifyVariableName(property.displayName); listView.bindItem = (element, index) => { diff --git a/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs b/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs index d1a2b21..5d74a1b 100644 --- a/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs +++ b/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs @@ -1,10 +1,11 @@ +using System; +using System.Reflection; using UnityEditor; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; using UnityEngine.Assertions; using Alchemy.Inspector; -using System; namespace Alchemy.Editor { @@ -51,8 +52,9 @@ namespace Alchemy.Editor }; } - public static ListView CreateListViewFromSettingsAttribute(ListViewSettingsAttribute settings) + public static ListView CreateListViewFromFieldInfo(FieldInfo fieldInfo) { + var settings = fieldInfo.GetCustomAttribute(); return new ListView { reorderable = settings == null ? true : settings.Reorderable,