diff options
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index aeb3737120..d8f0a2764a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -369,6 +369,13 @@ void EditorNode::_notification(int p_what) { RS::get_singleton()->environment_glow_set_use_bicubic_upscale(glow_bicubic); RS::EnvironmentSSRRoughnessQuality ssr_roughness_quality = RS::EnvironmentSSRRoughnessQuality(int(GLOBAL_GET("rendering/quality/screen_space_reflection/roughness_quality"))); RS::get_singleton()->environment_set_ssr_roughness_quality(ssr_roughness_quality); + RS::SubSurfaceScatteringQuality sss_quality = RS::SubSurfaceScatteringQuality(int(GLOBAL_GET("rendering/quality/subsurface_scattering/subsurface_scattering_quality"))); + RS::get_singleton()->sub_surface_scattering_set_quality(sss_quality); + float sss_scale = GLOBAL_GET("rendering/quality/subsurface_scattering/subsurface_scattering_scale"); + float sss_depth_scale = GLOBAL_GET("rendering/quality/subsurface_scattering/subsurface_scattering_depth_scale"); + RS::get_singleton()->sub_surface_scattering_set_scale(sss_scale, sss_depth_scale); + RS::ShadowFilter shadow_filter = RS::ShadowFilter(int(GLOBAL_GET("rendering/quality/shadows/filter_mode"))); + RS::get_singleton()->shadow_filter_set(shadow_filter); } ResourceImporterTexture::get_singleton()->update_imports(); @@ -3953,11 +3960,14 @@ void EditorNode::_copy_warning(const String &p_str) { } void EditorNode::_dock_floating_close_request(Control *p_control) { - Window *window = (Window *)p_control->get_parent(); + // Through the MarginContainer to the Window. + Window *window = (Window *)p_control->get_parent()->get_parent(); int window_slot = window->get_meta("dock_slot"); - window->remove_child(p_control); + p_control->get_parent()->remove_child(p_control); dock_slot[window_slot]->add_child(p_control); + dock_slot[window_slot]->move_child(p_control, MIN((int)window->get_meta("dock_index"), dock_slot[window_slot]->get_child_count())); + dock_slot[window_slot]->set_current_tab(window->get_meta("dock_index")); window->queue_delete(); @@ -3970,10 +3980,12 @@ void EditorNode::_dock_make_float() { Control *dock = dock_slot[dock_popup_selected]->get_current_tab_control(); ERR_FAIL_COND(!dock); - Size2 dock_size = dock->get_size(); //remember size - Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position(); + const Size2i borders = Size2i(4, 4) * EDSCALE; + Size2 dock_size = dock->get_size() + borders * 2; //remember size + Point2 dock_screen_pos = dock->get_global_position() + get_tree()->get_root()->get_position() - borders; print_line("dock pos: " + dock->get_global_position() + " window pos: " + get_tree()->get_root()->get_position()); + int dock_index = dock->get_index(); dock_slot[dock_popup_selected]->remove_child(dock); Window *window = memnew(Window); @@ -3982,14 +3994,22 @@ void EditorNode::_dock_make_float() { p->set_mode(Panel::MODE_FOREGROUND); p->set_anchors_and_margins_preset(Control::PRESET_WIDE); window->add_child(p); + MarginContainer *margin = memnew(MarginContainer); + margin->set_anchors_and_margins_preset(Control::PRESET_WIDE); + margin->add_theme_constant_override("margin_right", borders.width); + margin->add_theme_constant_override("margin_top", borders.height); + margin->add_theme_constant_override("margin_left", borders.width); + margin->add_theme_constant_override("margin_bottom", borders.height); + window->add_child(margin); dock->set_anchors_and_margins_preset(Control::PRESET_WIDE); - window->add_child(dock); + margin->add_child(dock); window->set_wrap_controls(true); window->set_size(dock_size); window->set_position(dock_screen_pos); window->set_transient(true); window->connect("close_requested", callable_mp(this, &EditorNode::_dock_floating_close_request), varray(dock)); window->set_meta("dock_slot", dock_popup_selected); + window->set_meta("dock_index", dock_index); gui_base->add_child(window); dock_select_popup->hide(); @@ -5914,7 +5934,7 @@ EditorNode::EditorNode() { dock_vb->add_child(dock_select); dock_float = memnew(Button); - dock_float->set_text("Make Floating"); + dock_float->set_text(TTR("Make Floating")); dock_float->set_focus_mode(Control::FOCUS_NONE); dock_float->set_h_size_flags(Control::SIZE_SHRINK_CENTER); dock_float->connect("pressed", callable_mp(this, &EditorNode::_dock_make_float)); |