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

Add get_class_reference method #10862

Open
Smorty10 opened this issue Sep 30, 2024 · 2 comments
Open

Add get_class_reference method #10862

Smorty10 opened this issue Sep 30, 2024 · 2 comments

Comments

@Smorty10
Copy link

Describe the project you are working on

I am integrating a more convenient way to get quick answers out of the local class reference by embedding it using some local ai model. As far as I can tell, I cannot access the class reference documentation.

Describe the problem or limitation you are having in your project

I am integrating a more convenient way to get quick answers out of the local class reference by embedding it using some local ai model.
As far as I can tell, I cannot access the class reference documentation. I have a feeling, that I must venture through the Godot Editor Node Tree, then trigger to open the class reference, then get the TextLabel which has the text, and then get the text out of it, which is cumbersome.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Adding a get_class_reference(class:String) method to the ClassDB autoload, we could access the documentation way easier, which is great for Godot tool developers like myself.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

This get_class_reference method would take the class name as an argument, and would return either a String or a Dictionary. The dictionary approach feels better, as we could separate the methods, variables and actual documentation text better, without using delimiters and special characters.

var char_doc:Dictionary = ClassDB.get_class_reference("CharacterBody2D")
print("All methods: ", char_doc["methods"])

If this enhancement will not be used often, can it be worked around with a few lines of script?

I have a feeling, that I must venture through the Godot Editor Node Tree, then trigger to open the class reference, then get the TextLabel which has the text, and then get the text out of it, which is cumbersome.
So yes it's possible, but it would open all sorts of unwanted panels and require deeper understanding of the engine.

Is there a reason why this should be core and not an add-on in the asset library?

This is a baseline feature which is specific to the Godot engine. The built-in documentation is great, and being able to access and play with it is even better.
A plugin would not be able to achieve the seemlessness which a built-in implementation would offer.

@dalexeev
Copy link
Member

Note that you can use --doctool command line option to get engine and custom documentation as XML files.

@Smorty10
Copy link
Author

Smorty10 commented Oct 1, 2024

@dalexeev I was not aware of this command line solution.
However, getting the directory of the Godot program and running an OS.execute() command (which will be different for every operating system, and might not even be supported on some) is very cumbersome.
Having a built in method for this would make this fetching action trivial, and available to everyone.

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

2 participants