@tool extends Button class_name IconButton @export var data: String @export var image: Texture: set(value): image = value if is_inside_tree() and has_node("%Texture"): $%Texture.texture = image @export var images: Array[Texture] @export var apply_texture_on_selection: bool = true @export var enable_tooltip: bool = false @export var tooltip_scene: PackedScene @export var tooltip_image: Texture func _ready(): if image != null and has_node("%Texture"): $%Texture.texture = image func _on_mouse_entered() -> void: TweenFX.stop_all(self) scale = Vector2.ONE rotation = 0.0 modulate.a = 1.0 TweenFX.breathe(self, 1) func _on_mouse_exited() -> void: TweenFX.stop_all(self) scale = Vector2.ONE rotation = 0.0 modulate.a = 1.0 func _on_pressed() -> void: TweenFX.stop_all(self) scale = Vector2.ONE rotation = 0.0 modulate.a = 1.0 TweenFX.press_rotate(self) func _make_custom_tooltip(for_text: String) -> Object: if !enable_tooltip: return null var tooltip = tooltip_scene.instantiate() tooltip.text = for_text if tooltip_image != null: tooltip.image = tooltip_image return tooltip