diff options
-rw-r--r-- | core/extension/extension_api_dump.cpp | 39 | ||||
-rw-r--r-- | core/io/resource_format_binary.cpp | 7 | ||||
-rw-r--r-- | core/variant/variant_internal.h | 25 | ||||
-rw-r--r-- | doc/classes/AnimationPlayer.xml | 5 | ||||
-rw-r--r-- | doc/classes/DisplayServer.xml | 4 | ||||
-rw-r--r-- | doc/classes/TreeItem.xml | 9 | ||||
-rw-r--r-- | editor/editor_file_system.cpp | 2 | ||||
-rw-r--r-- | editor/editor_node.cpp | 7 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 29 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.h | 1 | ||||
-rw-r--r-- | modules/openxr/openxr_api.cpp | 107 | ||||
-rw-r--r-- | platform/macos/display_server_macos.h | 2 | ||||
-rw-r--r-- | platform/macos/display_server_macos.mm | 22 | ||||
-rw-r--r-- | platform/macos/godot_button_view.h | 5 | ||||
-rw-r--r-- | platform/macos/godot_button_view.mm | 22 | ||||
-rw-r--r-- | scene/animation/animation_player.cpp | 32 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 13 | ||||
-rw-r--r-- | scene/gui/tree.cpp | 1 | ||||
-rw-r--r-- | scene/resources/resource_format_text.cpp | 7 | ||||
-rw-r--r-- | servers/display_server.h | 2 | ||||
-rw-r--r-- | tests/scene/test_text_edit.h | 12 |
21 files changed, 216 insertions, 137 deletions
diff --git a/core/extension/extension_api_dump.cpp b/core/extension/extension_api_dump.cpp index e6e0fff266..96b396caa9 100644 --- a/core/extension/extension_api_dump.cpp +++ b/core/extension/extension_api_dump.cpp @@ -38,7 +38,15 @@ #ifdef TOOLS_ENABLED -static String get_type_name(const PropertyInfo &p_info) { +static String get_builtin_or_variant_type_name(const Variant::Type p_type) { + if (p_type == Variant::NIL) { + return "Variant"; + } else { + return Variant::get_type_name(p_type); + } +} + +static String get_property_info_type_name(const PropertyInfo &p_info) { if (p_info.type == Variant::INT && (p_info.hint == PROPERTY_HINT_INT_IS_POINTER)) { if (p_info.hint_string.is_empty()) { return "void*"; @@ -70,7 +78,7 @@ static String get_type_name(const PropertyInfo &p_info) { if (p_info.type == Variant::NIL) { return "void"; } - return Variant::get_type_name(p_info.type); + return get_builtin_or_variant_type_name(p_info.type); } Dictionary NativeExtensionAPIDump::generate_extension_api() { @@ -430,8 +438,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { Dictionary arg; String argname = vararg ? "arg" + itos(i + 1) : Variant::get_utility_function_argument_name(name, i); arg["name"] = argname; - Variant::Type argtype = Variant::get_utility_function_argument_type(name, i); - arg["type"] = argtype == Variant::NIL ? String("Variant") : Variant::get_type_name(argtype); + arg["type"] = get_builtin_or_variant_type_name(Variant::get_utility_function_argument_type(name, i)); //no default value support in utility functions arguments.push_back(arg); } @@ -461,8 +468,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { Dictionary d; d["name"] = Variant::get_type_name(type); if (Variant::has_indexing(type)) { - Variant::Type index_type = Variant::get_indexed_element_type(type); - d["indexing_return_type"] = index_type == Variant::NIL ? String("Variant") : Variant::get_type_name(index_type); + d["indexing_return_type"] = get_builtin_or_variant_type_name(Variant::get_indexed_element_type(type)); } d["is_keyed"] = Variant::is_keyed(type); @@ -476,7 +482,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { for (const StringName &member_name : member_names) { Dictionary d2; d2["name"] = String(member_name); - d2["type"] = Variant::get_type_name(Variant::get_member_type(type, member_name)); + d2["type"] = get_builtin_or_variant_type_name(Variant::get_member_type(type, member_name)); members.push_back(d2); } if (members.size()) { @@ -493,7 +499,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { Dictionary d2; d2["name"] = String(constant_name); Variant constant = Variant::get_constant_value(type, constant_name); - d2["type"] = Variant::get_type_name(constant.get_type()); + d2["type"] = get_builtin_or_variant_type_name(constant.get_type()); d2["value"] = constant.get_construct_string(); constants.push_back(d2); } @@ -544,9 +550,9 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { Dictionary d2; d2["name"] = Variant::get_operator_name(Variant::Operator(k)); if (k != Variant::OP_NEGATE && k != Variant::OP_POSITIVE && k != Variant::OP_NOT && k != Variant::OP_BIT_NEGATE) { - d2["right_type"] = Variant::get_type_name(Variant::Type(j)); + d2["right_type"] = get_builtin_or_variant_type_name(Variant::Type(j)); } - d2["return_type"] = Variant::get_type_name(Variant::get_operator_return_type(Variant::Operator(k), type, Variant::Type(j))); + d2["return_type"] = get_builtin_or_variant_type_name(Variant::get_operator_return_type(Variant::Operator(k), type, Variant::Type(j))); operators.push_back(d2); } } @@ -580,8 +586,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { for (int j = 0; j < argcount; j++) { Dictionary d3; d3["name"] = Variant::get_builtin_method_argument_name(type, method_name, j); - Variant::Type argtype = Variant::get_builtin_method_argument_type(type, method_name, j); - d3["type"] = argtype == Variant::NIL ? String("Variant") : Variant::get_type_name(argtype); + d3["type"] = get_builtin_or_variant_type_name(Variant::get_builtin_method_argument_type(type, method_name, j)); if (j >= (argcount - default_args.size())) { int dargidx = j - (argcount - default_args.size()); @@ -613,7 +618,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { for (int k = 0; k < argcount; k++) { Dictionary d3; d3["name"] = Variant::get_constructor_argument_name(type, j, k); - d3["type"] = Variant::get_type_name(Variant::get_constructor_argument_type(type, j, k)); + d3["type"] = get_builtin_or_variant_type_name(Variant::get_constructor_argument_type(type, j, k)); arguments.push_back(d3); } if (arguments.size()) { @@ -741,7 +746,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { d3["name"] = pinfo.name; } - d3["type"] = get_type_name(pinfo); + d3["type"] = get_property_info_type_name(pinfo); if (i == -1) { d2["return_value"] = d3; @@ -784,7 +789,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { if (i >= 0) { d3["name"] = pinfo.name; } - d3["type"] = get_type_name(pinfo); + d3["type"] = get_property_info_type_name(pinfo); if (method->get_argument_meta(i) > 0) { static const char *argmeta[11] = { "none", "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", "float", "double" }; @@ -831,7 +836,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { for (int i = 0; i < F.arguments.size(); i++) { Dictionary d3; d3["name"] = F.arguments[i].name; - d3["type"] = get_type_name(F.arguments[i]); + d3["type"] = get_property_info_type_name(F.arguments[i]); arguments.push_back(d3); } if (arguments.size()) { @@ -863,7 +868,7 @@ Dictionary NativeExtensionAPIDump::generate_extension_api() { } StringName property_name = F.name; Dictionary d2; - d2["type"] = get_type_name(F); + d2["type"] = get_property_info_type_name(F); d2["name"] = String(property_name); d2["setter"] = ClassDB::get_property_setter(class_name, F.name); d2["getter"] = ClassDB::get_property_getter(class_name, F.name); diff --git a/core/io/resource_format_binary.cpp b/core/io/resource_format_binary.cpp index 2a79067e02..4611528db7 100644 --- a/core/io/resource_format_binary.cpp +++ b/core/io/resource_format_binary.cpp @@ -1042,7 +1042,14 @@ void ResourceLoaderBinary::open(Ref<FileAccess> p_f, bool p_no_resources, bool p // If a UID is found and the path is valid, it will be used, otherwise, it falls back to the path. er.path = ResourceUID::get_singleton()->get_id_path(er.uid); } else { +#ifdef TOOLS_ENABLED + // Silence a warning that can happen during the initial filesystem scan due to cache being regenerated. + if (ResourceLoader::get_resource_uid(res_path) != er.uid) { + WARN_PRINT(String(res_path + ": In external resource #" + itos(i) + ", invalid UUID: " + ResourceUID::get_singleton()->id_to_text(er.uid) + " - using text path instead: " + er.path).utf8().get_data()); + } +#else WARN_PRINT(String(res_path + ": In external resource #" + itos(i) + ", invalid UUID: " + ResourceUID::get_singleton()->id_to_text(er.uid) + " - using text path instead: " + er.path).utf8().get_data()); +#endif } } } diff --git a/core/variant/variant_internal.h b/core/variant/variant_internal.h index 874a183d29..7ae2368fe4 100644 --- a/core/variant/variant_internal.h +++ b/core/variant/variant_internal.h @@ -1047,7 +1047,7 @@ struct VariantInternalAccessor<PackedColorArray> { template <> struct VariantInternalAccessor<Object *> { static _FORCE_INLINE_ Object *get(const Variant *v) { return const_cast<Object *>(*VariantInternal::get_object(v)); } - static _FORCE_INLINE_ void set(Variant *v, const Object *p_value) { *VariantInternal::get_object(v) = const_cast<Object *>(p_value); } + static _FORCE_INLINE_ void set(Variant *v, const Object *p_value) { VariantInternal::object_assign(v, p_value); } }; template <> @@ -1532,27 +1532,4 @@ struct VariantTypeConstructor { } }; -template <> -struct VariantTypeConstructor<Object *> { - _FORCE_INLINE_ static void variant_from_type(void *p_variant, void *p_value) { - Variant *variant = reinterpret_cast<Variant *>(p_variant); - VariantInitializer<Object *>::init(variant); - Object *object = *(reinterpret_cast<Object **>(p_value)); - if (object) { - if (object->is_ref_counted()) { - if (!VariantInternal::initialize_ref(object)) { - return; - } - } - VariantInternalAccessor<Object *>::set(variant, object); - VariantInternalAccessor<ObjectID>::set(variant, object->get_instance_id()); - } - } - - _FORCE_INLINE_ static void type_from_variant(void *p_value, void *p_variant) { - Object **value = reinterpret_cast<Object **>(p_value); - *value = VariantInternalAccessor<Object *>::get(reinterpret_cast<Variant *>(p_variant)); - } -}; - #endif // VARIANT_INTERNAL_H diff --git a/doc/classes/AnimationPlayer.xml b/doc/classes/AnimationPlayer.xml index b7ac1ff7f8..c32cc5c5b8 100644 --- a/doc/classes/AnimationPlayer.xml +++ b/doc/classes/AnimationPlayer.xml @@ -268,6 +268,11 @@ [b]Note:[/b] This signal is not emitted if an animation is looping. </description> </signal> + <signal name="animation_libraries_updated"> + <description> + Notifies when the animation libraries have changed. + </description> + </signal> <signal name="animation_list_changed"> <description> Notifies when an animation list is changed. diff --git a/doc/classes/DisplayServer.xml b/doc/classes/DisplayServer.xml index 0dbaa9c86f..85d9fd34ca 100644 --- a/doc/classes/DisplayServer.xml +++ b/doc/classes/DisplayServer.xml @@ -1116,10 +1116,10 @@ </description> </method> <method name="window_get_safe_title_margins" qualifiers="const"> - <return type="Vector2i" /> + <return type="Vector3i" /> <param index="0" name="window_id" type="int" default="0" /> <description> - Returns left and right margins of the title that are safe to use (contains no buttons or other elements) when [constant WINDOW_FLAG_EXTEND_TO_TITLE] flag is set. + Returns left margins ([code]x[/code]), right margins ([code]y[/code]) adn height ([code]z[/code]) of the title that are safe to use (contains no buttons or other elements) when [constant WINDOW_FLAG_EXTEND_TO_TITLE] flag is set. </description> </method> <method name="window_get_size" qualifiers="const"> diff --git a/doc/classes/TreeItem.xml b/doc/classes/TreeItem.xml index c109dc57f7..a8ffef427f 100644 --- a/doc/classes/TreeItem.xml +++ b/doc/classes/TreeItem.xml @@ -425,6 +425,15 @@ Sets the given column's button [Texture2D] at index [param button_idx] to [param button]. </description> </method> + <method name="set_button_color"> + <return type="void" /> + <param index="0" name="column" type="int" /> + <param index="1" name="button_idx" type="int" /> + <param index="2" name="color" type="Color" /> + <description> + Sets the given column's button color at index [param button_idx] to [param color]. + </description> + </method> <method name="set_button_disabled"> <return type="void" /> <param index="0" name="column" type="int" /> diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 6f34c677db..651501f75e 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -2422,7 +2422,7 @@ EditorFileSystem::EditorFileSystem() { scan_total = 0; update_script_classes_queued.clear(); - ResourceUID::get_singleton()->clear(); //will be updated on scan + MessageQueue::get_singleton()->push_callable(callable_mp(ResourceUID::get_singleton(), &ResourceUID::clear)); // Will be updated on scan. ResourceSaver::set_get_resource_id_for_path(_resource_saver_get_resource_id_for_path); } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 288ee4fa8f..7aca8fde6f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -1181,7 +1181,8 @@ void EditorNode::_vp_resized() { } void EditorNode::_titlebar_resized() { - const Size2 &margin = DisplayServer::get_singleton()->window_get_safe_title_margins(DisplayServer::MAIN_WINDOW_ID); + DisplayServer::get_singleton()->window_set_window_buttons_offset(Vector2i(menu_hb->get_global_position().y + menu_hb->get_size().y / 2, menu_hb->get_global_position().y + menu_hb->get_size().y / 2), DisplayServer::MAIN_WINDOW_ID); + const Vector3i &margin = DisplayServer::get_singleton()->window_get_safe_title_margins(DisplayServer::MAIN_WINDOW_ID); if (left_menu_spacer) { int w = (gui_base->is_layout_rtl()) ? margin.y : margin.x; left_menu_spacer->set_custom_minimum_size(Size2(w, 0)); @@ -1190,6 +1191,9 @@ void EditorNode::_titlebar_resized() { int w = (gui_base->is_layout_rtl()) ? margin.x : margin.y; right_menu_spacer->set_custom_minimum_size(Size2(w, 0)); } + if (menu_hb) { + menu_hb->set_custom_minimum_size(Size2(0, margin.z - menu_hb->get_global_position().y)); + } } void EditorNode::_version_button_pressed() { @@ -7560,7 +7564,6 @@ EditorNode::EditorNode() { // Extend menu bar to window title. if (can_expand) { - DisplayServer::get_singleton()->window_set_window_buttons_offset(Vector2i(menu_hb->get_minimum_size().y / 2, menu_hb->get_minimum_size().y / 2), DisplayServer::MAIN_WINDOW_ID); DisplayServer::get_singleton()->window_set_flag(DisplayServer::WINDOW_FLAG_EXTEND_TO_TITLE, true, DisplayServer::MAIN_WINDOW_ID); menu_hb->set_can_move_window(true); } diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index dc84c08506..a48990779b 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -302,6 +302,8 @@ void AnimationPlayerEditor::_animation_selected(int p_which) { AnimationPlayerEditor::get_singleton()->get_track_editor()->update_keying(); _animation_key_editor_seek(timeline_position, false); + + emit_signal("animation_selected", current); } void AnimationPlayerEditor::_animation_new() { @@ -720,7 +722,18 @@ void AnimationPlayerEditor::set_state(const Dictionary &p_state) { if (p_state.has("player")) { Node *n = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["player"]); if (Object::cast_to<AnimationPlayer>(n) && EditorNode::get_singleton()->get_editor_selection()->is_selected(n)) { + if (player) { + if (player->is_connected("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated))) { + player->disconnect("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated)); + } + } player = Object::cast_to<AnimationPlayer>(n); + if (player) { + if (!player->is_connected("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated))) { + player->connect("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated)); + } + } + _update_player(); EditorNode::get_singleton()->make_bottom_panel_item_visible(this); set_process(true); @@ -982,9 +995,18 @@ void AnimationPlayerEditor::edit(AnimationPlayer *p_player) { if (player && pin->is_pressed()) { return; // Ignore, pinned. } + + if (player) { + if (player->is_connected("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated))) { + player->disconnect("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated)); + } + } player = p_player; if (player) { + if (!player->is_connected("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated))) { + player->connect("animation_libraries_updated", callable_mp(this, &AnimationPlayerEditor::_animation_libraries_updated)); + } _update_player(); if (onion.enabled) { @@ -1151,6 +1173,10 @@ void AnimationPlayerEditor::_animation_player_changed(Object *p_pl) { } } +void AnimationPlayerEditor::_animation_libraries_updated() { + _animation_player_changed(player); +} + void AnimationPlayerEditor::_list_changed() { if (is_visible_in_tree()) { _update_player(); @@ -1545,6 +1571,7 @@ void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_animation_edit"), &AnimationPlayerEditor::_animation_edit); ClassDB::bind_method(D_METHOD("_animation_resource_edit"), &AnimationPlayerEditor::_animation_resource_edit); ClassDB::bind_method(D_METHOD("_animation_player_changed"), &AnimationPlayerEditor::_animation_player_changed); + ClassDB::bind_method(D_METHOD("_animation_libraries_updated"), &AnimationPlayerEditor::_animation_libraries_updated); ClassDB::bind_method(D_METHOD("_list_changed"), &AnimationPlayerEditor::_list_changed); ClassDB::bind_method(D_METHOD("_animation_duplicate"), &AnimationPlayerEditor::_animation_duplicate); @@ -1552,6 +1579,8 @@ void AnimationPlayerEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("_prepare_onion_layers_2"), &AnimationPlayerEditor::_prepare_onion_layers_2); ClassDB::bind_method(D_METHOD("_start_onion_skinning"), &AnimationPlayerEditor::_start_onion_skinning); ClassDB::bind_method(D_METHOD("_stop_onion_skinning"), &AnimationPlayerEditor::_stop_onion_skinning); + + ADD_SIGNAL(MethodInfo("animation_selected", PropertyInfo(Variant::STRING, "name"))); } AnimationPlayerEditor *AnimationPlayerEditor::singleton = nullptr; diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index 448a0639b1..ae570e53f3 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -195,6 +195,7 @@ class AnimationPlayerEditor : public VBoxContainer { void _blend_edited(); void _animation_player_changed(Object *p_pl); + void _animation_libraries_updated(); void _animation_key_editor_seek(float p_pos, bool p_drag, bool p_timeline_only = false); void _animation_key_editor_anim_len_changed(float p_len); diff --git a/modules/openxr/openxr_api.cpp b/modules/openxr/openxr_api.cpp index 01107ebcc9..8a67462613 100644 --- a/modules/openxr/openxr_api.cpp +++ b/modules/openxr/openxr_api.cpp @@ -131,11 +131,9 @@ bool OpenXRAPI::load_layer_properties() { result = xrEnumerateApiLayerProperties(num_layer_properties, &num_layer_properties, layer_properties); ERR_FAIL_COND_V_MSG(XR_FAILED(result), false, "OpenXR: Failed to enumerate api layer properties"); -#ifdef DEBUG for (uint32_t i = 0; i < num_layer_properties; i++) { - print_line("OpenXR: Found OpenXR layer ", layer_properties[i].layerName); + print_verbose(String("OpenXR: Found OpenXR layer ") + layer_properties[i].layerName); } -#endif return true; } @@ -163,11 +161,9 @@ bool OpenXRAPI::load_supported_extensions() { result = xrEnumerateInstanceExtensionProperties(nullptr, num_supported_extensions, &num_supported_extensions, supported_extensions); ERR_FAIL_COND_V_MSG(XR_FAILED(result), false, "OpenXR: Failed to enumerate extension properties"); -#ifdef DEBUG for (uint32_t i = 0; i < num_supported_extensions; i++) { - print_line("OpenXR: Found OpenXR extension ", supported_extensions[i].extensionName); + print_verbose(String("OpenXR: Found OpenXR extension ") + supported_extensions[i].extensionName); } -#endif return true; } @@ -175,17 +171,10 @@ bool OpenXRAPI::load_supported_extensions() { bool OpenXRAPI::is_extension_supported(const String &p_extension) const { for (uint32_t i = 0; i < num_supported_extensions; i++) { if (supported_extensions[i].extensionName == p_extension) { -#ifdef DEBUG - print_line("OpenXR: requested extension", p_extension, "is supported"); -#endif return true; } } -#ifdef DEBUG - print_line("OpenXR: requested extension", p_extension, "is not supported"); -#endif - return false; } @@ -401,11 +390,9 @@ bool OpenXRAPI::load_supported_view_configuration_types() { result = xrEnumerateViewConfigurations(instance, system_id, num_view_configuration_types, &num_view_configuration_types, supported_view_configuration_types); ERR_FAIL_COND_V_MSG(XR_FAILED(result), false, "OpenXR: Failed to enumerateview configurations"); -#ifdef DEBUG for (uint32_t i = 0; i < num_view_configuration_types; i++) { - print_line("OpenXR: Found supported view configuration ", OpenXRUtil::get_view_configuration_name(supported_view_configuration_types[i])); + print_verbose(String("OpenXR: Found supported view configuration ") + OpenXRUtil::get_view_configuration_name(supported_view_configuration_types[i])); } -#endif return true; } @@ -454,17 +441,15 @@ bool OpenXRAPI::load_supported_view_configuration_views(XrViewConfigurationType result = xrEnumerateViewConfigurationViews(instance, system_id, p_configuration_type, view_count, &view_count, view_configuration_views); ERR_FAIL_COND_V_MSG(XR_FAILED(result), false, "OpenXR: Failed to enumerate view configurations"); -#ifdef DEBUG for (uint32_t i = 0; i < view_count; i++) { - print_line("OpenXR: Found supported view configuration view"); - print_line(" - width: ", view_configuration_views[i].maxImageRectWidth); - print_line(" - height: ", view_configuration_views[i].maxImageRectHeight); - print_line(" - sample count: ", view_configuration_views[i].maxSwapchainSampleCount); - print_line(" - recommended render width: ", view_configuration_views[i].recommendedImageRectWidth); - print_line(" - recommended render height: ", view_configuration_views[i].recommendedImageRectHeight); - print_line(" - recommended render sample count: ", view_configuration_views[i].recommendedSwapchainSampleCount); + print_verbose("OpenXR: Found supported view configuration view"); + print_verbose(String(" - width: ") + view_configuration_views[i].maxImageRectWidth); + print_verbose(String(" - height: ") + view_configuration_views[i].maxImageRectHeight); + print_verbose(String(" - sample count: ") + view_configuration_views[i].maxSwapchainSampleCount); + print_verbose(String(" - recommended render width: ") + view_configuration_views[i].recommendedImageRectWidth); + print_verbose(String(" - recommended render height: ") + view_configuration_views[i].recommendedImageRectHeight); + print_verbose(String(" - recommended render sample count: ") + view_configuration_views[i].recommendedSwapchainSampleCount); } -#endif return true; } @@ -546,11 +531,9 @@ bool OpenXRAPI::load_supported_reference_spaces() { result = xrEnumerateReferenceSpaces(session, num_reference_spaces, &num_reference_spaces, supported_reference_spaces); ERR_FAIL_COND_V_MSG(XR_FAILED(result), false, "OpenXR: Failed to enumerate reference spaces"); - // #ifdef DEBUG for (uint32_t i = 0; i < num_reference_spaces; i++) { - print_line("OpenXR: Found supported reference space ", OpenXRUtil::get_reference_space_name(supported_reference_spaces[i])); + print_verbose(String("OpenXR: Found supported reference space ") + OpenXRUtil::get_reference_space_name(supported_reference_spaces[i])); } - // #endif return true; } @@ -643,11 +626,9 @@ bool OpenXRAPI::load_supported_swapchain_formats() { result = xrEnumerateSwapchainFormats(session, num_swapchain_formats, &num_swapchain_formats, supported_swapchain_formats); ERR_FAIL_COND_V_MSG(XR_FAILED(result), false, "OpenXR: Failed to enumerate swapchain formats"); - // #ifdef DEBUG for (uint32_t i = 0; i < num_swapchain_formats; i++) { - print_line("OpenXR: Found supported swapchain format ", get_swapchain_format_name(supported_swapchain_formats[i])); + print_verbose(String("OpenXR: Found supported swapchain format ") + get_swapchain_format_name(supported_swapchain_formats[i])); } - // #endif return true; } @@ -706,7 +687,7 @@ bool OpenXRAPI::create_swapchains() { swapchain_format_to_use = usable_swapchain_formats[0]; // just use the first one and hope for the best... print_line("Couldn't find usable color swap chain format, using", get_swapchain_format_name(swapchain_format_to_use), "instead."); } else { - print_line("Using color swap chain format:", get_swapchain_format_name(swapchain_format_to_use)); + print_verbose(String("Using color swap chain format:") + get_swapchain_format_name(swapchain_format_to_use)); } if (!create_swapchain(XR_SWAPCHAIN_USAGE_SAMPLED_BIT | XR_SWAPCHAIN_USAGE_COLOR_ATTACHMENT_BIT, swapchain_format_to_use, recommended_size.width, recommended_size.height, view_configuration_views[0].recommendedSwapchainSampleCount, view_count, swapchains[OPENXR_SWAPCHAIN_COLOR].swapchain, &swapchains[OPENXR_SWAPCHAIN_COLOR].swapchain_graphics_data)) { @@ -741,7 +722,7 @@ bool OpenXRAPI::create_swapchains() { swapchain_format_to_use = usable_swapchain_formats[0]; // just use the first one and hope for the best... print_line("Couldn't find usable depth swap chain format, using", get_swapchain_format_name(swapchain_format_to_use), "instead."); } else { - print_line("Using depth swap chain format:", get_swapchain_format_name(swapchain_format_to_use)); + print_verbose(String("Using depth swap chain format:") + get_swapchain_format_name(swapchain_format_to_use)); } if (!create_swapchain(XR_SWAPCHAIN_USAGE_SAMPLED_BIT | XR_SWAPCHAIN_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, swapchain_format_to_use, recommended_size.width, recommended_size.height, view_configuration_views[0].recommendedSwapchainSampleCount, view_count, swapchains[OPENXR_SWAPCHAIN_DEPTH].swapchain, &swapchains[OPENXR_SWAPCHAIN_DEPTH].swapchain_graphics_data)) { @@ -900,9 +881,7 @@ bool OpenXRAPI::create_swapchain(XrSwapchainUsageFlags p_usage_flags, int64_t p_ } bool OpenXRAPI::on_state_idle() { -#ifdef DEBUG - print_line("On state idle"); -#endif + print_verbose("On state idle"); for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { wrapper->on_state_idle(); @@ -912,9 +891,7 @@ bool OpenXRAPI::on_state_idle() { } bool OpenXRAPI::on_state_ready() { -#ifdef DEBUG - print_line("On state ready"); -#endif + print_verbose("On state ready"); // begin session XrSessionBeginInfo session_begin_info = { @@ -957,9 +934,7 @@ bool OpenXRAPI::on_state_ready() { } bool OpenXRAPI::on_state_synchronized() { -#ifdef DEBUG - print_line("On state synchronized"); -#endif + print_verbose("On state synchronized"); // Just in case, see if we already have active trackers... List<RID> trackers; @@ -976,9 +951,7 @@ bool OpenXRAPI::on_state_synchronized() { } bool OpenXRAPI::on_state_visible() { -#ifdef DEBUG - print_line("On state visible"); -#endif + print_verbose("On state visible"); for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { wrapper->on_state_visible(); @@ -992,9 +965,7 @@ bool OpenXRAPI::on_state_visible() { } bool OpenXRAPI::on_state_focused() { -#ifdef DEBUG - print_line("On state focused"); -#endif + print_verbose("On state focused"); for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { wrapper->on_state_focused(); @@ -1008,9 +979,7 @@ bool OpenXRAPI::on_state_focused() { } bool OpenXRAPI::on_state_stopping() { -#ifdef DEBUG - print_line("On state stopping"); -#endif + print_verbose("On state stopping"); if (xr_interface) { xr_interface->on_state_stopping(); @@ -1036,9 +1005,7 @@ bool OpenXRAPI::on_state_stopping() { } bool OpenXRAPI::on_state_loss_pending() { -#ifdef DEBUG - print_line("On state loss pending"); -#endif + print_verbose("On state loss pending"); for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { wrapper->on_state_loss_pending(); @@ -1050,9 +1017,7 @@ bool OpenXRAPI::on_state_loss_pending() { } bool OpenXRAPI::on_state_exiting() { -#ifdef DEBUG - print_line("On state existing"); -#endif + print_verbose("On state existing"); for (OpenXRExtensionWrapper *wrapper : registered_extension_wrappers) { wrapper->on_state_exiting(); @@ -1324,12 +1289,10 @@ XRPose::TrackingConfidence OpenXRAPI::get_head_center(Transform3D &r_transform, head_pose_confidence = confidence; if (head_pose_confidence == XRPose::XR_TRACKING_CONFIDENCE_NONE) { print_line("OpenXR head space location not valid (check tracking?)"); -#ifdef DEBUG } else if (head_pose_confidence == XRPose::XR_TRACKING_CONFIDENCE_LOW) { - print_line("OpenVR Head pose now tracking with low confidence"); + print_verbose("OpenVR Head pose now tracking with low confidence"); } else { - print_line("OpenVR Head pose now tracking with high confidence"); -#endif + print_verbose("OpenVR Head pose now tracking with high confidence"); } } @@ -1417,7 +1380,7 @@ bool OpenXRAPI::poll_events() { // TODO We get this event if we're about to loose our OpenXR instance. // We should queue exiting Godot at this point. - print_verbose("OpenXR EVENT: instance loss pending at " + itos(event->lossTime)); + print_verbose(String("OpenXR EVENT: instance loss pending at ") + itos(event->lossTime)); return false; } break; case XR_TYPE_EVENT_DATA_SESSION_STATE_CHANGED: { @@ -1425,9 +1388,9 @@ bool OpenXRAPI::poll_events() { session_state = event->state; if (session_state >= XR_SESSION_STATE_MAX_ENUM) { - print_verbose("OpenXR EVENT: session state changed to UNKNOWN - " + itos(session_state)); + print_verbose(String("OpenXR EVENT: session state changed to UNKNOWN - ") + itos(session_state)); } else { - print_verbose("OpenXR EVENT: session state changed to " + OpenXRUtil::get_session_state_name(session_state)); + print_verbose(String("OpenXR EVENT: session state changed to ") + OpenXRUtil::get_session_state_name(session_state)); switch (session_state) { case XR_SESSION_STATE_IDLE: @@ -1462,7 +1425,7 @@ bool OpenXRAPI::poll_events() { case XR_TYPE_EVENT_DATA_REFERENCE_SPACE_CHANGE_PENDING: { XrEventDataReferenceSpaceChangePending *event = (XrEventDataReferenceSpaceChangePending *)&runtimeEvent; - print_verbose("OpenXR EVENT: reference space type " + OpenXRUtil::get_reference_space_name(event->referenceSpaceType) + " change pending!"); + print_verbose(String("OpenXR EVENT: reference space type ") + OpenXRUtil::get_reference_space_name(event->referenceSpaceType) + " change pending!"); if (event->poseValid && xr_interface) { xr_interface->on_pose_recentered(); } @@ -1481,7 +1444,7 @@ bool OpenXRAPI::poll_events() { } break; default: if (!handled) { - print_verbose("OpenXR Unhandled event type " + OpenXRUtil::get_structure_type_name(runtimeEvent.type)); + print_verbose(String("OpenXR Unhandled event type ") + OpenXRUtil::get_structure_type_name(runtimeEvent.type)); } break; } @@ -1589,7 +1552,7 @@ void OpenXRAPI::pre_render() { if (frame_state.predictedDisplayPeriod > 500000000) { // display period more then 0.5 seconds? must be wrong data - print_verbose("OpenXR resetting invalid display period " + rtos(frame_state.predictedDisplayPeriod)); + print_verbose(String("OpenXR resetting invalid display period ") + rtos(frame_state.predictedDisplayPeriod)); frame_state.predictedDisplayPeriod = 0; } @@ -1636,13 +1599,11 @@ void OpenXRAPI::pre_render() { } if (view_pose_valid != pose_valid) { view_pose_valid = pose_valid; -#ifdef DEBUG if (!view_pose_valid) { - print_line("OpenXR View pose became invalid"); + print_verbose("OpenXR View pose became invalid"); } else { - print_line("OpenXR View pose became valid"); + print_verbose("OpenXR View pose became valid"); } -#endif } // let's start our frame.. @@ -2081,8 +2042,6 @@ RID OpenXRAPI::action_set_create(const String p_name, const String p_localized_n copy_string_to_char_buffer(p_name, action_set_info.actionSetName, XR_MAX_ACTION_SET_NAME_SIZE); copy_string_to_char_buffer(p_localized_name, action_set_info.localizedActionSetName, XR_MAX_LOCALIZED_ACTION_SET_NAME_SIZE); - // print_line("Creating action set ", action_set_info.actionSetName, " - ", action_set_info.localizedActionSetName, " (", itos(action_set_info.priority), ")"); - XrResult result = xrCreateActionSet(instance, &action_set_info, &action_set.handle); if (XR_FAILED(result)) { print_line("OpenXR: failed to create action set ", p_name, "! [", get_error_string(result), "]"); @@ -2236,8 +2195,6 @@ RID OpenXRAPI::action_create(RID p_action_set, const String p_name, const String copy_string_to_char_buffer(p_name, action_info.actionName, XR_MAX_ACTION_NAME_SIZE); copy_string_to_char_buffer(p_localized_name, action_info.localizedActionName, XR_MAX_LOCALIZED_ACTION_NAME_SIZE); - // print_line("Creating action ", action_info.actionName, action_info.localizedActionName, action_info.countSubactionPaths); - XrResult result = xrCreateAction(action_set->handle, &action_info, &action.handle); if (XR_FAILED(result)) { print_line("OpenXR: failed to create action ", p_name, "! [", get_error_string(result), "]"); diff --git a/platform/macos/display_server_macos.h b/platform/macos/display_server_macos.h index e72273a681..484b8ffebc 100644 --- a/platform/macos/display_server_macos.h +++ b/platform/macos/display_server_macos.h @@ -401,7 +401,7 @@ public: virtual bool window_minimize_on_title_dbl_click() const override; virtual void window_set_window_buttons_offset(const Vector2i &p_offset, WindowID p_window = MAIN_WINDOW_ID) override; - virtual Vector2i window_get_safe_title_margins(WindowID p_window = MAIN_WINDOW_ID) const override; + virtual Vector3i window_get_safe_title_margins(WindowID p_window = MAIN_WINDOW_ID) const override; virtual Point2i ime_get_selection() const override; virtual String ime_get_text() const override; diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index f980129081..f4692abc92 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -2655,25 +2655,33 @@ void DisplayServerMacOS::window_set_window_buttons_offset(const Vector2i &p_offs ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; - wd.wb_offset = p_offset; + float scale = screen_get_max_scale(); + wd.wb_offset = p_offset / scale; + wd.wb_offset.x = MAX(wd.wb_offset.x, 12); + wd.wb_offset.y = MAX(wd.wb_offset.y, 12); + if (wd.window_button_view) { + [wd.window_button_view setOffset:NSMakePoint(wd.wb_offset.x, wd.wb_offset.y)]; + } } -Vector2i DisplayServerMacOS::window_get_safe_title_margins(WindowID p_window) const { +Vector3i DisplayServerMacOS::window_get_safe_title_margins(WindowID p_window) const { _THREAD_SAFE_METHOD_ - ERR_FAIL_COND_V(!windows.has(p_window), Vector2i()); + ERR_FAIL_COND_V(!windows.has(p_window), Vector3i()); const WindowData &wd = windows[p_window]; if (!wd.window_button_view) { - return Vector2i(); + return Vector3i(); } - float max_x = wd.wb_offset.x + [wd.window_button_view frame].size.width; + float scale = screen_get_max_scale(); + float max_x = [wd.window_button_view getOffset].x + [wd.window_button_view frame].size.width; + float max_y = [wd.window_button_view getOffset].y + [wd.window_button_view frame].size.height; if ([wd.window_object windowTitlebarLayoutDirection] == NSUserInterfaceLayoutDirectionRightToLeft) { - return Vector2i(0, max_x * screen_get_max_scale()); + return Vector3i(0, max_x * scale, max_y * scale); } else { - return Vector2i(max_x * screen_get_max_scale(), 0); + return Vector3i(max_x * scale, 0, max_y * scale); } } diff --git a/platform/macos/godot_button_view.h b/platform/macos/godot_button_view.h index e7627a9e9b..ef1d5fe412 100644 --- a/platform/macos/godot_button_view.h +++ b/platform/macos/godot_button_view.h @@ -42,10 +42,15 @@ CGFloat spacing; bool mouse_in_group; bool rtl; + NSButton *close_button; + NSButton *miniaturize_button; + NSButton *zoom_button; } - (void)initButtons:(CGFloat)button_spacing offset:(NSPoint)button_offset rtl:(bool)is_rtl; - (void)displayButtons; +- (void)setOffset:(NSPoint)button_offset; +- (NSPoint)getOffset; @end diff --git a/platform/macos/godot_button_view.mm b/platform/macos/godot_button_view.mm index 9106f0b0db..7d380cbe11 100644 --- a/platform/macos/godot_button_view.mm +++ b/platform/macos/godot_button_view.mm @@ -40,6 +40,9 @@ spacing = 20; mouse_in_group = false; rtl = false; + close_button = nullptr; + miniaturize_button = nullptr; + zoom_button = nullptr; return self; } @@ -48,15 +51,15 @@ spacing = button_spacing; rtl = is_rtl; - NSButton *close_button = [NSWindow standardWindowButton:NSWindowCloseButton forStyleMask:NSWindowStyleMaskTitled]; + close_button = [NSWindow standardWindowButton:NSWindowCloseButton forStyleMask:NSWindowStyleMaskTitled]; [close_button setFrameOrigin:NSMakePoint(rtl ? spacing * 2 : 0, 0)]; [self addSubview:close_button]; - NSButton *miniaturize_button = [NSWindow standardWindowButton:NSWindowMiniaturizeButton forStyleMask:NSWindowStyleMaskTitled]; + miniaturize_button = [NSWindow standardWindowButton:NSWindowMiniaturizeButton forStyleMask:NSWindowStyleMaskTitled]; [miniaturize_button setFrameOrigin:NSMakePoint(spacing, 0)]; [self addSubview:miniaturize_button]; - NSButton *zoom_button = [NSWindow standardWindowButton:NSWindowZoomButton forStyleMask:NSWindowStyleMaskTitled]; + zoom_button = [NSWindow standardWindowButton:NSWindowZoomButton forStyleMask:NSWindowStyleMaskTitled]; [zoom_button setFrameOrigin:NSMakePoint(rtl ? 0 : spacing * 2, 0)]; [self addSubview:zoom_button]; @@ -71,6 +74,19 @@ [self displayButtons]; } +- (void)setOffset:(NSPoint)button_offset { + if (zoom_button) { + offset.y = button_offset.y - zoom_button.frame.size.height / 2; + offset.x = button_offset.x - zoom_button.frame.size.width / 2; + + [self viewDidMoveToWindow]; + } +} + +- (NSPoint)getOffset { + return offset; +} + - (void)viewDidMoveToWindow { if (!self.window) { return; diff --git a/scene/animation/animation_player.cpp b/scene/animation/animation_player.cpp index fe67c0886f..2e3d0a26c2 100644 --- a/scene/animation/animation_player.cpp +++ b/scene/animation/animation_player.cpp @@ -109,7 +109,7 @@ bool AnimationPlayer::_set(const StringName &p_name, const Variant &p_value) { Ref<AnimationLibrary> lib = d[lib_name]; add_animation_library(lib_name, lib); } - + emit_signal("animation_libraries_updated"); } else if (name.begins_with("next/")) { String which = name.get_slicec('/', 1); animation_set_next(which, p_value); @@ -1274,6 +1274,23 @@ void AnimationPlayer::_animation_set_cache_update() { } void AnimationPlayer::_animation_added(const StringName &p_name, const StringName &p_library) { + { + int at_pos = -1; + + for (uint32_t i = 0; i < animation_libraries.size(); i++) { + if (animation_libraries[i].name == p_library) { + at_pos = i; + break; + } + } + + ERR_FAIL_COND(at_pos == -1); + + ERR_FAIL_COND(!animation_libraries[at_pos].library->animations.has(p_name)); + + _ref_anim(animation_libraries[at_pos].library->animations[p_name]); + } + _animation_set_cache_update(); } @@ -1283,6 +1300,12 @@ void AnimationPlayer::_animation_removed(const StringName &p_name, const StringN if (!animation_set.has(name)) { return; // No need to update because not the one from the library being used. } + + AnimationData animation_data = animation_set[name]; + if (animation_data.animation_library == p_library) { + _unref_anim(animation_data.animation); + } + _animation_set_cache_update(); // Erase blends if needed @@ -1379,6 +1402,10 @@ Error AnimationPlayer::add_animation_library(const StringName &p_name, const Ref ald.library->connect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_added).bind(p_name)); ald.library->connect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed).bind(p_name)); + for (const KeyValue<StringName, Ref<Animation>> &K : ald.library->animations) { + _ref_anim(K.value); + } + _animation_set_cache_update(); notify_property_list_changed(); @@ -1399,7 +1426,7 @@ void AnimationPlayer::remove_animation_library(const StringName &p_name) { ERR_FAIL_COND(at_pos == -1); animation_libraries[at_pos].library->disconnect(SNAME("animation_added"), callable_mp(this, &AnimationPlayer::_animation_added)); - animation_libraries[at_pos].library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_added)); + animation_libraries[at_pos].library->disconnect(SNAME("animation_removed"), callable_mp(this, &AnimationPlayer::_animation_removed)); animation_libraries[at_pos].library->disconnect(SNAME("animation_renamed"), callable_mp(this, &AnimationPlayer::_animation_renamed)); stop(); @@ -2151,6 +2178,7 @@ void AnimationPlayer::_bind_methods() { ADD_SIGNAL(MethodInfo("animation_changed", PropertyInfo(Variant::STRING_NAME, "old_name"), PropertyInfo(Variant::STRING_NAME, "new_name"))); ADD_SIGNAL(MethodInfo("animation_started", PropertyInfo(Variant::STRING_NAME, "anim_name"))); ADD_SIGNAL(MethodInfo("animation_list_changed")); + ADD_SIGNAL(MethodInfo("animation_libraries_updated")); ADD_SIGNAL(MethodInfo("caches_cleared")); BIND_ENUM_CONSTANT(ANIMATION_PROCESS_PHYSICS); diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 32a9cc5b4c..598420da37 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -2192,8 +2192,17 @@ void TextEdit::gui_input(const Ref<InputEvent> &p_gui_input) { return; } - // Handle Unicode (if no modifiers active). Tab has a value of 0x09. - if (allow_unicode_handling && editable && (k->get_unicode() >= 32 || k->get_keycode() == Key::TAB)) { + // Handle tab as it has no set unicode value. + if (k->is_action("ui_text_indent", true)) { + if (editable) { + insert_text_at_caret("\t"); + } + accept_event(); + return; + } + + // Handle Unicode (if no modifiers active). + if (allow_unicode_handling && editable && k->get_unicode() >= 32) { handle_unicode_input(k->get_unicode()); accept_event(); return; diff --git a/scene/gui/tree.cpp b/scene/gui/tree.cpp index acf398305c..2e8fa1e606 100644 --- a/scene/gui/tree.cpp +++ b/scene/gui/tree.cpp @@ -1504,6 +1504,7 @@ void TreeItem::_bind_methods() { ClassDB::bind_method(D_METHOD("set_button", "column", "button_idx", "button"), &TreeItem::set_button); ClassDB::bind_method(D_METHOD("erase_button", "column", "button_idx"), &TreeItem::erase_button); ClassDB::bind_method(D_METHOD("set_button_disabled", "column", "button_idx", "disabled"), &TreeItem::set_button_disabled); + ClassDB::bind_method(D_METHOD("set_button_color", "column", "button_idx", "color"), &TreeItem::set_button_color); ClassDB::bind_method(D_METHOD("is_button_disabled", "column", "button_idx"), &TreeItem::is_button_disabled); ClassDB::bind_method(D_METHOD("set_tooltip_text", "column", "tooltip"), &TreeItem::set_tooltip_text); diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp index c0d65fb445..85b538b1d9 100644 --- a/scene/resources/resource_format_text.cpp +++ b/scene/resources/resource_format_text.cpp @@ -445,7 +445,14 @@ Error ResourceLoaderText::load() { // If a UID is found and the path is valid, it will be used, otherwise, it falls back to the path. path = ResourceUID::get_singleton()->get_id_path(uid); } else { +#ifdef TOOLS_ENABLED + // Silence a warning that can happen during the initial filesystem scan due to cache being regenerated. + if (ResourceLoader::get_resource_uid(path) != uid) { + WARN_PRINT(String(res_path + ":" + itos(lines) + " - ext_resource, invalid UUID: " + uidt + " - using text path instead: " + path).utf8().get_data()); + } +#else WARN_PRINT(String(res_path + ":" + itos(lines) + " - ext_resource, invalid UUID: " + uidt + " - using text path instead: " + path).utf8().get_data()); +#endif } } diff --git a/servers/display_server.h b/servers/display_server.h index 8eafccc040..31ebf12531 100644 --- a/servers/display_server.h +++ b/servers/display_server.h @@ -382,7 +382,7 @@ public: virtual void window_move_to_foreground(WindowID p_window = MAIN_WINDOW_ID) = 0; virtual void window_set_window_buttons_offset(const Vector2i &p_offset, WindowID p_window = MAIN_WINDOW_ID) {} - virtual Vector2i window_get_safe_title_margins(WindowID p_window = MAIN_WINDOW_ID) const { return Vector2i(); } + virtual Vector3i window_get_safe_title_margins(WindowID p_window = MAIN_WINDOW_ID) const { return Vector3i(); } virtual bool window_can_draw(WindowID p_window = MAIN_WINDOW_ID) const = 0; diff --git a/tests/scene/test_text_edit.h b/tests/scene/test_text_edit.h index 3dfbd3e7b6..9514178c61 100644 --- a/tests/scene/test_text_edit.h +++ b/tests/scene/test_text_edit.h @@ -2944,6 +2944,18 @@ TEST_CASE("[SceneTree][TextEdit] text entry") { SIGNAL_CHECK("lines_edited_from", lines_edited_args); text_edit->set_overtype_mode_enabled(false); CHECK_FALSE(text_edit->is_overtype_mode_enabled()); + + lines_edited_args.remove_at(0); + lines_edited_args.remove_at(1); + + SEND_GUI_KEY_EVENT(text_edit, Key::TAB); + CHECK(text_edit->get_viewport()->is_input_handled()); + CHECK(text_edit->get_text() == "A\tB\nA\tB"); + CHECK(text_edit->get_caret_column() == 2); + CHECK(text_edit->get_caret_column(1) == 2); + SIGNAL_CHECK("caret_changed", empty_signal_args); + SIGNAL_CHECK("text_changed", empty_signal_args); + SIGNAL_CHECK("lines_edited_from", lines_edited_args); } SIGNAL_UNWATCH(text_edit, "text_set"); |