UNPKG

playcanvas

Version:

Open-source WebGL/WebGPU 3D engine for the web

28 lines (25 loc) 870 B
import { SceneParser } from '../parsers/scene.js'; import { SceneUtils } from './scene-utils.js'; import { ResourceHandler } from './handler.js'; /** * @import { AppBase } from '../app-base.js' */ class HierarchyHandler extends ResourceHandler { load(url, callback) { SceneUtils.load(url, this.maxRetries, callback); } open(url, data) { // prevent script initialization until entire scene is open this._app.systems.script.preloading = true; const parser = new SceneParser(this._app, false); const parent = parser.parse(data); // re-enable script initialization this._app.systems.script.preloading = false; return parent; } /** * @param {AppBase} app - The running {@link AppBase}. */ constructor(app){ super(app, 'hierarchy'); } } export { HierarchyHandler };