diff options
-rw-r--r-- | doc/classes/Array.xml | 2 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 28 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 1 |
3 files changed, 21 insertions, 10 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 27331d3f96..ef4f86f1a9 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -194,7 +194,7 @@ <return type="void" /> <argument index="0" name="value" type="Variant" /> <description> - Removes the first occurrence of a value from the array. To remove an element by index, use [method remove_at] instead. + Removes the first occurrence of a value from the array. If the value does not exist in the array, nothing happens. To remove an element by index, use [method remove_at] instead. [b]Note:[/b] This method acts in-place and doesn't return a value. [b]Note:[/b] On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed. </description> diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 6f85b24d5e..0f45415c4d 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3291,15 +3291,8 @@ void ScriptEditor::_help_class_open(const String &p_class) { void ScriptEditor::_help_class_goto(const String &p_desc) { String cname = p_desc.get_slice(":", 1); - for (int i = 0; i < tab_container->get_tab_count(); i++) { - EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i)); - - if (eh && eh->get_class() == cname) { - _go_to_tab(i); - eh->go_to_help(p_desc); - _update_script_names(); - return; - } + if (_help_tab_goto(cname, p_desc)) { + return; } EditorHelp *eh = memnew(EditorHelp); @@ -3313,6 +3306,22 @@ void ScriptEditor::_help_class_goto(const String &p_desc) { _sort_list_on_update = true; _update_script_names(); _save_layout(); + + call_deferred("_help_tab_goto", cname, p_desc); +} + +bool ScriptEditor::_help_tab_goto(const String &p_name, const String &p_desc) { + for (int i = 0; i < tab_container->get_tab_count(); i++) { + EditorHelp *eh = Object::cast_to<EditorHelp>(tab_container->get_tab_control(i)); + + if (eh && eh->get_class() == p_name) { + _go_to_tab(i); + eh->go_to_help(p_desc); + _update_script_names(); + return true; + } + } + return false; } void ScriptEditor::update_doc(const String &p_name) { @@ -3601,6 +3610,7 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method("_update_script_connections", &ScriptEditor::_update_script_connections); ClassDB::bind_method("_help_class_open", &ScriptEditor::_help_class_open); + ClassDB::bind_method("_help_tab_goto", &ScriptEditor::_help_tab_goto); ClassDB::bind_method("_live_auto_reload_running_scripts", &ScriptEditor::_live_auto_reload_running_scripts); ClassDB::bind_method("_update_members_overview", &ScriptEditor::_update_members_overview); ClassDB::bind_method("_update_recent_scripts", &ScriptEditor::_update_recent_scripts); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index 5b8d46089e..7885ffe2c5 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -440,6 +440,7 @@ class ScriptEditor : public PanelContainer { void _help_class_open(const String &p_class); void _help_class_goto(const String &p_desc); + bool _help_tab_goto(const String &p_name, const String &p_desc); void _update_history_arrows(); void _save_history(); void _go_to_tab(int p_idx); |