-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix synchronization of global class name #92303
Fix synchronization of global class name #92303
Conversation
If this works, you will be a God amongst ots! :D |
a6528a8
to
5c01caa
Compare
I added some modifications to fix the issue #81615 |
a9f0a28
to
f2d352c
Compare
Found a problem in the is_ready condition in editor_node. Last commit should fix that. |
While I'm sure this change will be of help to many people, since it does seem to resolve the issue of scripts ending up in a perpetual state of error and needing to be resaved one at a time, it obviously does not change the actual order of This does however mean that importing from the command-line using There's also the issue of the more or less official (and fairly common) plugin pattern where you have a Both of these are of course largely "cosmetic" issues (as far as I can tell), since these errors seem to eventually get dealt with by your Anyway, again, I'm not saying this change shouldn't be merged, and I wouldn't/shouldn't be the judge of that in the first place, but I figured I'd bring this up in case it hadn't been considered already, or if there's some discussion to be had about a more holistic solution. |
Thanks @mihe for your detailed response and to take the time to test my modifications. I'll try your autoload-plugin-errors.zip and see if I can do something about the error messages. If I understand correctly, with this fix, you have error messages in the console and output panel (and potentially a lot of them), but with the |
Just to clarify, the issue with the errors in the two scenarios ( Those two scenarios also seem largely orthogonal to the issue of needing to resave files individually. I honestly haven't run into the issue of files needing to be resaved much myself, but when testing your PR on the repro in #75388 I seemed to observe that having been fixed. Don't quote me on that though. :) But yes, the error messages show up in the console in both scenarios and the output panel for the plugin scenario, if by console you're referring to a command-line terminal. |
Thanks for the clarifications :) |
A holistic solution is vital. If class_name is not immediately and always respected, then what is the point of class_name? All class_names, no matter their origins, must be known at all times. |
I totally agree with that. Actually, the way I see it, the only way to really do that would be to remove completely the global_script_class_cache.cfg and reload all the class on startup from the code. I don't why it was not done like that from the beginning, maybe for performance issue? Just today I think I saw 2-3 news issues linked to global script class. I can try to implement it that way if everyone thinks that's a good idea? I'm a pretty new contributor, I usually try to limit the amount of code I touch, but I'm welling to try! |
I don't know why there's a cache file either, but I guess it was for speed. Perhaps moving it out of the dot-godot directory could be an answer; but that would involve merging it with other class caches that come from plugins and general project churn. That sounds like hell. The simplest way feels like, on startup, grepping all the resource and gdscript files for 'class_name' and thence into a hash map. |
f2d352c
to
353a8dd
Compare
353a8dd
to
7d93e47
Compare
I took your advice @mihe and @donn-xx and I’m pretty happy with the result. This commit removes the need for I tested with a project having 3000 gdscripts of 22ko each. At first, it took 10 sec to parse every file at startup. After a bit of debugging I found out that the complete file was parsed just to find the class_name and the icon. I added a new parameter to the With this modification the test project from @mihe loads without any error or warning event if the .godot folder is missing or the |
I am holding my breath! So excite! |
This comment was marked as off-topic.
This comment was marked as off-topic.
That's not relevant to this so please stay on topic |
7d93e47
to
85854c5
Compare
81f9a39
to
9a29c95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changes look fine overall. I tested it in various scenarios and a complex project and the script cache works correctly.
Aside from the last comments I left, there code could get more const
s for some pointers/Strings, but it's not really important.
9a29c95
to
39369db
Compare
@Hilderin Don't hesitate to come chat in the developers chat! Especially for such a big PR! :) |
I've made some test builds to help validate this PR, in hope that some Godot users could try it out on their projects before we include it in the next 4.3 beta. I built the editor for Windows, macOS, and Linux, with:
To test and help validate this PR:
If your project generally works well in current 4.3-beta / 7907ef8, try to use the build from #92303 to do some development work like creating new global classes, renaming some, etc., to find potential bugs. If your project doesn't work at all with either build (vanilla |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did some testing on various projects and it seems to work well for me.
I also got reports from various users testing it and they either saw improvements, or no new issue in their daily workflow, which is also a good sign.
So let's give it a spin and see how it fares in 4.3-beta3.
Thanks! Amazing work 🎉 |
Thanks for your help and support!! |
Sorry for being away. Have just done my first few tests for this fix and it's looking real good. I'll poke at my addon project and keep notes. |
This should fix the issues #76380, #75388, #81615 and #92054
This should manage these situations:
The global class name are now loaded from the scripts at the editor startup, always recreating the global_script_class_cache.cfg. When not in the editor, the global_script_class_cache.cfg is used for performance when the project runs.
Bugsquad edit:
class_name
results in errors #92054Edited: Adding modifications for the issue #81615
Edited: Updating for the modifications loading class name at startup from scripts.
Edited: Adding modifications for the issue #92054
Edited: Adding fix for deletion of folders