diff options
-rw-r--r-- | core/ustring.cpp | 8 | ||||
-rw-r--r-- | doc/classes/ProjectSettings.xml | 10 | ||||
-rw-r--r-- | editor/editor_node.cpp | 3 | ||||
-rw-r--r-- | editor/project_manager.cpp | 1 | ||||
-rw-r--r-- | main/main.cpp | 7 | ||||
-rw-r--r-- | modules/bullet/godot_ray_world_algorithm.cpp | 4 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 53 |
7 files changed, 53 insertions, 33 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp index c1888c87a7..838907419e 100644 --- a/core/ustring.cpp +++ b/core/ustring.cpp @@ -2945,12 +2945,12 @@ String String::left(int p_pos) const { String String::right(int p_pos) const { - if (p_pos >= size()) - return *this; - - if (p_pos < 0) + if (p_pos >= length()) return ""; + if (p_pos <= 0) + return *this; + return substr(p_pos, (length() - p_pos)); } diff --git a/doc/classes/ProjectSettings.xml b/doc/classes/ProjectSettings.xml index 6b53615535..1782edf25d 100644 --- a/doc/classes/ProjectSettings.xml +++ b/doc/classes/ProjectSettings.xml @@ -319,9 +319,6 @@ <member name="display/mouse_cursor/custom_image_hotspot" type="Vector2" setter="" getter=""> Hotspot for the custom mouse cursor image. </member> - <member name="display/window/allow_per_pixel_transparency" type="bool" setter="" getter=""> - Allow per pixel transparency in a Desktop window. This affects performance if not needed, so leave it off. - </member> <member name="display/window/dpi/allow_hidpi" type="bool" setter="" getter=""> Allow HiDPI display on Windows and OSX. On Desktop Linux, this can't be enabled or disabled. </member> @@ -331,9 +328,12 @@ <member name="display/window/handheld/orientation" type="String" setter="" getter=""> Default orientation for cell phone or tablet. </member> - <member name="display/window/per_pixel_transparency" type="bool" setter="" getter=""> + <member name="display/window/per_pixel_transparency/allowed" type="bool" setter="" getter=""> + Allow per pixel transparency in a Desktop window. This affects performance if not needed, so leave it off. + </member> + <member name="display/window/per_pixel_transparency/enabled" type="bool" setter="" getter=""> </member> - <member name="display/window/per_pixel_transparency_splash" type="bool" setter="" getter=""> + <member name="display/window/per_pixel_transparency/splash" type="bool" setter="" getter=""> </member> <member name="display/window/size/always_on_top" type="bool" setter="" getter=""> Force the window to be always on top. diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 973b2cc7a2..745be39df7 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4419,7 +4419,7 @@ void EditorNode::remove_tool_menu_item(const String &p_name) { void EditorNode::_dropped_files(const Vector<String> &p_files, int p_screen) { - String to_path = ProjectSettings::get_singleton()->globalize_path(get_filesystem_dock()->get_current_path()); + String to_path = ProjectSettings::get_singleton()->globalize_path(get_filesystem_dock()->get_selected_path()); DirAccessRef dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); Vector<String> just_copy = String("ttf,otf").split(","); @@ -5004,6 +5004,7 @@ EditorNode::EditorNode() { main_vbox = memnew(VBoxContainer); gui_base->add_child(main_vbox); main_vbox->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8); + main_vbox->add_constant_override("separation", 8 * EDSCALE); menu_hb = memnew(HBoxContainer); main_vbox->add_child(menu_hb); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index bda5add381..0a24f325fd 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1901,6 +1901,7 @@ ProjectManager::ProjectManager() { VBoxContainer *vb = memnew(VBoxContainer); panel->add_child(vb); vb->set_anchors_and_margins_preset(Control::PRESET_WIDE, Control::PRESET_MODE_MINSIZE, 8 * EDSCALE); + vb->add_constant_override("separation", 8 * EDSCALE); String cp; cp += 0xA9; diff --git a/main/main.cpp b/main/main.cpp index c504aa7e8e..b81a379dbb 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -926,13 +926,12 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph OS::get_singleton()->_allow_hidpi = GLOBAL_DEF("display/window/dpi/allow_hidpi", false); } - OS::get_singleton()->_allow_layered = GLOBAL_DEF("display/window/allow_per_pixel_transparency", false); - video_mode.use_vsync = GLOBAL_DEF("display/window/vsync/use_vsync", true); OS::get_singleton()->_use_vsync = video_mode.use_vsync; - video_mode.layered = GLOBAL_DEF("display/window/per_pixel_transparency", false); - video_mode.layered_splash = GLOBAL_DEF("display/window/per_pixel_transparency_splash", false); + OS::get_singleton()->_allow_layered = GLOBAL_DEF("display/window/per_pixel_transparency/allowed", false); + video_mode.layered = GLOBAL_DEF("display/window/per_pixel_transparency/enabled", false); + video_mode.layered_splash = GLOBAL_DEF("display/window/per_pixel_transparency/splash", false); GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation", 2); GLOBAL_DEF("rendering/quality/intended_usage/framebuffer_allocation.mobile", 3); diff --git a/modules/bullet/godot_ray_world_algorithm.cpp b/modules/bullet/godot_ray_world_algorithm.cpp index cadc8dd59e..3e06239453 100644 --- a/modules/bullet/godot_ray_world_algorithm.cpp +++ b/modules/bullet/godot_ray_world_algorithm.cpp @@ -100,8 +100,8 @@ void GodotRayWorldAlgorithm::processCollision(const btCollisionObjectWrapper *bo btScalar depth(ray_shape->getScaledLength() * (btResult.m_closestHitFraction - 1)); - if (depth >= -ray_shape->getMargin()) - depth *= 0.5; + if (depth >= -ray_shape->getMargin() * 0.5) + depth = 0; if (ray_shape->getSlipsOnSlope()) resultOut->addContactPoint(btResult.m_hitNormalWorld, btResult.m_hitPointWorld, depth); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index d2c56dba06..2fd86bd8b0 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -861,6 +861,9 @@ void TextEdit::_notification(int p_what) { const String &str = wrap_rows[line_wrap_index]; int indent_px = line_wrap_index != 0 ? get_indent_level(line) * cache.font->get_char_size(' ').width : 0; + if (indent_px >= wrap_at) { + indent_px = 0; + } if (line_wrap_index > 0) last_wrap_column += wrap_rows[line_wrap_index - 1].length(); @@ -3788,6 +3791,9 @@ Vector<String> TextEdit::get_wrap_rows_text(int p_line) const { int cur_wrap_index = 0; int tab_offset_px = get_indent_level(p_line) * cache.font->get_char_size(' ').width; + if (tab_offset_px >= wrap_at) { + tab_offset_px = 0; + } while (col < line_text.length()) { CharType c = line_text[col]; @@ -3795,29 +3801,36 @@ Vector<String> TextEdit::get_wrap_rows_text(int p_line) const { int indent_ofs = (cur_wrap_index != 0 ? tab_offset_px : 0); - word_str += c; - word_px += w; - if (c == ' ') { - // end of a word; add this word to the substring + if (indent_ofs + word_px + w > wrap_at) { + // not enough space to add this char; start next line wrap_substring += word_str; - px += word_px; - word_str = ""; - word_px = 0; - } + lines.push_back(wrap_substring); + cur_wrap_index++; + wrap_substring = ""; + px = 0; - if ((indent_ofs + px + word_px) > wrap_at) { - // do not want to add this word - if (indent_ofs + word_px > wrap_at) { - // not enough space; add it anyway + word_str = ""; + word_str += c; + word_px = w; + } else { + word_str += c; + word_px += w; + if (c == ' ') { + // end of a word; add this word to the substring wrap_substring += word_str; + px += word_px; word_str = ""; word_px = 0; } - lines.push_back(wrap_substring); - // reset for next wrap - cur_wrap_index++; - wrap_substring = ""; - px = 0; + + if (indent_ofs + px + word_px > wrap_at) { + // this word will be moved to the next line + lines.push_back(wrap_substring); + // reset for next wrap + cur_wrap_index++; + wrap_substring = ""; + px = 0; + } } col++; } @@ -4030,6 +4043,9 @@ int TextEdit::get_char_pos_for_line(int p_px, int p_line, int p_wrap_index) cons int line_wrap_amount = times_line_wraps(p_line); int wrap_offset_px = get_indent_level(p_line) * cache.font->get_char_size(' ').width; + if (wrap_offset_px >= wrap_at) { + wrap_offset_px = 0; + } if (p_wrap_index > line_wrap_amount) p_wrap_index = line_wrap_amount; if (p_wrap_index > 0) @@ -4071,6 +4087,9 @@ int TextEdit::get_column_x_offset_for_line(int p_char, int p_line) const { int px = get_column_x_offset(n_char, rows[wrap_index]); int wrap_offset_px = get_indent_level(p_line) * cache.font->get_char_size(' ').width; + if (wrap_offset_px >= wrap_at) { + wrap_offset_px = 0; + } if (wrap_index != 0) px += wrap_offset_px; |