diff options
-rw-r--r-- | doc/classes/ScriptEditor.xml | 29 | ||||
-rw-r--r-- | editor/editor_inspector.cpp | 22 | ||||
-rw-r--r-- | editor/editor_inspector.h | 7 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | main/main.cpp | 2 | ||||
-rw-r--r-- | tests/test_main.cpp | 2 |
6 files changed, 51 insertions, 13 deletions
diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml index 2c88ecd675..43ee4dda60 100644 --- a/doc/classes/ScriptEditor.xml +++ b/doc/classes/ScriptEditor.xml @@ -34,6 +34,35 @@ Returns an array with all [Script] objects which are currently open in editor. </description> </method> + <method name="goto_help"> + <return type="void" /> + <param index="0" name="topic" type="String" /> + <description> + Opens help for the given topic. The [param topic] is an encoded string that controls which class, method, constant, signal, annotation, property, or theme item should be focused. + The supported [param topic] formats include [code]class_name:class[/code], [code]class_method:class:method[/code], [code]class_constant:class:constant[/code], [code]class_signal:class:signal[/code], [code]class_annotation:class:@annotation[/code], [code]class_property:class:property[/code], and [code]class_theme_item:class:item[/code], where [code]class[/code] is the class name, [code]method[/code] is the method name, [code]constant[/code] is the constant name, [code]signal[/code] is the signal name, [code]annotation[/code] is the annotation name, [code]property[/code] is the property name, and [code]item[/code] is the theme item. + [b]Examples:[/b] + [codeblock] + # Shows help for the Node class. + class_name:Node + # Shows help for the global min function. + # Global objects are accessible in the `@GlobalScope` namespace, shown here. + class_method:@GlobalScope:min + # Shows help for get_viewport in the Node class. + class_method:Node:get_viewport + # Shows help for the Input constant MOUSE_BUTTON_MIDDLE. + class_constant:Input:MOUSE_BUTTON_MIDDLE + # Shows help for the BaseButton signal pressed. + class_signal:BaseButton:pressed + # Shows help for the CanvasItem property visible. + class_property:CanvasItem:visible + # Shows help for the GDScript annotation export. + # Annotations should be prefixed with the `@` symbol in the descriptor, as shown here. + class_annotation:@GDScript:@export + # Shows help for the GraphNode theme item named panel_selected. + class_theme_item:GraphNode:panel_selected + [/codeblock] + </description> + </method> <method name="goto_line"> <return type="void" /> <param index="0" name="line_number" type="int" /> diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 7919d61f26..aed1462eb6 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -3220,12 +3220,13 @@ void EditorInspector::update_tree() { } // Search for the doc path in the cache. - HashMap<StringName, HashMap<StringName, String>>::Iterator E = doc_path_cache.find(classname); + HashMap<StringName, HashMap<StringName, DocCacheInfo>>::Iterator E = doc_cache.find(classname); if (E) { - HashMap<StringName, String>::Iterator F = E->value.find(propname); + HashMap<StringName, DocCacheInfo>::Iterator F = E->value.find(propname); if (F) { found = true; - doc_path = F->value; + doc_path = F->value.doc_path; + theme_item_name = F->value.theme_item_name; } } @@ -3246,23 +3247,22 @@ void EditorInspector::update_tree() { theme_item_name = F->value.theme_properties[i].name; } } - - if (is_native_class) { - doc_path_cache[classname][propname] = doc_path; - } } else { for (int i = 0; i < F->value.properties.size(); i++) { String doc_path_current = "class_property:" + F->value.name + ":" + F->value.properties[i].name; if (F->value.properties[i].name == propname.operator String()) { doc_path = doc_path_current; } - - if (is_native_class) { - doc_path_cache[classname][propname] = doc_path; - } } } + if (is_native_class) { + DocCacheInfo cache_info; + cache_info.doc_path = doc_path; + cache_info.theme_item_name = theme_item_name; + doc_cache[classname][propname] = cache_info; + } + if (!doc_path.is_empty() || F->value.inherits.is_empty()) { break; } diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 8c55950a2b..eff4f9caa5 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -505,7 +505,12 @@ class EditorInspector : public ScrollContainer { int property_focusable; int update_scroll_request; - HashMap<StringName, HashMap<StringName, String>> doc_path_cache; + struct DocCacheInfo { + String doc_path; + String theme_item_name; + }; + + HashMap<StringName, HashMap<StringName, DocCacheInfo>> doc_cache; HashSet<StringName> restart_request_props; HashMap<String, String> custom_property_descriptions; diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 6c63d9ff0d..c832570fee 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3886,6 +3886,8 @@ void ScriptEditor::_bind_methods() { ClassDB::bind_method(D_METHOD("get_open_scripts"), &ScriptEditor::_get_open_scripts); ClassDB::bind_method(D_METHOD("open_script_create_dialog", "base_name", "base_path"), &ScriptEditor::open_script_create_dialog); + ClassDB::bind_method(D_METHOD("goto_help", "topic"), &ScriptEditor::goto_help); + ADD_SIGNAL(MethodInfo("editor_script_changed", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script"))); ADD_SIGNAL(MethodInfo("script_close", PropertyInfo(Variant::OBJECT, "script", PROPERTY_HINT_RESOURCE_TYPE, "Script"))); } diff --git a/main/main.cpp b/main/main.cpp index a1031b5385..ed74094c9e 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -697,7 +697,9 @@ Error Main::test_setup() { /** INITIALIZE SERVERS **/ register_server_types(); +#ifndef _3D_DISABLED XRServer::set_xr_mode(XRServer::XRMODE_OFF); // Skip in tests. +#endif // _3D_DISABLED initialize_modules(MODULE_INITIALIZATION_LEVEL_SERVERS); GDExtensionManager::get_singleton()->initialize_extensions(GDExtension::INITIALIZATION_LEVEL_SERVERS); diff --git a/tests/test_main.cpp b/tests/test_main.cpp index bb6837c965..56bd8739c6 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -100,7 +100,6 @@ #include "tests/core/variant/test_variant.h" #include "tests/core/variant/test_variant_utility.h" #include "tests/scene/test_animation.h" -#include "tests/scene/test_arraymesh.h" #include "tests/scene/test_audio_stream_wav.h" #include "tests/scene/test_bit_map.h" #include "tests/scene/test_camera_2d.h" @@ -127,6 +126,7 @@ #include "tests/test_validate_testing.h" #ifndef _3D_DISABLED +#include "tests/scene/test_arraymesh.h" #include "tests/scene/test_camera_3d.h" #include "tests/scene/test_navigation_agent_2d.h" #include "tests/scene/test_navigation_agent_3d.h" |