diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index a6321ce058..c6613cdf63 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -30,21 +30,21 @@ #include "editor_node.h" -#include "core/bind/core_bind.h" -#include "core/class_db.h" +#include "core/config/project_settings.h" +#include "core/core_bind.h" #include "core/input/input.h" #include "core/io/config_file.h" #include "core/io/image_loader.h" #include "core/io/resource_loader.h" #include "core/io/resource_saver.h" #include "core/io/stream_peer_ssl.h" -#include "core/message_queue.h" +#include "core/object/class_db.h" +#include "core/object/message_queue.h" #include "core/os/file_access.h" #include "core/os/keyboard.h" #include "core/os/os.h" -#include "core/print_string.h" -#include "core/project_settings.h" -#include "core/translation.h" +#include "core/string/print_string.h" +#include "core/string/translation.h" #include "core/version.h" #include "main/main.h" #include "scene/gui/center_container.h" @@ -505,6 +505,12 @@ void EditorNode::_notification(int p_what) { 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")); + RS::get_singleton()->canvas_set_shadow_texture_size(GLOBAL_GET("rendering/quality/2d_shadow_atlas/size")); + + bool snap_2d_transforms = GLOBAL_GET("rendering/quality/2d/snap_2d_transforms_to_pixel"); + scene_root->set_snap_2d_transforms_to_pixel(snap_2d_transforms); + bool snap_2d_vertices = GLOBAL_GET("rendering/quality/2d/snap_2d_vertices_to_pixel"); + scene_root->set_snap_2d_vertices_to_pixel(snap_2d_vertices); } ResourceImporterTexture::get_singleton()->update_imports(); @@ -516,6 +522,8 @@ void EditorNode::_notification(int p_what) { OS::get_singleton()->set_low_processor_usage_mode_sleep_usec(int(EDITOR_GET("interface/editor/low_processor_mode_sleep_usec"))); get_tree()->get_root()->set_as_audio_listener(false); get_tree()->get_root()->set_as_audio_listener_2d(false); + get_tree()->get_root()->set_snap_2d_transforms_to_pixel(false); + get_tree()->get_root()->set_snap_2d_vertices_to_pixel(false); get_tree()->set_auto_accept_quit(false); get_tree()->get_root()->connect("files_dropped", callable_mp(this, &EditorNode::_dropped_files)); @@ -2697,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 + "'."); } @@ -4225,6 +4237,7 @@ void EditorNode::_save_docks_to_config(Ref<ConfigFile> p_layout, const String &p p_layout->set_value(p_section, "dock_filesystem_split", filesystem_dock->get_split_offset()); p_layout->set_value(p_section, "dock_filesystem_display_mode", filesystem_dock->get_display_mode()); + p_layout->set_value(p_section, "dock_filesystem_file_sort", filesystem_dock->get_file_sort()); p_layout->set_value(p_section, "dock_filesystem_file_list_display_mode", filesystem_dock->get_file_list_display_mode()); for (int i = 0; i < vsplits.size(); i++) { @@ -4419,6 +4432,11 @@ void EditorNode::_load_docks_from_config(Ref<ConfigFile> p_layout, const String filesystem_dock->set_display_mode(dock_filesystem_display_mode); } + if (p_layout->has_section_key(p_section, "dock_filesystem_file_sort")) { + FileSystemDock::FileSortOption dock_filesystem_file_sort = FileSystemDock::FileSortOption(int(p_layout->get_value(p_section, "dock_filesystem_file_sort"))); + filesystem_dock->set_file_sort(dock_filesystem_file_sort); + } + if (p_layout->has_section_key(p_section, "dock_filesystem_file_list_display_mode")) { FileSystemDock::FileListDisplayMode dock_filesystem_file_list_display_mode = FileSystemDock::FileListDisplayMode(int(p_layout->get_value(p_section, "dock_filesystem_file_list_display_mode"))); filesystem_dock->set_file_list_display_mode(dock_filesystem_file_list_display_mode); |