为类参考手册贡献

The class reference is available online in the classes section of the documentation and in the Godot editor, from the help menu.

In the class reference, 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 plan to make large changes, you should create an issue on the godot-docs repository or comment on an existing issue. Doing so lets others know you're already taking care of a given class.

参见

You can find the writing guidelines for the class reference here.

For details on Git usage and the pull request workflow, please refer to the 拉取请求工作流程 page.

If you want to translate the class reference from English to another language, see 编辑器和文档本地化.

This guide is also available as a video tutorial on YouTube.

参见

Not sure which class to contribute to? Take a look at the class reference's completion status here.

You can find the source files for the class reference in Godot's GitHub repository: doc/classes/.

注解

For some modules in the engine's source code, you'll find the XML files in the modules/<module_name>/doc_classes/ directory instead.

警告

Always edit the API reference through these source XML files. Do not edit the generated .rst files in the online documentation, hosted in the godot-docs repository.

警告

Unless you make minor changes, like fixing a typo, we do not recommend using the GitHub web editor to edit the class reference's XML.

It lacks features to edit XML well, like keeping indentations consistent, and it does not allow amending commits based on reviews.

Also, it doesn't allow you to test your changes in the engine or with validation scripts as described in 如何编辑类 XML.

更新文档模板

When you create a new class or modify the engine's API, you need to re-generate the XML files in doc/classes/.

To do so, you first need to compile Godot. See the 构建系统介绍 page to learn how. Then, execute the compiled Godot binary from the Godot root directory with the --doctool option. For example, if you're on 64-bit Linux, the command is:

./bin/godot.linuxbsd.tools.64 --doctool

在 doc/classes 中的 XML 文件此时应该是与当前 Godot 引擎的特性一致的。你可以使用 git diff 查看不同之处。请让你的提交仅包含与你修改的 API 相关的改动。可以使用 git checkout 放弃对其他 XML 文件的修改。