Hi, as far as I can tell, in 3.0 there is no simple way to do this, although there seems to have been some discussion about adding this functionality.
https://github.com/godotengine/godot/pull/10303
https://github.com/godotengine/godot/issues/4378
It is possible, though, as described by Bojidar Marinov in a post to this thread:
https://godotengine.org/qa/3196/how-add-subcategories-inspector-script-variables-section
Here is a slightly different implementation I use based on the same technique:
Scripts/PropertyList.gd
extends Object
var properties = {}
func add(name, type, default_value):
properties[name] = {
"hint": PROPERTY_HINT_NONE,
"usage": PROPERTY_USAGE_DEFAULT,
"name": name,
"type": type,
"value": default_value
}
func get(name):
return properties[name].value
func set(name, value):
if properties.has(name):
properties[name].value = value
func _init(list):
for prop in list:
add(prop[0], prop[1], prop[2])
And then, in your scripts you can do:
tool
extends Spatial
const PropertyList = preload("res://Scripts/PropertyList.gd")
var property_list = PropertyList.new([
["test/foo",TYPE_STRING,"allo"],
["test/bar",TYPE_INT,32],
["other/foo",TYPE_STRING,"truc"],
["other/bar",TYPE_INT,8]])
func _get(property):
return property_list.get(property)
func _set(property, value):
property_list.set(property, value)
func _get_property_list():
return property_list.properties.values()