Then you can only choose from the following five options:
Modify Godot, implementation method unknown
Create GDExtension, the implementation method is unknown, but you can take a look at the source code of the orchestrator
Analyze class documents by obtaining help nodes, then obtaining text, and finally parsing.
Disadvantages: 1. Due to the absence of spaces in some areas, only a portion of the document can be obtained. 2. Manual parsing is required
To parse class files, the implementation method is:load("C:/Users/shen/AppData/Local/Godot/editor_doc_cache.res")
Disadvantages: 1. No translation, 2. This is a large array, you can open it yourself to see the details, 3. It needs to be manually parsed
Give up
Advantages: Fast and efficient
If you find a better implementation, please let me know
I might try the third method of searching for the correct node which has the text itself. I’m searching through the scene tree, and under Mainscreen, there are loads of different control Nodes. I have already looked through the first four and couldn’t find the correct Node yet (even with the help help open). This might take a bit longer…
engine_script_editor = EditorInterface.get_script_editor()
engine_edit_tab=engine_script_editor.get_child(0).get_child(1).get_child(1).get_child(0)
for i in engine_edit_tab.get_children():
if i.get_class()=="EditorHelp":
var engine_edit_help:RichTextLabel=i.get_child(0)
engine_edit_help.select_all()
edit=engine_edit_help.get_selected_text()
Thank you for the code snippet! I added this to not have the selection persist:
engine_edit_help.deselect()
EDIT: Using the RichTextLabel.get_parsed_text() method seems to return slightly more useful output. It leaves in some of the tabs which are ignored by RichTextLabel.get_selected_text().
These RichTextLabels function in a weird way, where the text does not appear in the text field, but it does appear visually and can be selected. I would have liked to get the text with all of the BBCode formatting, but that seems to be impossible.
All of the text seems to be inserted using the append_text and push_* methods.
This is gonna be a bit harder it seems…
But thank you very much for helping me with this!
EDIT: Difference between get_parsed_text() and get_selected_text()
get_parsed_text()
Enumerationen
enum ContextMenuSlot:
● CONTEXT_SLOT_SCENE_TREE = 0
Context menu of Scene dock. _popup_menu() will be called with a list of paths to currently selected nodes, while option callback will receive the list of currently selected nodes.
● CONTEXT_SLOT_FILESYSTEM = 1
Context menu of FileSystem dock. _popup_menu() and option callback will be called with list of paths of the currently selected files.
● CONTEXT_SLOT_FILESYSTEM_CREATE = 3
The "Create..." submenu of FileSystem dock's context menu. _popup_menu() and option callback will be called with list of paths of the currently selected files.
● CONTEXT_SLOT_SCRIPT_EDITOR = 2
Context menu of Scene dock. _popup_menu() will be called with the path to the currently edited script, while option callback will receive reference to that script.
get_selected_text()
Enumerationen
enum ContextMenuSlot:
● CONTEXT_SLOT_SCENE_TREE = 0
Context menu of Scene dock. _popup_menu() will be called with a list of paths to currently selected nodes, while option callback will receive the list of currently selected nodes.
● CONTEXT_SLOT_FILESYSTEM = 1
Context menu of FileSystem dock. _popup_menu() and option callback will be called with list of paths of the currently selected files.
● CONTEXT_SLOT_FILESYSTEM_CREATE = 3
The "Create..." submenu of FileSystem dock's context menu. _popup_menu() and option callback will be called with list of paths of the currently selected files.
● CONTEXT_SLOT_SCRIPT_EDITOR = 2
Context menu of Scene dock. _popup_menu() will be called with the path to the currently edited script, while option callback will receive reference to that script.