Skip to content

Root Type property of imported models is set incorrectly when using custom global classes #122547

Description

@EtiTheSpirit

Tested versions

v4.7.1.stable.mono.official [a13da4f]

System information

Godot v4.7.1.stable.mono - Windows 10 (build 19045) - Multi-window, 3 monitors - Direct3D 12 (Forward+) - dedicated NVIDIA GeForce RTX 3070 Ti (NVIDIA; 32.0.15.9186) - Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz (20 threads) - 31.85 GiB memory - WASAPI (44100 Hz, Stereo/mono)

Issue description

When attempting to set the "Root Type" import property of a model to a custom global class, the importer dialog will set the property value to the path (res://...) of the script file, not its global class name.

This results in the message "Cannot get class 'res://whatever/etc'." being displayed in the console. Trying to instantiate the imported model will not use the custom type.

This does not occur when using built-in classes. Only custom ones.

Steps to reproduce

  1. Create or locate a 3D model file of any kind that can be imported by Godot.
  2. Create a new script, in either GDScript or C#. The script must be a global class.
  3. Edit the import settings of the model file. In its "Root Type" property, select your custom global class.
  4. The value of the property will be set to a res:// path instead of the name of the class. An error will be raised in the console Cannot get class 'res://whatever/etc'.

This can be bypassed by editing the .import file by hand, and replacing the value of nodes/root_type to a string of the class's global name, as opposed to its path.

Minimal reproduction project (MRP)

custom_type_repro.zip includes a scene with a cube attached to a single armature. The import settings of this model are set to the custom type as defined by GDScript. The two custom node types are called CustomType and CustomTypeButGDScript for C# and GDScript respectively. Select either of these two for the "Root Type" property to cause the error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions