Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inspector Tooltips Load Without Descriptions on Custom Classes And Properties #94234

Closed
jake-abed opened this issue Jul 11, 2024 · 5 comments
Closed

Comments

@jake-abed
Copy link

jake-abed commented Jul 11, 2024

Tested versions

  • Reproducible in v4.3.beta3.official [82cedc8], v4.3.beta2, and v4.3.beta1.
  • Not reproducible in 4.2.2 stable and earlier [EDIT: Inaccurate - present in earlier versions]

System information

Godot v4.3.beta3 - macOS 14.5.0 - Vulkan (Forward+) - integrated Apple M1 Pro - Apple M1 Pro (8 Threads) (Also tested on Windows 10 and Linux Ubuntu 24.04)

Issue description

Upon initially loading a project, custom descriptions in user created classes do not appear in the Inspector menu. Instead the text 'No description available.' appears in the tool up.

Saving the file with changes does not fix the problem. However, making any changes/edits to the script and saving it will cause the tooltips to load with the descriptions in place as expected. Closing and reloading Godot will revert the behavior back to the initial unintended behavior.

Expected behavior is that the description, as written in documentation in GDScript, will appear in the tooltip.

Example:

Snippet:

## A test node to demonstrate this bug!
class_name TestNode extends Node2D

## The name of the node!
@export var node_name: String

## The scaling factor for the node size.
@export var scaling: float

Appears as the following initially:
Screenshot 2024-07-11 at 1 51 41 PM

It should appear as such:
Screenshot 2024-07-11 at 1 52 33 PM

Appears to be a regression, though I could be mistaken. I am very curious as to the root cause/solution to the issue, but I am not very familiar with C++ nor the engine's internals.

Steps to reproduce

  1. Load the Minimal Reproduction Project below in a Godot 4.3 beta release.
  2. If not open already, open the test_node.tscn scene.
  3. Open the associated test_node.gd script in the Script Editor.
  4. With TestNode selected in the Scene Dock, try hovering over the custom class TestNode or its properties.
  5. The tooltip should render with the placeholder text: 'No description available'.
  6. Make any non-breaking edits to the test_node.gd script.
  7. Repeat step 5 and the documentation will load as intended.
  8. Close Godot and reload the project. You should be able to reproduce steps 1-5 again.

Minimal reproduction project (MRP)

tooltip_test_mrp.zip

@akien-mga
Copy link
Member

CC @dalexeev

@dalexeev
Copy link
Member

dalexeev commented Jul 12, 2024

Related to / duplicate of:

This is not a recent regression, the bug is quite long-lived. The worst part is that documentation is not always available even for loaded scripts, so tooltips may be missing in the Inspector.

Also, there is a more global problem that scripts are loaded/compiled on demand. So, documentation may be missing in Editor Help Search, and doc links to unloaded scripts will not work. We probably need a cache.

@jake-abed
Copy link
Author

Apologies, in testing I could have sworn it was not a problem in 4.2.x; it very clearly is. Maybe there was some behavior that I was doing that was causing scripts to compile/load without the saving? I have to head into work, but I'll take a look and try to recreate the expected behavior really quickly.

I'll keep putzing around and see what I can find.

@dalexeev
Copy link
Member

The following code works well when you run Godot with the --gdscript-docs flag. But I'm not sure that using something like this every editor run would be good for performance.

godot/main/main.cpp

Lines 3703 to 3732 in 97b8ad1

#ifdef MODULE_GDSCRIPT_ENABLED
if (!doc_tool_path.is_empty() && !gdscript_docs_path.is_empty()) {
DocTools docs;
Error err;
Vector<String> paths = get_files_with_extension(gdscript_docs_path, "gd");
ERR_FAIL_COND_V_MSG(paths.is_empty(), EXIT_FAILURE, "Couldn't find any GDScript files under the given directory: " + gdscript_docs_path);
for (const String &path : paths) {
Ref<GDScript> gdscript = ResourceLoader::load(path);
for (const DocData::ClassDoc &class_doc : gdscript->get_documentation()) {
docs.add_doc(class_doc);
}
}
if (doc_tool_implicit_cwd) {
doc_tool_path = "./docs";
}
Ref<DirAccess> da = DirAccess::create_for_path(doc_tool_path);
err = da->make_dir_recursive(doc_tool_path);
ERR_FAIL_COND_V_MSG(err != OK, EXIT_FAILURE, "Error: Can't create GDScript docs directory: " + doc_tool_path + ": " + itos(err));
HashMap<String, String> doc_data_classes;
err = docs.save_classes(doc_tool_path, doc_data_classes, false);
ERR_FAIL_COND_V_MSG(err != OK, EXIT_FAILURE, "Error saving GDScript docs:" + itos(err));
return EXIT_SUCCESS;
}
#endif // MODULE_GDSCRIPT_ENABLED

@akien-mga
Copy link
Member

Consolidating in #72406 / #86577.

@akien-mga akien-mga removed this from the 4.3 milestone Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants