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 link to Godot engine source from documentation page #11432

Open
pcvonz opened this issue Dec 28, 2024 · 2 comments
Open

Add link to Godot engine source from documentation page #11432

pcvonz opened this issue Dec 28, 2024 · 2 comments

Comments

@pcvonz
Copy link

pcvonz commented Dec 28, 2024

Describe the project you are working on

Any sort of game that uses some of Godot's less documented features

Describe the problem or limitation you are having in your project

An easy way to find the relevant source file from the editor documentation tool

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

Adding a link to the source or a way to view the source code for a class could help understand how a class works.

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

A simple option could be to just link to the github page for the code. A more complicated version could show the source code in the documentation page perhaps like rust's documentation viewer does.

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

No, there will have to be a modification to the editor

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

Requires a modification to the editor

@tetrapod00
Copy link

Some prior discussion of the concept in godotengine/godot-docs#4314.

@Calinou Calinou changed the title Add link to godot engine source from documentation page Add link to Godot engine source from documentation page Jan 2, 2025
@Calinou
Copy link
Member

Calinou commented Jan 2, 2025

This can likely be implemented in a more direct manner than godotengine/godot-docs#4314 (comment) proposed by keeping a reference to the source file for each class as a top-level attribute to the XML file. This can surely be achieved using the __FILE__ C++ macro in the GDCLASS() macro, turning into a path relative to the repository root and ensuring doc_data.cpp can read it somehow.

We can then open the correct page on GitHub by checking the current engine version and setting the branch/tag accordingly. If you want to open local source code instead, we could have an editor setting where you define the folder of a Godot source repository, which would make it open a local file instead of GitHub. (This can also be used for the "Open C++ Source" menu actions in the Debugger > Errors tab.)

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