From 5f40d38f8d73a4d8d816c4031eff63ef4b6b306b Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Sun, 7 Jul 2024 12:11:23 +0200 Subject: [PATCH] Add a hack to force documentation parsing on user scripts As things currently stand in Godot Engine, documentation comments are not loaded from user scripts into help system when the project is started. This leads to empty tooltips for user tasks in LimboAI, unless such a script is resaved. This hack forces script documentation to be added to help system, when the editor needs it to show a tooltip. --- editor/task_palette.cpp | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/editor/task_palette.cpp b/editor/task_palette.cpp index 158efaa..1262671 100644 --- a/editor/task_palette.cpp +++ b/editor/task_palette.cpp @@ -60,7 +60,9 @@ void TaskButton::_bind_methods() { Control *TaskButton::_do_make_tooltip() const { #ifdef LIMBOAI_MODULE String help_symbol; - if (task_meta.begins_with("res://")) { + bool is_resource = task_meta.begins_with("res://"); + + if (is_resource) { help_symbol = "class|\"" + task_meta.lstrip("res://") + "\"|"; } else { help_symbol = "class|" + task_meta + "|"; @@ -70,6 +72,18 @@ Control *TaskButton::_do_make_tooltip() const { help_bit->set_content_height_limits(1, 360 * EDSCALE); String desc = _module_get_help_description(task_meta); + if (desc.is_empty() && is_resource) { + // ! HACK: Force documentation parsing. + Ref