Install Asset
Install via Godot
To maintain one source of truth, Godot Asset Library is just a mirror of the old asset library so you can download directly on Godot via the integrated asset library browser
![Tool Button thumbnail image](https://img.godotassetlibrary.com/yBEoHwZZY-9p5zYFXzepXFwWk06IkUPUxLHG1cYwyHk/rs:fit:640:360:0/g:no/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3RlZWJhcmp1bmsvZ29kb3QtNC4wLXRvb2xfYnV0dG9uL21haW4vcmVhZG1lL3ByZXZpZXcxLnBuZw.webp)
![Tool Button thumbnail image](https://img.godotassetlibrary.com/pO_ky9efeY3D7qzACNW6sRNf1gWkrvtIhjvqe6vo0u4/rs:fit:640:360:0/g:no/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3RlZWJhcmp1bmsvZ29kb3QtNC4wLXRvb2xfYnV0dG9uL21haW4vcmVhZG1lL3ByZXZpZXcyLnBuZw.webp)
![Tool Button hero image](https://img.godotassetlibrary.com/-HXgMd3NLGs35RAS0QiMOaIVOVAm1lzBehtKhULSFVk/rs:fit:1920:1080:0/g:no/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3RlZWJhcmp1bmsvZ29kb3QtNC4wLXRvb2xfYnV0dG9uL21haW4vcmVhZG1lL3ByZXZpZXcxLnBuZw.webp)
Quick Information
![Tool Button icon image](https://img.godotassetlibrary.com/kCyxBbdqzO5VVqEVr1AQI6kbW3HdIoPWHwRbU6pPWao/rs:fit:50:50:0/g:no/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3RlZWJhcmp1bmsvZ29kb3QtNC4wLXRvb2xfYnV0dG9uL21haW4vcmVhZG1lL2xvZ28ucG5n.webp)
Tool Button
Add inspector buttons with one line: `@tool`.
Supported Engine Version
4.0
Version String
1.4
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL
ToolButtonPlugin for Godot 4.0 - v1.0
Editor buttons with one line of code: @tool
.
Getting Started
- Enable plugin.
- Add
@tool
to top of your script. - Buttons will be at the bottom of the inspector.
Advanced Example
To specify buttons that show above the inspector, add a _get_tool_buttons
func.
With Strings
:
@tool
extends Node
func _get_tool_buttons(): return ["boost_score", "remove_player"]
func boost_score():
Player.score += 100
func remove_player():
Player.queue_free()
And/or Dictionarys
@tool
extends Node
signal reset()
func _get_tool_buttons(): return [
"boost_score",
{call="boost_score", args=[100], tint=Color.DEEP_SKY_BLUE},
{call="emit_signal", args=["reset"], text="Reset", tint=Color.TOMATO}
]
func boost_score(x=10):
Player.score += x
call
is mandatory. Other's are optional.
key | desc | default |
---|---|---|
call | Method to call. | - |
args | Array of arguments to pass. (Mouse over button to see args.) |
- |
text | Button label. | - |
tint | Button color. | Color.WHITE |
icon | Button icon. | - |
flat | Button is flat style. | false |
hint | Hint text for mouse over. | - |
Print output of method call? | true | |
align | Button alignment. | Button.ALIGN_CENTER |
disable | Disable button? | false |
update_filesystem | Tells Godot editor to rescan file system. | false |
Resource Example
For _get_tool_buttons
to work on a Resource
it needs to be static.
@tool
extends Resource
class_name MyResource
# STATIC
static func _get_tool_buttons():
return ["my_button"]
# LOCAL
export(String) var my_name:String = ""
func my_button():
print(my_name)
Add inspector buttons with one line: `@tool`.
Reviews
Quick Information
![Tool Button icon image](https://img.godotassetlibrary.com/kCyxBbdqzO5VVqEVr1AQI6kbW3HdIoPWHwRbU6pPWao/rs:fit:50:50:0/g:no/aHR0cHM6Ly9yYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3RlZWJhcmp1bmsvZ29kb3QtNC4wLXRvb2xfYnV0dG9uL21haW4vcmVhZG1lL2xvZ28ucG5n.webp)
Tool Button
Add inspector buttons with one line: `@tool`.
Supported Engine Version
4.0
Version String
1.4
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL