diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/text_edit.cpp | 16 | ||||
-rw-r--r-- | scene/gui/text_edit.h | 5 | ||||
-rw-r--r-- | scene/main/scene_tree.cpp | 5 | ||||
-rw-r--r-- | scene/main/window.cpp | 4 | ||||
-rw-r--r-- | scene/resources/syntax_highlighter.cpp | 4 | ||||
-rw-r--r-- | scene/resources/visual_shader.cpp | 10 | ||||
-rw-r--r-- | scene/resources/visual_shader.h | 1 |
7 files changed, 39 insertions, 6 deletions
diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 39ac10a46e..e17085cafc 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1631,7 +1631,7 @@ void TextEdit::_notification(int p_what) { DisplayServer::get_singleton()->window_set_ime_position(get_global_position() + cursor_pos, get_viewport()->get_window_id()); } - if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD)) { + if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD) && virtual_keyboard_enabled) { DisplayServer::get_singleton()->virtual_keyboard_show(get_text(), get_global_rect(), true); } } break; @@ -1647,7 +1647,7 @@ void TextEdit::_notification(int p_what) { ime_text = ""; ime_selection = Point2(); - if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD)) { + if (DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_VIRTUAL_KEYBOARD) && virtual_keyboard_enabled) { DisplayServer::get_singleton()->virtual_keyboard_hide(); } } break; @@ -4889,6 +4889,7 @@ void TextEdit::_update_caches() { cache.folded_eol_icon = get_theme_icon("GuiEllipsis", "EditorIcons"); cache.executing_icon = get_theme_icon("MainPlay", "EditorIcons"); text.set_font(cache.font); + text.clear_width_cache(); if (syntax_highlighter.is_valid()) { syntax_highlighter->set_text_edit(this); @@ -6692,6 +6693,10 @@ void TextEdit::set_shortcut_keys_enabled(bool p_enabled) { _generate_context_menu(); } +void TextEdit::set_virtual_keyboard_enabled(bool p_enable) { + virtual_keyboard_enabled = p_enable; +} + void TextEdit::set_selecting_enabled(bool p_enabled) { selecting_enabled = p_enabled; @@ -6710,6 +6715,10 @@ bool TextEdit::is_shortcut_keys_enabled() const { return shortcut_keys_enabled; } +bool TextEdit::is_virtual_keyboard_enabled() const { + return virtual_keyboard_enabled; +} + PopupMenu *TextEdit::get_menu() const { return menu; } @@ -6762,6 +6771,8 @@ void TextEdit::_bind_methods() { ClassDB::bind_method(D_METHOD("is_context_menu_enabled"), &TextEdit::is_context_menu_enabled); ClassDB::bind_method(D_METHOD("set_shortcut_keys_enabled", "enable"), &TextEdit::set_shortcut_keys_enabled); ClassDB::bind_method(D_METHOD("is_shortcut_keys_enabled"), &TextEdit::is_shortcut_keys_enabled); + ClassDB::bind_method(D_METHOD("set_virtual_keyboard_enabled", "enable"), &TextEdit::set_virtual_keyboard_enabled); + ClassDB::bind_method(D_METHOD("is_virtual_keyboard_enabled"), &TextEdit::is_virtual_keyboard_enabled); ClassDB::bind_method(D_METHOD("set_selecting_enabled", "enable"), &TextEdit::set_selecting_enabled); ClassDB::bind_method(D_METHOD("is_selecting_enabled"), &TextEdit::is_selecting_enabled); @@ -6853,6 +6864,7 @@ void TextEdit::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::BOOL, "override_selected_font_color"), "set_override_selected_font_color", "is_overriding_selected_font_color"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "context_menu_enabled"), "set_context_menu_enabled", "is_context_menu_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "shortcut_keys_enabled"), "set_shortcut_keys_enabled", "is_shortcut_keys_enabled"); + ADD_PROPERTY(PropertyInfo(Variant::BOOL, "virtual_keyboard_enabled"), "set_virtual_keyboard_enabled", "is_virtual_keyboard_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "selecting_enabled"), "set_selecting_enabled", "is_selecting_enabled"); ADD_PROPERTY(PropertyInfo(Variant::BOOL, "smooth_scrolling"), "set_smooth_scroll_enable", "is_smooth_scroll_enabled"); ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "v_scroll_speed"), "set_v_scroll_speed", "get_v_scroll_speed"); diff --git a/scene/gui/text_edit.h b/scene/gui/text_edit.h index 5a6ed99845..a6bc9963cc 100644 --- a/scene/gui/text_edit.h +++ b/scene/gui/text_edit.h @@ -386,6 +386,8 @@ private: bool context_menu_enabled; bool shortcut_keys_enabled; + bool virtual_keyboard_enabled = true; + int executing_line; void _generate_context_menu(); @@ -749,6 +751,9 @@ public: void set_shortcut_keys_enabled(bool p_enabled); bool is_shortcut_keys_enabled() const; + void set_virtual_keyboard_enabled(bool p_enable); + bool is_virtual_keyboard_enabled() const; + PopupMenu *get_menu() const; String get_text_for_completion(); diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 2449b3bd35..adefb53862 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -880,7 +880,10 @@ void SceneTree::_call_input_pause(const StringName &p_group, const StringName &p if (n->get_script_instance()) { n->get_script_instance()->call(p_method, (const Variant **)v, 1, err); } - n->call(p_method, (const Variant **)v, 1, err); + MethodBind *method = ClassDB::get_method(n->get_class_name(), p_method); + if (method) { + method->call(n, (const Variant **)v, 1, err); + } } call_lock--; diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 8c985242f1..a5c5be8a44 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -527,11 +527,11 @@ void Window::_update_window_size() { size.x = MAX(size_limit.x, size.x); size.y = MAX(size_limit.y, size.y); - if (max_size.x > 0 && max_size.x > min_size.x && max_size.x > size.x) { + if (max_size.x > 0 && max_size.x > min_size.x && size.x > max_size.x) { size.x = max_size.x; } - if (max_size.y > 0 && max_size.y > min_size.y && max_size.y > size.y) { + if (max_size.y > 0 && max_size.y > min_size.y && size.y > max_size.y) { size.y = max_size.y; } diff --git a/scene/resources/syntax_highlighter.cpp b/scene/resources/syntax_highlighter.cpp index 9c8f9334a9..4479b822c0 100644 --- a/scene/resources/syntax_highlighter.cpp +++ b/scene/resources/syntax_highlighter.cpp @@ -158,6 +158,10 @@ Dictionary CodeHighlighter::_get_line_syntax_highlighting(int p_line) { const String &str = text_edit->get_line(p_line); const int line_length = str.length(); Color prev_color; + + if (in_region != -1 && str.length() == 0) { + color_region_cache[p_line] = in_region; + } for (int j = 0; j < line_length; j++) { Dictionary highlighter_info; diff --git a/scene/resources/visual_shader.cpp b/scene/resources/visual_shader.cpp index 8b84ce9e8c..e4851ad9f7 100644 --- a/scene/resources/visual_shader.cpp +++ b/scene/resources/visual_shader.cpp @@ -71,7 +71,15 @@ bool VisualShaderNode::is_output_port_connected(int p_port) const { } void VisualShaderNode::set_output_port_connected(int p_port, bool p_connected) { - connected_output_ports[p_port] = p_connected; + if (p_connected) { + connected_output_ports[p_port] = true; + ++connected_output_count; + } else { + --connected_output_count; + if (connected_output_count == 0) { + connected_output_ports[p_port] = false; + } + } } bool VisualShaderNode::is_input_port_connected(int p_port) const { diff --git a/scene/resources/visual_shader.h b/scene/resources/visual_shader.h index d74269cfc6..05d8950be9 100644 --- a/scene/resources/visual_shader.h +++ b/scene/resources/visual_shader.h @@ -184,6 +184,7 @@ class VisualShaderNode : public Resource { Map<int, Variant> default_input_values; Map<int, bool> connected_input_ports; Map<int, bool> connected_output_ports; + int connected_output_count = 0; protected: bool simple_decl; |