Rename editor namespaces.

This commit is contained in:
2025-11-05 23:57:44 +01:00
parent a4ec9f4801
commit 60544312be
9 changed files with 198 additions and 200 deletions

View File

@@ -4,9 +4,8 @@ using System;
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
using UnityEditor; using UnityEditor;
using UnityEngine.UIElements;
namespace Utilities.Extensions.UIToolkit namespace SerializableFunc.Editor.Extensions.DropdownField
{ {
public static class DropdownFieldExtensions public static class DropdownFieldExtensions
{ {
@@ -21,7 +20,7 @@ namespace Utilities.Extensions.UIToolkit
#region Generic Menu Assigning #region Generic Menu Assigning
public static void AssignGenericMenu(this DropdownField dropdownField, public static void AssignGenericMenu(this UnityEngine.UIElements.DropdownField dropdownField,
Func<GenericMenu> genericMenuBuildingFunc) Func<GenericMenu> genericMenuBuildingFunc)
{ {
Func<object> genericOSMenuFunc = () => Func<object> genericOSMenuFunc = () =>
@@ -32,7 +31,7 @@ namespace Utilities.Extensions.UIToolkit
object boxedfunc = ConvertFuncToDesiredType(genericOSMenuFunc); object boxedfunc = ConvertFuncToDesiredType(genericOSMenuFunc);
FieldInfo createMenuCallbackFieldInfo = typeof(DropdownField) FieldInfo createMenuCallbackFieldInfo = typeof(UnityEngine.UIElements.DropdownField)
.GetField(CreateMenuCallback_Property_Name, BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); .GetField(CreateMenuCallback_Property_Name, BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
createMenuCallbackFieldInfo.SetValue(dropdownField, boxedfunc); createMenuCallbackFieldInfo.SetValue(dropdownField, boxedfunc);
@@ -102,7 +101,7 @@ namespace Utilities.Extensions.UIToolkit
#region Formatting Callback Assigning #region Formatting Callback Assigning
public static void AssignFormattingCallback(this DropdownField dropdownField, public static void AssignFormattingCallback(this UnityEngine.UIElements.DropdownField dropdownField,
Func<string, string> formattingCallback) Func<string, string> formattingCallback)
{ {
#if UNITY_2022_2_OR_NEWER #if UNITY_2022_2_OR_NEWER
@@ -112,10 +111,10 @@ namespace Utilities.Extensions.UIToolkit
#endif #endif
} }
private static void AssignFormattingCallbackViaReflection(this DropdownField functionDropdown, private static void AssignFormattingCallbackViaReflection(this UnityEngine.UIElements.DropdownField functionDropdown,
Func<string, string> formattingCallback) Func<string, string> formattingCallback)
{ {
PropertyInfo propertyInfo = typeof(DropdownField) PropertyInfo propertyInfo = typeof(UnityEngine.UIElements.DropdownField)
.GetProperty(FormatSelectedValueCallback_Property_Name, BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance); .GetProperty(FormatSelectedValueCallback_Property_Name, BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
object[] args = new object[] { formattingCallback }; object[] args = new object[] { formattingCallback };

View File

@@ -4,15 +4,14 @@ using System.Collections;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using UnityEditor;
namespace UnityUtilities.SerializableDataHelpers.UnityEditorUtilities namespace SerializableFunc.Editor.Extensions.SerializedProperty
{ {
public static class SerializedPropertyExtensions public static class SerializedPropertyExtensions
{ {
static readonly Regex rgx = new Regex(@"\[\d+\]", RegexOptions.Compiled); static readonly Regex rgx = new Regex(@"\[\d+\]", RegexOptions.Compiled);
public static object GetBoxedValue(this SerializedProperty property) public static object GetBoxedValue(this UnityEditor.SerializedProperty property)
{ {
property.serializedObject.ApplyModifiedProperties(); property.serializedObject.ApplyModifiedProperties();
#if UNITY_2023_2_OR_NEWER #if UNITY_2023_2_OR_NEWER
@@ -22,7 +21,7 @@ namespace UnityUtilities.SerializableDataHelpers.UnityEditorUtilities
#endif #endif
} }
public static void SetBoxedValue(this SerializedProperty property, object value) public static void SetBoxedValue(this UnityEditor.SerializedProperty property, object value)
{ {
property.serializedObject.Update(); property.serializedObject.Update();
#if UNITY_2023_2_OR_NEWER #if UNITY_2023_2_OR_NEWER
@@ -33,7 +32,7 @@ namespace UnityUtilities.SerializableDataHelpers.UnityEditorUtilities
property.serializedObject.ApplyModifiedProperties(); property.serializedObject.ApplyModifiedProperties();
} }
public static T GetValue<T>(this SerializedProperty property) where T : class public static T GetValue<T>(this UnityEditor.SerializedProperty property) where T : class
{ {
object obj = property.serializedObject.targetObject; object obj = property.serializedObject.targetObject;
string path = property.propertyPath.Replace(".Array.data", string.Empty); string path = property.propertyPath.Replace(".Array.data", string.Empty);
@@ -53,7 +52,7 @@ namespace UnityUtilities.SerializableDataHelpers.UnityEditorUtilities
return (T)obj; return (T)obj;
} }
public static bool SetValue<T>(this SerializedProperty property, T value) where T : class public static bool SetValue<T>(this UnityEditor.SerializedProperty property, T value) where T : class
{ {
object obj = property.serializedObject.targetObject; object obj = property.serializedObject.targetObject;
string path = property.propertyPath.Replace(".Array.data", ""); string path = property.propertyPath.Replace(".Array.data", "");

View File

@@ -2,7 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace Utilities.Extensions.SystemExtensions namespace SerializableFunc.Editor.Extensions.TypeExtensions
{ {
public static class TypeExtensions public static class TypeExtensions
{ {

View File

@@ -5,21 +5,21 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text; using System.Text;
using SerializableFunc; using SerializableFunc.Editor.Extensions.DropdownField;
using SerializableFunc.Editor.Extensions.SerializedProperty;
using SerializableFunc.Editor.Extensions.TypeExtensions;
using UnityEditor; using UnityEditor;
using UnityEditor.UIElements; using UnityEditor.UIElements;
using UnityEditorInternal; using UnityEditorInternal;
using UnityEngine; using UnityEngine;
using UnityEngine.UIElements; using UnityEngine.UIElements;
using Utilities.Extensions.SystemExtensions;
using Utilities.Extensions.UIToolkit;
using Object = UnityEngine.Object; using Object = UnityEngine.Object;
namespace UnityUtilities.SerializableDataHelpers.UnityEditorUtilities namespace SerializableFunc.Editor.PropertyDrawer
{ {
[CustomPropertyDrawer(typeof(SerializableAction), true)] [CustomPropertyDrawer(typeof(SerializableAction), true)]
[CustomPropertyDrawer(typeof(SerializableFuncBase<>), true)] [CustomPropertyDrawer(typeof(SerializableFuncBase<>), true)]
public class SerializableFuncBasePropertyDrawer : PropertyDrawer public class SerializableFuncBasePropertyDrawer : UnityEditor.PropertyDrawer
{ {
private const string Target_Function_Label = "Target Function"; private const string Target_Function_Label = "Target Function";
private const string Target_Object_Label = "Target Object"; private const string Target_Object_Label = "Target Object";

View File

@@ -1,6 +1,6 @@
{ {
"name": "SerializableFunc.Editor", "name": "SerializableFunc.Editor",
"rootNamespace": "", "rootNamespace": "SerializableFunc",
"references": [ "references": [
"GUID:e72a8e3728c787f4fafc146b590e6be5" "GUID:e72a8e3728c787f4fafc146b590e6be5"
], ],