You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Babushka/addons/dialogic/Editor/Common/copy_clipboard_icon.gd

27 lines
669 B

@tool
extends TextureRect
var timer:Timer
func _ready() -> void:
if owner and owner.get_parent() is SubViewport:
texture = null
return
texture = get_theme_icon("CopyNodePath", "EditorIcons")
modulate = get_theme_color("contrast_color_1", "Editor")
tooltip_text = "Copy to clipboard"
func _on_gui_input(event: InputEvent) -> void:
if event.is_pressed():
DisplayServer.clipboard_set((get_parent().find_child("TimelineName") as Label).text)
$Label.text = "Copied!"
if timer == null:
var timer: Timer = Timer.new()
add_child(timer)
timer.one_shot = true
timer.timeout.connect(_end_timer)
timer.start(2)
func _end_timer():
$Label.text = ""