From 4fac3e50165b2d992681dd76bf30e68d576b4cfc Mon Sep 17 00:00:00 2001 From: Relintai Date: Sun, 3 Feb 2019 23:03:31 +0100 Subject: [PATCH] Started updating the asset to work with 3.1 (alpha 4). It mostly works now, but a bunch of events still need to be fixed, also the new base classes will need to be implemented. --- .../godot_data_editor/custom_properties.gd | 2 +- demo/addons/godot_data_editor/data_editor.gd | 33 +- .../godot_data_editor/data_editor_gui.gd | 22 +- .../godot_data_editor/data_editor_gui.tscn | 687 ++++-------------- demo/addons/godot_data_editor/data_item.gd | 4 +- demo/addons/godot_data_editor/input_dialog.gd | 4 +- demo/addons/godot_data_editor/item_manager.gd | 32 +- demo/addons/godot_data_editor/item_tree.gd | 2 +- .../addons/godot_data_editor/property_item.gd | 8 +- .../godot_data_editor/property_item.tscn | 31 +- demo/classes/element.gd | 2 +- demo/classes/merchant.gd | 2 +- demo/classes/shop_item.gd | 2 +- demo/classes/spell.gd | 4 +- demo/data/element/12.json | 1 + demo/data/merchant/43.json | 1 + demo/data/shop_item/12.json | 1 + demo/data/spell/343.json | 1 + demo/project.godot | 10 + 19 files changed, 220 insertions(+), 629 deletions(-) create mode 100644 demo/data/element/12.json create mode 100644 demo/data/merchant/43.json create mode 100644 demo/data/shop_item/12.json create mode 100644 demo/data/spell/343.json diff --git a/demo/addons/godot_data_editor/custom_properties.gd b/demo/addons/godot_data_editor/custom_properties.gd index d5032c5..5aea1eb 100644 --- a/demo/addons/godot_data_editor/custom_properties.gd +++ b/demo/addons/godot_data_editor/custom_properties.gd @@ -20,7 +20,7 @@ signal custom_property_delete_requested(custom_property_id) func _ready(): pass - self.item_manager = Globals.get("item_manager") + self.item_manager = ProjectSettings.get("item_manager") func build_properties(item): self.item = item diff --git a/demo/addons/godot_data_editor/data_editor.gd b/demo/addons/godot_data_editor/data_editor.gd index d29e3cb..c01dc87 100644 --- a/demo/addons/godot_data_editor/data_editor.gd +++ b/demo/addons/godot_data_editor/data_editor.gd @@ -11,21 +11,37 @@ signal data_item_class_opened(item_class) func _enter_tree(): OS.set_low_processor_usage_mode(true) + name = "Data Editor" # Currently, adding the singleton automatically, does not work #check_for_data_singleton() check_plugin_settings() gui = data_editor_class.instance() - get_editor_viewport().add_child(gui) - gui.set_area_as_parent_rect() + + gui.rect_min_size = Vector2(0, 500) + add_control_to_bottom_panel(gui, "Data Editor") + + #get_editor_interface().get_editor_viewport().add_child(gui) + #gui.set_anchors_preset(Control.PRESET_WIDE) + + #get_editor_interface(). + #get_editor_interface(). + #get_editor_interface().get_editor_viewport().add_ + #gui.set_area_as_parent_rect() + gui.hide() # Remove control and data singleton func _exit_tree(): OS.set_low_processor_usage_mode(false) - get_editor_viewport().remove_child(gui) + + remove_control_from_bottom_panel(gui) + + #get_editor_interface().get_editor_viewport().remove_child(gui) + if gui: gui.free() + var config = ConfigFile.new() #var status = config.load("res://engine.cfg") #if status == OK: @@ -34,15 +50,18 @@ func _exit_tree(): # config.save("res://engine.cfg") # Check if the Classes and Data folders exist - Globals.clear("item_manager") + ProjectSettings.clear("item_manager") + ProjectSettings.save() + + func _ready(): gui.connect("class_edit_requested", self, "edit_class", []) - Globals.set("debug_is_editor", true) + ProjectSettings.set("debug_is_editor", true) # Opens the selected class in the Script Editor func edit_class(item_class): - edit_resource(item_class) + get_editor_interface().edit_resource(item_class) # TODO: Maybe there is a way to refresh the tree without restart? @@ -88,8 +107,10 @@ func has_main_screen(): # Virtual: func make_visible(visible): if gui and visible: + gui.reload() gui.show() + elif gui: gui.hide() diff --git a/demo/addons/godot_data_editor/data_editor_gui.gd b/demo/addons/godot_data_editor/data_editor_gui.gd index d52e627..92c61a1 100644 --- a/demo/addons/godot_data_editor/data_editor_gui.gd +++ b/demo/addons/godot_data_editor/data_editor_gui.gd @@ -59,7 +59,7 @@ func _init(): item_manager = preload("item_manager.gd").new() # This item_manager will add itself to the globals func _ready(): - Globals.set("debug_is_editor", false) + ProjectSettings.set("debug_is_editor", false) # Tree signals @@ -222,7 +222,7 @@ func _on_ItemTree_on_new_item_created(new_item): func create_shortcut(keys): var short_cut = ShortCut.new() - var input_event = InputEvent() + var input_event = InputEvent.new() input_event.type = InputEvent.KEY input_event.ID = keys short_cut.set_shortcut(input_event) @@ -230,7 +230,7 @@ func create_shortcut(keys): # TODO: Implement func warn_about_reload(): if item_manager.has_unsaved_items(): - input_dialog.popup(self, "reload_confirmed", tr("Confirm reload"), tr("Some changes have not been saved. \nThey will be discarded if you proceed. Are you sure you want to perform this action?")) + input_dialog.input_dialog_popup(self, "reload_confirmed", tr("Confirm reload"), tr("Some changes have not been saved. \nThey will be discarded if you proceed. Are you sure you want to perform this action?")) func reload(): @@ -293,19 +293,19 @@ func _on_NewClassIconFileDialog_file_selected(path): # General handler for a lot of actions to centralize the GUI logic a bit func handle_actions(action, argument = ""): if action == "add": - input_dialog.popup(self, "_on_add_item_confirmed", tr("New Item"), tr("Please enter an ID for and optionally a display name the new item"), tr("ID"), "", tr("Display Name (optional)"), "") + input_dialog.input_dialog_popup(self, "_on_add_item_confirmed", tr("New Item"), tr("Please enter an ID for and optionally a display name the new item"), tr("ID"), "", tr("Display Name (optional)"), "") elif action == "rename": if selected_item: - input_dialog.popup(self, "_on_rename_item_confirmed", tr("Rename Item"), tr("Please enter a new ID for this item."), "ID", selected_id) + input_dialog.input_dialog_popup(self, "_on_rename_item_confirmed", tr("Rename Item"), tr("Please enter a new ID for this item."), "ID", selected_id) else: - input_dialog.popup(self, "_on_rename_class_confirmed", tr("Rename Class"), tr("Please enter a new name for this class. All pending changes will be discarded!"), "ID", selected_class) + input_dialog.input_dialog_popup(self, "_on_rename_class_confirmed", tr("Rename Class"), tr("Please enter a new name for this class. All pending changes will be discarded!"), "ID", selected_class) elif action == "duplicate": var new_display_name = "" if selected_item._dirty: - input_dialog.popup(self, "item_duplication_failed", tr("Item duplication failed"), tr("Before duplicating this item, please first save it.")) + input_dialog.input_dialog_popup(self, "item_duplication_failed", tr("Item duplication failed"), tr("Before duplicating this item, please first save it.")) return 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) + input_dialog.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) elif action == "save": item_manager.save_item(selected_item) item_tree.load_tree() @@ -321,9 +321,9 @@ func handle_actions(action, argument = ""): _on_AddClassButton_button_down() # TODO: Incorporate into dialog handling elif action == "delete": if selected_item: - input_dialog.popup(self, "_on_delete_item_confirmed", tr("Delete Item"), tr("Are you sure you want to delete this item?")) + input_dialog.input_dialog_popup(self, "_on_delete_item_confirmed", tr("Delete Item"), tr("Are you sure you want to delete this item?")) else: - input_dialog.popup(self, "_on_delete_class_confirmed", tr("Delete Class"), tr("Are you sure you want to delete class along with all items?")) + input_dialog.input_dialog_popup(self, "_on_delete_class_confirmed", tr("Delete Class"), tr("Are you sure you want to delete class along with all items?")) elif action == "options": options_screen.popup_centered() elif action == "edit_class": @@ -333,7 +333,7 @@ func handle_actions(action, argument = ""): elif action == "copy_get_item": copy_get_item() elif action == "change_display_name": - input_dialog.popup(self, "change_display_name", tr("Change Display Name"), tr("Please enter a display name for this item."), "Display Name", selected_item._display_name) + input_dialog.input_dialog_popup(self, "change_display_name", tr("Change Display Name"), tr("Please enter a display name for this item."), "Display Name", selected_item._display_name) elif action == "add_custom_property": new_custom_property_name.set_text("") new_custom_property_dialog.popup_centered() diff --git a/demo/addons/godot_data_editor/data_editor_gui.tscn b/demo/addons/godot_data_editor/data_editor_gui.tscn index 4cc708b..819ad27 100644 --- a/demo/addons/godot_data_editor/data_editor_gui.tscn +++ b/demo/addons/godot_data_editor/data_editor_gui.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=54 format=2] +[gd_scene load_steps=22 format=2] [ext_resource path="res://addons/godot_data_editor/data_editor_gui.gd" type="Script" id=1] [ext_resource path="res://addons/godot_data_editor/icons/icon_add.png" type="Texture" id=2] @@ -23,646 +23,331 @@ [ext_resource path="res://addons/godot_data_editor/input_dialog.tscn" type="PackedScene" id=21] [node name="godot_data_editor" type="Control"] - anchor_right = 1.0 anchor_bottom = 1.0 rect_min_size = Vector2( 800, 0 ) -focus/ignore_mouse = false -focus/stop_mouse = true size_flags_horizontal = 3 size_flags_vertical = 3 -margin_left = 0.0 -margin_top = 0.0 -margin_right = 0.0 -margin_bottom = 0.0 script = ExtResource( 1 ) -mouse_filter = 0 [node name="VBox" type="VBoxContainer" parent="."] - anchor_right = 1.0 anchor_bottom = 1.0 -focus/ignore_mouse = false -focus/stop_mouse = true +mouse_filter = 0 size_flags_horizontal = 3 size_flags_vertical = 3 -margin_left = 0.0 -margin_top = 0.0 -margin_right = 0.0 -margin_bottom = 0.0 -alignment = 0 -mouse_filter = 0 [node name="Head" type="HBoxContainer" parent="VBox"] - -rect_min_size = Vector2( 0, 22 ) -focus/ignore_mouse = false -focus/stop_mouse = false -size_flags_horizontal = 1 -size_flags_vertical = 0 -margin_left = 0.0 -margin_top = 0.0 +editor/display_folded = true margin_right = 1024.0 margin_bottom = 28.0 -alignment = 0 +rect_min_size = Vector2( 0, 22 ) mouse_filter = 0 +size_flags_vertical = 0 [node name="Add" type="ToolButton" parent="VBox/Head"] - -rect_min_size = Vector2( 28, 28 ) -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 0.0 -margin_top = 0.0 margin_right = 56.0 margin_bottom = 28.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null +rect_min_size = Vector2( 28, 28 ) text = "Add" icon = ExtResource( 2 ) -flat = true align = 0 -mouse_filter = 0 [node name="VSeparator5" type="VSeparator" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 margin_left = 60.0 -margin_top = 0.0 -margin_right = 63.0 +margin_right = 64.0 margin_bottom = 28.0 -mouse_filter = 0 [node name="Save" type="ToolButton" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 67.0 -margin_top = 0.0 -margin_right = 127.0 +margin_left = 68.0 +margin_right = 128.0 margin_bottom = 28.0 disabled = true -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "Save" icon = ExtResource( 3 ) flat = false -mouse_filter = 0 [node name="SaveAll" type="ToolButton" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 131.0 -margin_top = 0.0 -margin_right = 212.0 +margin_left = 132.0 +margin_right = 213.0 margin_bottom = 28.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "Save All" icon = ExtResource( 3 ) flat = false -mouse_filter = 0 [node name="VSeparator" type="VSeparator" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 216.0 -margin_top = 0.0 -margin_right = 219.0 +margin_left = 217.0 +margin_right = 221.0 margin_bottom = 28.0 -mouse_filter = 0 [node name="Rename" type="ToolButton" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 223.0 -margin_top = 0.0 -margin_right = 306.0 +margin_left = 225.0 +margin_right = 308.0 margin_bottom = 28.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "Rename" icon = ExtResource( 4 ) flat = false -mouse_filter = 0 [node name="Duplicate" type="ToolButton" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 310.0 -margin_top = 0.0 -margin_right = 402.0 +margin_left = 312.0 +margin_right = 404.0 margin_bottom = 28.0 disabled = true -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "Duplicate" icon = ExtResource( 5 ) flat = false -mouse_filter = 0 [node name="Delete" type="ToolButton" parent="VBox/Head"] - -rect_min_size = Vector2( 28, 28 ) -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 406.0 -margin_top = 0.0 -margin_right = 480.0 +margin_left = 408.0 +margin_right = 482.0 margin_bottom = 28.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null +rect_min_size = Vector2( 28, 28 ) text = "Delete" icon = ExtResource( 6 ) -flat = true -mouse_filter = 0 [node name="VSeparator3" type="VSeparator" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 484.0 -margin_top = 0.0 -margin_right = 487.0 +margin_left = 486.0 +margin_right = 490.0 margin_bottom = 28.0 -mouse_filter = 0 [node name="Refresh2" type="ToolButton" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 491.0 -margin_top = 0.0 -margin_right = 563.0 +margin_left = 494.0 +margin_right = 566.0 margin_bottom = 28.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "Reload" icon = ExtResource( 7 ) flat = false -mouse_filter = 0 [node name="VSeparator2" type="VSeparator" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 567.0 -margin_top = 0.0 -margin_right = 570.0 +margin_left = 570.0 +margin_right = 574.0 margin_bottom = 28.0 -mouse_filter = 0 [node name="NewClass" type="ToolButton" parent="VBox/Head"] - -rect_min_size = Vector2( 28, 28 ) -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 574.0 -margin_top = 0.0 -margin_right = 670.0 +margin_left = 578.0 +margin_right = 674.0 margin_bottom = 28.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null +rect_min_size = Vector2( 28, 28 ) text = "New Class" icon = ExtResource( 8 ) -flat = true align = 0 -mouse_filter = 0 [node name="VSeparator4" type="VSeparator" parent="VBox/Head"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 674.0 -margin_top = 0.0 -margin_right = 677.0 +margin_left = 678.0 +margin_right = 682.0 margin_bottom = 28.0 -mouse_filter = 0 [node name="Options" type="ToolButton" parent="VBox/Head"] - -rect_min_size = Vector2( 28, 28 ) -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 681.0 -margin_top = 0.0 -margin_right = 763.0 +margin_left = 686.0 +margin_right = 768.0 margin_bottom = 28.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null +rect_min_size = Vector2( 28, 28 ) text = "Options" icon = ExtResource( 9 ) -flat = true align = 0 -mouse_filter = 0 [node name="HSeparator" type="HSeparator" parent="VBox"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 0.0 margin_top = 32.0 margin_right = 1024.0 -margin_bottom = 35.0 -mouse_filter = 0 +margin_bottom = 36.0 [node name="Body" type="HSplitContainer" parent="VBox"] - -focus/ignore_mouse = false -focus/stop_mouse = false -size_flags_horizontal = 3 -size_flags_vertical = 3 -margin_left = 0.0 -margin_top = 39.0 +margin_top = 40.0 margin_right = 1024.0 margin_bottom = 600.0 -split_offset = 0 -collapsed = false -dragger_visibility = 0 -mouse_filter = 0 +size_flags_horizontal = 3 +size_flags_vertical = 3 [node name="ItemTree" parent="VBox/Body" instance=ExtResource( 10 )] - anchor_right = 0.0 anchor_bottom = 0.0 +margin_right = 165.0 +margin_bottom = 560.0 rect_min_size = Vector2( 165, 0 ) size_flags_horizontal = 1 size_flags_stretch_ratio = 0.0 -margin_right = 165.0 -margin_bottom = 561.0 [node name="Content" type="Panel" parent="VBox/Body"] - +editor/display_folded = true self_modulate = Color( 1, 1, 1, 0 ) -focus/ignore_mouse = false -focus/stop_mouse = true +margin_left = 177.0 +margin_right = 1024.0 +margin_bottom = 560.0 size_flags_horizontal = 3 size_flags_vertical = 3 -margin_left = 177.0 -margin_top = 0.0 -margin_right = 1024.0 -margin_bottom = 561.0 -mouse_filter = 0 [node name="VBox" type="VBoxContainer" parent="VBox/Body/Content"] - anchor_right = 1.0 anchor_bottom = 1.0 -focus/ignore_mouse = false -focus/stop_mouse = false +mouse_filter = 0 size_flags_horizontal = 3 size_flags_vertical = 3 size_flags_stretch_ratio = 0.0 -margin_left = 0.0 -margin_top = 0.0 -margin_right = 0.0 -margin_bottom = 0.0 -alignment = 0 -mouse_filter = 0 [node name="Container" type="MarginContainer" parent="VBox/Body/Content/VBox"] - -rect_min_size = Vector2( 0, 25 ) -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 0.0 -margin_top = 0.0 margin_right = 847.0 -margin_bottom = 25.0 -mouse_filter = 0 +margin_bottom = 27.0 +rect_min_size = Vector2( 0, 25 ) [node name="HBox" type="HBoxContainer" parent="VBox/Body/Content/VBox/Container"] - -focus/ignore_mouse = false -focus/stop_mouse = false -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 8.0 -margin_top = 0.0 margin_right = 847.0 -margin_bottom = 25.0 +margin_bottom = 27.0 +mouse_filter = 0 custom_constants/separation = 15 alignment = 2 -mouse_filter = 0 [node name="DisplayName" type="ToolButton" parent="VBox/Body/Content/VBox/Container/HBox"] - -focus/ignore_mouse = false -focus/stop_mouse = true +margin_left = 305.0 +margin_right = 475.0 +margin_bottom = 27.0 size_flags_horizontal = 0 -size_flags_vertical = 1 -margin_left = 297.0 -margin_top = 0.0 -margin_right = 467.0 -margin_bottom = 25.0 disabled = true -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "Change Display Name" icon = ExtResource( 11 ) -flat = true align = 0 -mouse_filter = 0 [node name="CopyGetItem" type="ToolButton" parent="VBox/Body/Content/VBox/Container/HBox"] - -focus/ignore_mouse = false -focus/stop_mouse = true +margin_left = 490.0 +margin_right = 644.0 +margin_bottom = 27.0 size_flags_horizontal = 0 -size_flags_vertical = 1 -margin_left = 482.0 -margin_top = 0.0 -margin_right = 636.0 -margin_bottom = 25.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null +disabled = true text = "Copy \"get_item(...)\"" icon = ExtResource( 12 ) -flat = true align = 0 -mouse_filter = 0 [node name="CopyId" type="ToolButton" parent="VBox/Body/Content/VBox/Container/HBox"] - -focus/ignore_mouse = false -focus/stop_mouse = true +margin_left = 659.0 +margin_right = 740.0 +margin_bottom = 27.0 size_flags_horizontal = 0 -size_flags_vertical = 1 -margin_left = 651.0 -margin_top = 0.0 -margin_right = 732.0 -margin_bottom = 25.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "Copy ID" icon = ExtResource( 12 ) -flat = true align = 0 -mouse_filter = 0 [node name="EditClass" type="ToolButton" parent="VBox/Body/Content/VBox/Container/HBox"] - -focus/ignore_mouse = false -focus/stop_mouse = true +margin_left = 755.0 +margin_right = 847.0 +margin_bottom = 27.0 size_flags_horizontal = 0 -size_flags_vertical = 1 -margin_left = 747.0 -margin_top = 0.0 -margin_right = 839.0 -margin_bottom = 25.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "Edit Class" icon = ExtResource( 13 ) -flat = true align = 0 -mouse_filter = 0 [node name="ItemIdLabel" type="Label" parent="VBox/Body/Content/VBox/Container"] - -focus/ignore_mouse = true -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 0 -margin_left = 8.0 -margin_top = 0.0 margin_right = 847.0 -margin_bottom = 25.0 +margin_bottom = 27.0 +mouse_filter = 1 +size_flags_vertical = 0 custom_fonts/font = ExtResource( 14 ) custom_colors/font_color_shadow = Color( 0.300781, 0.300781, 0.300781, 1 ) custom_constants/shadow_offset_x = 1 custom_constants/shadow_offset_y = 1 text = "Element" -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 -mouse_filter = 1 [node name="GridContainer" type="GridContainer" parent="VBox/Body/Content/VBox/Container"] - visible = false -focus/ignore_mouse = false -focus/stop_mouse = false +margin_bottom = 27.0 +mouse_filter = 0 size_flags_horizontal = 0 -size_flags_vertical = 1 -margin_left = 427.0 -margin_top = 0.0 -margin_right = 427.0 -margin_bottom = 25.0 custom_constants/hseparation = 10 columns = 2 -mouse_filter = 0 [node name="Created" type="Label" parent="VBox/Body/Content/VBox/Container/GridContainer"] - modulate = Color( 1, 1, 1, 0.25 ) -focus/ignore_mouse = true -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 0 -margin_left = 0.0 -margin_top = 0.0 margin_right = 91.0 margin_bottom = 14.0 -text = "Created:" -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 mouse_filter = 1 +size_flags_vertical = 0 +text = "Created:" [node name="CreatedDate" type="Label" parent="VBox/Body/Content/VBox/Container/GridContainer"] - modulate = Color( 1, 1, 1, 0.25 ) -focus/ignore_mouse = true -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 0 margin_left = 101.0 -margin_top = 0.0 margin_right = 217.0 margin_bottom = 14.0 -text = "01.01.01 01:01:01" -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 mouse_filter = 1 +size_flags_vertical = 0 +text = "01.01.01 01:01:01" [node name="LastModifiedLabel" type="Label" parent="VBox/Body/Content/VBox/Container/GridContainer"] - modulate = Color( 1, 1, 1, 0.25 ) -focus/ignore_mouse = true -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 0 -margin_left = 0.0 margin_top = 18.0 margin_right = 91.0 margin_bottom = 32.0 -text = "Last modified:" -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 mouse_filter = 1 +size_flags_vertical = 0 +text = "Last modified:" [node name="LastModifiedDate" type="Label" parent="VBox/Body/Content/VBox/Container/GridContainer"] - modulate = Color( 1, 1, 1, 0.25 ) -focus/ignore_mouse = true -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 0 margin_left = 101.0 margin_top = 18.0 margin_right = 217.0 margin_bottom = 32.0 -text = "01.01.01 01:01:01" -percent_visible = 1.0 -lines_skipped = 0 -max_lines_visible = -1 mouse_filter = 1 +size_flags_vertical = 0 +text = "01.01.01 01:01:01" [node name="VBoxContainer" type="VBoxContainer" parent="VBox/Body/Content/VBox/Container"] - visible = false -focus/ignore_mouse = false -focus/stop_mouse = false -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 8.0 -margin_top = 0.0 margin_right = 847.0 -margin_bottom = 25.0 -alignment = 0 +margin_bottom = 27.0 mouse_filter = 0 [node name="HSeparator" type="HSeparator" parent="VBox/Body/Content/VBox"] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 3 -size_flags_vertical = 1 -margin_left = 0.0 -margin_top = 29.0 +margin_top = 31.0 margin_right = 847.0 -margin_bottom = 32.0 -mouse_filter = 0 +margin_bottom = 35.0 +size_flags_horizontal = 3 [node name="Spacer" type="Control" parent="VBox/Body/Content/VBox"] - -rect_min_size = Vector2( 0, 10 ) -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 3 -size_flags_vertical = 1 -margin_left = 0.0 -margin_top = 36.0 +margin_top = 39.0 margin_right = 847.0 -margin_bottom = 46.0 -mouse_filter = 0 +margin_bottom = 49.0 +rect_min_size = Vector2( 0, 10 ) +size_flags_horizontal = 3 [node name="InstanceDetails" type="PanelContainer" parent="VBox/Body/Content/VBox"] - visible = false -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 3 -size_flags_vertical = 3 -margin_left = 0.0 margin_top = 50.0 margin_right = 847.0 margin_bottom = 303.0 -mouse_filter = 0 - -[node name="HBox" type="HBoxContainer" parent="VBox/Body/Content/VBox/InstanceDetails"] - -focus/ignore_mouse = false -focus/stop_mouse = false size_flags_horizontal = 3 size_flags_vertical = 3 + +[node name="HBox" type="HBoxContainer" parent="VBox/Body/Content/VBox/InstanceDetails"] margin_left = 7.0 margin_top = 7.0 margin_right = 840.0 margin_bottom = 246.0 -alignment = 0 mouse_filter = 0 +size_flags_horizontal = 3 +size_flags_vertical = 3 [node name="ClassProperties" parent="VBox/Body/Content/VBox/InstanceDetails/HBox" instance=ExtResource( 15 )] - anchor_right = 0.0 anchor_bottom = 0.0 margin_right = 414.0 margin_bottom = 239.0 [node name="CustomProperties" parent="VBox/Body/Content/VBox/InstanceDetails/HBox" instance=ExtResource( 16 )] - anchor_right = 0.0 anchor_bottom = 0.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 margin_left = 418.0 margin_right = 833.0 margin_bottom = 239.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 [node name="ClassOverview" parent="VBox/Body/Content/VBox" instance=ExtResource( 17 )] - anchor_right = 0.0 anchor_bottom = 0.0 -margin_top = 50.0 +margin_top = 53.0 margin_right = 847.0 -margin_bottom = 561.0 +margin_bottom = 560.0 [node name="NoClasses" parent="VBox/Body/Content/VBox" instance=ExtResource( 18 )] - visible = false anchor_right = 0.0 anchor_bottom = 0.0 @@ -672,29 +357,14 @@ margin_right = 1103.0 margin_bottom = 561.0 [node name="WarnDialog" type="AcceptDialog" parent="."] - -visible = false -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 0.0 -margin_top = 0.0 margin_right = 350.0 margin_bottom = 110.0 popup_exclusive = true window_title = "" -dialog_hide_on_ok = true script = ExtResource( 19 ) -mouse_filter = 0 [node name="NewClassDialog" type="ConfirmationDialog" parent="."] - -visible = false -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 +editor/display_folded = true margin_left = 396.0 margin_top = 193.0 margin_right = 915.0 @@ -702,190 +372,103 @@ margin_bottom = 316.0 popup_exclusive = true window_title = "New Class" dialog_text = "Enter the name and the path to an optional icon" -dialog_hide_on_ok = true -mouse_filter = 0 [node name="ClassName" type="LineEdit" parent="NewClassDialog"] - anchor_top = 0.5 anchor_right = 1.0 anchor_bottom = 0.5 -focus_neighbour_bottom = NodePath("../ClassIconPath") -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 margin_left = 8.0 -margin_top = -34.5 +margin_top = -65.0 margin_right = -8.0 -margin_bottom = -10.5 +margin_bottom = 51.0 +focus_neighbour_bottom = NodePath("../ClassIconPath") placeholder_text = "Name" -placeholder_alpha = 0.6 -focus_mode = 2 -caret_blink = false -caret_blink_speed = 0.65 -mouse_filter = 0 [node name="ClassIconPath" type="LineEdit" parent="NewClassDialog"] - anchor_top = 0.5 anchor_right = 1.0 anchor_bottom = 0.5 +margin_left = 8.0 +margin_top = -65.0 +margin_right = -8.0 +margin_bottom = 51.0 focus_neighbour_top = NodePath("../ClassName") focus_neighbour_right = NodePath("../NewClassIconSearchButton") -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 8.0 -margin_top = -1.5 -margin_right = -86.0 -margin_bottom = 22.5 placeholder_text = "Icon Path (optional)" -placeholder_alpha = 0.6 -focus_mode = 2 -caret_blink = false -caret_blink_speed = 0.65 -mouse_filter = 0 [node name="ClassIconFileDialog" type="FileDialog" parent="NewClassDialog"] - -visible = false -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 0.0 -margin_top = 0.0 -margin_right = 393.0 -margin_bottom = 404.0 +margin_left = 8.0 +margin_top = 22.0 +margin_right = 511.0 +margin_bottom = 152.0 popup_exclusive = true window_title = "Open a File" dialog_hide_on_ok = true mode = 0 access = 2 filters = PoolStringArray( "*.png" ) -show_hidden_files = false -mouse_filter = 0 +current_dir = "C:/Users/Relintai/Projects/godot_data_editor/demo" +current_path = "C:/Users/Relintai/Projects/godot_data_editor/demo/" [node name="NewClassIconSearchButton" type="Button" parent="NewClassDialog"] - anchor_left = 1.0 anchor_top = 0.5 anchor_right = 1.0 anchor_bottom = 0.5 -focus_neighbour_left = NodePath("../ClassIconPath") -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = -80.0 -margin_top = -0.5 +margin_left = -511.0 +margin_top = -65.0 margin_right = -8.0 -margin_bottom = 21.5 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null +margin_bottom = 51.0 +focus_neighbour_left = NodePath("../ClassIconPath") text = "Search" -flat = false -mouse_filter = 0 [node name="OptionsDialog" parent="." instance=ExtResource( 20 )] - -visible = false margin_right = 550.0 margin_bottom = 310.0 [node name="InputDialog" parent="." instance=ExtResource( 21 )] -visible = false - [node name="NewCustomPropertyDialog" type="ConfirmationDialog" parent="."] - -visible = false -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 margin_left = 117.0 margin_top = 117.0 margin_right = 489.0 margin_bottom = 243.0 -popup_exclusive = false window_title = "New custom property" dialog_text = "Enter the name and type of the property" -dialog_hide_on_ok = true -mouse_filter = 0 [node name="LineEdit" type="LineEdit" parent="NewCustomPropertyDialog"] - +margin_left = 8.0 +margin_top = 22.0 +margin_right = 364.0 +margin_bottom = 90.0 focus_neighbour_bottom = NodePath("../TypeOptions") -focus/ignore_mouse = false -focus/stop_mouse = true size_flags_horizontal = 3 -size_flags_vertical = 1 -margin_left = 7.0 -margin_top = 29.0 -margin_right = 363.0 -margin_bottom = 53.0 placeholder_text = "Name" -placeholder_alpha = 0.6 -focus_mode = 2 -caret_blink = false -caret_blink_speed = 0.65 -mouse_filter = 0 [node name="TypeOptions" type="OptionButton" parent="NewCustomPropertyDialog"] - +margin_left = 8.0 +margin_top = 22.0 +margin_right = 364.0 +margin_bottom = 90.0 focus_neighbour_top = NodePath("../LineEdit") -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 7.0 -margin_top = 64.0 -margin_right = 363.0 -margin_bottom = 84.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null text = "BOOL" -flat = false -align = 0 +items = [ "BOOL", null, false, -1, 1, "COLOR", null, false, -1, 14, "INT", null, false, -1, 2, "NODE_PATH", null, false, -1, 15, "OBJECT", null, false, -1, 17, "PLANE", null, false, -1, 9, "QUAT", null, false, -1, 10, "REAL", null, false, -1, 3, "RECT2", null, false, -1, 6, "STRING", null, false, -1, 4, "TRANSFORM", null, false, -1, 13, "VECTOR2", null, false, -1, 5, "VECTOR3", null, false, -1, 7 ] selected = 0 -items = [ "BOOL", null, false, -1, 1, "COLOR", null, false, -1, 14, "IMAGE", null, false, -1, 15, "INT", null, false, -1, 2, "NODE_PATH", null, false, -1, 16, "OBJECT", null, false, -1, 18, "PLANE", null, false, -1, 9, "QUAT", null, false, -1, 10, "REAL", null, false, -1, 3, "RECT2", null, false, -1, 6, "STRING", null, false, -1, 4, "TRANSFORM", null, false, -1, 13, "VECTOR2", null, false, -1, 5, "VECTOR3", null, false, -1, 7 ] -mouse_filter = 0 -[connection signal="button_down" from="VBox/Head/Add" to="." method="handle_actions" binds=[ "add" ]] - -[connection signal="button_down" from="VBox/Head/Save" to="." method="handle_actions" binds=[ "save" ]] - -[connection signal="button_down" from="VBox/Head/SaveAll" to="." method="handle_actions" binds=[ "save_all" ]] - -[connection signal="button_down" from="VBox/Head/Rename" to="." method="handle_actions" binds=[ "rename" ]] - -[connection signal="button_down" from="VBox/Head/Duplicate" to="." method="handle_actions" binds=[ "duplicate" ]] - -[connection signal="button_down" from="VBox/Head/Delete" to="." method="handle_actions" binds=[ "delete" ]] - -[connection signal="button_down" from="VBox/Head/Refresh2" to="." method="handle_actions" binds=[ "reload" ]] - -[connection signal="button_down" from="VBox/Head/NewClass" to="." method="handle_actions" binds=[ "new_class" ]] - -[connection signal="button_down" from="VBox/Head/Options" to="." method="handle_actions" binds=[ "options" ]] - -[connection signal="button_down" from="VBox/Body/Content/VBox/Container/HBox/DisplayName" to="." method="handle_actions" binds=[ "change_display_name" ]] - -[connection signal="button_down" from="VBox/Body/Content/VBox/Container/HBox/CopyGetItem" to="." method="handle_actions" binds=[ "copy_get_item" ]] - -[connection signal="button_down" from="VBox/Body/Content/VBox/Container/HBox/CopyId" to="." method="handle_actions" binds=[ "copy_id" ]] - -[connection signal="button_down" from="VBox/Body/Content/VBox/Container/HBox/EditClass" to="." method="handle_actions" binds=[ "edit_class" ]] - -[connection signal="confirmed" from="NewClassDialog" to="." method="_on_NewClassDialog_confirmed" binds=[ ]] - -[connection signal="file_selected" from="NewClassDialog/ClassIconFileDialog" to="." method="_on_NewClassIconFileDialog_file_selected" binds=[ ]] - -[connection signal="button_down" from="NewClassDialog/NewClassIconSearchButton" to="." method="_on_NewClassIconSearchButton_button_down" binds=[ ]] - -[connection signal="confirmed" from="NewCustomPropertyDialog" to="." method="_on_NewCustomPropertyDialog_confirmed" binds=[ ]] +[connection signal="button_down" from="VBox/Head/Add" to="." method="handle_actions" binds= [ "add" ]] +[connection signal="button_down" from="VBox/Head/Save" to="." method="handle_actions" binds= [ "save" ]] +[connection signal="button_down" from="VBox/Head/SaveAll" to="." method="handle_actions" binds= [ "save_all" ]] +[connection signal="button_down" from="VBox/Head/Rename" to="." method="handle_actions" binds= [ "rename" ]] +[connection signal="button_down" from="VBox/Head/Duplicate" to="." method="handle_actions" binds= [ "duplicate" ]] +[connection signal="button_down" from="VBox/Head/Delete" to="." method="handle_actions" binds= [ "delete" ]] +[connection signal="button_down" from="VBox/Head/Refresh2" to="." method="handle_actions" binds= [ "reload" ]] +[connection signal="button_down" from="VBox/Head/NewClass" to="." method="handle_actions" binds= [ "new_class" ]] +[connection signal="button_down" from="VBox/Head/Options" to="." method="handle_actions" binds= [ "options" ]] +[connection signal="button_down" from="VBox/Body/Content/VBox/Container/HBox/DisplayName" to="." method="handle_actions" binds= [ "change_display_name" ]] +[connection signal="button_down" from="VBox/Body/Content/VBox/Container/HBox/CopyGetItem" to="." method="handle_actions" binds= [ "copy_get_item" ]] +[connection signal="button_down" from="VBox/Body/Content/VBox/Container/HBox/CopyId" to="." method="handle_actions" binds= [ "copy_id" ]] +[connection signal="button_down" from="VBox/Body/Content/VBox/Container/HBox/EditClass" to="." method="handle_actions" binds= [ "edit_class" ]] +[connection signal="confirmed" from="NewClassDialog" to="." method="_on_NewClassDialog_confirmed"] +[connection signal="file_selected" from="NewClassDialog/ClassIconFileDialog" to="." method="_on_NewClassIconFileDialog_file_selected"] +[connection signal="button_down" from="NewClassDialog/NewClassIconSearchButton" to="." method="_on_NewClassIconSearchButton_button_down"] +[connection signal="confirmed" from="NewCustomPropertyDialog" to="." method="_on_NewCustomPropertyDialog_confirmed"] diff --git a/demo/addons/godot_data_editor/data_item.gd b/demo/addons/godot_data_editor/data_item.gd index dd960a9..038951b 100644 --- a/demo/addons/godot_data_editor/data_item.gd +++ b/demo/addons/godot_data_editor/data_item.gd @@ -26,7 +26,7 @@ func get_class(): if _class: return _class else: - _class = self.get_script().get_path().get_file().basename() + _class = self.get_script().get_path().get_file().get_basename() return _class @@ -46,7 +46,7 @@ func set_display_name(name): func update_property(property, value): - var data_singleton = Globals.get_singleton("data") + var data_singleton = ProjectSettings.get_singleton("data") if data_singleton: data_singleton.set_progress(_class, _id, property, value) diff --git a/demo/addons/godot_data_editor/input_dialog.gd b/demo/addons/godot_data_editor/input_dialog.gd index 0bdc4f2..a925978 100644 --- a/demo/addons/godot_data_editor/input_dialog.gd +++ b/demo/addons/godot_data_editor/input_dialog.gd @@ -14,7 +14,7 @@ onready var line_edit_2 = get_node("VBox/LineEdit2") #func _init(text, placerholder_1 = "", placeholder_2 = ""): -func popup(caller, callback_method, title, text, placeholder_1 = "", default_text_1 = "", placeholder_2 = "", default_text_2 = ""): +func input_dialog_popup(caller, callback_method, title, text, placeholder_1 = "", default_text_1 = "", placeholder_2 = "", default_text_2 = ""): self.caller = caller self.callback_method = callback_method self.placeholder_1 = placeholder_1 @@ -41,7 +41,7 @@ func popup(caller, callback_method, title, text, placeholder_1 = "", default_tex line_edit_2.set_text(default_text_2) self.popup_centered() - if not line_edit_1.is_hidden(): + if line_edit_1.visible: line_edit_1.grab_focus() func _on_ConfirmationDialog_confirmed(): diff --git a/demo/addons/godot_data_editor/item_manager.gd b/demo/addons/godot_data_editor/item_manager.gd index 0890883..73e65b7 100644 --- a/demo/addons/godot_data_editor/item_manager.gd +++ b/demo/addons/godot_data_editor/item_manager.gd @@ -28,7 +28,7 @@ var default_type_values = { str(TYPE_BOOL): false, # OK str(TYPE_COLOR): Color(0,0,0), str(TYPE_OBJECT): "res://", - str(TYPE_IMAGE): "res://", + #str(TYPE_IMAGE): "res://", str(TYPE_INT): 0, str(TYPE_NODE_PATH): @"", str(TYPE_REAL): 0.0, @@ -40,8 +40,8 @@ var default_type_values = { str(TYPE_TRANSFORM): Transform(Vector3(0,0,0),Vector3(0,0,0),Vector3(0,0,0),Vector3(0,0,0)) } -var type_names = {"STRING":TYPE_STRING, "BOOL":TYPE_BOOL, "COLOR":TYPE_COLOR, "OBJECT":TYPE_OBJECT, "IMAGE":TYPE_IMAGE, "INT":TYPE_INT, "NODE_PATH":TYPE_NODE_PATH, "REAL":TYPE_REAL, "RECT2":TYPE_RECT2, "VECTOR2":TYPE_VECTOR2, "VECTOR3":TYPE_VECTOR3, "PLANE":TYPE_PLANE, "QUAT":TYPE_QUAT, "TRANSFORM":TYPE_TRANSFORM } - +var type_names = {"STRING":TYPE_STRING, "BOOL":TYPE_BOOL, "COLOR":TYPE_COLOR, "OBJECT":TYPE_OBJECT, "INT":TYPE_INT, "NODE_PATH":TYPE_NODE_PATH, "REAL":TYPE_REAL, "RECT2":TYPE_RECT2, "VECTOR2":TYPE_VECTOR2, "VECTOR3":TYPE_VECTOR3, "PLANE":TYPE_PLANE, "QUAT":TYPE_QUAT, "TRANSFORM":TYPE_TRANSFORM } +# "IMAGE":TYPE_IMAGE, func _init(): load_manager() @@ -56,7 +56,7 @@ func load_manager(): set_up_item_folders() load_items() reload_unsaved_items() - Globals.set("item_manager", self) + ProjectSettings.set("item_manager", self) # Try to keep unsaved changes when (re)loading the item_manager var unsaved_items = [] @@ -111,7 +111,7 @@ func load_class_names(): directory.list_dir_begin() var file_name = directory.get_next() while (file_name != ""): - if file_name.extension() == "gd" and not directory.current_is_dir() and file_name != "data_item.gd" : + if file_name.get_extension() == "gd" and not directory.current_is_dir() and file_name != "data_item.gd" : class_names.append(file_name.replace(".gd", "")) file_name = directory.get_next() class_names.sort() @@ -142,7 +142,7 @@ func get_item_path(item): return config_output_directory + "/" + item._class + "/" + item._id + "." + config_extension func get_full_path(item): - return Globals.globalize_path(config_output_directory + "/" + item._class + "/" + item._id + "." + config_extension) + return ProjectSettings.globalize_path(config_output_directory + "/" + item._class + "/" + item._id + "." + config_extension) # return config_output_directory.replace("res://", "") + "/" + item._class + "/" + item._id + "." + config_extension func load_items(): @@ -158,8 +158,8 @@ func load_items(): directory.list_dir_begin() var file_name = directory.get_next() while (file_name != ""): - if file_name.extension() == config_extension and not directory.current_is_dir() : - var id = file_name.basename() + if file_name.get_extension() == config_extension and not directory.current_is_dir() : + var id = file_name.get_basename() if config_serializer == "json": items[item_class][id] = load_json_item(item_class, file_name) elif config_serializer == "binary": @@ -174,7 +174,7 @@ func load_items(): # Loads a single item stored in the binary format func load_binary_item(item_class, file_name): var file = File.new() - var id = file_name.basename() + var id = file_name.get_basename() var status = 0 if not config_encrypt: file.open(config_output_directory + "/" + item_class + "/" + file_name, File.READ) @@ -201,16 +201,14 @@ func load_binary_item(item_class, file_name): # Loads a single item stored in the json format func load_json_item(item_class, file_name): var file = File.new() - var id = file_name.basename() + var id = file_name.get_basename() var status = file.open(config_output_directory + "/" + item_class + "/" + file_name, File.READ) var item = classes[item_class].new(id) if status == OK: var text = file.get_as_text() - var dict = {} - dict.parse_json(text) + var dict = parse_json(text) for property_name in dict: - if property_name == "_custom_properties": var value = dict["_custom_properties"] @@ -315,7 +313,7 @@ func save_json_item(item): if property_name == "_custom_properties": dict["_custom_properties"] = {} for custom_property in value: - var type = value[custom_property][0] + type = value[custom_property][0] var sanitized_value = sanitize_variant(value[custom_property][1], type) dict["_custom_properties"][custom_property] = [sanitized_value, type] pass @@ -329,7 +327,7 @@ func save_json_item(item): else: #TODO: Handle pass - file.store_string(dict.to_json()) + file.store_string(to_json(dict)) file.close() @@ -490,7 +488,7 @@ func create_class(name, icon_path): var icon_resource = load(icon_path) var icon_data = icon_resource.get_data() if icon_data.get_width() <= 22 and icon_data.get_height() <= 22: - var directory = Directory.new() + directory = Directory.new() var error = directory.copy(icon_path, config_class_directory + "/" + name + ".png") if error != OK: emit_signal("class_insertion_failed", tr("Could not copy icon"), tr("There was a problem while copying the icon. Was it already opened by another program?") + "\nError code: " + str(error)) @@ -510,7 +508,7 @@ func create_class(name, icon_path): class_source += "\tpass\n" var script_file = File.new() - var directory = Directory.new() + directory = Directory.new() if not directory.dir_exists(config_class_directory): directory.make_dir(config_class_directory) diff --git a/demo/addons/godot_data_editor/item_tree.gd b/demo/addons/godot_data_editor/item_tree.gd index 8321110..718485a 100644 --- a/demo/addons/godot_data_editor/item_tree.gd +++ b/demo/addons/godot_data_editor/item_tree.gd @@ -45,7 +45,7 @@ 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") + self.item_manager = ProjectSettings.get("item_manager") tree_elements = {} tree_roots = {} last_selected_id = "" diff --git a/demo/addons/godot_data_editor/property_item.gd b/demo/addons/godot_data_editor/property_item.gd index e579aed..ce574d8 100644 --- a/demo/addons/godot_data_editor/property_item.gd +++ b/demo/addons/godot_data_editor/property_item.gd @@ -82,7 +82,7 @@ func _ready(): elif type == TYPE_TRANSFORM: control = create_custom_editor_button(value); create_custom_editor(12, 4, 16, ["xx", "xy", "xz", "xo", "yx", "yy", "yz", "yo", "zx", "zy", "zz", "zo"]) - elif type == TYPE_OBJECT or type == TYPE_IMAGE: + elif type == TYPE_OBJECT:# or type == TYPE_IMAGE: create_object_or_image() else: control = get_not_yet_supported() @@ -231,7 +231,7 @@ func create_color(): if typeof(value) == TYPE_STRING and value.find(","): var split_color = value.split(",") value = Color(split_color[0], split_color[1], split_color[2], split_color[3]) - control.set_color(value) + control.set_pick_color(value) control.connect("color_changed", self, "property_value_changed", []) func create_node_path(): @@ -351,7 +351,7 @@ func create_object_or_image(): object_type_line_edit.set_text(str(value)) object_type_line_edit.set_h_size_flags(SIZE_EXPAND_FILL) object_type_line_edit.connect("text_changed", self, "property_value_changed", []) - if hint_text == "Texture" or type == TYPE_IMAGE: + if hint_text == "Texture":# or type == TYPE_IMAGE: var f = File.new() if value != null and f.file_exists(value): var texture = load(value) @@ -377,7 +377,7 @@ func create_object_or_image(): control.add_child(load_button) - if Globals.get("debug_is_editor"): + if ProjectSettings.get("debug_is_editor"): dialog = EditorFileDialog.new() dialog.set_access(EditorFileDialog.ACCESS_RESOURCES) dialog.set_mode(EditorFileDialog.MODE_OPEN_FILE) diff --git a/demo/addons/godot_data_editor/property_item.tscn b/demo/addons/godot_data_editor/property_item.tscn index b1ddcac..282cdba 100644 --- a/demo/addons/godot_data_editor/property_item.tscn +++ b/demo/addons/godot_data_editor/property_item.tscn @@ -4,53 +4,28 @@ [ext_resource path="res://addons/godot_data_editor/icons/icon_remove.png" type="Texture" id=2] [node name="Panel" type="Panel"] - anchor_right = 1.0 anchor_bottom = 1.0 -rect_min_size = Vector2( 0, 26 ) -focus/ignore_mouse = false -focus/stop_mouse = false -size_flags_horizontal = 3 -size_flags_vertical = 1 margin_left = 1.0 -margin_top = 0.0 margin_right = 1.0 margin_bottom = -574.0 +rect_min_size = Vector2( 0, 26 ) +size_flags_horizontal = 3 script = ExtResource( 1 ) -mouse_filter = 0 [node name="DeleteButton" type="ToolButton" parent="."] - visible = false anchor_left = 1.0 anchor_top = 0.5 anchor_right = 1.0 anchor_bottom = 0.5 -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 margin_left = -1280.0 margin_top = -13.0 margin_right = -1252.0 margin_bottom = 11.0 -toggle_mode = false -enabled_focus_mode = 2 -shortcut = null icon = ExtResource( 2 ) -flat = true -mouse_filter = 0 [node name="PopupMenu" type="PopupMenu" parent="."] - -focus/ignore_mouse = false -focus/stop_mouse = true -size_flags_horizontal = 1 -size_flags_vertical = 1 -margin_left = 0.0 -margin_top = 0.0 margin_right = 20.0 margin_bottom = 20.0 -popup_exclusive = false -items = [ ] -mouse_filter = 0 + diff --git a/demo/classes/element.gd b/demo/classes/element.gd index 11acdbd..7c28b57 100644 --- a/demo/classes/element.gd +++ b/demo/classes/element.gd @@ -1,6 +1,6 @@ extends "res://addons/godot_data_editor/data_item.gd" -export(String) var name = "" +export(String) var elementname = "" export(Color) var color = Color(1,0,1) export(Texture) var image = null diff --git a/demo/classes/merchant.gd b/demo/classes/merchant.gd index 619a9a0..684452d 100644 --- a/demo/classes/merchant.gd +++ b/demo/classes/merchant.gd @@ -1,6 +1,6 @@ extends "res://addons/godot_data_editor/data_item.gd" -export(String, "Armor Shop", "Weapon Shop", "Inn", "Travelling Salesman") var name = "" +export(String, "Armor Shop", "Weapon Shop", "Inn", "Travelling Salesman") var merchantname = "" export(String) var greeting = "" diff --git a/demo/classes/shop_item.gd b/demo/classes/shop_item.gd index b8b5ccc..76dbaf0 100644 --- a/demo/classes/shop_item.gd +++ b/demo/classes/shop_item.gd @@ -1,6 +1,6 @@ extends "res://addons/godot_data_editor/data_item.gd" -export(String) var name = "" +export(String) var itemname = "" export(Texture) var icon = null export(int, 0, 9999) var price = 0 export(String, "Armor Shop", "Weapon Shop", "Inn", "Travelling Salesman") var seller = "Armor Shop" diff --git a/demo/classes/spell.gd b/demo/classes/spell.gd index 510ec37..f3d8c36 100644 --- a/demo/classes/spell.gd +++ b/demo/classes/spell.gd @@ -1,13 +1,13 @@ extends "res://addons/godot_data_editor/data_item.gd" -export(String) var name = "" +export(String) var itemname = "" export(String, MULTILINE) var description = "" export(String, "water", "fire", "wind", "earth") var element = "water" export(Texture) var icon = null export(int, 0, 9999) var base_damage = 0 export(String, "One Enemy", "All Enemies", "One Player", "All Players") var target = "One Enemy" export(PackedScene) var effect = null -export(Sample) var sound = null +#export(AudioStreamSample) var sound = null func _init(id).(id): pass diff --git a/demo/data/element/12.json b/demo/data/element/12.json new file mode 100644 index 0000000..bf5f6c9 --- /dev/null +++ b/demo/data/element/12.json @@ -0,0 +1 @@ +{"_class":["element",4],"_class_name":["Element",4],"_created":[1549229769,3],"_custom_properties":{},"_display_name":["fdf",4],"_id":["12",4],"_import_path":["",15],"_last_modified":[1549230859,2],"_persistent":[true,1],"color":["ffff00ff",14],"editor/display_folded":[false,1],"elementname":["dferfe",4],"image":[null,0]} \ No newline at end of file diff --git a/demo/data/merchant/43.json b/demo/data/merchant/43.json new file mode 100644 index 0000000..cfa3d46 --- /dev/null +++ b/demo/data/merchant/43.json @@ -0,0 +1 @@ +{"_class":["merchant",4],"_class_name":["Merchant",4],"_created":[1549229794,3],"_custom_properties":{},"_display_name":["sadfsdf",4],"_id":["43",4],"_import_path":["",15],"_last_modified":[1549230859,2],"_persistent":[true,1],"editor/display_folded":[false,1],"greeting":["adadadasdasd",4],"merchantname":["",4]} \ No newline at end of file diff --git a/demo/data/shop_item/12.json b/demo/data/shop_item/12.json new file mode 100644 index 0000000..cfc2ecf --- /dev/null +++ b/demo/data/shop_item/12.json @@ -0,0 +1 @@ +{"_class":["shop_item",4],"_class_name":["Shop Item",4],"_created":[1549230837,2],"_custom_properties":{},"_display_name":["fwef",4],"_id":["12",4],"_import_path":["",15],"_last_modified":[1549230859,2],"_persistent":[false,1],"description":["asdfasdf",4],"editor/display_folded":[false,1],"icon":[null,0],"itemname":["thdthd",4],"price":[4,2],"seller":["Armor Shop",4]} \ No newline at end of file diff --git a/demo/data/spell/343.json b/demo/data/spell/343.json new file mode 100644 index 0000000..bf8be19 --- /dev/null +++ b/demo/data/spell/343.json @@ -0,0 +1 @@ +{"_class":["spell",4],"_class_name":["Spell",4],"_created":[1549230884,2],"_custom_properties":{},"_display_name":["sdfsdf",4],"_id":["343",4],"_import_path":["",15],"_last_modified":[1549230889,2],"_persistent":[false,1],"base_damage":[0,2],"description":["dadad",4],"editor/display_folded":[false,1],"effect":[null,0],"element":["water",4],"icon":[null,0],"itemname":["asdasd",4],"target":["One Enemy",4]} \ No newline at end of file diff --git a/demo/project.godot b/demo/project.godot index 5d4fa8b..bcb0fb0 100644 --- a/demo/project.godot +++ b/demo/project.godot @@ -12,12 +12,22 @@ _global_script_classes=[ ] _global_script_class_icons={ } +debug_is_editor=false [application] config/name="demo" +run/main_scene="res://addons/godot_data_editor/data_editor_gui.tscn" config/icon="res://icon.png" +[autoload] + +data="*res://addons/godot_data_editor/data.gd" + +[editor_plugins] + +enabled=PoolStringArray( "godot_data_editor" ) + [importer_defaults] texture={