GDScript: Add @export_storage annotation

This commit is contained in:
Danil Alexeev
2023-12-19 20:56:30 +03:00
parent 1f5d4a62e9
commit 3a3a2011f4
16 changed files with 178 additions and 109 deletions

View File

@@ -1,17 +1,17 @@
extends RefCounted # TODO: Fix standalone annotations parsing.
const Utils = preload("../../utils.notest.gd")
# GH-73843
@export_group("Resource")
# GH-78252
@export var prop_1: int
@export_category("prop_1")
@export var prop_2: int
@export var test_1: int
@export_category("test_1")
@export var test_2: int
func test():
var resource := Resource.new()
prints("Not shadowed:", resource.get_class())
for property in get_property_list():
if property.name in ["prop_1", "prop_2"]:
print(property)
if str(property.name).begins_with("test_"):
Utils.print_property_extended_info(property, self)

View File

@@ -1,5 +1,8 @@
GDTEST_OK
Not shadowed: Resource
{ "name": "prop_1", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
{ "name": "prop_1", "class_name": &"", "type": 0, "hint": 0, "hint_string": "", "usage": 128 }
{ "name": "prop_2", "class_name": &"", "type": 2, "hint": 0, "hint_string": "int", "usage": 4102 }
var test_1: int = 0
hint=NONE hint_string="int" usage=DEFAULT|SCRIPT_VARIABLE
@export_category("test_1")
hint=NONE hint_string="" usage=CATEGORY
var test_2: int = 0
hint=NONE hint_string="int" usage=DEFAULT|SCRIPT_VARIABLE

View File

@@ -60,7 +60,7 @@ func test():
var script: Script = get_script()
for property in script.get_property_list():
if str(property.name).begins_with("test_"):
print(Utils.get_property_signature(property, true))
print(Utils.get_property_signature(property, null, true))
for property in get_property_list():
if str(property.name).begins_with("test_"):
print(Utils.get_property_signature(property))

View File

@@ -6,13 +6,13 @@ static var test_static_var_hard_int: int
var test_var_untyped: Variant
var test_var_weak_null: Variant
var test_var_weak_int: Variant
@export var test_var_weak_int_exported: int
var test_var_weak_int_exported: int
var test_var_weak_variant_type: Variant
@export var test_var_weak_variant_type_exported: Variant.Type
var test_var_weak_variant_type_exported: Variant.Type
var test_var_hard_variant: Variant
var test_var_hard_int: int
var test_var_hard_variant_type: Variant.Type
@export var test_var_hard_variant_type_exported: Variant.Type
var test_var_hard_variant_type_exported: Variant.Type
var test_var_hard_node_process_mode: Node.ProcessMode
var test_var_hard_my_enum: TestMemberInfo.MyEnum
var test_var_hard_array: Array

View File

@@ -30,7 +30,7 @@ func test():
var b := B.new()
for property in (B as GDScript).get_property_list():
if str(property.name).begins_with("test_"):
print(Utils.get_property_signature(property, true))
print(Utils.get_property_signature(property, null, true))
print("---")
for property in b.get_property_list():
if str(property.name).begins_with("test_"):