This section is currently being written and will be updated frequently.
Important: only the API from window.editorAPI is considered stable and officially supported.
The window.editor object is available for exploration and experimentation, but its structure may change without notice and compatibility between versions is not guaranteed.
The entire editor instance is available globally as window.editor.
This object is useful for research, debugging and advanced experiments, but it is not considered a stable public API. Internal property names and structures may change between versions without notice.
Use window.editorAPI whenever it can solve your task.
window.editorAPI is the official stable entry point for plugins.
The current public methods are:
In addition to window.editor and window.editorAPI, plugins can also use several global objects prepared by the editor:
Example:
(() => {
class ExampleSelectable extends Selectable {
constructor(editor) {
super(editor);
const geometry = new THREE.BoxGeometry(1, 1, 1);
const material = new THREE.MeshBasicMaterial({color: 0xff9900});
const mesh = new THREE.Mesh(geometry, material);
this.add(mesh);
this.name = 'ExampleSelectable';
}
}
})();
Selectable is the base class for editor objects that can be selected and transformed.
Useful methods and properties:
Notes: