gfolf2/addons/terrain_3d/src/channel_packer_dragdrop.gd

16 lines
390 B
GDScript3
Raw Normal View History

2024-11-17 19:47:37 +00:00
@tool
extends Button
signal dropped
func _can_drop_data(p_position, p_data) -> bool:
if typeof(p_data) == TYPE_DICTIONARY:
if p_data.files.size() == 1:
match p_data.files[0].get_extension():
"png", "bmp", "exr", "hdr", "jpg", "jpeg", "tga", "svg", "webp", "ktx", "dds":
return true
return false
func _drop_data(p_position, p_data) -> void:
dropped.emit(p_data.files[0])