Unable to Exporting Typed Arrays of Inner Classes
Godot version
4.0.stable
System information
Kubuntu 22.10, GLES 3, Intel HD Graphics 2000
Issue description
When trying to export typed arrays of a inner class, the type declaration in the resource file becomes Array[Object].
Steps to reproduce
# res://test.gd
class_name test
extends Resource
class example_class:
extends Resource
@export var example_array: Array[example_class] = [example_class.new()]
Create a new "test.gd" resource in the editor and add an empty example_class to the example_array.
Save the resource file to a file with a .tres extension.
Open the file and you can see example_array = Array[Object]([null]).
Minimal reproduction project
N/A
[example_class.new()] is a non-constant expression, so export won't work (at least without @tool). See #71091.
But it looks like inner classes are not supported, the "Cannot get class 'example_class'." error is displayed. As far as I remember, custom resources export requires a global name (class_name), which only scripts can have. In this case, we should add a compile-time error.
Exported variables need scripts that can be identified by path. I didn't test, but const SCRIPT = preload(some script) can theoretically work too as a type. But inner classes and built-in scripts won't work.