Options
All
  • Public
  • Public/Protected
  • All
Menu

Class used to help serialization objects

Hierarchy

  • SerializationHelper

Index

Constructors

Properties

AllowLoadingUniqueId: boolean

Gets or sets a boolean to indicate if the UniqueId property should be serialized

Methods

  • AppendSerializedAnimations(source: IAnimatable, destination: any): void
  • Appends the serialized animations from the source animations

    Parameters

    • source: IAnimatable

      Source containing the animations

    • destination: any

      Target to store the animations

    Returns void

  • Clone<T>(creationFunction: (() => T), source: T, options?: CopySourceOptions): T
  • Clones an object

    Type Parameters

    • T

    Parameters

    • creationFunction: (() => T)

      defines the function used to instanciate the new object

        • (): T
        • Returns T

    • source: T

      defines the source object

    • Optional options: CopySourceOptions

    Returns T

    the cloned object

  • Instanciate<T>(creationFunction: (() => T), source: T): T
  • Instanciates a new object based on a source one (some data will be shared between both object)

    Type Parameters

    • T

    Parameters

    • creationFunction: (() => T)

      defines the function used to instanciate the new object

        • (): T
        • Returns T

    • source: T

      defines the source object

    Returns T

    the new object

  • Parse<T>(creationFunction: (() => T), source: any, scene: Nullable<Scene>, rootUrl?: Nullable<string>): T
  • Creates a new entity from a serialization data object

    Type Parameters

    • T

    Parameters

    • creationFunction: (() => T)

      defines a function used to instanciated the new entity

        • (): T
        • Returns T

    • source: any

      defines the source serialization data

    • scene: Nullable<Scene>

      defines the hosting scene

    • Optional rootUrl: Nullable<string>

      defines the root url for resources

    Returns T

    a new entity

  • Given a source json and a destination object in a scene, this function will parse the source and will try to apply its content to the destination object

    Parameters

    • source: any

      the source json data

    • destination: any

      the destination object

    • scene: Nullable<Scene>

      the scene where the object is

    • rootUrl: Nullable<string>

      root url to use to load assets

    Returns void

  • Serialize<T>(entity: T, serializationObject?: any): any
  • Static function used to serialized a specific entity

    Type Parameters

    • T

    Parameters

    • entity: T

      defines the entity to serialize

    • Optional serializationObject: any

      defines the optional target object where serialization data will be stored

    Returns any

    a JSON compatible object representing the serialization of the entity

Legend

  • Constructor
  • Property
  • Method
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Property
  • Method
  • Static property
  • Static method

Settings

Theme