Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document GDScript @export_tool_button #10338

Merged
merged 5 commits into from
Nov 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions tutorials/scripting/gdscript/gdscript_exports.rst
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,24 @@ for a list of parameters and their allowed values.
When using ``@export_custom``, GDScript does not perform any validation on
the syntax. Invalid syntax may have unexpected behavior in the inspector.

``@export_tool_button``
-----------------------

If you need to create a clickable inspector button, you can use ``@export_tool_button``.
This exports a ``Callable`` property as a clickable button. When the button is pressed, the callable is called.

Export a button with label ``"Hello"`` and icon ``"Callable"``. When you press it, it will print ``"Hello world!"``.

::

@tool
extends Node

@export_tool_button("Hello", "Callable") var hello_action = hello

func hello():
print("Hello world!")

Setting exported variables from a tool script
---------------------------------------------

Expand Down