mirror of
https://github.com/Relintai/godot_data_editor.git
synced 2024-11-13 06:27:19 +01:00
Removed engine.cfg modification, resized class dlg
This commit is contained in:
parent
b35700a1da
commit
8ff1edd96f
13
README.md
13
README.md
@ -22,7 +22,8 @@ This repository hosts a plugin for the [Godot Engine]. It allows users to enter
|
||||
* Copy the "addons" folder into your project folder
|
||||
* Open your project in the editor and navigate to the plugin (Scene -> Project Settings -> Plugins)
|
||||
* The plugin "godot_data_editor" should now appear, change the status from "Inactive" to "Active"
|
||||
* Restart the editor to make sure that the _data_ singleton is loaded properly. If _data_ was not added, add a [singleton] to the class "addons/godot_data_editor/data.gd".
|
||||
* Add the _data_ singleton which allows you to access the data later on. To do so, go to the Project Settings -> AutoLoad, then enter "addons/godot_data_editor/data.gd" as path and "data" as Node Name. Save the singleton by clicking on "Add".
|
||||
![singleton]
|
||||
|
||||
I intend to upload the plugin to the AssetLib, once I feel it is stable enough.
|
||||
|
||||
@ -100,8 +101,11 @@ Please feel free to contribute. Unfortunately, the code base still is not docume
|
||||
* In some cases, the controls are not correctly resized - pressing "Reload" should usually do the trick though
|
||||
* There is no support for undo/redo
|
||||
* Pressing Ctrl+S will not save the data items but the current scene
|
||||
* The _data_ singleton is only visible in the editor when the project is being restarted. This seems to be a limitation of the engine which does not allow reload the engine.cfg file
|
||||
* The "New Class" dialog is not displayed correctly under certain resolutions
|
||||
* Originally, the _data_ singleton was stored automatically in the engine.cfg configuration as soon as the plugin was loaded. This has lead to various issues though. For that reason, _data_ must currently be added manually.
|
||||
* Internationalization is still lacking
|
||||
* Under certain circumstances, integers cannot be entered
|
||||
|
||||
Please post any issues you encounter.
|
||||
|
||||
# HALP! Something went wrong!
|
||||
Stay calm, most issues can be resolved by either pressing the "Reload" button or activating and deactivating the plugin. If the problem persists, there is likely an issue with your data. Check if the name of the class (which are stored in the "classes" folder by default) is the same as the folder name of your instances (by default called "data"). If this is the case, there might be a conflict with duplicate IDs or the like. Please post an issue here if this happened without any external influence (e.g. you edited the files manually in another editor).
|
||||
@ -113,4 +117,5 @@ Stay calm, most issues can be resolved by either pressing the "Reload" button or
|
||||
[export property hints]: <http://docs.godotengine.org/en/latest/learning/scripting/gdscript/gdscript_basics.html#exports>
|
||||
[editor_screenshot]: https://github.com/Stoeoeoe/godot_data_editor/blob/master/screenshots/editor.png "The Godot Data Editor"
|
||||
[class_screenshot]: https://github.com/Stoeoeoe/godot_data_editor/blob/master/screenshots/class.png "Example Class"
|
||||
[data_access]: https://github.com/Stoeoeoe/godot_data_editor/blob/master/screenshots/data_access.png "Example Data Access"
|
||||
[data_access]: https://github.com/Stoeoeoe/godot_data_editor/blob/master/screenshots/data_access.png "Example Data Access"
|
||||
[singleton]: https://github.com/Stoeoeoe/godot_data_editor/blob/master/screenshots/singleton.png "Data Singleton"
|
@ -11,7 +11,8 @@ signal data_item_class_opened(item_class)
|
||||
|
||||
func _enter_tree():
|
||||
OS.set_low_processor_usage_mode(true)
|
||||
check_for_data_singleton()
|
||||
# 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)
|
||||
@ -23,36 +24,35 @@ func _enter_tree():
|
||||
func _exit_tree():
|
||||
OS.set_low_processor_usage_mode(false)
|
||||
get_editor_viewport().remove_child(gui)
|
||||
gui.free()
|
||||
if gui:
|
||||
gui.free()
|
||||
var config = ConfigFile.new()
|
||||
var status = config.load("res://engine.cfg")
|
||||
if status == OK:
|
||||
if config.has_section_key("autoload", "data"):
|
||||
config.set_value("autoload", "data", null)
|
||||
config.save("res://engine.cfg")
|
||||
#var status = config.load("res://engine.cfg")
|
||||
#if status == OK:
|
||||
# if not config.has_section_key("autoload", "data"):
|
||||
# config.set_value("autoload", "data", null)
|
||||
# config.save("res://engine.cfg")
|
||||
|
||||
# Check if the Classes and Data folders exist
|
||||
Globals.clear("item_manager")
|
||||
|
||||
func _ready():
|
||||
gui.connect("class_edit_requested", self, "edit_class", [])
|
||||
Globals.set("debug_is_editor", true)
|
||||
Globals.set("debug_is_editor", true)
|
||||
|
||||
# Opens the selected class in the Script Editor
|
||||
func edit_class(item_class):
|
||||
edit_resource(item_class)
|
||||
|
||||
|
||||
# TODO: Maybe there is a way to refresh the tree without restart?
|
||||
func check_for_data_singleton():
|
||||
var config = ConfigFile.new()
|
||||
var status = config.load("res://engine.cfg")
|
||||
|
||||
|
||||
if status == OK:
|
||||
if not config.has_section_key("autoload", "data"):
|
||||
config.set_value("autoload", "data", "*res://addons/godot_data_editor/data.gd")
|
||||
config.save("res://engine.cfg")
|
||||
#var directory = Directory.new()
|
||||
#directory.copy("res://engine.cfg", "res://engine.cfg_BACKUP")
|
||||
pass
|
||||
#var config = ConfigFile.new()
|
||||
#var status = config.load("res://engine.cfg")
|
||||
#if status == OK and not config.has_section_key("autoload", "data"):
|
||||
# config.set_value("autoload", "data", "*res://addons/godot_data_editor/data.gd")
|
||||
# config.save("res://engine.cfg")
|
||||
|
||||
# Load the plugin settings and adds default if they do not exist.
|
||||
# TODO: Obtain defaults from dialog
|
||||
@ -87,11 +87,10 @@ func has_main_screen():
|
||||
|
||||
# Virtual:
|
||||
func make_visible(visible):
|
||||
if(visible):
|
||||
if gui and visible:
|
||||
gui.reload()
|
||||
gui.show()
|
||||
|
||||
else:
|
||||
elif gui:
|
||||
gui.hide()
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 0
|
||||
margin/left = 0.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1280.0
|
||||
margin/right = 1024.0
|
||||
margin/bottom = 28.0
|
||||
alignment = 0
|
||||
|
||||
@ -281,23 +281,6 @@ icon = ExtResource( 9 )
|
||||
flat = true
|
||||
align = 0
|
||||
|
||||
[node name="Search" type="LineEdit" parent="VBox/Head"]
|
||||
|
||||
visibility/visible = false
|
||||
focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 377.0
|
||||
margin/top = 0.0
|
||||
margin/right = 435.0
|
||||
margin/bottom = 28.0
|
||||
placeholder/text = "Search"
|
||||
placeholder/alpha = 0.6
|
||||
focus_mode = 2
|
||||
caret/caret_blink = false
|
||||
caret/caret_blink_speed = 0.65
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBox"]
|
||||
|
||||
focus/ignore_mouse = false
|
||||
@ -306,7 +289,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 0.0
|
||||
margin/top = 32.0
|
||||
margin/right = 1280.0
|
||||
margin/right = 1024.0
|
||||
margin/bottom = 35.0
|
||||
|
||||
[node name="Body" type="HSplitContainer" parent="VBox"]
|
||||
@ -317,7 +300,7 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 0.0
|
||||
margin/top = 39.0
|
||||
margin/right = 1280.0
|
||||
margin/right = 1024.0
|
||||
margin/bottom = 600.0
|
||||
split/offset = 0
|
||||
split/collapsed = false
|
||||
@ -342,7 +325,7 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 177.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1280.0
|
||||
margin/right = 1024.0
|
||||
margin/bottom = 561.0
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="VBox/Body/Content"]
|
||||
@ -369,7 +352,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 0.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 25.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBox/Body/Content/VBox/Container"]
|
||||
@ -380,7 +363,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 8.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 25.0
|
||||
custom_constants/separation = 15
|
||||
alignment = 2
|
||||
@ -391,9 +374,9 @@ focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 0
|
||||
size_flags/vertical = 2
|
||||
margin/left = 722.0
|
||||
margin/left = 466.0
|
||||
margin/top = 0.0
|
||||
margin/right = 892.0
|
||||
margin/right = 636.0
|
||||
margin/bottom = 25.0
|
||||
disabled = true
|
||||
toggle_mode = false
|
||||
@ -410,9 +393,9 @@ focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 0
|
||||
size_flags/vertical = 2
|
||||
margin/left = 907.0
|
||||
margin/left = 651.0
|
||||
margin/top = 0.0
|
||||
margin/right = 988.0
|
||||
margin/right = 732.0
|
||||
margin/bottom = 25.0
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
@ -428,9 +411,9 @@ focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 0
|
||||
size_flags/vertical = 2
|
||||
margin/left = 1003.0
|
||||
margin/left = 747.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1095.0
|
||||
margin/right = 839.0
|
||||
margin/bottom = 25.0
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
@ -448,13 +431,13 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 0
|
||||
margin/left = 8.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 25.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 = "Actor"
|
||||
text = "Element"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
@ -466,9 +449,9 @@ focus/ignore_mouse = false
|
||||
focus/stop_mouse = false
|
||||
size_flags/horizontal = 0
|
||||
size_flags/vertical = 2
|
||||
margin/left = 555.0
|
||||
margin/left = 427.0
|
||||
margin/top = 0.0
|
||||
margin/right = 555.0
|
||||
margin/right = 427.0
|
||||
margin/bottom = 25.0
|
||||
custom_constants/hseparation = 10
|
||||
columns = 2
|
||||
@ -546,7 +529,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 8.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 25.0
|
||||
alignment = 0
|
||||
|
||||
@ -558,7 +541,7 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 2
|
||||
margin/left = 0.0
|
||||
margin/top = 29.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 32.0
|
||||
|
||||
[node name="Spacer" type="Control" parent="VBox/Body/Content/VBox"]
|
||||
@ -570,7 +553,7 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 2
|
||||
margin/left = 0.0
|
||||
margin/top = 36.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 46.0
|
||||
|
||||
[node name="InstanceDetails" type="PanelContainer" parent="VBox/Body/Content/VBox"]
|
||||
@ -582,8 +565,8 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 0.0
|
||||
margin/top = 50.0
|
||||
margin/right = 1103.0
|
||||
margin/bottom = 561.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 303.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBox/Body/Content/VBox/InstanceDetails"]
|
||||
|
||||
@ -593,16 +576,16 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 7.0
|
||||
margin/top = 7.0
|
||||
margin/right = 1096.0
|
||||
margin/bottom = 504.0
|
||||
margin/right = 840.0
|
||||
margin/bottom = 246.0
|
||||
alignment = 0
|
||||
|
||||
[node name="ClassProperties" parent="VBox/Body/Content/VBox/InstanceDetails/HBox" instance=ExtResource( 15 )]
|
||||
|
||||
anchor/right = 0
|
||||
anchor/bottom = 0
|
||||
margin/right = 542.0
|
||||
margin/bottom = 497.0
|
||||
margin/right = 414.0
|
||||
margin/bottom = 239.0
|
||||
|
||||
[node name="CustomProperties" parent="VBox/Body/Content/VBox/InstanceDetails/HBox" instance=ExtResource( 16 )]
|
||||
|
||||
@ -610,16 +593,16 @@ anchor/right = 0
|
||||
anchor/bottom = 0
|
||||
size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 546.0
|
||||
margin/right = 1089.0
|
||||
margin/bottom = 497.0
|
||||
margin/left = 418.0
|
||||
margin/right = 833.0
|
||||
margin/bottom = 239.0
|
||||
|
||||
[node name="ClassOverview" parent="VBox/Body/Content/VBox" instance=ExtResource( 17 )]
|
||||
|
||||
anchor/right = 0
|
||||
anchor/bottom = 0
|
||||
margin/top = 50.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 561.0
|
||||
|
||||
[node name="NoClasses" parent="VBox/Body/Content/VBox" instance=ExtResource( 18 )]
|
||||
@ -650,15 +633,13 @@ script/script = ExtResource( 19 )
|
||||
|
||||
[node name="NewClassDialog" type="ConfirmationDialog" parent="."]
|
||||
|
||||
editor/display_folded = true
|
||||
visibility/visible = false
|
||||
focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 519.0
|
||||
margin/left = 396.0
|
||||
margin/top = 193.0
|
||||
margin/right = 990.0
|
||||
margin/right = 915.0
|
||||
margin/bottom = 316.0
|
||||
popup/exclusive = true
|
||||
window/title = "New Class"
|
||||
@ -667,23 +648,30 @@ dialog/hide_on_ok = true
|
||||
|
||||
[node name="ClassName" type="LineEdit" parent="NewClassDialog"]
|
||||
|
||||
anchor/top = 3
|
||||
anchor/right = 1
|
||||
anchor/bottom = 3
|
||||
focus_neighbour/bottom = NodePath("../ClassIconPath")
|
||||
focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 8.0
|
||||
margin/top = 27.0
|
||||
margin/right = 466.0
|
||||
margin/bottom = 51.0
|
||||
margin/top = 34.5
|
||||
margin/right = 8.0
|
||||
margin/bottom = 10.5
|
||||
placeholder/text = "Name"
|
||||
placeholder/alpha = 0.6
|
||||
expand_to_len = false
|
||||
focus_mode = 2
|
||||
caret/caret_blink = false
|
||||
caret/caret_blink_speed = 0.65
|
||||
|
||||
[node name="ClassIconPath" type="LineEdit" parent="NewClassDialog"]
|
||||
|
||||
anchor/top = 3
|
||||
anchor/right = 1
|
||||
anchor/bottom = 3
|
||||
focus_neighbour/top = NodePath("../ClassName")
|
||||
focus_neighbour/right = NodePath("../NewClassIconSearchButton")
|
||||
focus/ignore_mouse = false
|
||||
@ -691,11 +679,12 @@ focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 8.0
|
||||
margin/top = 60.0
|
||||
margin/right = 393.0
|
||||
margin/bottom = 84.0
|
||||
margin/top = 1.5
|
||||
margin/right = 86.0
|
||||
margin/bottom = -22.5
|
||||
placeholder/text = "Icon Path (optional)"
|
||||
placeholder/alpha = 0.6
|
||||
expand_to_len = false
|
||||
focus_mode = 2
|
||||
caret/caret_blink = false
|
||||
caret/caret_blink_speed = 0.65
|
||||
@ -721,15 +710,19 @@ show_hidden_files = false
|
||||
|
||||
[node name="NewClassIconSearchButton" type="Button" parent="NewClassDialog"]
|
||||
|
||||
anchor/left = 1
|
||||
anchor/top = 3
|
||||
anchor/right = 1
|
||||
anchor/bottom = 3
|
||||
focus_neighbour/left = NodePath("../ClassIconPath")
|
||||
focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 399.0
|
||||
margin/top = 61.0
|
||||
margin/right = 466.0
|
||||
margin/bottom = 83.0
|
||||
margin/left = 80.0
|
||||
margin/top = 0.5
|
||||
margin/right = 8.0
|
||||
margin/bottom = -21.5
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
@ -775,6 +768,7 @@ margin/right = 363.0
|
||||
margin/bottom = 53.0
|
||||
placeholder/text = "Name"
|
||||
placeholder/alpha = 0.6
|
||||
expand_to_len = false
|
||||
focus_mode = 2
|
||||
caret/caret_blink = false
|
||||
caret/caret_blink_speed = 0.65
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 140 KiB |
Binary file not shown.
Before Width: | Height: | Size: 134 KiB |
@ -1,114 +0,0 @@
|
||||
# Godot Data Editor
|
||||
This repository hosts a plugin for the [Godot Engine]. It allows users to enter data items based on Godot classes which are then serialized in either as json or binaries. Serialized items may be encrypted if desired.
|
||||
|
||||
# Features
|
||||
* Support for binary or json serialization
|
||||
* Create data classes with the click of a button
|
||||
* Use gdscript to add properties and logic to your data classes, all instances will be Nodes
|
||||
* Make use of the built-in [export property hints]
|
||||
* Add instance-specific custom properties
|
||||
* Access data with a simple API using the _data_ singleton
|
||||
* ALPHA: Use the notification/observer system to react to changes in data items
|
||||
* ALPHA: Encrypt your data files
|
||||
|
||||
# Screenshots
|
||||
![editor_screenshot]
|
||||
![class_screenshot]
|
||||
|
||||
# Installation
|
||||
* Open your project folder, e.g. "../MyGame/"
|
||||
* Create a folder named "addons" (if not already present)
|
||||
* In addons, create a folder named "godot_data_editor"
|
||||
* Copy the content of this repository into it. You may remove the "sceenshots" ;)
|
||||
* Open your project in the editor and navigate to the plugin (Scene -> Project Settings -> Plugins)
|
||||
* The plugin "godot_data_editor" should now appear, change the status from "Inactive" to "Active"
|
||||
* Restart the editor to make sure that the _data_ singleton is loaded properly
|
||||
|
||||
I intend to upload the plugin to the AssetLib, once I feel it is stable enough.
|
||||
|
||||
# System Requirements
|
||||
The plugin was written for version *2.1.3* of the Godot Engine. Upcoming minor versions should be supported as well.
|
||||
It is very likely that a number of changes will be necessary, once Godot 3 is released.
|
||||
|
||||
# API / Tutorial
|
||||
I created a little video which shows how to use the plugin to create a simple shop system: [[Link to video which does not exist yet :) ]]
|
||||
|
||||
Working with data is rather simple, use the provided _data_ class to access the items. The following code snippets demonstrates item retrieval as well as the observation feature:
|
||||
```gdscript
|
||||
extends Node
|
||||
|
||||
func _ready():
|
||||
# Get a single item
|
||||
var herb = data.get_item("shop_item", "herb")
|
||||
var price = herb.price
|
||||
|
||||
# Get all items as dictionary (key: id, value: item)
|
||||
var shop_items = data.get_items("shop_item")
|
||||
for shop_item in shop_items.values():
|
||||
print(shop_item.price)
|
||||
pass
|
||||
|
||||
#######################################
|
||||
# Observe Properties:
|
||||
# Please note that you currently have to update properties using the "update_property" to make use of this feature
|
||||
#######################################
|
||||
|
||||
# Be notified when something about this herb changes
|
||||
data.observe_item(self, herb, "herb_changed")
|
||||
herb.update_property("name", "better_herb")
|
||||
|
||||
# Be notified when the price of this herb changes,
|
||||
data.observe_item_property(self, herb, "price", "herb_price_changed")
|
||||
herb.update_property("price", 500)
|
||||
|
||||
# Be notified when any item changes
|
||||
var doge_axe = data.get_item("shop_item", "doge_axe")
|
||||
data.observe_class(self, "shop_item", "shop_item_changed")
|
||||
doge_axe.update_property("price", 500)
|
||||
|
||||
# Overkill: be notified about everything
|
||||
data.observe_all_changes(self, "something_changed")
|
||||
|
||||
#######################################
|
||||
# Stop Observing:
|
||||
# When you are no longer interested in updates, simply unsubscribe/stop observing
|
||||
#######################################
|
||||
data.stop_observing_item_property(self, herb, "price")
|
||||
data.stop_observing_item(self, herb)
|
||||
data.stop_observing_class(self, "shop_item")
|
||||
data.stop_observing_changes(self)
|
||||
|
||||
|
||||
func herb_changed(item, property, value):
|
||||
print("Something about this herb changed!")
|
||||
|
||||
func herb_price_changed(item, property, value):
|
||||
print("Herb price changed!")
|
||||
|
||||
func shop_item_changed(item, property, value):
|
||||
print(item.name + " changed! " + property + " : " + str(value))
|
||||
|
||||
func something_changed(item, property, value):
|
||||
print("I guess something changed.")
|
||||
```
|
||||
|
||||
# Please Contribute!
|
||||
Please feel free to contribute. Unfortunately, the code base still is not documented that well and there are a number of bugs which will need to be ironed out. I am sure that there are many things I have been doing wrong, especially in regard to memory management.
|
||||
|
||||
# Known Issues
|
||||
* The "Rename Class" feature may not properly rename the class file if it still in use
|
||||
* In some cases, the controls are not correctly resized - pressing "Reload" should usually do the trick though
|
||||
* There is no support for undo/redo
|
||||
* Pressing Ctrl+S will not save the data items but the current scene
|
||||
* The _data_ singleton is only visible in the editor when the project is being restarted. This seems to be a limitation of the engine which does not allow reload the engine.cfg file
|
||||
* The "class overview" screen is lacking any kind of useful content
|
||||
|
||||
# HALP! Something went wrong!
|
||||
Stay calm, most issues can be resolved by either pressing the "Reload" button or activating and deactivating the plugin. If the problem persists, there is likely an issue with your data. Check if the name of the class (which are stored in the "classes" folder by default) is the same as the folder name of your instances (by default called "data"). If this is the case, there might be a conflict with duplicate IDs or the like. Please post an issue here if this happened without any external influence (e.g. you edited the files manually in another editor).
|
||||
|
||||
|
||||
|
||||
[Godot Engine]: <https://github.com/godotengine/godot>
|
||||
[export property hints]: <http://docs.godotengine.org/en/latest/learning/scripting/gdscript/gdscript_basics.html#exports>
|
||||
[editor_screenshot]: https://github.com/Stoeoeoe/godot_data_editor/blob/master/screenshots/editor.png "The Godot Data Editor"
|
||||
[class_screenshot]: https://github.com/Stoeoeoe/godot_data_editor/blob/master/screenshots/class.png "Example Class"
|
@ -11,7 +11,8 @@ signal data_item_class_opened(item_class)
|
||||
|
||||
func _enter_tree():
|
||||
OS.set_low_processor_usage_mode(true)
|
||||
check_for_data_singleton()
|
||||
# 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)
|
||||
@ -23,36 +24,35 @@ func _enter_tree():
|
||||
func _exit_tree():
|
||||
OS.set_low_processor_usage_mode(false)
|
||||
get_editor_viewport().remove_child(gui)
|
||||
gui.free()
|
||||
if gui:
|
||||
gui.free()
|
||||
var config = ConfigFile.new()
|
||||
var status = config.load("res://engine.cfg")
|
||||
if status == OK:
|
||||
if config.has_section_key("autoload", "data"):
|
||||
config.set_value("autoload", "data", null)
|
||||
config.save("res://engine.cfg")
|
||||
#var status = config.load("res://engine.cfg")
|
||||
#if status == OK:
|
||||
# if not config.has_section_key("autoload", "data"):
|
||||
# config.set_value("autoload", "data", null)
|
||||
# config.save("res://engine.cfg")
|
||||
|
||||
# Check if the Classes and Data folders exist
|
||||
Globals.clear("item_manager")
|
||||
|
||||
func _ready():
|
||||
gui.connect("class_edit_requested", self, "edit_class", [])
|
||||
Globals.set("debug_is_editor", true)
|
||||
Globals.set("debug_is_editor", true)
|
||||
|
||||
# Opens the selected class in the Script Editor
|
||||
func edit_class(item_class):
|
||||
edit_resource(item_class)
|
||||
|
||||
|
||||
# TODO: Maybe there is a way to refresh the tree without restart?
|
||||
func check_for_data_singleton():
|
||||
var config = ConfigFile.new()
|
||||
var status = config.load("res://engine.cfg")
|
||||
|
||||
|
||||
if status == OK:
|
||||
if not config.has_section_key("autoload", "data"):
|
||||
config.set_value("autoload", "data", "*res://addons/godot_data_editor/data.gd")
|
||||
config.save("res://engine.cfg")
|
||||
#var directory = Directory.new()
|
||||
#directory.copy("res://engine.cfg", "res://engine.cfg_BACKUP")
|
||||
pass
|
||||
#var config = ConfigFile.new()
|
||||
#var status = config.load("res://engine.cfg")
|
||||
#if status == OK and not config.has_section_key("autoload", "data"):
|
||||
# config.set_value("autoload", "data", "*res://addons/godot_data_editor/data.gd")
|
||||
# config.save("res://engine.cfg")
|
||||
|
||||
# Load the plugin settings and adds default if they do not exist.
|
||||
# TODO: Obtain defaults from dialog
|
||||
@ -87,11 +87,10 @@ func has_main_screen():
|
||||
|
||||
# Virtual:
|
||||
func make_visible(visible):
|
||||
if(visible):
|
||||
if gui and visible:
|
||||
gui.reload()
|
||||
gui.show()
|
||||
|
||||
else:
|
||||
elif gui:
|
||||
gui.hide()
|
||||
|
||||
|
||||
|
@ -60,7 +60,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 0
|
||||
margin/left = 0.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1280.0
|
||||
margin/right = 1024.0
|
||||
margin/bottom = 28.0
|
||||
alignment = 0
|
||||
|
||||
@ -281,23 +281,6 @@ icon = ExtResource( 9 )
|
||||
flat = true
|
||||
align = 0
|
||||
|
||||
[node name="Search" type="LineEdit" parent="VBox/Head"]
|
||||
|
||||
visibility/visible = false
|
||||
focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 377.0
|
||||
margin/top = 0.0
|
||||
margin/right = 435.0
|
||||
margin/bottom = 28.0
|
||||
placeholder/text = "Search"
|
||||
placeholder/alpha = 0.6
|
||||
focus_mode = 2
|
||||
caret/caret_blink = false
|
||||
caret/caret_blink_speed = 0.65
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="VBox"]
|
||||
|
||||
focus/ignore_mouse = false
|
||||
@ -306,7 +289,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 0.0
|
||||
margin/top = 32.0
|
||||
margin/right = 1280.0
|
||||
margin/right = 1024.0
|
||||
margin/bottom = 35.0
|
||||
|
||||
[node name="Body" type="HSplitContainer" parent="VBox"]
|
||||
@ -317,7 +300,7 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 0.0
|
||||
margin/top = 39.0
|
||||
margin/right = 1280.0
|
||||
margin/right = 1024.0
|
||||
margin/bottom = 600.0
|
||||
split/offset = 0
|
||||
split/collapsed = false
|
||||
@ -342,7 +325,7 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 177.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1280.0
|
||||
margin/right = 1024.0
|
||||
margin/bottom = 561.0
|
||||
|
||||
[node name="VBox" type="VBoxContainer" parent="VBox/Body/Content"]
|
||||
@ -369,7 +352,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 0.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 25.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBox/Body/Content/VBox/Container"]
|
||||
@ -380,7 +363,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 8.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 25.0
|
||||
custom_constants/separation = 15
|
||||
alignment = 2
|
||||
@ -391,9 +374,9 @@ focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 0
|
||||
size_flags/vertical = 2
|
||||
margin/left = 722.0
|
||||
margin/left = 466.0
|
||||
margin/top = 0.0
|
||||
margin/right = 892.0
|
||||
margin/right = 636.0
|
||||
margin/bottom = 25.0
|
||||
disabled = true
|
||||
toggle_mode = false
|
||||
@ -410,9 +393,9 @@ focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 0
|
||||
size_flags/vertical = 2
|
||||
margin/left = 907.0
|
||||
margin/left = 651.0
|
||||
margin/top = 0.0
|
||||
margin/right = 988.0
|
||||
margin/right = 732.0
|
||||
margin/bottom = 25.0
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
@ -428,9 +411,9 @@ focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 0
|
||||
size_flags/vertical = 2
|
||||
margin/left = 1003.0
|
||||
margin/left = 747.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1095.0
|
||||
margin/right = 839.0
|
||||
margin/bottom = 25.0
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
@ -448,13 +431,13 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 0
|
||||
margin/left = 8.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 25.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 = "Actor"
|
||||
text = "Element"
|
||||
percent_visible = 1.0
|
||||
lines_skipped = 0
|
||||
max_lines_visible = -1
|
||||
@ -466,9 +449,9 @@ focus/ignore_mouse = false
|
||||
focus/stop_mouse = false
|
||||
size_flags/horizontal = 0
|
||||
size_flags/vertical = 2
|
||||
margin/left = 555.0
|
||||
margin/left = 427.0
|
||||
margin/top = 0.0
|
||||
margin/right = 555.0
|
||||
margin/right = 427.0
|
||||
margin/bottom = 25.0
|
||||
custom_constants/hseparation = 10
|
||||
columns = 2
|
||||
@ -546,7 +529,7 @@ size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 8.0
|
||||
margin/top = 0.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 25.0
|
||||
alignment = 0
|
||||
|
||||
@ -558,7 +541,7 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 2
|
||||
margin/left = 0.0
|
||||
margin/top = 29.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 32.0
|
||||
|
||||
[node name="Spacer" type="Control" parent="VBox/Body/Content/VBox"]
|
||||
@ -570,7 +553,7 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 2
|
||||
margin/left = 0.0
|
||||
margin/top = 36.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 46.0
|
||||
|
||||
[node name="InstanceDetails" type="PanelContainer" parent="VBox/Body/Content/VBox"]
|
||||
@ -582,8 +565,8 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 0.0
|
||||
margin/top = 50.0
|
||||
margin/right = 1103.0
|
||||
margin/bottom = 561.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 303.0
|
||||
|
||||
[node name="HBox" type="HBoxContainer" parent="VBox/Body/Content/VBox/InstanceDetails"]
|
||||
|
||||
@ -593,16 +576,16 @@ size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 7.0
|
||||
margin/top = 7.0
|
||||
margin/right = 1096.0
|
||||
margin/bottom = 504.0
|
||||
margin/right = 840.0
|
||||
margin/bottom = 246.0
|
||||
alignment = 0
|
||||
|
||||
[node name="ClassProperties" parent="VBox/Body/Content/VBox/InstanceDetails/HBox" instance=ExtResource( 15 )]
|
||||
|
||||
anchor/right = 0
|
||||
anchor/bottom = 0
|
||||
margin/right = 542.0
|
||||
margin/bottom = 497.0
|
||||
margin/right = 414.0
|
||||
margin/bottom = 239.0
|
||||
|
||||
[node name="CustomProperties" parent="VBox/Body/Content/VBox/InstanceDetails/HBox" instance=ExtResource( 16 )]
|
||||
|
||||
@ -610,16 +593,16 @@ anchor/right = 0
|
||||
anchor/bottom = 0
|
||||
size_flags/horizontal = 3
|
||||
size_flags/vertical = 3
|
||||
margin/left = 546.0
|
||||
margin/right = 1089.0
|
||||
margin/bottom = 497.0
|
||||
margin/left = 418.0
|
||||
margin/right = 833.0
|
||||
margin/bottom = 239.0
|
||||
|
||||
[node name="ClassOverview" parent="VBox/Body/Content/VBox" instance=ExtResource( 17 )]
|
||||
|
||||
anchor/right = 0
|
||||
anchor/bottom = 0
|
||||
margin/top = 50.0
|
||||
margin/right = 1103.0
|
||||
margin/right = 847.0
|
||||
margin/bottom = 561.0
|
||||
|
||||
[node name="NoClasses" parent="VBox/Body/Content/VBox" instance=ExtResource( 18 )]
|
||||
@ -650,15 +633,13 @@ script/script = ExtResource( 19 )
|
||||
|
||||
[node name="NewClassDialog" type="ConfirmationDialog" parent="."]
|
||||
|
||||
editor/display_folded = true
|
||||
visibility/visible = false
|
||||
focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 519.0
|
||||
margin/left = 396.0
|
||||
margin/top = 193.0
|
||||
margin/right = 990.0
|
||||
margin/right = 915.0
|
||||
margin/bottom = 316.0
|
||||
popup/exclusive = true
|
||||
window/title = "New Class"
|
||||
@ -667,23 +648,30 @@ dialog/hide_on_ok = true
|
||||
|
||||
[node name="ClassName" type="LineEdit" parent="NewClassDialog"]
|
||||
|
||||
anchor/top = 3
|
||||
anchor/right = 1
|
||||
anchor/bottom = 3
|
||||
focus_neighbour/bottom = NodePath("../ClassIconPath")
|
||||
focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 8.0
|
||||
margin/top = 27.0
|
||||
margin/right = 466.0
|
||||
margin/bottom = 51.0
|
||||
margin/top = 34.5
|
||||
margin/right = 8.0
|
||||
margin/bottom = 10.5
|
||||
placeholder/text = "Name"
|
||||
placeholder/alpha = 0.6
|
||||
expand_to_len = false
|
||||
focus_mode = 2
|
||||
caret/caret_blink = false
|
||||
caret/caret_blink_speed = 0.65
|
||||
|
||||
[node name="ClassIconPath" type="LineEdit" parent="NewClassDialog"]
|
||||
|
||||
anchor/top = 3
|
||||
anchor/right = 1
|
||||
anchor/bottom = 3
|
||||
focus_neighbour/top = NodePath("../ClassName")
|
||||
focus_neighbour/right = NodePath("../NewClassIconSearchButton")
|
||||
focus/ignore_mouse = false
|
||||
@ -691,11 +679,12 @@ focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 8.0
|
||||
margin/top = 60.0
|
||||
margin/right = 393.0
|
||||
margin/bottom = 84.0
|
||||
margin/top = 1.5
|
||||
margin/right = 86.0
|
||||
margin/bottom = -22.5
|
||||
placeholder/text = "Icon Path (optional)"
|
||||
placeholder/alpha = 0.6
|
||||
expand_to_len = false
|
||||
focus_mode = 2
|
||||
caret/caret_blink = false
|
||||
caret/caret_blink_speed = 0.65
|
||||
@ -721,15 +710,19 @@ show_hidden_files = false
|
||||
|
||||
[node name="NewClassIconSearchButton" type="Button" parent="NewClassDialog"]
|
||||
|
||||
anchor/left = 1
|
||||
anchor/top = 3
|
||||
anchor/right = 1
|
||||
anchor/bottom = 3
|
||||
focus_neighbour/left = NodePath("../ClassIconPath")
|
||||
focus/ignore_mouse = false
|
||||
focus/stop_mouse = true
|
||||
size_flags/horizontal = 2
|
||||
size_flags/vertical = 2
|
||||
margin/left = 399.0
|
||||
margin/top = 61.0
|
||||
margin/right = 466.0
|
||||
margin/bottom = 83.0
|
||||
margin/left = 80.0
|
||||
margin/top = 0.5
|
||||
margin/right = 8.0
|
||||
margin/bottom = -21.5
|
||||
toggle_mode = false
|
||||
enabled_focus_mode = 2
|
||||
shortcut = null
|
||||
@ -775,6 +768,7 @@ margin/right = 363.0
|
||||
margin/bottom = 53.0
|
||||
placeholder/text = "Name"
|
||||
placeholder/alpha = 0.6
|
||||
expand_to_len = false
|
||||
focus_mode = 2
|
||||
caret/caret_blink = false
|
||||
caret/caret_blink_speed = 0.65
|
||||
|
@ -1,21 +0,0 @@
|
||||
Add "Notes" to each element
|
||||
Add Display Name for each
|
||||
Add Refresh
|
||||
Check how to deal with reloading the tree
|
||||
Add Sub categories
|
||||
Translate
|
||||
Add "state" handling
|
||||
Add UndoRedo
|
||||
|
||||
Move short callbacks from self to the object and call directly (e.g. popup)
|
||||
|
||||
Use EditorFileSystem class to check for changes (external ones)
|
||||
|
||||
print_progress
|
||||
|
||||
|
||||
Handle when switching from encrypted to non-encrypted and vice versa
|
||||
|
||||
# Progress?
|
||||
get_status(story_item)
|
||||
set_status(story_item, value)
|
@ -130,7 +130,7 @@ func _on_Options_confirmed():
|
||||
config.set_value("custom", "serializer", serializer)
|
||||
config.set_value("custom", "encrypt", encrypt)
|
||||
config.set_value("custom", "password", password)
|
||||
config.set_value("custom", "class_directory", output_directory)
|
||||
config.set_value("custom", "class_directory", class_directory)
|
||||
config.set_value("custom", "output_directory", output_directory)
|
||||
config.set_value("custom", "sanitize_ids", sanitize_ids)
|
||||
config.save("res://addons/godot_data_editor/plugin.cfg")
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 140 KiB |
Binary file not shown.
Before Width: | Height: | Size: 134 KiB |
10
demo/classes/test.gd
Normal file
10
demo/classes/test.gd
Normal file
@ -0,0 +1,10 @@
|
||||
extends "res://addons/godot_data_editor/data_item.gd"
|
||||
|
||||
export(int) var int_no_hints = 0
|
||||
export(String) var string_no_hints = ""
|
||||
export(Color) var your_color_property = Color(1,0,1)
|
||||
|
||||
|
||||
|
||||
func _init(id).(id):
|
||||
pass
|
BIN
demo/classes/test.png
Normal file
BIN
demo/classes/test.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 267 B |
1
demo/data/test/test_instance.json
Normal file
1
demo/data/test/test_instance.json
Normal file
@ -0,0 +1 @@
|
||||
{"_last_modified":[1503426771, 2], "int_no_hints":[100000, 2], "_id":["test_instance", 4], "_display_name":["test_instance", 4], "_class_name":["Test", 4], "_class":["test", 4], "_custom_properties":{}, "_created":[1503426734, 2], "string_no_hints":["", 4], "_persistent":[true, 1], "your_color_property":["ffff00ff", 14]}
|
@ -11,3 +11,7 @@ data="*res://addons/godot_data_editor/data.gd"
|
||||
[editor_plugins]
|
||||
|
||||
enabled=["godot_data_editor"]
|
||||
|
||||
[input]
|
||||
|
||||
Test=[Vector2(0, 0), key(A), key(B)]
|
||||
|
BIN
screenshots/singleton.png
Normal file
BIN
screenshots/singleton.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
Loading…
Reference in New Issue
Block a user