Prepicked plants editor

This commit is contained in:
Rendo 2025-07-29 04:08:05 +05:00
commit 56f75a5d06
43 changed files with 532 additions and 50 deletions

View file

@ -0,0 +1,28 @@
@tool
extends TextureButton
signal save_callback
var held_data : PlantResource = null
@export var preview : TextureRect
func _can_drop_data(at_position: Vector2, data: Variant) -> bool:
if typeof(data) == TYPE_DICTIONARY:
if data.type == "files":
return load(data.files[0]) is PlantResource
return false
func _drop_data(at_position: Vector2, data: Variant) -> void:
held_data = load(data.files[0]) as PlantResource
update()
func update():
if held_data:
preview.texture = held_data.Preview
else:
preview.texture = null
save_callback.emit()
func _pressed() -> void:
held_data = null
update()