SelectionDisplayUtility¶
Namespace:
SideXP.Selection
Utility functions for displaying selections on GUI.
Fields¶
MaxNamedObjectsCount¶
The maximum number of object names used to name a selection.
MaxNameLength¶
The maximum length of a selection name, including Ellipsis if the name is truncated.
Ellipsis¶
The text appended to a truncated name.
Methods¶
GetNamedObjects(SelectionSnapshot)¶
Gets the objects used to name and illustrate a given selection: the objects that are not temporary (assets and objects saved in a scene), or all the objects if they're all temporary.
Parameters
snapshot: The selection to name.
Returns
Returns the objects to use, in selection order.
GetMainObject(SelectionSnapshot)¶
Gets the object that represents a given selection, for example to display its icon.
Parameters
snapshot: The selection.
Returns
Returns the first of the objects returned by GetNamedObjects, or null if the selection is empty.
GetName(SelectionSnapshot)¶
Gets the display name of a given selection: the names of its first objects separated by commas, truncated by word if it's too long.
Parameters
snapshot: The selection to name.
Returns
Returns the display name, or an empty string if the selection is empty.
Remarks
Uses GetNamedObjects to choose the objects, with their names as they were when the selection was captured, at most MaxNamedObjectsCount of them, and truncated to MaxNameLength characters.
GetUnavailableObjectsMessage(SelectionSnapshot)¶
Gets a message describing the objects of a given selection that can't be selected, grouped by the scene that must be loaded to select them.
Parameters
snapshot: The selection to check.
Returns
Returns the message, or an empty string if all the objects of the selection can be selected.
TruncateByWord(string, int)¶
Truncates a given text at the end of the last whole word that fits, and appends Ellipsis to it.
Parameters
text: The text to truncate.maxLength: The maximum length of the result, including Ellipsis.
Returns
Returns the text as is if it's not longer than the given length, or the truncated text. A single word longer than the available space is cut in the middle.