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

Error:Cannot get class 'ClydeDialogueFile' #46

Open
suiyubanbo opened this issue Jun 24, 2024 · 8 comments
Open

Error:Cannot get class 'ClydeDialogueFile' #46

suiyubanbo opened this issue Jun 24, 2024 · 8 comments

Comments

@suiyubanbo
Copy link

  • godot v4.2.1

When I import and open the plugin, there are errors ( Cannot get class 'ClydeDialogueFile'.)
000

thank you

@viniciusgerevini
Copy link
Owner

Hello @suiyubanbo . Does this happen every time you open godot or just on installation?

@suiyubanbo
Copy link
Author

Hello @suiyubanbo . Does this happen every time you open godot or just on installation?

hi,yes,it happens every time,I tried to create this file It doesn't work,Maybe I'm a new godoter don't know how to do it

@suiyubanbo
Copy link
Author

try once again,I find it happens whenever I save it (macos : command + s)

@viniciusgerevini
Copy link
Owner

Interesting. Are you still able to see the updated dialogue when running the game? I've been testing it on Linux, I'll try to run it in a MacOS clean install today.

@0Volcanon
Copy link

0Volcanon commented Jul 4, 2024

The error appears for each .clyde file in the project. So, 4 times for the examples provided and more for each file created. Removing all .clyde files from the project clears the error. For me, it only appears on project startup. I'm using Godot 4.3 beta 2.

@Wierdox
Copy link

Wierdox commented Oct 22, 2024

Same issue here. Godot 4.3, Win10, happens whenever saving and on initial launch of editor. Using latest addon version, the error doesn't seem to happen if I use Godot 4.2, like OP does, for some reason.

From my tests it started happening in commit #40, which sucks because it's a huge 8k line commit so I can't just eyeball where the issue could be.

@viniciusgerevini
Copy link
Owner

viniciusgerevini commented Oct 22, 2024

Yeah, this class was introduced on #40 . The main branch commit was squashed but you can still see the individual changeset here: d685beb

I looked into it briefly, and the issue on startup seems to be some concurrency issue with Godot, where it tries to load the files before the custom class is registered. I don't think there is much that can be done if that's really the case, but maybe there is something that can be done with the plugin startup.

@Wierdox you mentioned that also happens every time you save the file, which sounds like a related but maybe different problem. Would you be able to attach a minimal reproduction project so I can check if there is anything different? Does it fail to save the file or does it just print a warning?

EDIT: I just remembered that godot used to have a warning about implementing loaders with custom classes, so maybe that's just not supported. The good thing is that the custom class is only used to identify which files to load in the editor, but implementation wise it's just a rename of PackedDataContainer. This means that even with the warning, saving should still work just fine and that's probably being thrown while loading the file back.

@Wierdox
Copy link

Wierdox commented Nov 11, 2024

Thanks for pointing me in the right direction, though I was busy elsewhere for awhile.

My solution was to change import_plugin's func _get_resource_type(): from return "ClydeDialogueFile" to return "PackedDataContainer", and also deleting the clyde .import files since they become out of date. After that, I get zero errors on save or load, and the files still have the clyde icon and such.

I also tried for several hours to get it to work otherwise, but I couldn't figure it out. One thing I found curious is how the official docs only showcase custom load/save formats using c++, I wonder if the GDScript version has issues? Maybe related, I notice when browsing the source that it occasionally uses ClassDB in relation to get_resource_type(), which doesn't respect class_name declarations I think.

Also, see this relevant godot issue.

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

No branches or pull requests

4 participants