| 1 |
@tool |
| 2 |
class_name ExportVariableTest |
| 3 |
extends Node |
| 4 |
|
| 5 |
const PreloadedGlobalClass = preload("./export_variable_global.notest.gd") |
| 6 |
const PreloadedUnnamedClass = preload("./export_variable_unnamed.notest.gd") |
| 7 |
|
| 8 |
# Built-in types. |
| 9 |
@export var test_weak_int = 1 |
| 10 |
@export var test_hard_int: int = 2 |
| 11 |
@export_range(0, 100) var test_range = 100 |
| 12 |
@export_range(0, 100, 1) var test_range_step = 101 |
| 13 |
@export_range(0, 100, 1, "or_greater") var test_range_step_or_greater = 102 |
| 14 |
@export var test_color: Color |
| 15 |
@export_color_no_alpha var test_color_no_alpha: Color |
| 16 |
@export_node_path("Sprite2D", "Sprite3D", "Control", "Node") var test_node_path := ^"hello" |
| 17 |
|
| 18 |
# Enums. |
| 19 |
@export var test_side: Side |
| 20 |
@export var test_atm: AutoTranslateMode |
| 21 |
|
| 22 |
# Resources and nodes. |
| 23 |
@export var test_image: Image |
| 24 |
@export var test_timer: Timer |
| 25 |
|
| 26 |
# Global custom classes. |
| 27 |
@export var test_global_class: ExportVariableTest |
| 28 |
@export var test_preloaded_global_class: PreloadedGlobalClass |
| 29 |
@export var test_preloaded_unnamed_class: PreloadedUnnamedClass # GH-93168 |
| 30 |
|
| 31 |
# Arrays. |
| 32 |
@export var test_array: Array |
| 33 |
@export var test_array_bool: Array[bool] |
| 34 |
@export var test_array_array: Array[Array] |
| 35 |
@export var test_array_side: Array[Side] |
| 36 |
@export var test_array_atm: Array[AutoTranslateMode] |
| 37 |
@export var test_array_image: Array[Image] |
| 38 |
@export var test_array_timer: Array[Timer] |
| 39 |
|
| 40 |
# `@export_storage`. |
| 41 |
@export_storage var test_storage_untyped |
| 42 |
@export_storage var test_storage_weak_int = 3 # Property info still `Variant`, unlike `@export`. |
| 43 |
@export_storage var test_storage_hard_int: int = 4 |
| 44 |
|
| 45 |
# `@export_custom`. |
| 46 |
# NOTE: `PROPERTY_USAGE_NIL_IS_VARIANT` flag will be removed. |
| 47 |
@export_custom(PROPERTY_HINT_ENUM, "A,B,C") var test_export_custom_untyped |
| 48 |
@export_custom(PROPERTY_HINT_ENUM, "A,B,C") var test_export_custom_weak_int = 5 |
| 49 |
@export_custom(PROPERTY_HINT_ENUM, "A,B,C") var test_export_custom_hard_int: int = 6 |
| 50 |
|
| 51 |
# `@export_tool_button`. |
| 52 |
@export_tool_button("Click me!") var test_tool_button_1: Callable |
| 53 |
@export_tool_button("Click me!", "ColorRect") var test_tool_button_2: Callable |
| 54 |
|
| 55 |
func test(): |
| 56 |
for property in get_property_list(): |
| 57 |
if str(property.name).begins_with("test_"): |
| 58 |
Utils.print_property_extended_info(property, self) |