diff options
-rw-r--r-- | doc/classes/Control.xml | 4 | ||||
-rw-r--r-- | drivers/unix/os_unix.cpp | 15 | ||||
-rw-r--r-- | editor/dependency_editor.cpp | 2 | ||||
-rw-r--r-- | editor/editor_export.cpp | 16 | ||||
-rw-r--r-- | editor/export_template_manager.cpp | 2 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 14 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 3 | ||||
-rw-r--r-- | editor/plugins/navigation_mesh_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/tile_set_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/property_editor.cpp | 1 | ||||
-rw-r--r-- | platform/haiku/os_haiku.cpp | 2 | ||||
-rw-r--r-- | platform/javascript/export/export.cpp | 2 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 2 | ||||
-rw-r--r-- | platform/osx/export/export.cpp | 25 | ||||
-rw-r--r-- | platform/osx/os_osx.mm | 6 | ||||
-rw-r--r-- | platform/server/os_server.cpp | 3 | ||||
-rw-r--r-- | platform/windows/os_windows.cpp | 11 | ||||
-rw-r--r-- | scene/gui/popup_menu.cpp | 5 | ||||
-rw-r--r-- | scene/gui/text_edit.cpp | 10 | ||||
-rw-r--r-- | servers/visual_server.cpp | 2 |
21 files changed, 96 insertions, 35 deletions
diff --git a/doc/classes/Control.xml b/doc/classes/Control.xml index 6c30a92ed5..680e008ff1 100644 --- a/doc/classes/Control.xml +++ b/doc/classes/Control.xml @@ -632,6 +632,7 @@ Distance between the node's top edge and its parent container, based on [member anchor_top]. </member> <member name="mouse_filter" type="int" setter="set_mouse_filter" getter="get_mouse_filter" enum="Control.MouseFilter"> + Controls whether the control will be able to receive mouse button input events through [Control._gui_input] and how these events should be handled. Use one of the [code]MOUSE_FILTER_*[/code] constants. See the constants to learn what each does. </member> <member name="rect_clip_content" type="bool" setter="set_clip_contents" getter="is_clipping_contents"> </member> @@ -869,10 +870,13 @@ Tells the parent [Container] to align the node with its end, either the bottom or the right edge. It doesn't work with the fill or expand size flags. Use with [member size_flags_horizontal] and [member size_flags_vertical]. </constant> <constant name="MOUSE_FILTER_STOP" value="0" enum="MouseFilter"> + The control will receive mouse button input events through [method Control._gui_input] if clicked on. These events are automatically marked as handled and they will not propogate further to other controls. </constant> <constant name="MOUSE_FILTER_PASS" value="1" enum="MouseFilter"> + The control will receive mouse button input events through [method Control._gui_input] if clicked on. If this control does not handle the event, the parent control (if any) will be considered for a mouse click, and so on until there is no more parent control to potentially handle it. Even if no control handled it at all, the event will still be handled automatically. </constant> <constant name="MOUSE_FILTER_IGNORE" value="2" enum="MouseFilter"> + The control will not receive mouse button input events through [method Control._gui_input] and will not block other controls from receiving these events. These events will also not be handled automatically. </constant> <constant name="GROW_DIRECTION_BEGIN" value="0" enum="GrowDirection"> </constant> diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index fa8094f31a..e08b58cf5c 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -362,7 +362,20 @@ String OS_Unix::get_locale() const { } Error OS_Unix::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) { - p_library_handle = dlopen(p_path.utf8().get_data(), RTLD_NOW); + + String path = p_path; + + if (!FileAccess::exists(path)) { + //this code exists so gdnative can load .so files from within the executable path + path = get_executable_path().get_base_dir().plus_file(p_path.get_file()); + } + + if (!FileAccess::exists(path)) { + //this code exists so gdnative can load .so files from a standard unix location + path = get_executable_path().get_base_dir().plus_file("../lib").plus_file(p_path.get_file()); + } + + p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW); if (!p_library_handle) { ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror()); ERR_FAIL_V(ERR_CANT_OPEN); diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index f18a966151..4e753cb342 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -514,7 +514,7 @@ void DependencyRemoveDialog::ok_pressed() { print_line("Moving to trash: " + path); Error err = OS::get_singleton()->move_to_trash(path); if (err != OK) { - EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:\n") + to_delete[i] + "\n"); + EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + to_delete[i] + "\n"); } } diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 1a10040bac..e6a481eb01 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1347,7 +1347,7 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr } if (template_path != String() && !FileAccess::exists(template_path)) { - EditorNode::get_singleton()->show_warning(TTR("Template file not found:\n") + template_path); + EditorNode::get_singleton()->show_warning(TTR("Template file not found:") + "\n" + template_path); return ERR_FILE_NOT_FOUND; } @@ -1361,7 +1361,19 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr String pck_path = p_path.get_basename() + ".pck"; - return save_pack(p_preset, pck_path); + Vector<SharedObject> so_files; + + err = save_pack(p_preset, pck_path, &so_files); + + if (err != OK || so_files.empty()) + return err; + //if shared object files, copy them + da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + for (int i = 0; i < so_files.size(); i++) { + da->copy(so_files[i].path, p_path.get_base_dir().plus_file(so_files[i].path.get_file())); + } + memdelete(da); + return OK; } void EditorExportPlatformPC::set_extension(const String &p_extension, const String &p_feature_key) { diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index 0206e37c43..ccc9a52a3e 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -250,7 +250,7 @@ void ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_ DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); Error err = d->make_dir_recursive(template_path); if (err != OK) { - EditorNode::get_singleton()->show_warning(TTR("Error creating path for templates:\n") + template_path); + EditorNode::get_singleton()->show_warning(TTR("Error creating path for templates:") + "\n" + template_path); unzClose(pkg); return; } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index b18cd6b747..e6bc19b571 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -752,7 +752,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_ return; } else if (!p_item.is_file && new_path.begins_with(old_path)) { //This check doesn't erroneously catch renaming to a longer name as folder paths always end with "/" - EditorNode::get_singleton()->add_io_error(TTR("Cannot move a folder into itself.\n") + old_path + "\n"); + EditorNode::get_singleton()->add_io_error(TTR("Cannot move a folder into itself.") + "\n" + old_path + "\n"); return; } @@ -772,7 +772,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_ if (p_item.is_file && FileAccess::exists(old_path + ".import")) { err = da->rename(old_path + ".import", new_path + ".import"); if (err != OK) { - EditorNode::get_singleton()->add_io_error(TTR("Error moving:\n") + old_path + ".import\n"); + EditorNode::get_singleton()->add_io_error(TTR("Error moving:") + "\n" + old_path + ".import\n"); } } @@ -796,7 +796,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_ print_line(" Remap: " + changed_paths[i] + " -> " + p_renames[changed_paths[i]]); } } else { - EditorNode::get_singleton()->add_io_error(TTR("Error moving:\n") + old_path + "\n"); + EditorNode::get_singleton()->add_io_error(TTR("Error moving:") + "\n" + old_path + "\n"); } memdelete(da); } @@ -813,7 +813,7 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin return; } else if (!p_item.is_file && new_path.begins_with(old_path)) { //This check doesn't erroneously catch renaming to a longer name as folder paths always end with "/" - EditorNode::get_singleton()->add_io_error(TTR("Cannot move a folder into itself.\n") + old_path + "\n"); + EditorNode::get_singleton()->add_io_error(TTR("Cannot move a folder into itself.") + "\n" + old_path + "\n"); return; } @@ -825,11 +825,11 @@ void FileSystemDock::_try_duplicate_item(const FileOrFolder &p_item, const Strin if (p_item.is_file && FileAccess::exists(old_path + ".import")) { err = da->copy(old_path + ".import", new_path + ".import"); if (err != OK) { - EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:\n") + old_path + ".import\n"); + EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + ".import\n"); } } } else { - EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:\n") + old_path + "\n"); + EditorNode::get_singleton()->add_io_error(TTR("Error duplicating:") + "\n" + old_path + "\n"); } memdelete(da); } @@ -901,7 +901,7 @@ void FileSystemDock::_update_dependencies_after_move(const Map<String, String> & if (ResourceLoader::get_resource_type(file) == "PackedScene") editor->reload_scene(file); } else { - EditorNode::get_singleton()->add_io_error(TTR("Unable to update dependencies:\n") + remaps[i] + "\n"); + EditorNode::get_singleton()->add_io_error(TTR("Unable to update dependencies:") + "\n" + remaps[i] + "\n"); } } } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index a52c914096..d116e30cfe 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3990,6 +3990,7 @@ void CanvasItemEditor::_bind_methods() { ClassDB::bind_method("_snap_changed", &CanvasItemEditor::_snap_changed); ClassDB::bind_method(D_METHOD("_selection_result_pressed"), &CanvasItemEditor::_selection_result_pressed); ClassDB::bind_method(D_METHOD("_selection_menu_hide"), &CanvasItemEditor::_selection_menu_hide); + ClassDB::bind_method(D_METHOD("set_state"), &CanvasItemEditor::set_state); ADD_SIGNAL(MethodInfo("item_lock_status_changed")); ADD_SIGNAL(MethodInfo("item_group_status_changed")); @@ -4348,7 +4349,7 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { additive_selection = false; // Update the menus checkboxes - set_state(get_state()); + call_deferred("set_state", get_state()); } CanvasItemEditor *CanvasItemEditor::singleton = NULL; diff --git a/editor/plugins/navigation_mesh_editor_plugin.cpp b/editor/plugins/navigation_mesh_editor_plugin.cpp index 8c80225db6..933ab36886 100644 --- a/editor/plugins/navigation_mesh_editor_plugin.cpp +++ b/editor/plugins/navigation_mesh_editor_plugin.cpp @@ -107,7 +107,7 @@ NavigationMeshEditor::NavigationMeshEditor() { button_bake->set_text(TTR("Bake!")); button_bake->set_toggle_mode(true); button_reset = memnew(Button); - button_bake->set_tooltip(TTR("Bake the navigation mesh.\n")); + button_bake->set_tooltip(TTR("Bake the navigation mesh.") + "\n"); bake_info = memnew(Label); bake_hbox->add_child(button_bake); diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index f6aef52e8b..71f15a4421 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -4947,7 +4947,7 @@ SpatialEditor::SpatialEditor(EditorNode *p_editor) { tool_button[TOOL_MODE_SELECT]->set_pressed(true); button_binds[0] = MENU_TOOL_SELECT; tool_button[TOOL_MODE_SELECT]->connect("pressed", this, "_menu_item_pressed", button_binds); - tool_button[TOOL_MODE_SELECT]->set_tooltip(TTR("Select Mode (Q)\n") + keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection")); + tool_button[TOOL_MODE_SELECT]->set_tooltip(TTR("Select Mode (Q)") + "\n" + keycode_get_string(KEY_MASK_CMD) + TTR("Drag: Rotate\nAlt+Drag: Move\nAlt+RMB: Depth list selection")); tool_button[TOOL_MODE_MOVE] = memnew(ToolButton); hbc_menu->add_child(tool_button[TOOL_MODE_MOVE]); diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp index 50db80ba01..475cdf07ba 100644 --- a/editor/plugins/tile_set_editor_plugin.cpp +++ b/editor/plugins/tile_set_editor_plugin.cpp @@ -342,7 +342,7 @@ AutotileEditor::AutotileEditor(EditorNode *p_editor) { split->add_child(property_editor); helper = memnew(AutotileEditorHelper(this)); - property_editor->edit(helper); + property_editor->call_deferred("edit", helper); //Editor diff --git a/editor/property_editor.cpp b/editor/property_editor.cpp index 1dcc5a3231..89dcae0038 100644 --- a/editor/property_editor.cpp +++ b/editor/property_editor.cpp @@ -4135,6 +4135,7 @@ void PropertyEditor::_bind_methods() { ClassDB::bind_method("_resource_preview_done", &PropertyEditor::_resource_preview_done); ClassDB::bind_method("refresh", &PropertyEditor::refresh); ClassDB::bind_method("_draw_transparency", &PropertyEditor::_draw_transparency); + ClassDB::bind_method("edit", &PropertyEditor::edit); ClassDB::bind_method(D_METHOD("get_drag_data_fw"), &PropertyEditor::get_drag_data_fw); ClassDB::bind_method(D_METHOD("can_drop_data_fw"), &PropertyEditor::can_drop_data_fw); diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index 2d1d976399..1ebadd337e 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -114,7 +114,7 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p visual_server = memnew(VisualServerRaster(rasterizer)); - ERR_FAIL_COND(!visual_server, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE); // TODO: enable multithreaded VS /* diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index ab7aa96372..a3514df05c 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -277,7 +277,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese splash.instance(); Error err = splash->load(splash_path); if (err) { - EditorNode::get_singleton()->show_warning(TTR("Could not read boot splash image file:") + "\n" + splash_path + "\n" + TTR("Using default boot splash image."); + EditorNode::get_singleton()->show_warning(TTR("Could not read boot splash image file:") + "\n" + splash_path + "\n" + TTR("Using default boot splash image.")); splash.unref(); } } diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 665280df96..26fb380aed 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -429,7 +429,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, attributes.antialias = false; attributes.majorVersion = 2; EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes); - ERR_FAIL_COND(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE); video_mode = p_desired; // can't fulfil fullscreen request due to browser security diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 657a899367..23ca1e3fb9 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -541,7 +541,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p } else { String pack_path = EditorSettings::get_singleton()->get_cache_dir().plus_file(pkg_name + ".pck"); - Error err = save_pack(p_preset, pack_path); + + Vector<SharedObject> shared_objects; + Error err = save_pack(p_preset, pack_path, &shared_objects); if (err == OK) { zipOpenNewFileInZip(dst_pkg_zip, @@ -567,11 +569,32 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p break; zipWriteInFileInZip(dst_pkg_zip, buf, r); } + zipCloseFileInZip(dst_pkg_zip); memdelete(pf); } else { err = ERR_CANT_OPEN; } + + //add shared objects + for (int i = 0; i < shared_objects.size(); i++) { + Vector<uint8_t> file = FileAccess::get_file_as_array(shared_objects[i].path); + ERR_CONTINUE(file.empty()); + + zipOpenNewFileInZip(dst_pkg_zip, + (pkg_name + ".app/Contents/MacOS/").plus_file(shared_objects[i].path.get_file()).utf8().get_data(), + NULL, + NULL, + 0, + NULL, + 0, + NULL, + Z_DEFLATED, + Z_DEFAULT_COMPRESSION); + + zipWriteInFileInZip(dst_pkg_zip, file.ptr(), file.size()); + zipCloseFileInZip(dst_pkg_zip); + } } } } diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index a16391c30f..d8dd2eb1db 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -1013,7 +1013,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a backing:NSBackingStoreBuffered defer:NO]; - ERR_FAIL_COND(window_object == nil, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(window_object == nil, ERR_UNAVAILABLE); window_view = [[GodotContentView alloc] init]; @@ -1100,11 +1100,11 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a #undef ADD_ATTR2 pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; - ERR_FAIL_COND(pixelFormat == nil, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(pixelFormat == nil, ERR_UNAVAILABLE); context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil]; - ERR_FAIL_COND(context == nil, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(context == nil, ERR_UNAVAILABLE); [context setView:window_view]; diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index e8d076322c..410fea153a 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -67,7 +67,7 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int spatial_sound_2d_server = memnew(SpatialSound2DServerSW); spatial_sound_2d_server->init(); - ERR_FAIL_COND(!visual_server, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE); visual_server->init(); @@ -77,6 +77,7 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int return OK; } + void OS_Server::finalize() { if (main_loop) diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index a48ae8cc8c..22294005f6 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -1633,6 +1633,13 @@ void OS_Windows::_update_window_style(bool repaint) { Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) { + String path = p_path; + + if (!FileAccess::exists(path)) { + //this code exists so gdnative can load .dll files from within the executable path + path = get_executable_path().get_base_dir().plus_file(p_path.get_file()); + } + typedef DLL_DIRECTORY_COOKIE(WINAPI * PAddDllDirectory)(PCWSTR); typedef BOOL(WINAPI * PRemoveDllDirectory)(DLL_DIRECTORY_COOKIE); @@ -1643,10 +1650,10 @@ Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_han DLL_DIRECTORY_COOKIE cookie; if (p_also_set_library_path && has_dll_directory_api) { - cookie = add_dll_directory(p_path.get_base_dir().c_str()); + cookie = add_dll_directory(path.get_base_dir().c_str()); } - p_library_handle = (void *)LoadLibraryExW(p_path.c_str(), NULL, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0); + p_library_handle = (void *)LoadLibraryExW(path.c_str(), NULL, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0); if (p_also_set_library_path && has_dll_directory_api) { remove_dll_directory(cookie); diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 7999f50013..97f7c65cbe 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -122,8 +122,7 @@ int PopupMenu::_get_mouse_over(const Point2 &p_over) const { for (int i = 0; i < items.size(); i++) { - if (i > 0) - ofs.y += vseparation; + ofs.y += vseparation; float h; if (!items[i].icon.is_null()) { @@ -459,7 +458,7 @@ void PopupMenu::_notification(int p_what) { if (i == mouse_over) { - hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation * 2))); + hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation / 2), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation))); } if (items[i].separator) { diff --git a/scene/gui/text_edit.cpp b/scene/gui/text_edit.cpp index 87043c65eb..95c4b9058d 100644 --- a/scene/gui/text_edit.cpp +++ b/scene/gui/text_edit.cpp @@ -1746,15 +1746,15 @@ void TextEdit::indent_left() { void TextEdit::_get_mouse_pos(const Point2i &p_mouse, int &r_row, int &r_col) const { float rows = p_mouse.y; - rows -= cache.style_normal->get_margin(MARGIN_TOP); rows /= get_row_height(); - int lsp = get_line_scroll_pos(true); - int row = cursor.line_ofs + (rows + (round(v_scroll->get_value()) - lsp)); + rows += v_scroll->get_value(); + int row = Math::floor(rows); if (is_hiding_enabled()) { // row will be offset by the hidden rows - int f_ofs = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(rows + 1, text.size() - cursor.line_ofs)) - 1; - row = cursor.line_ofs + (f_ofs + (round(v_scroll->get_value()) - lsp)); + int lsp = get_line_scroll_pos(true); + int f_ofs = num_lines_from(CLAMP(cursor.line_ofs, 0, text.size() - 1), MIN(row + 1 - cursor.line_ofs, text.size() - cursor.line_ofs)) - 1; + row = cursor.line_ofs + f_ofs; row = CLAMP(row, 0, text.size() - num_lines_from(text.size() - 1, -1)); } diff --git a/servers/visual_server.cpp b/servers/visual_server.cpp index bf6d425fb9..531c6045d6 100644 --- a/servers/visual_server.cpp +++ b/servers/visual_server.cpp @@ -711,7 +711,7 @@ Error VisualServer::_surface_set_data(Array p_arrays, uint32_t p_format, uint32_ if (first) { for (int i = 0; i < total_bones; i++) { - r_bone_aabb[i].size == Vector3(-1, -1, -1); //negative means unused + r_bone_aabb[i].size = Vector3(-1, -1, -1); //negative means unused } } |