Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDScript 2.0: @export_node_path() does not support custom classes #54284

Closed
mrawlingst opened this issue Oct 26, 2021 · 2 comments
Closed

GDScript 2.0: @export_node_path() does not support custom classes #54284

mrawlingst opened this issue Oct 26, 2021 · 2 comments

Comments

@mrawlingst
Copy link
Contributor

mrawlingst commented Oct 26, 2021

Godot version

4.0.dev (f113dc9)

System information

Windows 10

Issue description

When trying to use the new annotation for export variables @export_node_path(), it does not appear to support custom classes defined by the user, only predefined classes/nodes (i.e. Label, Sprite, etc.)

Steps to reproduce

  1. Add a node as root
  2. Create new script and attach to the root - Main.gd
  3. Add a new Label node under root
  4. Create a new script in Filesystem view - TestClass.gd
  5. Open TestClass.gd script in editor
  6. Give it a class name: class_name TestClass just under extends <NODE>
  7. Open Main.gd script in editor
  8. Add an export variable: @export_node_path(Label) var labelNodePath = NodePath()
  9. Add another export variable: @export_node_path(TestClass) var customNodePath = NodePath()
  10. Add a new TestClass node under root
  11. Save scene
  12. Select root node and observe both export property
    - Label Node Path - all but one node is greyed out, the singular node is a Label and can be selected
    - Custom Node Path - all nodes are greyed out and no nodes are selectable

The expected result is to be able to select the custom node (TestClass) inside NodePath window.

Minimal reproduction project

ExportNodePathCustomClass.zip

@Calinou Calinou added this to the 4.0 milestone Oct 26, 2021
@Calinou Calinou changed the title @export_node_path not supporting custom class GDScript 2.0: @export_node_path() does not support custom classes Oct 26, 2021
@poiati
Copy link
Contributor

poiati commented Nov 22, 2021

I was exploring this issue. This is related to #21789. The engine does not recognize GDScripts as named classes, it fallbacks to the first native node in the hierarchy tree. I'm wondering how we should move forward here.

@stephannv
Copy link

I think this can be closed. I downloaded the MRP and it's already possible to select the custom node.

Note: It is necessary to change TestClass to "TestClass" due this issue: #72192

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants