Class SplineSelection
Provides methods to track the selection of spline elements, knots, and tangents.
SplineTools
and SplineHandles
use SplineSelection
to manage these elements.
Inherited Members
Namespace: UnityEditor.Splines
Syntax
public static class SplineSelection
Properties
Count
The number of elements in the current selection.
Declaration
public static int Count { get; }
Property Value
Type | Description |
---|---|
Int32 |
Methods
Add<T>(T)
Adds an element to the current selection.
Declaration
public static bool Add<T>(T element)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
T | element | The ISelectableElement to add to the selection. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the element was added to the selection, and false if the element is already in the selection. |
Type Parameters
Name | Description |
---|---|
T |
AddRange<T>(IEnumerable<T>)
Add a set of elements to the current selection.
Declaration
public static void AddRange<T>(IEnumerable<T> elements)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<T> | elements | The set of ISelectableElement to add to the selection. |
Type Parameters
Name | Description |
---|---|
T |
Clear()
Clears the current selection.
Declaration
public static void Clear()
Contains<T>(T)
Checks if the selection contains a knot or a tangent.c'est
Declaration
public static bool Contains<T>(T element)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
T | element | The element to verify. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the element is contained in the current selection, false otherwise. |
Type Parameters
Name | Description |
---|---|
T |
GetActiveElement(IReadOnlyList<SplineInfo>)
Gets the active element of the selection. The active element is generally the last one added to this selection.
Declaration
public static ISelectableElement GetActiveElement(IReadOnlyList<SplineInfo> targets)
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<SplineInfo> | targets | The splines to consider when getting the active element. |
Returns
Type | Description |
---|---|
ISelectableElement | The ISelectableElement that represents the active knot or tangent. Returns null if no active element is found. |
GetElements<T>(IReadOnlyList<SplineInfo>, ICollection<T>)
Gets all the elements of the current selection, filtered by target splines. Elements are added to the given collection.
Declaration
public static void GetElements<T>(IReadOnlyList<SplineInfo> targets, ICollection<T> results)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<SplineInfo> | targets | The splines to consider when looking at selected elements. |
ICollection<T> | results | The collection to fill with spline elements from the selection. |
Type Parameters
Name | Description |
---|---|
T |
GetElements<T>(SplineInfo, ICollection<T>)
Gets all the elements of the current selection, from a single spline target. Elements are added to the given collection.
Declaration
public static void GetElements<T>(SplineInfo target, ICollection<T> results)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
SplineInfo | target | The spline to consider when looking at selected elements. |
ICollection<T> | results | The collection to fill with spline elements from the selection. |
Type Parameters
Name | Description |
---|---|
T |
HasAny<T>(IReadOnlyList<SplineInfo>)
Checks if the current selection contains at least one element from the given targeted splines.
Declaration
public static bool HasAny<T>(IReadOnlyList<SplineInfo> targets)
where T : struct, ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<SplineInfo> | targets | The splines to consider when looking at selected elements. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the current selection contains at least an element of the desired type. |
Type Parameters
Name | Description |
---|---|
T |
IsActive<T>(T)
Checks if an element is currently the active one in the selection.
Declaration
public static bool IsActive<T>(T element)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
T | element | The ISelectableElement to test. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the element is the active element, false if it is not. |
Type Parameters
Name | Description |
---|---|
T |
Remove<T>(T)
Remove an element from the current selection.
Declaration
public static bool Remove<T>(T element)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
T | element | The ISelectableElement to remove from the selection. |
Returns
Type | Description |
---|---|
Boolean | Returns true if the element has been removed from the selection, false otherwise. |
Type Parameters
Name | Description |
---|---|
T |
RemoveRange<T>(IReadOnlyList<T>)
Remove a set of elements from the current selection.
Declaration
public static bool RemoveRange<T>(IReadOnlyList<T> elements)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
IReadOnlyList<T> | elements | The set of ISelectableElement to remove from the selection. |
Returns
Type | Description |
---|---|
Boolean | Returns true if at least an element has been removed from the selection, false otherwise. |
Type Parameters
Name | Description |
---|---|
T |
Set<T>(T)
Sets the selection to the element.
Declaration
public static void Set<T>(T element)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
T | element | The ISelectableElement to set as the selection. |
Type Parameters
Name | Description |
---|---|
T |
SetActive<T>(T)
Sets the active element of the selection.
Declaration
public static void SetActive<T>(T element)
where T : ISelectableElement
Parameters
Type | Name | Description |
---|---|---|
T | element | The ISelectableElement to set as the active element. |
Type Parameters
Name | Description |
---|---|
T |
Events
changed
Action that is called when the element selection changes.
Declaration
public static event Action changed
Event Type
Type | Description |
---|---|
Action |