Contributing to the class reference

    This guide also is available as a .

    Godot ships with many nodes and singletons to help you develop your games. Each is a class, documented in the class reference. This reference is essential for anyone learning the engine: it is available both online and in the engine.

    But it’s incomplete. Some methods, variables and signals lack descriptions. Others changed with recent releases and need updates. The developers can’t write the entire reference on their own. Godot needs you, and all of us, to contribute.

    Important: If you are planning to make larger changes or a more substantial contribution, it is usually a good idea to create an issue (or a comment in an existing one) to let others know so they don’t start working on the same thing too.

    See also

    Not sure where to start contributing? Take a look at the current class reference completion status .

    The class reference lies in the following XML files, in Godot’s GitHub repository: doc/classes/.

    There are 5 steps to update the class reference (full guide below):

    1. Fork
    2. Clone your fork on your computer
    3. Edit the class file in to write documentation
    4. Commit your changes and push them to your fork
    5. Make a pull request on the Godot repository

    Warning

    Always use these XML files to edit the API reference. Do not edit the generated .rst files in the online documentation, hosted in the repository.

    If you’re new to Git and GitHub, this guide will help you get started. You’ll learn to:

    • Fork and clone Godot’s repository
    • Keep your fork up to date with other contributors
    • Create a pull request so your improvements end in the official docs

    Note

    If you’re new to Git, the version control system Godot uses, go through GitHub’s interactive guide. You’ll learn some essential vocabulary and get a sense for the tool.

    Fork the Godot Engine into a GitHub repository of your own.

    Clone the repository on your computer:

    Create a new branch to make your changes. It makes it a lot easier to sync your improvements with other docs writers. It’s also easier to clean up your repository if you run into any issues with Git.

    1. git checkout -b your-new-branch-name

    The new branch is the same as your master branch, until you start to write API docs. In the doc/ folder, you’ll find the class reference.

    How to keep your local clone up-to-date

    Other writers contribute to Godot’s documentation. Your local repository will fall behind it, and you’ll have to synchronize it. Especially if other contributors update the class reference while you work on it.

    1. git remote add upstream https://github.com/godotengine/godot

    You can check the list of all remote servers with:

    1. git remote -v

    You should have two: origin, your fork on GitHub that Git adds by default, and upstream, that you just added:

    1. origin https://github.com/your_name/godot.git (fetch)
    2. origin https://github.com/your_name/godot.git (push)
    3. upstream https://github.com/godotengine/godot.git (fetch)
    4. upstream https://github.com/godotengine/godot.git (push)

    Each time you want to sync your branch to the state of the upstream repository, enter:

    This command will first fetch, or download the latest version of the Godot repository. Then, it will reapply your local changes on top.

    If you made changes you don’t want to keep in your local branch, use the following commands instead:

    1. git fetch upstream

    Warning: The above command will reset your branch to the state of the upstream master branch. It will discard all local changes. Make sure to only run this before you make important changes.

    Another option is to delete the branch you’re working on, synchronize the master branch with the Godot repository, and create a new branch:

    1. git checkout master
    2. git branch -d your-new-branch-name
    3. git pull --rebase upstream master
    4. git checkout -b your-new-branch-name

    If you’re feeling lost by now, come to our and ask for help. Experienced Git users will give you a hand.

    When classes are modified in the source code, the documentation template might become outdated. To make sure that you are editing an up-to-date version, you first need to compile Godot (you can follow the Introduction to the buildsystem page), and then run the following command (assuming 64-bit Linux):

    1. ./bin/godot.x11.tools.64 --doctool .

    The XML files in doc/classes should then be up-to-date with current Godot Engine features. You can then check what changed using the git diff command. If there are changes to other classes than the one you are planning to document, please commit those changes first before starting to edit the template:

    1. git add doc/classes/*.xml
    2. git commit -m "Sync classes reference template with current code base"

    You are now ready to edit this file to add stuff.

    Note: If this has been done recently by another contributor, you don’t forcefully need to go through these steps (unless you know that the class you plan to edit has been modified recently).

    Push and request a pull of your changes

    Once your modifications are finished, push your changes on your GitHub repository:

    When it’s done, you can ask for a Pull Request via the GitHub UI of your Godot fork.

    Warning

    Although you can edit files on GitHub, it’s not recommended. As hundreds of contributors work on Godot, the Git history must stay clean. Each commit should bundle all related improvements you make to the class reference, a new feature, bug fixes… When you edit from GitHub, it will create a new branch and a Pull Request every time you want to save it. If a few days pass before your changes get a review, you won’t be able to update to the latest version of the repository cleanly. Also, it’s harder to keep clean indents from GitHub. And they’re very important in the docs.

    TL;DR: If you don’t know what you’re doing exactly, do not edit files from GitHub.

    Edit the file for your chosen class in to update the class reference. The folder contains an XML file for each class. The XML lists the constants and methods you’ll find in the class reference. Godot generates and updates the XML automatically.

    If you need to check that the modifications you’ve made are correct in the generated documentation, build Godot as described , run the editor and open the help for the page you modified.

    Each class has a brief and a long description. The brief description is always at the top of the page, while the full description lies below the list of methods, variables and constants. Methods, member variables, constants and signals are in separate categories or XML nodes. For each, learn how they work in Godot’s source code, and fill their <description>.

    Our job is to add the missing text between these marks:

    • <description></description>
    • <brief_description></brief_description>
    • <constant></constant>
    • <method></method>
    • <member></member>
    • <signal></signal>

    Write in a clear and simple language. Always follow the writing guidelines to keep your descriptions short and easy to read. Do not leave empty lines in the descriptions: each line in the XML file will result in a new paragraph.

    Here’s how a class looks like in XML:

    1. <class name="Node2D" inherits="CanvasItem" category="Core">
    2. <brief_description>
    3. Base node for 2D system.
    4. </brief_description>
    5. <description>
    6. Base node for 2D system. Node2D contains a position, rotation and scale, which is used to position and animate. It can alternatively be used with a custom 2D transform ([Matrix32]). A tree of Node2Ds allows complex hierarchies for animation and positioning.
    7. </description>
    8. <methods>
    9. <method name="set_pos">
    10. <argument index="0" name="pos" type="Vector2">
    11. </argument>
    12. <description>
    13. Sets the position of the 2D node.
    14. </description>
    15. [...]
    16. <method name="edit_set_pivot">
    17. <argument index="0" name="arg0" type="Vector2">
    18. </argument>
    19. <description>
    20. </description>
    21. </method>
    22. </methods>
    23. <member name="global_position" type="Vector2" setter="set_global_position" getter="get_global_position" brief="">
    24. </member>
    25. [...]
    26. <member name="z_as_relative" type="bool" setter="set_z_as_relative" getter="is_z_relative" brief="">
    27. </member>
    28. </members>
    29. <constants>
    30. </constants>
    31. </class>

    Use a code editor like Vim, Atom, Code, Notepad++ or anything similar to edit the file quickly. Use the search function to find classes fast.

    Improve formatting with BBCode style tags

    Godot’s class reference supports BBCode-like tags. They add nice formatting to the text. Here’s the list of available tags:

    Use [codeblock] for pre-formatted code blocks. Inside [codeblock], always use four spaces for indentation (the parser will delete tabs). Example:

    1. [codeblock]
    2. func _ready():
    3. var sprite = get_node("Sprite")
    4. print(sprite.get_pos())
    5. [/codeblock]

    Will display as:

    1. func _ready():
    2. var sprite = get_node("Sprite")
    3. print(sprite.get_pos())

    To denote important information, add a paragraph starting with “[b]Note:[/b]“ at the end of the description:

    1. [b]Note:[/b] Only available when using the GLES2 renderer.

    To denote crucial information that could cause security issues or loss of data if not followed carefully, add a paragraph starting with “[b]Warning:[/b]“ at the end of the description:

    For deprecated properties, add a paragraph starting with “[i]Deprecated.[/i]“. Notice the use of italics instead of bold:

      In all the paragraphs described above, make sure the punctuation is part of the BBCode tags for consistency.

      No problem. Leave it behind, and list the methods you skipped when you request a pull of your changes. Another writer will take care of it.

      You can still have a look at the methods’ implementation in Godot’s source code on GitHub. Also, if you have doubts, feel free to ask on the and on IRC (freenode, #godotengine).

      Localization

      The documentation can be translated in any language on Hosted Weblate.

      Translated strings are synced manually by documentation maintainers in the repository.

      Languages with a good level of completion have their own localized instances of ReadTheDocs. Open an issue on the godot-docs-l10n repository if you think that a new language is complete enough to get its own instance.