godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
88.68k stars 20.11k forks source link

[3.x] `export` in built-in scripts not working with parent classes that inherit from internal classes in the AutoLoad on editor #88617

Open SysError99 opened 6 months ago

SysError99 commented 6 months ago

Tested versions

3.5.3-stable

System information

6.1.71-1-MANJARO

Issue description

export in built-in scripts not working with parent classes that inherit from internal classes in the AutoLoad. The ones from the script itself seem to work fine. The class gets inherited properly in runtime, however.

Steps to reproduce

  1. Create a script file that contains internal classes.
    
    extends Node
    class_name BundleClass

export var my_parent_node_path: NodePath export var my_parent_string = ""

class MyClass extends Node: export var node_path: NodePath export var my_string = ""

func _ready() -> void:
    print(name + ":: I'm from MyClass")

func _ready() -> void: print(name + ":: I'm from BundleClass")

2. Attach the script from (1) into AutoLoad (singleton). In this case, named `Bundle`
![image](https://github.com/godotengine/godot/assets/17522480/bd37e00f-44bb-4408-9b36-e3054f809a4f)
3. Attach the built-in script to the nodes with scripts below
![image](https://github.com/godotengine/godot/assets/17522480/9f28c64a-ea39-4cb6-901f-b5afd860e9f8)
```gdscript
extends Bundle.MyClass
  1. Export variables aren't shown in the editor. image
  2. Add a custom export for the built-in script itself.
    export var my_string_2 := ""
  3. The new export variable seems to work while the rest from parent classes don't. image

Minimal reproduction project (MRP)

BuiltInScriptExportBug.zip

SysError99 commented 6 months ago

Weirdly enough, if the built-in script gets inherited using a global class registration (class_name fields), the inherited class instead shows exports from the parent class instead of the internal class from the parent. And yes, it still works properly in runtime image image Snapshot: BuiltInScriptExportBug.zip