• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Stoeoeoe/godot_data_editor: A data editor plugin for the Godot game engine

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

Stoeoeoe/godot_data_editor

开源软件地址:

https://github.com/Stoeoeoe/godot_data_editor

开源编程语言:

GDScript 100.0%

开源软件介绍:

IMPORTANT NOTE

This plugin was written for Godot 2.1.4 and is not compatible with Godot 3.x. Work on a port which will cover many features such as typing, proper handling of singleton etc. is in progress. Feel free to use the old version in your project.

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 data_access

Installation

  • Download/clone this repository
  • Open your project folder, e.g. "../MyGame/"
  • 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"
  • IMPORTANT: 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_screenshot

You can also download the addon in the Asset Lib, make sure to exclude the "demo" folder though :)

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 / Demo

There is a demo project available which shows how the plugin could be used in practice. Clone the repository and open the engine.cfg in the "demo" directory.

Working with data is rather simple, use the provided data class to access items. The following code snippets demonstrates item retrieval as well as the observation feature:

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
  • If you add the item as a child of another node and delete this parent later on, the item itself is also lost. I currently test a workaround where the item manager holds all items in a node hierarchy.
  • 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
  • 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
  • There is an issue with the color control whereby the default value indicated in the class is not being taken into account
  • No Godot 3 support yet ;)

Please post any issues you encounter.

HALP! Something went wrong!

Stay calm, most issues can be resolved by either pressing the "Reload" button or deactivating and activating the plugin. If the problem persists, there may be 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).




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap