Merge pull request #6211 from Evanaellio/fix-tool-annotation

Fix references to the @tool annotation
This commit is contained in:
Max Hilbrunner
2022-09-22 17:24:35 +02:00
committed by GitHub
4 changed files with 7 additions and 7 deletions

View File

@@ -147,7 +147,7 @@ or run game code in the editor. This means you can **use the same code**
and scenes for your games, or **build plugins and extend the editor.**
This leads to a reliable and flexible UI system, as it powers the editor
itself. With the ``tool`` keyword, you can run any game code in the editor.
itself. With the ``@tool`` annotation, you can run any game code in the editor.
|image5|
@@ -155,7 +155,7 @@ itself. With the ``tool`` keyword, you can run any game code in the editor.
UI tools for its node-based programming system and for the rest of the
interface.*
Put the ``tool`` keyword at the top of any GDScript file and it will run
Put the ``@tool`` annotation at the top of any GDScript file and it will run
in the editor. This lets you import and export plugins, create plugins
like custom level editors, or create scripts with the same nodes and API
you use in your projects.

View File

@@ -167,7 +167,7 @@ To create a new node type, you can use the function
:ref:`class_EditorPlugin` class. This function can add new types to the editor
(nodes or resources). However, before you can create the type, you need a script
that will act as the logic for the type. While that script doesn't have to use
the ``@tool`` keyword, it can be added so the script runs in the editor.
the ``@tool`` annotation, it can be added so the script runs in the editor.
For this tutorial, we'll create a button that prints a message when
clicked. For that, we'll need a script that extends from

View File

@@ -36,7 +36,7 @@ use cases:
How to use it
-------------
To turn a script into a tool, add the keyword ``@tool`` at the top of your code.
To turn a script into a tool, add the ``@tool`` annotation at the top of your code.
To check if you are currently in the editor, use: ``Engine.is_editor_hint()``.
@@ -351,6 +351,6 @@ If you are using :ref:`EditorScript<class_EditorScript>`:
.. warning::
Using ``@tool`` improperly can yield many errors. It is advised to first
write the code how you want it, and only then add the ``@tool`` keyword to
write the code how you want it, and only then add the ``@tool`` annotation to
the top. Also, make sure to separate code that runs in-editor from code that
runs in-game. This way, you can find bugs more easily.

View File

@@ -689,7 +689,7 @@ We suggest to organize GDScript code this way:
::
01. tool
01. @tool
02. class_name
03. extends
04. # docstring
@@ -724,7 +724,7 @@ This code order follows four rules of thumb:
Class declaration
~~~~~~~~~~~~~~~~~
If the code is meant to run in the editor, place the ``tool`` keyword on the
If the code is meant to run in the editor, place the ``@tool`` annotation on the
first line of the script.
Follow with the `class_name` if necessary. You can turn a GDScript file into a