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.cpp71
1 files changed, 40 insertions, 31 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index d0d99e071a..2e796b2dcd 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1679,7 +1679,7 @@ void EditorNode::_dialog_action(String p_file) {
if (err == ERR_FILE_CANT_OPEN || err == ERR_FILE_NOT_FOUND) {
config.instance(); // new config
} else if (err != OK) {
- show_warning(TTR("Error trying to save layout!"));
+ show_warning(TTR("An error occurred while trying to save the editor layout.\nMake sure the editor's user data path is writable."));
return;
}
@@ -1691,7 +1691,7 @@ void EditorNode::_dialog_action(String p_file) {
_update_layouts_menu();
if (p_file == "Default") {
- show_warning(TTR("Default editor layout overridden."));
+ show_warning(TTR("Default editor layout overridden.\nTo restore the Default layout to its base settings, use the Delete Layout option and delete the Default layout."));
}
} break;
@@ -1722,7 +1722,7 @@ void EditorNode::_dialog_action(String p_file) {
_update_layouts_menu();
if (p_file == "Default") {
- show_warning(TTR("Restored default layout to base settings."));
+ show_warning(TTR("Restored the Default layout to its base settings."));
}
} break;
@@ -2705,10 +2705,14 @@ void EditorNode::_screenshot(bool p_use_utc) {
}
void EditorNode::_save_screenshot(NodePath p_path) {
- SubViewport *viewport = Object::cast_to<SubViewport>(EditorInterface::get_singleton()->get_editor_viewport()->get_viewport());
- viewport->set_clear_mode(SubViewport::CLEAR_MODE_ONLY_NEXT_FRAME);
- Ref<Image> img = viewport->get_texture()->get_data();
- viewport->set_clear_mode(SubViewport::CLEAR_MODE_ALWAYS);
+ Control *editor_viewport = EditorInterface::get_singleton()->get_editor_viewport();
+ ERR_FAIL_COND_MSG(!editor_viewport, "Cannot get editor viewport.");
+ Viewport *viewport = editor_viewport->get_viewport();
+ ERR_FAIL_COND_MSG(!viewport, "Cannot get editor viewport.");
+ Ref<ViewportTexture> texture = viewport->get_texture();
+ ERR_FAIL_COND_MSG(texture.is_null(), "Cannot get editor viewport texture.");
+ Ref<Image> img = texture->get_data();
+ ERR_FAIL_COND_MSG(img.is_null(), "Cannot get editor viewport texture image.");
Error error = img->save_png(p_path);
ERR_FAIL_COND_MSG(error != OK, "Cannot save screenshot to file '" + p_path + "'.");
}
@@ -5561,46 +5565,51 @@ EditorNode::EditorNode() {
{
int display_scale = EditorSettings::get_singleton()->get("interface/editor/display_scale");
- float custom_display_scale = EditorSettings::get_singleton()->get("interface/editor/custom_display_scale");
switch (display_scale) {
case 0: {
- // Try applying a suitable display scale automatically
+ // Try applying a suitable display scale automatically.
#ifdef OSX_ENABLED
editor_set_scale(DisplayServer::get_singleton()->screen_get_max_scale());
#else
const int screen = DisplayServer::get_singleton()->window_get_current_screen();
- editor_set_scale(DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && DisplayServer::get_singleton()->screen_get_size(screen).x > 2000 ? 2.0 : 1.0);
+ float scale;
+ if (DisplayServer::get_singleton()->screen_get_dpi(screen) >= 192 && DisplayServer::get_singleton()->screen_get_size(screen).y >= 1400) {
+ // hiDPI display.
+ scale = 2.0;
+ } else if (DisplayServer::get_singleton()->screen_get_size(screen).y <= 800) {
+ // Small loDPI display. Use a smaller display scale so that editor elements fit more easily.
+ // Icons won't look great, but this is better than having editor elements overflow from its window.
+ scale = 0.75;
+ } else {
+ scale = 1.0;
+ }
+
+ editor_set_scale(scale);
#endif
} break;
- case 1: {
+ case 1:
editor_set_scale(0.75);
- } break;
-
- case 2: {
+ break;
+ case 2:
editor_set_scale(1.0);
- } break;
-
- case 3: {
+ break;
+ case 3:
editor_set_scale(1.25);
- } break;
-
- case 4: {
+ break;
+ case 4:
editor_set_scale(1.5);
- } break;
-
- case 5: {
+ break;
+ case 5:
editor_set_scale(1.75);
- } break;
-
- case 6: {
+ break;
+ case 6:
editor_set_scale(2.0);
- } break;
-
- default: {
- editor_set_scale(custom_display_scale);
- } break;
+ break;
+ default:
+ editor_set_scale(EditorSettings::get_singleton()->get("interface/editor/custom_display_scale"));
+ break;
}
}