mirror of
https://github.com/Relintai/godot_data_editor.git
synced 2025-02-23 09:54:19 +01:00
Fixed duplicate
This commit is contained in:
parent
6116da7de3
commit
8aa22fc04d
@ -110,6 +110,9 @@ func _ready():
|
||||
class_overview.hide()
|
||||
else:
|
||||
# Select the first item in the tree when loading the GUI
|
||||
var all_classes = item_manager.classes.keys()
|
||||
all_classes.sort()
|
||||
selected_class = all_classes[0]
|
||||
change_item_context(selected_item, selected_class)
|
||||
|
||||
# TODO: Implement
|
||||
@ -295,10 +298,8 @@ func handle_actions(action, argument = ""):
|
||||
if selected_item._dirty:
|
||||
input_dialog.popup(self, "item_duplication_failed", tr("Item duplication failed"), tr("Before duplicating this item, please first save it."))
|
||||
return
|
||||
if selected_id != selected_item._display_name:
|
||||
new_display_name = selected_item._display_name
|
||||
selected_item._display_name = ""
|
||||
input_dialog.popup(self, "_on_duplicate_confirmed", tr("Duplicate Item"), tr("Please enter a new ID for this item"), "ID", selected_id, tr("Display Name (optional)"), new_display_name)
|
||||
reload()
|
||||
elif action == "save":
|
||||
item_manager.save_item(selected_item)
|
||||
item_tree.load_tree()
|
||||
@ -351,9 +352,9 @@ func _on_rename_class_confirmed(name):
|
||||
|
||||
|
||||
func _on_duplicate_confirmed(id, display_name):
|
||||
var duplicated_item = item_manager.duplicate_item(selected_item, id, display_name)
|
||||
var duplicated_item = item_manager.duplicate_item(selected_item, id, display_name, false)
|
||||
item_tree.add_leaf(duplicated_item, true)
|
||||
|
||||
reload()
|
||||
|
||||
func _on_delete_item_confirmed():
|
||||
item_manager.delete_item(selected_item)
|
||||
|
@ -20,7 +20,8 @@ func popup(caller, callback_method, title, text, placeholder_1 = "", default_tex
|
||||
self.placeholder_1 = placeholder_1
|
||||
self.placeholder_2 = placeholder_2
|
||||
|
||||
caller.connect("input_dialog_confirmed", caller, callback_method, [])
|
||||
if not caller.is_connected("input_dialog_confirmed", caller, callback_method):
|
||||
caller.connect("input_dialog_confirmed", caller, callback_method, [])
|
||||
set_text(text)
|
||||
set_title(title)
|
||||
if placeholder_1 == "":
|
||||
|
@ -43,7 +43,6 @@ func load_tree(is_reload = false):
|
||||
plugin_config = ConfigFile.new()
|
||||
plugin_config.load("res://addons/godot_data_editor/plugin.cfg")
|
||||
|
||||
|
||||
self.item_manager = Globals.get("item_manager")
|
||||
tree_elements = {}
|
||||
tree_roots = {}
|
||||
@ -54,7 +53,6 @@ func load_tree(is_reload = false):
|
||||
last_selected = null
|
||||
var tree_element_to_be_selected = null
|
||||
|
||||
|
||||
# Store the class and name of the last selected item, in case the tree is reloaded
|
||||
last_selected = tree.get_selected()
|
||||
if last_selected:
|
||||
@ -64,8 +62,7 @@ func load_tree(is_reload = false):
|
||||
else:
|
||||
self.last_selected_id = null
|
||||
self.last_selected_class = last_selected.get_meta("class")
|
||||
#print(last_selected_id)
|
||||
#print(last_selected_class)
|
||||
|
||||
|
||||
tree.clear()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user