Class AlembicStreamPlayer
This component allows data streaming from Alembic files. It updates children nodes (Meshes, Transforms, Cameras, etc.) to reflect the Alembic data at the given time.
Implements
Inherited Members
Namespace: UnityEngine.Formats.Alembic.Importer
Assembly: Unity.Formats.Alembic.Runtime.dll
Syntax
[ExecuteInEditMode]
[DisallowMultipleComponent]
public class AlembicStreamPlayer : MonoBehaviour, ISerializationCallbackReceiver
Properties
CurrentTime
Get or set the current time relative to the Alembic file time range (scale in seconds). This is clamped between 0 and the alembic time duration.
Declaration
public float CurrentTime { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Duration
Get the duration of the Alembic file (in seconds).
Declaration
public float Duration { get; }
Property Value
| Type | Description |
|---|---|
| float |
EndTime
Get or set the end timestamp of the streaming time window (scale in seconds). This is clamped to the time range of the Alembic source file.
Declaration
public float EndTime { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
MediaDuration
The duration of the Alembic file (in seconds).
Declaration
public float MediaDuration { get; }
Property Value
| Type | Description |
|---|---|
| float |
MediaEndTime
The end timestamp of the Alembic file (scale in seconds).
Declaration
public float MediaEndTime { get; }
Property Value
| Type | Description |
|---|---|
| float |
MediaStartTime
The start timestamp of the Alembic file (scale in seconds).
Declaration
public float MediaStartTime { get; }
Property Value
| Type | Description |
|---|---|
| float |
PathToAbc
The path to the Alembic asset. When in a standalone build, the returned path is prepended by the streamingAssets path.
Declaration
public string PathToAbc { get; }
Property Value
| Type | Description |
|---|---|
| string |
Settings
The stream import options. NOTE: these options are shared between all instances of this asset.
Declaration
public AlembicStreamSettings Settings { get; set; }
Property Value
| Type | Description |
|---|---|
| AlembicStreamSettings |
StartTime
Get or set the start timestamp of the streaming time window (scale in seconds). This is clamped to the time range of the Alembic source file.
Declaration
public float StartTime { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
VertexMotionScale
Get or set the scalar multiplier to the Alembic vertex speed (magnification factor for velocity). Default value is 1.
Declaration
public float VertexMotionScale { get; set; }
Property Value
| Type | Description |
|---|---|
| float |
Methods
LoadFromFile(string)
Loads a different Alembic file.
Declaration
public bool LoadFromFile(string newPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | newPath | Path to the new file. |
Returns
| Type | Description |
|---|---|
| bool | True if the load succeeded, false otherwise. |
ReloadStream(bool)
Closes and reopens the Alembic stream. Use this method to apply the new stream settings.
Declaration
public bool ReloadStream(bool createMissingNodes = false)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | createMissingNodes | If true, it also recreates the missing GameObjects for the Alembic nodes. |
Returns
| Type | Description |
|---|---|
| bool | True if the stream was successfully reopened, false otherwise. |
RemoveObsoleteGameObjects()
This function removes all child game objects that don't have a corresponding alembic node. Note that is the object is a part of a prefab, this call will fail. Please note that GameObjects that are a part of a Prefab cannot be deleted.
Declaration
public void RemoveObsoleteGameObjects()
UpdateImmediately(float)
Update the child GameObject's data to the CurrentTime (The regular update happens during the LateUpdate phase).
Declaration
public void UpdateImmediately(float time)
Parameters
| Type | Name | Description |
|---|---|---|
| float | time | The timestamp to stream from the asset file. |