mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
Update plugin tutorial to use @tool
Replaces instances of tool with @tool in plugin tutorial.
This commit is contained in:
@@ -48,7 +48,7 @@ when needed:
|
||||
::
|
||||
|
||||
# material_import.gd
|
||||
tool
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ Let's begin to code our plugin, one method at time:
|
||||
::
|
||||
|
||||
# import_plugin.gd
|
||||
tool
|
||||
@tool
|
||||
extends EditorImportPlugin
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ good practice to use an enum so you can refer to them using names.
|
||||
|
||||
::
|
||||
|
||||
tool
|
||||
@tool
|
||||
extends EditorImportPlugin
|
||||
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ you should remove the instance you have added by calling
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
# plugin.gd
|
||||
tool
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
var plugin
|
||||
|
||||
@@ -28,7 +28,7 @@ Add five extra methods such that the script looks like this:
|
||||
|
||||
::
|
||||
|
||||
tool
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ Add a script to the button like this:
|
||||
|
||||
::
|
||||
|
||||
tool
|
||||
@tool
|
||||
extends Button
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ Here is the full plugin script:
|
||||
|
||||
::
|
||||
|
||||
tool
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
|
||||
@@ -69,13 +69,13 @@ The script file
|
||||
|
||||
Upon creation of the plugin, the dialog will automatically open the
|
||||
EditorPlugin script for you. The script has two requirements that you cannot
|
||||
change: it must be a ``tool`` script, or else it will not load properly in the
|
||||
change: it must be a ``@tool`` script, or else it will not load properly in the
|
||||
editor, and it must inherit from :ref:`class_EditorPlugin`.
|
||||
|
||||
.. warning::
|
||||
|
||||
In addition to the EditorPlugin script, any other GDScript that your plugin uses
|
||||
must *also* be a tool. Any GDScript without ``tool`` imported into the editor
|
||||
must *also* be a tool. Any GDScript without ``@tool`` imported into the editor
|
||||
will act like an empty file!
|
||||
|
||||
It's important to deal with initialization and clean-up of resources.
|
||||
@@ -89,7 +89,7 @@ like this:
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
tool
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
@@ -146,7 +146,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`` keyword, 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
|
||||
@@ -156,7 +156,7 @@ clicked. For that, we'll need a script that extends from
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
tool
|
||||
@tool
|
||||
extends Button
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ dialog. For that, change the ``custom_node.gd`` script to the following:
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
tool
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
@@ -316,7 +316,7 @@ The script could look like this:
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
tool
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ This would be a basic setup:
|
||||
::
|
||||
|
||||
# MyCustomEditorPlugin.gd
|
||||
tool
|
||||
@tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user