You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +00:00
Completed the support for plugins! It is not possible to add plugins.
Not all APIs are provided yet, please request whathever you are missing. Some example plugins are provided in demos/plugins. Just copy them to a folder in your project named addons/ and then enable them from the project settings. Have fun!
This commit is contained in:
12
demos/plugins/custom_node/heart.gd
Normal file
12
demos/plugins/custom_node/heart.gd
Normal file
@@ -0,0 +1,12 @@
|
||||
tool
|
||||
extends Node2D
|
||||
|
||||
|
||||
var heart = preload("res://addons/custom_node/heart.png")
|
||||
|
||||
func _draw():
|
||||
draw_texture(heart,-heart.get_size()/2)
|
||||
|
||||
func _get_item_rect():
|
||||
#override
|
||||
return Rect2(-heart.get_size()/2,heart.get_size())
|
||||
BIN
demos/plugins/custom_node/heart.png
Normal file
BIN
demos/plugins/custom_node/heart.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
demos/plugins/custom_node/heart_icon.png
Normal file
BIN
demos/plugins/custom_node/heart_icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 809 B |
18
demos/plugins/custom_node/heart_plugin.gd
Normal file
18
demos/plugins/custom_node/heart_plugin.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
func _enter_tree():
|
||||
# When this plugin node enters tree, add the custom type
|
||||
|
||||
add_custom_type("Heart","Node2D",preload("res://addons/custom_node/heart.gd"),preload("res://addons/custom_node/heart_icon.png"))
|
||||
|
||||
func _exit_tree():
|
||||
# When the plugin node exits the tree, remove the custom type
|
||||
|
||||
remove_custom_type("Heart")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
14
demos/plugins/custom_node/plugin.cfg
Normal file
14
demos/plugins/custom_node/plugin.cfg
Normal file
@@ -0,0 +1,14 @@
|
||||
[plugin]
|
||||
|
||||
name="Heart"
|
||||
description="Adds a new Heart node in 2D"
|
||||
author="Juan Linietsky"
|
||||
version="1.0"
|
||||
script="heart_plugin.gd"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user