// IWriter serializes data to a string. Obtain one via Yaml.createWriter() // (the constructor is protected). The resulting writer can be passed to // APIs that persist state — for example, Editor.Dock.IDockManager.write() // dumps the current dock layout and panel identifiers into the writer. const { Yaml } = awaitimport('LensStudio:Serialization');
constwriter = Yaml.createWriter();
// Serialize the current dock layout (panel IDs + attached/detached state) // through the IDockManager interface. This writes scene object-style // properties into the writer. constdockManager = this.pluginSystem.findInterface( Editor.Dock.IDockManager.interfaceId ) asunknownasEditor.Dock.IDockManager;
if (!Editor.isNull(dockManager)) { dockManager.write(writer); }
// getString() returns the YAML output — a structured, JSON-like string // describing every panel and its dock state. It can be round-tripped // through Yaml.createReader() and IDockManager.read() to restore layout. constserialized = writer.getString(); console.log('IWriter produced', serialized.length, 'bytes of YAML'); console.log(serialized);
Interface for writing serializable data.
Example