-
-
Save Invertex/0b65d1ec987a66cf8fc4cee7c1aabc24 to your computer and use it in GitHub Desktop.
Helper Texture class to use Godot Editor icons in plugins, such as main screen plugins.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@tool | |
class_name EditorIconTexture | |
extends AtlasTexture | |
var icon :String: | |
set(val): | |
icon = val | |
_update_icon.call_deferred() | |
func _init(): | |
_update_icon.call_deferred() | |
func _update_icon(): | |
atlas = EditorInterface.get_editor_theme().get_icon(icon, "EditorIcons") | |
region = Rect2i(0, 0, atlas.get_width(), atlas.get_height()) | |
func _get_property_list(): | |
return [{ | |
"name": "icon", | |
"type": TYPE_STRING, | |
"usage": PROPERTY_USAGE_DEFAULT, | |
"hint": PROPERTY_HINT_ENUM_SUGGESTION, | |
"hint_string": ",".join(EditorInterface.get_editor_theme().get_icon_list("EditorIcons")) | |
}] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment