Struct SelectableKnot
Implements the ISelectableElement interface. SelectableKnot is used by the spline selection and handles to use tools and handles to manipulate spline elements.
Inherited Members
Namespace: UnityEditor.Splines
Assembly: Unity.Splines.Editor.dll
Syntax
public struct SelectableKnot : ISelectableElement, IEquatable<ISelectableElement>, IEquatable<SelectableKnot>
Constructors
SelectableKnot(SplineInfo, int)
Creates a SelectableKnot from a SplineInfo and a knot index.
Declaration
public SelectableKnot(SplineInfo info, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| SplineInfo | info | The SplineInfo associated with the tangent. |
| int | index | The index of the knot. |
Properties
KnotIndex
The index of the knot in the spline. If the spline element is a tangent, this is the index of the knot that the tangent is attached to.
Declaration
public readonly int KnotIndex { get; }
Property Value
| Type | Description |
|---|---|
| int |
LocalPosition
The position of the spline element in local space.
Declaration
public float3 LocalPosition { get; set; }
Property Value
| Type | Description |
|---|---|
| float3 |
LocalRotation
The rotation of the spline element in local space.
Declaration
public quaternion LocalRotation { get; set; }
Property Value
| Type | Description |
|---|---|
| quaternion |
Mode
The TangentMode associated with a knot.
Declaration
public TangentMode Mode { get; set; }
Property Value
| Type | Description |
|---|---|
| TangentMode |
Position
The position of the spline element in world space.
Declaration
public float3 Position { get; set; }
Property Value
| Type | Description |
|---|---|
| float3 |
Rotation
The rotation of the spline element in world space.
Declaration
public quaternion Rotation { get; set; }
Property Value
| Type | Description |
|---|---|
| quaternion |
SplineInfo
The SplineInfo that describes the spline.
Declaration
public readonly SplineInfo SplineInfo { get; }
Property Value
| Type | Description |
|---|---|
| SplineInfo |
TangentIn
The In tangent associated with the knot. The In tangent defines the curvature of the segment that enters the knot.
Declaration
public SelectableTangent TangentIn { get; }
Property Value
| Type | Description |
|---|---|
| SelectableTangent |
TangentOut
The Out tangent associated with the knot. The Out tangent defines the curvature of the segment that exits the knot.
Declaration
public SelectableTangent TangentOut { get; }
Property Value
| Type | Description |
|---|---|
| SelectableTangent |
Tension
The tension associated with a knot. Tension is only used if the tangent mode is Auto Smooth.
Declaration
public float Tension { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
Equals(object)
Checks if two instances of an object are equal.
Declaration
public override bool Equals(object obj)
Parameters
| Type | Name | Description |
|---|---|---|
| object | obj | The object to compare against. |
Returns
| Type | Description |
|---|---|
| bool | Returns true if |
Overrides
Equals(ISelectableElement)
Checks if two instances of SplineElement are equal.
Declaration
public bool Equals(ISelectableElement other)
Parameters
| Type | Name | Description |
|---|---|---|
| ISelectableElement | other | The ISelectableElement to compare against. |
Returns
| Type | Description |
|---|---|
| bool | Returns true when |
Equals(SelectableKnot)
Checks if two instances of SelectableKnot are equal.
Declaration
public bool Equals(SelectableKnot other)
Parameters
| Type | Name | Description |
|---|---|---|
| SelectableKnot | other | The SelectableKnot to compare against. |
Returns
| Type | Description |
|---|---|
| bool | Returns true if the values of each instance of |
GetBezierKnot(bool)
Creates the BezierKnot representation associated with a SelectableKnot.
Declaration
public BezierKnot GetBezierKnot(bool worldSpace)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | worldSpace | Set to true for the BezierKnot to be in world space, or set to false for the Bezierknot to be in local space. |
Returns
| Type | Description |
|---|---|
| BezierKnot | The BezierKnot associated with the knot. |
GetHashCode()
Gets a hash code for this knot.
Declaration
public override int GetHashCode()
Returns
| Type | Description |
|---|---|
| int | A hash code for the SelectableKnot. |
Overrides
IsValid()
Checks if the element is valid. For example, checks if the spline is not null and the index is valid.
Declaration
public bool IsValid()
Returns
| Type | Description |
|---|---|
| bool | Returns true if all fields from the element have valid values. |
SetTangentMode(TangentMode, BezierTangent)
Sets the tangent mode of the knot.
Declaration
public void SetTangentMode(TangentMode mode, BezierTangent main)
Parameters
| Type | Name | Description |
|---|---|---|
| TangentMode | mode | The TangentMode to apply to the knot. |
| BezierTangent | main | The tangent to use as the main tangent when the tangent is set to the Mirrored or Continuous tangent mode. The main tangent is not modified, but the other tangent attached to that knot is modified to adopt the new tangent mode. |