Namespace: | Sirenix.OdinInspector.Editor |
Assembly: | Sirenix.OdinInspector.Editor |
public abstract class PropertyTree : IDisposable
Represents a set of values of the same type as a tree of properties that can be drawn in the inspector, and provides an array of utilities for querying the tree of properties.
public PropertyTree()
public bool AllowSearchFiltering
public readonly List<ComponentProvider> ComponentProviders
public static readonly EditorPrefBool EnableLeakDetection
protected SerializedProperty monoScriptProperty
protected bool monoScriptPropertyHasBeenGotten
public bool RecordUndoForChanges
public OdinAttributeProcessorLocator AttributeProcessorLocator { get; set; }
public DrawerChainResolver DrawerChainResolver { get; set; }
public bool DrawMonoScriptObjectField { get; set; }
protected abstract bool HasRootPropertyYet { get; }
public bool IsStatic { get; protected set; }
public abstract PrefabModificationHandler PrefabModificationHandler { get; }
public OdinPropertyResolverLocator PropertyResolverLocator { get; set; }
public abstract InspectorProperty RootProperty { get; }
public abstract int RootPropertyCount { get; }
public SerializationBackend SerializationBackend { get; set; }
public StateUpdaterLocator StateUpdaterLocator { get; set; }
public abstract Type TargetType { get; }
public abstract SerializedObject UnitySerializedObject { get; }
public abstract int UpdateID { get; }
public abstract ImmutableList<object> WeakTargets { get; }
public abstract bool ApplyChanges()
System.Boolean | true if any values were changed, otherwise false |
public void BeginDraw(bool withUndo)
System.Boolean | withUndo |
public abstract void CleanForCachedReuse()
Creates a new PropertyTree for a set of given target values.
Note that the targets all need to be of the same type.
public static PropertyTree Create(IList targets)
System.Collections.IList | targets | The targets to create a tree for. |
PropertyTree |
Creates a new PropertyTree for a set of given target values.
Note that the targets all need to be of the same type.
public static PropertyTree Create(IList targets, SerializationBackend backend)
System.Collections.IList | targets | The targets to create a tree for. |
SerializationBackend | backend | The serialization backend to use for the tree root. |
PropertyTree |
Creates a new PropertyTree for a set of given target values, represented by a given UnityEditor.SerializedObject.
Note that the targets all need to be of the same type.
public static PropertyTree Create(IList targets, SerializedObject serializedObject)
System.Collections.IList | targets | The targets to create a tree for. |
UnityEditor.SerializedObject | serializedObject | The serialized object to create a tree for. Note that the target values of the given UnityEditor.SerializedObject must be the same values given in the targets parameter. |
PropertyTree |
Creates a new PropertyTree for a set of given target values, represented by a given UnityEditor.SerializedObject.
Note that the targets all need to be of the same type.
public static PropertyTree Create(IList targets, SerializedObject serializedObject, SerializationBackend backend)
System.Collections.IList | targets | The targets to create a tree for. |
UnityEditor.SerializedObject | serializedObject | The serialized object to create a tree for. Note that the target values of the given UnityEditor.SerializedObject must be the same values given in the targets parameter. |
SerializationBackend | backend | The serialization backend to use for the tree root. |
PropertyTree |
public static PropertyTree Create(object target)
System.Object | target | The target to create a tree for. |
PropertyTree |
System.ArgumentNullException | target is null |
public static PropertyTree Create(object target, SerializationBackend backend)
System.Object | target | The target to create a tree for. |
SerializationBackend | backend | The serialization backend to use for the tree root. |
PropertyTree |
System.ArgumentNullException | target is null |
Creates a new PropertyTree for a set of given target values.
Note that the targets all need to be of the same type.
public static PropertyTree Create(params object[] targets)
System.Object[] | targets | The targets to create a tree for. |
PropertyTree |
System.ArgumentNullException | targets is null |
public static PropertyTree Create(SerializedObject serializedObject)
UnityEditor.SerializedObject | serializedObject | The serialized object to create a tree for. |
PropertyTree |
System.ArgumentNullException | serializedObject is null |
public static PropertyTree Create(SerializedObject serializedObject, SerializationBackend backend)
UnityEditor.SerializedObject | serializedObject | The serialized object to create a tree for. |
SerializationBackend | backend | The serialization backend to use for the tree root. |
PropertyTree |
System.ArgumentNullException | serializedObject is null |
public static PropertyTree CreateStatic(Type type)
System.Type | type | The type to inspect. |
PropertyTree | A PropertyTree instance for inspecting the type. |
public abstract void DelayAction(Action action)
System.Action | action | The action delegate to be delayed. |
public abstract void DelayActionUntilRepaint(Action action)
System.Action | action | The action to be delayed. |
public void Dispose()
protected virtual void Dispose(bool finalizer)
System.Boolean | finalizer |
protected abstract void DisposeAndResetRootProperty()
protected abstract void DisposeInheritedStuff()
Draw the property tree, and handles management of undo, as well as marking scenes and drawn assets dirty.
This is a shorthand for calling Sirenix.OdinInspector.Editor.InspectorUtilities.BeginDrawPropertyTree(Sirenix.OdinInspector.Editor.PropertyTree,System.Boolean), DrawPropertiesInTree(PropertyTree) and . Sirenix.OdinInspector.Editor.InspectorUtilities.EndDrawPropertyTree(Sirenix.OdinInspector.Editor.PropertyTree).
public void Draw(bool applyUndo = true)
System.Boolean | applyUndo |
public void DrawProperties()
Draws a search bar for the property tree, and draws the search results if the search bar is used.
If this method returns true, the property tree should generally not be drawn normally afterwards.
Note that this method will throw exceptions if the property tree is not set up to be searchable; for that, see SetSearchable(Boolean, SearchableAttribute).
public bool DrawSearch()
System.Boolean | True if the property tree is being searched and is currently drawing its search results, otherwise false. |
public void EndDraw()
public abstract IEnumerable<InspectorProperty> EnumerateTree(bool includeChildren = true, bool onlyVisible = false)
System.Boolean | includeChildren | Whether to include children of the root properties or not. If set to true, every property in the entire tree will be enumerated. |
System.Boolean | onlyVisible | Whether to only include visible properties. Properties whose parents are invisible are considered invisible. |
System.Collections.Generic.IEnumerable<InspectorProperty> |
protected void Finalize()
public abstract InspectorProperty GetPropertyAtPath(string path)
System.String | path | The path of the property to get. |
InspectorProperty |
public abstract InspectorProperty GetPropertyAtPath(string path, out InspectorProperty closestProperty)
System.String | path | The path of the property to get. |
InspectorProperty | closestProperty |
InspectorProperty |
public abstract InspectorProperty GetPropertyAtPrefabModificationPath(string path)
System.String | path | The prefab modification path of the property to get. |
InspectorProperty |
public abstract InspectorProperty GetPropertyAtPrefabModificationPath(string path, out InspectorProperty closestProperty)
System.String | path | The prefab modification path of the property to get. |
InspectorProperty | closestProperty |
InspectorProperty |
public abstract InspectorProperty GetPropertyAtUnityPath(string path)
System.String | path | The Unity path of the property to get. |
InspectorProperty |
public abstract InspectorProperty GetPropertyAtUnityPath(string path, out InspectorProperty closestProperty)
System.String | path | The Unity path of the property to get. |
InspectorProperty | closestProperty |
InspectorProperty |
public abstract int GetReferenceCount(object reference)
System.Object | reference |
System.Int32 |
public abstract InspectorProperty GetRootProperty(int index)
System.Int32 | index | The index of the property to get. |
InspectorProperty |
public SerializedProperty GetUnityPropertyForPath(string path)
System.String | path | The Odin or Unity path to the property to get. |
UnityEditor.SerializedProperty |
public abstract SerializedProperty GetUnityPropertyForPath(string path, out FieldInfo backingField)
System.String | path | The Odin or Unity path to the property to get. |
System.Reflection.FieldInfo | backingField | The backing field of the Unity property. |
UnityEditor.SerializedProperty |
protected void InitSearchFilter()
public abstract void InvokeDelayedActions()
public void InvokeOnValidate()
public abstract bool ObjectIsReferenced(object value, out string referencePath)
System.Object | value | The reference value to check. |
System.String | referencePath | The first found path of the object. |
System.Boolean |
public abstract void RegisterPropertyDirty(InspectorProperty property)
InspectorProperty | property |
public abstract void ReplaceAllReferences(object from, object to)
System.Object | from | The value to find all instances of. |
System.Object | to | The value to replace the found values with. |
Sets whether the property tree should be searchable or not, and allows the passing in of a custom SearchableAttribute instance to configure the search.
public void SetSearchable(bool searchable, SearchableAttribute config = null)
System.Boolean | searchable | Whether the tree should be set to be searchable or not. |
SearchableAttribute | config | If the tree is set to be searchable, then if this parameter is not null, it will be used to configure the property tree search. If the parameter is null, the SearchableAttribute on the tree's RootProperty will be used. If that property has no such attribute, then default search settings will be applied. |
public abstract void SetSerializedObject(SerializedObject serializedObject)
UnityEditor.SerializedObject | serializedObject |
public abstract void SetTargets(params object[] newTargets)
System.Object[] | newTargets |
public PropertyTree SetUpForIMGUIDrawing()
PropertyTree |
public PropertyTree SetUpForValidation()
PropertyTree |
public abstract void UpdateTree()
public event PropertyTree.OnPropertyValueChangedDelegate OnPropertyValueChanged
public event Action OnUndoRedoPerformed