@@ -1117,6 +1117,20 @@ void SceneImportSettingsDialog::_cleanup() {
11171117 set_process (false );
11181118}
11191119
1120+ void SceneImportSettingsDialog::_on_light_1_switch_pressed () {
1121+ light1->set_visible (light_1_switch->is_pressed ());
1122+ }
1123+
1124+ void SceneImportSettingsDialog::_on_light_2_switch_pressed () {
1125+ light2->set_visible (light_2_switch->is_pressed ());
1126+ }
1127+
1128+ void SceneImportSettingsDialog::_on_light_rotate_switch_pressed () {
1129+ bool light_top_level = !light_rotate_switch->is_pressed ();
1130+ light1->set_as_top_level_keep_local (light_top_level);
1131+ light2->set_as_top_level_keep_local (light_top_level);
1132+ }
1133+
11201134void SceneImportSettingsDialog::_viewport_input (const Ref<InputEvent> &p_input) {
11211135 float *rot_x = &cam_rot_x;
11221136 float *rot_y = &cam_rot_y;
@@ -1232,6 +1246,13 @@ void SceneImportSettingsDialog::_re_import() {
12321246 EditorFileSystem::get_singleton ()->reimport_file_with_custom_parameters (base_path, editing_animation ? " animation_library" : " scene" , main_settings);
12331247}
12341248
1249+ void SceneImportSettingsDialog::_update_theme_item_cache () {
1250+ ConfirmationDialog::_update_theme_item_cache ();
1251+ theme_cache.light_1_icon = get_editor_theme_icon (SNAME (" MaterialPreviewLight1" ));
1252+ theme_cache.light_2_icon = get_editor_theme_icon (SNAME (" MaterialPreviewLight2" ));
1253+ theme_cache.rotate_icon = get_editor_theme_icon (SNAME (" PreviewRotate" ));
1254+ }
1255+
12351256void SceneImportSettingsDialog::_notification (int p_what) {
12361257 switch (p_what) {
12371258 case NOTIFICATION_READY : {
@@ -1251,6 +1272,10 @@ void SceneImportSettingsDialog::_notification(int p_what) {
12511272 animation_play_button->set_icon (get_editor_theme_icon (SNAME (" MainPlay" )));
12521273 }
12531274 animation_stop_button->set_icon (get_editor_theme_icon (SNAME (" Stop" )));
1275+
1276+ light_1_switch->set_icon (theme_cache.light_1_icon );
1277+ light_2_switch->set_icon (theme_cache.light_2_icon );
1278+ light_rotate_switch->set_icon (theme_cache.rotate_icon );
12541279 } break ;
12551280
12561281 case NOTIFICATION_PROCESS : {
@@ -1644,6 +1669,40 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() {
16441669
16451670 base_viewport->set_use_own_world_3d (true );
16461671
1672+ HBoxContainer *viewport_hbox = memnew (HBoxContainer);
1673+ vp_container->add_child (viewport_hbox);
1674+ viewport_hbox->set_anchors_and_offsets_preset (Control::PRESET_FULL_RECT , Control::PRESET_MODE_MINSIZE , 2 );
1675+
1676+ viewport_hbox->add_spacer ();
1677+
1678+ VBoxContainer *vb_light = memnew (VBoxContainer);
1679+ vb_light->set_v_size_flags (Control::SIZE_EXPAND_FILL );
1680+ viewport_hbox->add_child (vb_light);
1681+
1682+ light_rotate_switch = memnew (Button);
1683+ light_rotate_switch->set_theme_type_variation (" PreviewLightButton" );
1684+ light_rotate_switch->set_toggle_mode (true );
1685+ light_rotate_switch->set_pressed (true );
1686+ light_rotate_switch->set_tooltip_text (TTR (" Rotate Lights With Model" ));
1687+ light_rotate_switch->connect (" pressed" , callable_mp (this , &SceneImportSettingsDialog::_on_light_rotate_switch_pressed));
1688+ vb_light->add_child (light_rotate_switch);
1689+
1690+ light_1_switch = memnew (Button);
1691+ light_1_switch->set_theme_type_variation (" PreviewLightButton" );
1692+ light_1_switch->set_toggle_mode (true );
1693+ light_1_switch->set_pressed (true );
1694+ light_1_switch->set_tooltip_text (TTR (" Primary Light" ));
1695+ light_1_switch->connect (" pressed" , callable_mp (this , &SceneImportSettingsDialog::_on_light_1_switch_pressed));
1696+ vb_light->add_child (light_1_switch);
1697+
1698+ light_2_switch = memnew (Button);
1699+ light_2_switch->set_theme_type_variation (" PreviewLightButton" );
1700+ light_2_switch->set_toggle_mode (true );
1701+ light_2_switch->set_pressed (true );
1702+ light_2_switch->set_tooltip_text (TTR (" Secondary Light" ));
1703+ light_2_switch->connect (" pressed" , callable_mp (this , &SceneImportSettingsDialog::_on_light_2_switch_pressed));
1704+ vb_light->add_child (light_2_switch);
1705+
16471706 camera = memnew (Camera3D);
16481707 base_viewport->add_child (camera);
16491708 camera->make_current ();
@@ -1675,10 +1734,15 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() {
16751734 environment->set_sky_custom_fov (50.0 );
16761735 camera->set_environment (environment);
16771736
1678- light = memnew (DirectionalLight3D);
1679- light->set_transform (Transform3D ().looking_at (Vector3 (-1 , -2 , -0.6 ), Vector3 (0 , 1 , 0 )));
1680- base_viewport->add_child (light);
1681- light->set_shadow (true );
1737+ light1 = memnew (DirectionalLight3D);
1738+ light1->set_transform (Transform3D (Basis::looking_at (Vector3 (-1 , -1 , -1 ))));
1739+ light1->set_shadow (true );
1740+ camera->add_child (light1);
1741+
1742+ light2 = memnew (DirectionalLight3D);
1743+ light2->set_transform (Transform3D (Basis::looking_at (Vector3 (0 , 1 , 0 ), Vector3 (0 , 0 , 1 ))));
1744+ light2->set_color (Color (0 .5f , 0 .5f , 0 .5f ));
1745+ camera->add_child (light2);
16821746
16831747 {
16841748 Ref<StandardMaterial3D> selection_mat;
0 commit comments