@@ -884,6 +884,16 @@ void SceneImportSettings::_scene_tree_selected() {
884884 _select (scene_tree, type, import_id);
885885}
886886
887+ void SceneImportSettings::_light_button_pressed (Node *p_button) {
888+ if (p_button == light_1_switch) {
889+ light1->set_visible (!light_1_switch->is_pressed ());
890+ }
891+
892+ if (p_button == light_2_switch) {
893+ light2->set_visible (!light_2_switch->is_pressed ());
894+ }
895+ }
896+
887897void SceneImportSettings::_viewport_input (const Ref<InputEvent> &p_input) {
888898 float *rot_x = &cam_rot_x;
889899 float *rot_y = &cam_rot_y;
@@ -995,6 +1005,15 @@ void SceneImportSettings::_re_import() {
9951005 EditorFileSystem::get_singleton ()->reimport_file_with_custom_parameters (base_path, editing_animation ? " animation_library" : " scene" , main_settings);
9961006}
9971007
1008+ void SceneImportSettings::_update_theme_item_cache () {
1009+ ConfirmationDialog::_update_theme_item_cache ();
1010+
1011+ theme_cache.light_1_on = get_theme_icon (SNAME (" MaterialPreviewLight1" ), SNAME (" EditorIcons" ));
1012+ theme_cache.light_1_off = get_theme_icon (SNAME (" MaterialPreviewLight1Off" ), SNAME (" EditorIcons" ));
1013+ theme_cache.light_2_on = get_theme_icon (SNAME (" MaterialPreviewLight2" ), SNAME (" EditorIcons" ));
1014+ theme_cache.light_2_off = get_theme_icon (SNAME (" MaterialPreviewLight2Off" ), SNAME (" EditorIcons" ));
1015+ }
1016+
9981017void SceneImportSettings::_notification (int p_what) {
9991018 switch (p_what) {
10001019 case NOTIFICATION_READY : {
@@ -1005,6 +1024,11 @@ void SceneImportSettings::_notification(int p_what) {
10051024 action_menu->add_theme_style_override (" normal" , get_theme_stylebox (" normal" , " Button" ));
10061025 action_menu->add_theme_style_override (" hover" , get_theme_stylebox (" hover" , " Button" ));
10071026 action_menu->add_theme_style_override (" pressed" , get_theme_stylebox (" pressed" , " Button" ));
1027+
1028+ light_1_switch->set_texture_normal (theme_cache.light_1_on );
1029+ light_1_switch->set_texture_pressed (theme_cache.light_1_off );
1030+ light_2_switch->set_texture_normal (theme_cache.light_2_on );
1031+ light_2_switch->set_texture_pressed (theme_cache.light_2_off );
10081032 } break ;
10091033
10101034 case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED : {
@@ -1347,6 +1371,32 @@ SceneImportSettings::SceneImportSettings() {
13471371
13481372 base_viewport->set_use_own_world_3d (true );
13491373
1374+ HBoxContainer *hb = memnew (HBoxContainer);
1375+ vp_container->add_child (hb);
1376+ hb->set_anchors_and_offsets_preset (Control::PRESET_FULL_RECT , Control::PRESET_MODE_MINSIZE , 2 );
1377+
1378+ hb->add_spacer ();
1379+
1380+ VBoxContainer *vb_toolbar = memnew (VBoxContainer);
1381+ vb_toolbar->set_v_size_flags (Control::SIZE_EXPAND_FILL );
1382+ hb->add_child (vb_toolbar);
1383+
1384+ light_1_switch = memnew (TextureButton);
1385+ light_1_switch->set_toggle_mode (true );
1386+ light_1_switch->set_tooltip_text (TTR (" Primary Light" ));
1387+ light_1_switch->set_stretch_mode (TextureButton::STRETCH_KEEP_ASPECT_CENTERED );
1388+ light_1_switch->set_custom_minimum_size (Size2 (20 , 20 ));
1389+ vb_toolbar->add_child (light_1_switch);
1390+ light_1_switch->connect (" pressed" , callable_mp (this , &SceneImportSettings::_light_button_pressed).bind (light_1_switch));
1391+
1392+ light_2_switch = memnew (TextureButton);
1393+ light_2_switch->set_toggle_mode (true );
1394+ light_2_switch->set_tooltip_text (TTR (" Secondary Light" ));
1395+ light_2_switch->set_stretch_mode (TextureButton::STRETCH_KEEP_ASPECT_CENTERED );
1396+ light_2_switch->set_custom_minimum_size (Size2 (20 , 20 ));
1397+ vb_toolbar->add_child (light_2_switch);
1398+ light_2_switch->connect (" pressed" , callable_mp (this , &SceneImportSettings::_light_button_pressed).bind (light_2_switch));
1399+
13501400 camera = memnew (Camera3D);
13511401 base_viewport->add_child (camera);
13521402 camera->make_current ();
@@ -1356,10 +1406,15 @@ SceneImportSettings::SceneImportSettings() {
13561406 camera->set_attributes (camera_attributes);
13571407 }
13581408
1359- light = memnew (DirectionalLight3D);
1360- light->set_transform (Transform3D ().looking_at (Vector3 (-1 , -2 , -0.6 ), Vector3 (0 , 1 , 0 )));
1361- base_viewport->add_child (light);
1362- light->set_shadow (true );
1409+ light1 = memnew (DirectionalLight3D);
1410+ light1->set_transform (Transform3D ().looking_at (Vector3 (-1 , -2 , -0.6 ), Vector3 (0 , 1 , 0 )));
1411+ base_viewport->add_child (light1);
1412+ light1->set_shadow (true );
1413+
1414+ light2 = memnew (DirectionalLight3D);
1415+ light2->set_transform (Transform3D ().looking_at (Vector3 (-1 , -1 , -1 ), Vector3 (0 , 1 , 0 )));
1416+ base_viewport->add_child (light2);
1417+ light2->set_color (Color (0.7 , 0.7 , 0.7 ));
13631418
13641419 {
13651420 Ref<StandardMaterial3D> selection_mat;
0 commit comments