docs.unity3d.com
    Show / Hide Table of Contents

    Class SplineSelection

    Provides methods to track the selection of spline elements, knots, and tangents. SplineTools and SplineHandles use SplineSelection to manage these elements.

    Inheritance
    Object
    SplineSelection
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    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

    SelectableKnot or SelectableTangent.

    Events

    changed

    Action that is called when the element selection changes.

    Declaration
    public static event Action changed
    Event Type
    Type Description
    Action
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023