updating_the_class_reference.rst 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. .. _doc_updating_the_class_reference:
  2. Contributing to the class reference
  3. ===================================
  4. .. highlight:: shell
  5. The :ref:`Class reference <doc_class_reference>` is a set of articles describing
  6. the public API of the engine. This includes descriptions for various classes,
  7. methods, properties, and global objects, available for scripting. The class reference
  8. is available online, from the documentation sidebar, and in the Godot editor, from
  9. the help menu.
  10. As the engine grows and features are added or modified, some parts of the class
  11. reference become obsolete and new descriptions and examples need to be added.
  12. While developers are required to document their work in the class reference when
  13. submitting a pull request, we can't expect every programmer to be a good
  14. technical writer. There is always work for contributors like you to polish
  15. existing and create missing reference material.
  16. The source of the class reference
  17. ---------------------------------
  18. As the class reference is available in two places, online and in the editor, we need to
  19. take care to keep things in sync. To achieve this the `main Godot repository <https://github.com/godotengine/godot/>`_
  20. is picked as the source of truth, and the documentation for the class reference is tracked there.
  21. .. warning::
  22. You should **not** edit ``.rst`` files in the ``classes/`` folder of the
  23. `documentation repository <https://github.com/godotengine/godot-docs/>`_.
  24. These files are generated automatically and are synced manually by project
  25. maintainers. Read further to learn how to correctly edit the class reference.
  26. In the main repository the class reference is stored in XML files, one for each exposed
  27. class or global object. The majority of these files is located in `doc/classes/
  28. <https://github.com/godotengine/godot/tree/master/doc/classes>`_, but some modules
  29. contain their own documentation as well. You will find it in the ``modules/<module_name>/doc_classes/``
  30. directory. To learn more about editing XML files refer to :ref:`doc_class_reference_primer`.
  31. .. seealso::
  32. For details on Git usage and the pull request workflow, please
  33. refer to the :ref:`doc_pr_workflow` page.
  34. If you want to translate the class reference from English to another
  35. language, see :ref:`doc_editor_and_docs_localization`. This guide is
  36. also available as a `video tutorial on YouTube
  37. <https://www.youtube.com/watch?v=5jeHXxeX-JY>`_.
  38. **Important:** If you plan to make large changes, you should create an issue on
  39. the `godot-docs repository <https://github.com/godotengine/godot-docs/>`_
  40. or comment on an existing issue. Doing so lets others know you're already
  41. taking care of a given class.
  42. What to contribute
  43. ------------------
  44. The natural place to start contributing is the classes that you are most familiar with.
  45. This ensures that the added description will be based on experience and the necessary
  46. know-how, not just the name of a method or a property. We advise not to add low effort
  47. descriptions, no matter how appealing it may look. Such descriptions obscure the need
  48. for documentation and are hard to identify automatically.
  49. .. seealso::
  50. Following this principle is important and allows us to create tools for contributors.
  51. Such as the class reference's `completion status tracker <https://godotengine.github.io/doc-status/>`_.
  52. You can use it to quickly find documentation pages missing descriptions.
  53. If you decide to document a class, but don't know what a particular method does, don't
  54. worry. Leave it for now, and list the methods you skipped when you open a pull request
  55. with your changes. Another writer will take care of it.
  56. You can still look at the methods' implementation in Godot's source code on GitHub.
  57. If you have doubts, feel free to ask on the `Q&A website <https://ask.godotengine.org/>`_
  58. and `Godot Contributors Chat <https://chat.godotengine.org/>`_.
  59. .. warning::
  60. Unless you make minor changes, like fixing a typo, we do not recommend using the
  61. GitHub web editor to edit the class reference's XML files. It lacks features to edit
  62. XML well, like keeping indentations consistent, and it does not allow amending commits
  63. based on reviews.
  64. It also doesn't allow you to test your changes in the engine or with validation
  65. scripts as described in :ref:`doc_class_reference_editing_xml`.
  66. Updating class reference when working on the engine
  67. ---------------------------------------------------
  68. When you create a new class or modify an existing engine's API, you need to re-generate
  69. the XML files in ``doc/classes/``.
  70. To do so, you first need to compile Godot. See the :ref:`doc_introduction_to_the_buildsystem`
  71. page to learn how. Then, execute the compiled Godot binary from the Godot root directory
  72. with the ``--doctool`` option. For example, if you're on 64-bit Linux, the command might be:
  73. ::
  74. ./bin/godot.linuxbsd.editor.x86_64 --doctool
  75. The exact set of suffixes may be different. Carefully read through the linked article to
  76. learn more about that.
  77. The XML files in ``doc/classes/`` should then be up-to-date with current Godot Engine
  78. features. You can then check what changed using the ``git diff`` command.
  79. Please only include changes that are relevant to your work on the API in your commits.
  80. You can discard changes in other XML files using ``git checkout``, but consider reporting
  81. if you notice unrelated files being updated. Ideally, running this command should only
  82. bring up the changes that you yourself have made.
  83. You will then need to add descriptions to any newly generated entries.