Skip to content

Documentation / scene / SerializableClass

Type Alias: SerializableClass

SerializableClass = object

Defined in: libs/scene/src/utility/serialization/types.ts:284

Descriptor for a serializable class/type.

This defines how a class is identified, constructed, and inspected for properties. Editors and serializers can use this metadata to instantiate objects, load initial parameters, and enumerate property accessors.

Properties

ctor

ctor: GenericConstructor

Defined in: libs/scene/src/utility/serialization/types.ts:286

Concrete constructor for the serializable class.


parent?

optional parent?: GenericConstructor

Defined in: libs/scene/src/utility/serialization/types.ts:288

Optional parent/superclass constructor to represent inheritance in tooling.


noTitle?

optional noTitle?: boolean

Defined in: libs/scene/src/utility/serialization/types.ts:290

If true, suppresses title rendering in UI for compact displays.


name

name: string

Defined in: libs/scene/src/utility/serialization/types.ts:292

Display name used by tooling and editors.


createFunc?

optional createFunc?: (ctx?, init?) => { obj: any; loadProps?: boolean; } | Promise<{ obj: any; loadProps?: boolean; }>

Defined in: libs/scene/src/utility/serialization/types.ts:303

Custom factory to create an instance and optionally control property loading.

If loadProps is false, the caller may skip default property loading (useful for lazy or staged initialization).

Parameters

ctx?

any

Optional construction context (editor/runtime-specific).

init?

any

Optional initialization payload.

Returns

{ obj: any; loadProps?: boolean; } | Promise<{ obj: any; loadProps?: boolean; }>

The created object and a loadProps hint.


getInitParams?

optional getInitParams?: (obj, flags) => any

Defined in: libs/scene/src/utility/serialization/types.ts:316

Extracts initialization parameters from an instance suitable for re-creation.

This is the inverse of createFunc's init argument, enabling round-trip serialization of constructor/initializer data.

Parameters

obj

any

The instance to introspect.

flags
saveProps

boolean

Returns

any

An initialization payload (serializable).


getProps

getProps: () => PropertyAccessor<any>[]

Defined in: libs/scene/src/utility/serialization/types.ts:324

Enumerates property accessors for this class.

The returned list defines the full set of serializable/editor-visible properties.

Returns

PropertyAccessor<any>[]

Array of property accessors.

Released under the MIT License.