This is a concrete, SerializedProperty type, variant of the abstract base class, LimitedListDrawer. It defines/implements the abstract functions declared required by LimitedListDrawer, using SerializedProperties.
It has a slider with which the user can select how large (vertically) the list should be when drawn. A scrollable area of this vertical-size is used to display the elements of the list. This abstract base class defines several functions that a descendant class must implement for a specific type of property T. The LimitedListProperty class, for example, implements this base class as a variant for SerializedProperties. A file is created, which includes the scene name, that is used to store the current scroll state of this control when the scene is opened or closed. This feature may be disabled in ProjectSettings, via EditorTools Option ClearObjectCacheOnEditorQuit. Usage Example: ArrayHolderPropertyDrawer.cs, VectorAndRankArrayHolder.cs
Note: the PerObjectBooleansClass is leveraged to provide persistence of expanded/not expanded settings of list elements, between sessions. Usage Example: ArrayHolderPropertyDrawer.cs, VectorAndRankArrayHolder.cs
Public Member Functions | |
LimitedListProperty (PropertyDrawer useThisDrawerForElements) | |
Constructor for an instance of the drawer, that takes a PropertyDrawer which will be used to draw each element of the list. | |
![]() | |
void | InternalDrawLimitedListPropertyLayout (T property, GUIContent label=null, params GUILayoutOption[] options) |
Auto-Layout Version of this function draws the limited list using auto layout. | |
Static Public Member Functions | |
static void | DrawLimitedListProperty (Rect position, SerializedProperty property, GUIContent label=null, PropertyDrawer useThisDrawer=null) |
Draws a LimiedList using the specified property, at the specified location. Providing a Label and useTheDrawer parameters is optional. | |
static void | DrawLimitedListPropertyLayout (SerializedProperty property, GUIContent label=null, PropertyDrawer useThisDrawer=null, params GUILayoutOption[] options) |
Draws a LimiedList using the specified property, at the specified location. Providing a Label and useTheDrawer parameters is optional. | |
static float | GetLimitedListPropertyHeight (SerializedProperty property, GUIContent label, PropertyDrawer useThisDrawer=null) |
Use to compute the total height of a drawn LimitedListProperty, when using the provided property to reference the list to be drawn. | |
![]() | |
static void | ClearAllPositionAndDrawnElementsFiles () |
Deletes all files in the current directory that end with fileNameConst. This will remove all saved foldout states. | |
static void | ClearCasheNow () |
Static function that clears the contents of the internal scrollPositionAndDrawSize dictionary. | |
Protected Member Functions | |
override string | ArrayName (SerializedProperty listProperty) |
Used to compute the label that will be Displayed for the list | |
override int | ArraySize (SerializedProperty listProperty) |
Extracts and returns the size of the array provided | |
override void | DrawElementProperty (Rect r, SerializedProperty property, int index) |
Actual drawing code for an element of the list. The property parameter will provide the data to be drawn. | |
override UniqueStringID | GenerateListScrollPositionAndDrawSizeKey (SerializedProperty property, string label) |
Creates a new UniqueStringID from the provided property, and optionally, the provided label. Passing the same property to this function, should always yield an equivalent UniqueStringID, even across editor-sessions. UniqueStringID's can be quickly compared with other UniqueStringIDs for equality. Generating the UniqueID can be costly, so it is performed as rarely as possible (once inside the GetScrollPositionAndDrawSizeOfList function). | |
override SerializedProperty | GetArrayElementAtIndex (SerializedProperty listProperty, int index) |
Used to get the array elements from the list. Which element is returned is defined by the integer parameter, index. Invalid indexes should throw an Exception. | |
override bool | GetPropertyExpanded (SerializedProperty listProperty) |
Used to lookup the last user-selected expanded state of the specified property. | |
override float | GetPropertyHeight (SerializedProperty property) |
Computes and returns the height of the specified property. | |
override void | InternalDrawLimitedListProperty (Rect position, SerializedProperty property, GUIContent label=null) |
Implements the abstract function defined in LimitedListDrawer. function will invoke the base class version, after checking the property is a valid array. If not a valid array, the regular PropertyField will be used to draw. | |
override float | InternalGetLimitedListPropertyHeight (SerializedProperty property, GUIContent label) |
Checks the provided Serialized Property is an array/list, and invokes base class version of this function: LimitedListDrawer.InternalGetLimitedListPropertyHeight | |
override bool | LoadAndGetPropertyExpanded (SerializedProperty listProperty) |
Refreshes any stored expanded state from storage, then assigns the expanded state to the property and returns it | |
override void | SetAndStorePropertyExpanded (SerializedProperty listProperty, bool expanded) |
Used to set the expanded state of the specified property, and record it in storage. | |
override void | SetArraySize (SerializedProperty listProperty, int newSize) |
Adjusts the size of the array referenced in the provided property, to the specified size. | |
override void | SetPropertyExpanded (SerializedProperty listProperty, bool expanded) |
Used to set the expanded state of the specified property. | |
![]() | |
abstract string | ArrayName (T listProperty) |
Used to compute the label that will be Displayed for the list | |
abstract int | ArraySize (T listProperty) |
Extracts and returns the size of the array provided | |
abstract void | DrawElementProperty (Rect r, T property, int index) |
Actual drawing code for an element of the list. The property parameter will provide the data to be drawn. | |
abstract UniqueStringID | GenerateListScrollPositionAndDrawSizeKey (T property, string label) |
Creates a new UniqueStringID from the provided property, and optionally, the provided label. Passing the same property to this function, should always yield an equivalent UniqueStringID, even across editor-sessions. UniqueStringID's can be quickly compared with other UniqueStringIDs for equality. Generating the UniqueID can be costly, so it is performed as rarely as possible (once inside the GetScrollPositionAndDrawSizeOfList function). | |
abstract T | GetArrayElementAtIndex (T listProperty, int index) |
Used to get the array elements from the list. Which element is returned is defined by the integer parameter, index. Invalid indexes should throw an Exception. | |
abstract bool | GetPropertyExpanded (T property) |
Used to lookup the last user-selected expanded state of the specified property. | |
abstract float | GetPropertyHeight (T property) |
Computes and returns the height of the specified property. | |
virtual void | InternalDrawLimitedListProperty (Rect position, T property, GUIContent _label=null) |
non auto-layout version of this control. Will draw the list in the location and area specified by the position parameter. | |
virtual float | InternalGetLimitedListPropertyHeight (T property, GUIContent label) |
Drawn height of limited list. The height of the control is computed once and cashed. It is recomputed as necessary. | |
abstract bool | LoadAndGetPropertyExpanded (T property) |
Refreshes any stored expanded state from storage, then assigns the expanded state to the property and returns it | |
abstract void | SetAndStorePropertyExpanded (T property, bool expanded) |
Used to set the expanded state of the specified property, and record it in storage. | |
abstract void | SetArraySize (T listProperty, int newSize) |
Adjusts the size of the array referenced in the provided property, to the specified size. | |
abstract void | SetPropertyExpanded (T property, bool expanded) |
Used to set the expanded state of the specified property. | |