summaryrefslogtreecommitdiff
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp43
1 files changed, 23 insertions, 20 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index f768a2cacf..fd6c05d9db 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -496,6 +496,10 @@ void EditorNode::_notification(int p_what) {
RS::get_singleton()->environment_set_sdfgi_ray_count(ray_count);
RS::GIProbeQuality gi_probe_quality = RS::GIProbeQuality(int(GLOBAL_GET("rendering/quality/gi_probes/quality")));
RS::get_singleton()->gi_probe_set_quality(gi_probe_quality);
+ RS::get_singleton()->environment_set_volumetric_fog_volume_size(GLOBAL_GET("rendering/volumetric_fog/volume_size"), GLOBAL_GET("rendering/volumetric_fog/volume_depth"));
+ RS::get_singleton()->environment_set_volumetric_fog_filter_active(bool(GLOBAL_GET("rendering/volumetric_fog/use_filter")));
+ RS::get_singleton()->environment_set_volumetric_fog_directional_shadow_shrink_size(GLOBAL_GET("rendering/volumetric_fog/directional_shadow_shrink"));
+ RS::get_singleton()->environment_set_volumetric_fog_positional_shadow_shrink_size(GLOBAL_GET("rendering/volumetric_fog/positional_shadow_shrink"));
}
ResourceImporterTexture::get_singleton()->update_imports();
@@ -992,8 +996,8 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
}
file->set_current_path(existing);
}
- file->popup_centered_ratio();
file->set_title(TTR("Save Resource As..."));
+ file->popup_file_dialog();
}
void EditorNode::_menu_option(int p_option) {
@@ -1234,7 +1238,10 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
img.instance();
img->create(1, 1, 0, Image::FORMAT_RGB8);
} else if (c3d < c2d) {
- img = scene_root->get_texture()->get_data();
+ Ref<ViewportTexture> viewport_texture = scene_root->get_texture();
+ if (viewport_texture->get_width() > 0 && viewport_texture->get_height() > 0) {
+ img = viewport_texture->get_data();
+ }
} else {
// The 3D editor may be disabled as a feature, but scenes can still be opened.
// This check prevents the preview from regenerating in case those scenes are then saved.
@@ -1244,7 +1251,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
}
}
- if (img.is_valid()) {
+ if (img.is_valid() && img->get_width() > 0 && img->get_height() > 0) {
img = img->duplicate();
save.step(TTR("Creating Thumbnail"), 2);
@@ -2050,7 +2057,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
String args;
bool skip_breakpoints;
- if (p_current || (editor_data.get_edited_scene_root() && p_custom == editor_data.get_edited_scene_root()->get_filename())) {
+ if (p_current || (editor_data.get_edited_scene_root() && p_custom != String() && p_custom == editor_data.get_edited_scene_root()->get_filename())) {
Node *scene = editor_data.get_edited_scene_root();
if (!scene) {
@@ -2080,13 +2087,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) {
if (unsaved_cache) {
Node *scene = editor_data.get_edited_scene_root();
- if (scene) { //only autosave if there is a scene obviously
-
- if (scene->get_filename() == "") {
- show_accept(TTR("Current scene was never saved, please save it prior to running."), TTR("OK"));
- return;
- }
-
+ if (scene && scene->get_filename() != "") { // Only autosave if there is a scene and if it has a path.
_save_scene_with_preview(scene->get_filename());
}
}
@@ -2180,7 +2181,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->set_current_path(scene->get_filename());
};
file->set_title(p_option == FILE_OPEN_SCENE ? TTR("Open Scene") : TTR("Open Base Scene"));
- file->popup_centered_ratio();
+ file->popup_file_dialog();
} break;
case FILE_QUICK_OPEN: {
@@ -2316,7 +2317,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
file->set_current_path(existing);
}
- file->popup_centered_ratio();
+ file->popup_file_dialog();
file->set_title(TTR("Save Scene As..."));
} break;
@@ -2355,7 +2356,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file_export_lib->add_filter("*." + E->get());
}
- file_export_lib->popup_centered_ratio();
+ file_export_lib->popup_file_dialog();
file_export_lib->set_title(TTR("Export Mesh Library"));
} break;
@@ -2374,7 +2375,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file_export_lib->add_filter("*." + E->get());
}
- file_export_lib->popup_centered_ratio();
+ file_export_lib->popup_file_dialog();
file_export_lib->set_title(TTR("Export Tile Set"));
} break;
@@ -2621,7 +2622,6 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
case SETTINGS_TOGGLE_CONSOLE: {
bool was_visible = DisplayServer::get_singleton()->is_console_visible();
DisplayServer::get_singleton()->console_set_visible(!was_visible);
- EditorSettings::get_singleton()->set_setting("interface/editor/hide_console_window", was_visible);
} break;
case EDITOR_SCREENSHOT: {
screenshot_timer->start();
@@ -2640,7 +2640,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
file->set_current_path(scene->get_filename());
};
file->set_title(TTR("Pick a Main Scene"));
- file->popup_centered_ratio();
+ file->popup_file_dialog();
} break;
case HELP_SEARCH: {
@@ -3602,6 +3602,8 @@ void EditorNode::register_editor_types() {
ClassDB::register_class<EditorFileSystemDirectory>();
ClassDB::register_class<EditorVCSInterface>();
ClassDB::register_virtual_class<ScriptEditor>();
+ ClassDB::register_virtual_class<ScriptEditorBase>();
+ ClassDB::register_class<EditorSyntaxHighlighter>();
ClassDB::register_virtual_class<EditorInterface>();
ClassDB::register_class<EditorExportPlugin>();
ClassDB::register_class<EditorResourceConversionPlugin>();
@@ -6317,7 +6319,7 @@ EditorNode::EditorNode() {
right_menu_hb->add_child(video_driver);
#ifndef _MSC_VER
-#warning neeeds to be reimplemented
+#warning needs to be reimplemented
#endif
#if 0
String video_drivers = ProjectSettings::get_singleton()->get_custom_property_info()["rendering/quality/driver/driver_name"].hint_string;
@@ -6478,7 +6480,7 @@ EditorNode::EditorNode() {
confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
save_confirmation = memnew(ConfirmationDialog);
- save_confirmation->add_button(TTR("Don't Save"), DisplayServer::get_singleton()->get_swap_ok_cancel(), "discard");
+ save_confirmation->add_button(TTR("Don't Save"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
gui_base->add_child(save_confirmation);
save_confirmation->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current));
save_confirmation->connect("custom_action", callable_mp(this, &EditorNode::_discard_changes));
@@ -6697,7 +6699,7 @@ EditorNode::EditorNode() {
open_imported = memnew(ConfirmationDialog);
open_imported->get_ok()->set_text(TTR("Open Anyway"));
- new_inherited_button = open_imported->add_button(TTR("New Inherited"), !DisplayServer::get_singleton()->get_swap_ok_cancel(), "inherit");
+ new_inherited_button = open_imported->add_button(TTR("New Inherited"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "inherit");
open_imported->connect("confirmed", callable_mp(this, &EditorNode::_open_imported));
open_imported->connect("custom_action", callable_mp(this, &EditorNode::_inherit_imported));
gui_base->add_child(open_imported);
@@ -6798,6 +6800,7 @@ EditorNode::EditorNode() {
EditorNode::~EditorNode() {
EditorInspector::cleanup_plugins();
+ EditorTranslationParser::get_singleton()->clean_parsers();
remove_print_handler(&print_handler);
memdelete(EditorHelp::get_doc_data());