Prepicked plants editor
This commit is contained in:
parent
9eba7d3069
commit
56f75a5d06
43 changed files with 532 additions and 50 deletions
|
|
@ -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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue