Decorator to mark properties of a Serializable for automatic serialization and editor configuration.
Editor Configuration: Specify a type (constructor) for an attribute within a class's metadata. This allows the intended type of an attribute to be known by the editor (at runtime), making it:
undefined).Serialization: The automatic serialization occurs after an instance's Serializable.serialize / Serializable.deserialize method was called.
Example:
import ƒ = FudgeCore;
@ƒ.serialize
export class MyScript extends ƒ.ComponentScript {
#size: number = 1;
@ƒ.serialize(String) // display a string in the editor
public info: string;
@ƒ.serialize(ƒ.Vector3) // display a vector in the editor
public position: ƒ.Vector3 = new ƒ.Vector3(1, 2, 3);
@ƒ.serialize(ƒ.Material) // drop a material inside the editor to reference it
public resource: ƒ.Material;
@ƒ.serialize(ƒ.Node) // drop a node inside the editor to reference it
public reference: ƒ.Node
@ƒ.serialize(Number) // display a number in the editor
public get size(): number {
return this.#size;
}
// define a setter to allow writing to size, or omit it to leave the property read-only
public set size(_size: number) {
this.#size = _size;
}
}
Side effects:
Decorator to mark properties of a Serializable for automatic serialization and editor configuration.
Editor Configuration: Specify a type (constructor) for an attribute within a class's metadata. This allows the intended type of an attribute to be known by the editor (at runtime), making it:
undefined).Serialization: The automatic serialization occurs after an instance's Serializable.serialize / Serializable.deserialize method was called.
Example:
import ƒ = FudgeCore;
@ƒ.serialize
export class MyScript extends ƒ.ComponentScript {
#size: number = 1;
@ƒ.serialize(String) // display a string in the editor
public info: string;
@ƒ.serialize(ƒ.Vector3) // display a vector in the editor
public position: ƒ.Vector3 = new ƒ.Vector3(1, 2, 3);
@ƒ.serialize(ƒ.Material) // drop a material inside the editor to reference it
public resource: ƒ.Material;
@ƒ.serialize(ƒ.Node) // drop a node inside the editor to reference it
public reference: ƒ.Node
@ƒ.serialize(Number) // display a number in the editor
public get size(): number {
return this.#size;
}
// define a setter to allow writing to size, or omit it to leave the property read-only
public set size(_size: number) {
this.#size = _size;
}
}
Side effects:
Decorator to mark properties of a Serializable for automatic serialization and editor configuration.
Editor Configuration: Specify a type (constructor) for an attribute within a class's metadata. This allows the intended type of an attribute to be known by the editor (at runtime), making it:
undefined).Serialization: The automatic serialization occurs after an instance's Serializable.serialize / Serializable.deserialize method was called.
Example:
import ƒ = FudgeCore;
@ƒ.serialize
export class MyScript extends ƒ.ComponentScript {
#size: number = 1;
@ƒ.serialize(String) // display a string in the editor
public info: string;
@ƒ.serialize(ƒ.Vector3) // display a vector in the editor
public position: ƒ.Vector3 = new ƒ.Vector3(1, 2, 3);
@ƒ.serialize(ƒ.Material) // drop a material inside the editor to reference it
public resource: ƒ.Material;
@ƒ.serialize(ƒ.Node) // drop a node inside the editor to reference it
public reference: ƒ.Node
@ƒ.serialize(Number) // display a number in the editor
public get size(): number {
return this.#size;
}
// define a setter to allow writing to size, or omit it to leave the property read-only
public set size(_size: number) {
this.#size = _size;
}
}
Side effects:
Decorator to mark properties of a Serializable for automatic serialization and editor configuration.
Editor Configuration: Specify a type (constructor) for an attribute within a class's metadata. This allows the intended type of an attribute to be known by the editor (at runtime), making it:
undefined).Serialization: The automatic serialization occurs after an instance's Serializable.serialize / Serializable.deserialize method was called.
Example:
Side effects: