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

Editor spams "Class name cannot be empty." error when sorting by type. #85698

Closed
Grix opened this issue Dec 3, 2023 · 7 comments · Fixed by #86064
Closed

Editor spams "Class name cannot be empty." error when sorting by type. #85698

Grix opened this issue Dec 3, 2023 · 7 comments · Fixed by #86064

Comments

@Grix
Copy link

Grix commented Dec 3, 2023

Godot version

v4.2.stable.mono.official [46dc277]

System information

Godot v4.2.stable.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.2698) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)

Issue description

Recently it started to happen that whenever I save my project in the editor, or other similar actions, the editor hangs for a second and I get hundreds of error messages in the log, saying "Class name cannot be empty".

When opening Godot from the terminal, the error message elaborates slightly that it comes from this line: https://github.com/godotengine/godot/blob/master/editor/editor_node.cpp#L4441

One thing I noticed is that it only seems to happen when I sort by type in the filesystem window. When sorting by name (default), I have not seen it happen yet.

I have no idea where in my project this error comes from, because the message doesn't say. It seems to be from the editor trying to find an icon for custom classes? But which class, and what would be wrong with said class? I don't know if it's user error on my part but I'm reporting as a bug to be sure.

I was able to delete a lot of my assets from a test project and only keep some textures mostly, and it still happens (although with fewer messages). When I delete the textures folder also, the issue stops entirely. So we at least know that some of the textures are some of the culprits (but not all). You probably need a .NET version of Godot to open the project, but maybe not since you don't need to actually compile to see the bug.

Steps to reproduce

  1. Open the project
  2. In the filesystem window, set sort to "Sort By Type" (either ascending or descending is fine).
  3. Observe 108 error messages in the output window.

Minimal reproduction project

[removed]

@MrBlockers
Copy link
Contributor

MrBlockers commented Dec 4, 2023

I started looking into this, adding this here for any contributors more savvy with the filesystem dock

struct FileSystemDock::FileInfoTypeComparator {
bool operator()(const FileInfo &p_a, const FileInfo &p_b) const {
// Uses the extension, then the icon name to distinguish file types.
String icon_path_a = "";
String icon_path_b = "";
Ref<Texture2D> icon_a = EditorNode::get_singleton()->get_class_icon(p_a.type);
if (icon_a.is_valid()) {
icon_path_a = icon_a->get_name();
}
Ref<Texture2D> icon_b = EditorNode::get_singleton()->get_class_icon(p_b.type);
if (icon_b.is_valid()) {
icon_path_b = icon_b->get_name();
}
return NaturalNoCaseComparator()(p_a.name.get_extension() + icon_path_a + p_a.name.get_basename(), p_b.name.get_extension() + icon_path_b + p_b.name.get_basename());
}
};

Interesting to me that the actual icon name is used as a sorting heuristic. I guess this is for when you have multiple of the same filetype, but imported as different resource types? Could it just be the FileInfo::type instead and not need to lookup the icon?

@jsjtxietian
Copy link
Contributor

Is the mrp link still valid? For a simple fix we can just check if the type an empty string.

@Grix
Copy link
Author

Grix commented Dec 12, 2023

Is the mrp link still valid?

It should be, nothing has changed

@jsjtxietian
Copy link
Contributor

It should be, nothing has changed

Maybe it's due to my internet connection, but I can't open the link right now. I suspect it has something to do with your textures but can get them right now lol.

@Grix
Copy link
Author

Grix commented Dec 12, 2023

It should be, nothing has changed

Maybe it's due to my internet connection, but I can't open the link right now. I suspect it has something to do with your textures but can get them right now lol.

Does this work instead: https://drive.google.com/file/d/1Y1U62zis-4hGtvpwShk8OqJcIuF0zf-d/view?usp=sharing

@jsjtxietian
Copy link
Contributor

jsjtxietian commented Dec 12, 2023

Yes thank you!

There will be cases when the type are all empty ( import as keep file no import) :

image

@erik1801
Copy link

Thanks helped me a lot :)

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

Successfully merging a pull request may close this issue.

6 participants