diff options
-rw-r--r-- | doc/classes/Array.xml | 6 | ||||
-rw-r--r-- | editor/editor_help.cpp | 18 | ||||
-rw-r--r-- | editor/import/3d/scene_import_settings.cpp | 26 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 2 |
4 files changed, 34 insertions, 18 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 40016f0904..fd5ba57615 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -218,6 +218,11 @@ <param index="1" name="before" type="bool" default="true" /> <description> Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. + [codeblock] + var array = ["a", "b", "c", "c", "d", "e"] + print(array.bsearch("c", true)) # Prints 2, at the first matching element. + print(array.bsearch("c", false)) # Prints 4, after the last matching element, pointing to "d". + [/codeblock] [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior. </description> </method> @@ -228,6 +233,7 @@ <param index="2" name="before" type="bool" default="true" /> <description> Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search and a custom comparison method. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array. The custom method receives two arguments (an element from the array and the value searched for) and must return [code]true[/code] if the first argument is less than the second, and return [code]false[/code] otherwise. + [b]Note:[/b] The custom method must accept the two arguments in any order, you cannot rely on that the first argument will always be from the array. [b]Note:[/b] Calling [method bsearch_custom] on an unsorted array results in unexpected behavior. </description> </method> diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 598db3cc78..8c55c45190 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -360,7 +360,7 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum, bool p_is link_t = link_t.trim_suffix("[]"); display_t = display_t.trim_suffix("[]"); - class_desc->push_meta("#Array"); // class + class_desc->push_meta("#Array", RichTextLabel::META_UNDERLINE_ON_HOVER); // class class_desc->add_text("Array"); class_desc->pop(); // meta class_desc->add_text("["); @@ -374,9 +374,9 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum, bool p_is } if (is_enum_type) { - class_desc->push_meta("$" + link_t); // enum + class_desc->push_meta("$" + link_t, RichTextLabel::META_UNDERLINE_ON_HOVER); // enum } else { - class_desc->push_meta("#" + link_t); // class + class_desc->push_meta("#" + link_t, RichTextLabel::META_UNDERLINE_ON_HOVER); // class } } class_desc->add_text(display_t); @@ -503,7 +503,7 @@ void EditorHelp::_add_method(const DocData::MethodDoc &p_method, bool p_overview const bool is_documented = p_method.is_deprecated || p_method.is_experimental || !p_method.description.strip_edges().is_empty(); if (p_overview && is_documented) { - class_desc->push_meta("@method " + p_method.name); + class_desc->push_meta("@method " + p_method.name, RichTextLabel::META_UNDERLINE_ON_HOVER); } class_desc->push_color(theme_cache.headline_color); @@ -1210,7 +1210,7 @@ void EditorHelp::_update_doc() { class_desc->push_color(theme_cache.headline_color); if (describe) { - class_desc->push_meta("@member " + prop.name); + class_desc->push_meta("@member " + prop.name, RichTextLabel::META_UNDERLINE_ON_HOVER); } class_desc->add_text(prop.name); @@ -2452,12 +2452,16 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control const String link_target = tag.substr(tag_end + 1, tag.length()).lstrip(" "); Color target_color = link_color; + RichTextLabel::MetaUnderline underline_mode = RichTextLabel::META_UNDERLINE_ON_HOVER; if (link_tag == "method" || link_tag == "constructor" || link_tag == "operator") { target_color = link_method_color; } else if (link_tag == "member" || link_tag == "signal" || link_tag == "theme_item") { target_color = link_property_color; } else if (link_tag == "annotation") { target_color = link_annotation_color; + } else { + // Better visibility for constants, enums, etc. + underline_mode = RichTextLabel::META_UNDERLINE_ALWAYS; } // Use monospace font to make clickable references @@ -2465,7 +2469,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control p_rt->push_font(doc_code_font); p_rt->push_font_size(doc_code_font_size); p_rt->push_color(target_color); - p_rt->push_meta("@" + link_tag + " " + link_target); + p_rt->push_meta("@" + link_tag + " " + link_target, underline_mode); if (link_tag == "member" && ((!link_target.contains(".") && (p_class == "ProjectSettings" || p_class == "EditorSettings")) || @@ -2526,7 +2530,7 @@ static void _add_text_to_rt(const String &p_bbcode, RichTextLabel *p_rt, Control p_rt->push_font(doc_code_font); p_rt->push_font_size(doc_code_font_size); p_rt->push_color(type_color); - p_rt->push_meta("#" + tag); + p_rt->push_meta("#" + tag, RichTextLabel::META_UNDERLINE_ON_HOVER); p_rt->add_text(tag); diff --git a/editor/import/3d/scene_import_settings.cpp b/editor/import/3d/scene_import_settings.cpp index f0de608cf5..721eccdfdd 100644 --- a/editor/import/3d/scene_import_settings.cpp +++ b/editor/import/3d/scene_import_settings.cpp @@ -443,24 +443,27 @@ void SceneImportSettingsDialog::_update_view_gizmos() { return; } for (const KeyValue<String, NodeData> &e : node_map) { + // Skip import nodes that aren't MeshInstance3D. + const MeshInstance3D *mesh_node = Object::cast_to<MeshInstance3D>(e.value.node); + if (mesh_node == nullptr || mesh_node->get_mesh().is_null()) { + continue; + } + + // Determine if the mesh collider should be visible. bool show_collider_view = false; if (e.value.settings.has(SNAME("generate/physics"))) { show_collider_view = e.value.settings[SNAME("generate/physics")]; } - MeshInstance3D *mesh_node = Object::cast_to<MeshInstance3D>(e.value.node); - if (mesh_node == nullptr || mesh_node->get_mesh().is_null()) { - // Nothing to do. - continue; - } - + // Get the collider_view MeshInstance3D. TypedArray<Node> descendants = mesh_node->find_children("collider_view", "MeshInstance3D"); - CRASH_COND_MSG(descendants.is_empty(), "This is unreachable, since the collider view is always created even when the collision is not used! If this is triggered there is a bug on the function `_fill_scene`."); + MeshInstance3D *collider_view = Object::cast_to<MeshInstance3D>(descendants[0].operator Object *()); - MeshInstance3D *collider_view = static_cast<MeshInstance3D *>(descendants[0].operator Object *()); - collider_view->set_visible(show_collider_view); - if (generate_collider) { + // Regenerate the physics collider for this MeshInstance3D if either: + // - A regeneration is requested for the selected import node. + // - The collider is being made visible. + if ((generate_collider && e.key == selected_id) || (show_collider_view && !collider_view->is_visible())) { // This collider_view doesn't have a mesh so we need to generate a new one. Ref<ImporterMesh> mesh; mesh.instantiate(); @@ -524,6 +527,9 @@ void SceneImportSettingsDialog::_update_view_gizmos() { collider_view->set_mesh(collider_view_mesh); collider_view->set_transform(transform); } + + // Set the collider visibility. + collider_view->set_visible(show_collider_view); } generate_collider = false; diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 42f8b205c5..0884119278 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -2573,7 +2573,7 @@ struct Win32InputTextDialogInit { const Callable &callback; }; -static constexpr int scale_with_dpi(int p_pos, int p_dpi) { +static int scale_with_dpi(int p_pos, int p_dpi) { return IsProcessDPIAware() ? (p_pos * p_dpi / 96) : p_pos; } |