How to load AmbientLight and DirectionalLight in the editor by default?

Hello, I have a question.
I hope that every time I open a new project, AmbientLight and DirectionalLight can be loaded by default.
Can you point me in the right direction?

You could add default 3D objects like lights at this place:

This logic is executed when a user clicks on the New button. After the editor.clear() statement, you could do something like:

const ambientLight = new AmbientLight( 0xffffff, 0.4 );
const directionalLight = new DirectionalLight( 0xffffff, 0.6 );
directionalLight.position.set( 10, 10, 10 );

editor.execute( new AddObjectCommand( editor, ambientLight ) );
editor.execute( new AddObjectCommand( editor, directionalLight ) );
1 Like

Thank you for your help. After adding this code, it can be executed successfully, but the function needs to be loaded. :grin:

Is AddObjectCommand, AmbientLight, and DirectionalLight loaded like this? :thinking:

import { AddObjectCommand } from './commands/AddObjectCommand.js';

import { AmbientLight } from '../../../threejsEditor/src/lights/AmbientLight.js';
import { DirectionalLight } from '../../../threejsEditor/src/lights/DirectionalLight.js';