using System.Collections.Generic; using UnityEngine; using UnityEngine.Formats.Alembic.Sdk; namespace UnityEngine.Formats.Alembic.Importer { /// /// The AlembicCurves component stores the curve information for the associated Alembic tree Node. /// [DisallowMultipleComponent] public class AlembicCurves : MonoBehaviour { /// /// Defines the type for the update callback. /// /// the component that was updated. public delegate void OnUpdateDataHandler(AlembicCurves curves); /// /// Returns the positions for all the curves in the current Alembic node. /// public Vector3[] Positions => positionsList.GetArray(); /// /// Returns an array where: the i-th entry returns the starting index of the i-th curve ( the i-th curve is between [CurveOffsets[i]..CurveOffsets[i+1]-1) ). /// public int[] CurveOffsets => curveOffsets.GetArray(); /// /// Returns an array of UVs (optional), if the imported file contained UVs. /// public Vector2[] UVs => uvs.GetArray(); /// /// Returns an array of Widths (optional), if the imported file contained widths/ /// public float[] Widths => widths.GetArray(); /// /// Returns an array of Velocities (optional), if the imported file contained UVs. /// public Vector3[] Velocities => velocitiesList.GetArray(); /// /// Is an event that is invoked every time the data in the component is updated by the AlembicStreamPlayer. This is caused by the evaluation time or import options changing. /// This allows users to perform data post-processing only when needed. /// public event OnUpdateDataHandler OnUpdateData { add => update += value; remove => update -= value; } internal void InvokeOnUpdate(AlembicCurves curves) { update?.Invoke(curves); } OnUpdateDataHandler update; internal PinnedList positionsList { get; } = new PinnedList(); internal PinnedList curveOffsets { get; } = new PinnedList(); internal PinnedList uvs { get; } = new PinnedList(); internal PinnedList widths { get; } = new PinnedList(); internal PinnedList velocitiesList { get; } = new PinnedList(); } }