1.9.2: Added OpenPropertyEditor and fixed some issues regarding using multiple drawers with EditorGUI.PropertyField
- Property: `OpenPropertyEditor` adds a "show"-button next to a `ScriptableObject` or `Component` to open a property window - Property: Fixed issue, where x PropertyDrawers would invoke each other x times
This commit is contained in:
parent
f609ba6f51
commit
c87dd743f6
8 changed files with 189 additions and 63 deletions
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Module.Inspector.Editor.Utilities
|
||||
|
|
@ -64,6 +65,11 @@ namespace Module.Inspector.Editor.Utilities
|
|||
return result;
|
||||
}
|
||||
|
||||
public static int CalculateHash(SerializedProperty property)
|
||||
{
|
||||
return property.propertyPath.GetHashCode();
|
||||
}
|
||||
|
||||
private static Result InternalFetchProperties(FieldInfo fieldInfo)
|
||||
{
|
||||
ResultValue<DrawerPropertyAttribute, DrawerPropertyDrawer> drawer = null;
|
||||
|
|
@ -192,7 +198,8 @@ namespace Module.Inspector.Editor.Utilities
|
|||
public readonly List<ResultValue<HandleDrawerPropertyAttribute, HandlePropertyDrawer>> handleDrawers;
|
||||
public readonly string tooltip;
|
||||
public readonly bool isObsolete;
|
||||
|
||||
private List<int> usedBy = new List<int>();
|
||||
|
||||
public Result(ResultValue<DrawerPropertyAttribute, DrawerPropertyDrawer> draw,
|
||||
List<ResultValue<PredrawerModifierPropertyAttribute, PredrawerModifierPropertyDrawer>> predrawerModifiers,
|
||||
List<ResultValue<ValueModifierPropertyAttribute, ValueModifierPropertyDrawer>> valueModifiers,
|
||||
|
|
@ -212,6 +219,21 @@ namespace Module.Inspector.Editor.Utilities
|
|||
this.isObsolete = isObsolete;
|
||||
}
|
||||
|
||||
public bool IsUsedBy(int propertyHash)
|
||||
{
|
||||
return usedBy.Contains(propertyHash);
|
||||
}
|
||||
|
||||
public void AddUsedBy(int propertyHash)
|
||||
{
|
||||
usedBy.Add(propertyHash);
|
||||
}
|
||||
|
||||
public void RemoveUsedBy(int propertyHash)
|
||||
{
|
||||
usedBy.Remove(propertyHash);
|
||||
}
|
||||
|
||||
public T GetPredrawerModifier<T>() where T : PredrawerModifierPropertyAttribute
|
||||
{
|
||||
for (var i = 0; i < predrawerModifiers.Count; i++)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue