How to use the babylonjs-editor.Tools.LoadFile function in babylonjs-editor

To help you get started, we’ve selected a few babylonjs-editor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BabylonJS / Editor / src / tools / behavior / code.ts View on Github external
// Add grid
        this.grid = new Grid('CodeGrid', {
            toolbarReload: false,
            toolbarSearch: false,
            toolbarEdit: false
        });
        this.grid.columns = [{ field: 'name', caption: 'Name', size: '100%', editable: { type: 'string' } }];
        this.grid.onClick = (id) => this.selectCode(id[0]);
        this.grid.onAdd = () => this.add();
        this.grid.onDelete = (ids) => this.delete(ids);
        this.grid.onChange = (id, value) => this.change(id, value);
        this.grid.build('CODE-BEHAVIOR-LIST');

        // Add code editor
        await this.createEditor();
        this.template = await Tools.LoadFile('./assets/templates/code.txt', false);

        // Events
        this.editor.core.onSelectObject.add(this.onSelectObject);

        // Select object
        if (this.editor.core.currentSelectedObject)
            this.selectObject(this.editor.core.currentSelectedObject);

        // Request extension
        Extensions.RequestExtension(this.editor.core.scene, 'BehaviorExtension');
    }