Added a new request_item_edit signal to the DataList.

This commit is contained in:
Relintai 2022-08-05 22:04:53 +02:00
parent e68b2733de
commit e675512362

View File

@ -11,10 +11,15 @@ var _ignore_changed_event : bool = false
var _plugin : EditorPlugin = null
var _undo_redo : UndoRedo = null
signal request_item_edit(world_gen_base_reosurce)
func _init():
if !is_connected("item_edited", self, "on_item_edited"):
connect("item_edited", self, "on_item_edited")
if !is_connected("button_pressed", self, "on_tree_button_pressed"):
connect("button_pressed", self, "on_tree_button_pressed")
func set_plugin(plugin : EditorPlugin) -> void:
_plugin = plugin
_undo_redo = _plugin.get_undo_redo()
@ -166,6 +171,14 @@ func on_resource_changed() -> void:
call_deferred("refresh")
func on_tree_button_pressed(item: TreeItem, column: int, id: int) -> void:
var resource : WorldGenBaseResource = item.get_meta("res")
if !resource:
return
emit_signal("request_item_edit", resource)
func on_item_edited() -> void:
var item : TreeItem = get_edited()