ConvertSpineData
Converter for Spine animation data fields in entity components.
This converter handles the serialization and deserialization of SpineData fields when saving/loading entity data. It automatically loads the corresponding Spine asset when converting from a string asset name to SpineData.
Instance Members
basicToField(instance: Entity, field: String, assets: Assets, basic: String, done: Function): Void
Converts a string (asset name) to SpineData by loading the corresponding Spine asset.
This method is called during deserialization when converting saved data back to runtime SpineData objects. It ensures the Spine asset is loaded before providing the SpineData to the entity.
Name | Type | Description |
---|---|---|
instance |
Entity | The entity instance that owns the field |
field |
String | The name of the field being converted |
assets |
Assets | The asset manager used to load the Spine asset |
basic |
String | The string value (asset name) to convert from |
done |
Function | Callback invoked with the loaded SpineData (or null if loading fails) |
Converts SpineData to a string (asset name) for serialization.
This method extracts the asset name from the SpineData object, allowing it to be saved as a simple string reference rather than the full animation data.
Name | Type | Description |
---|---|---|
instance |
Entity | The entity instance that owns the field |
field |
String | The name of the field being converted |
value |
SpineData | The SpineData value to convert |
Returns | Description |
---|---|
String | The asset name string, or null if the SpineData has no associated asset |