-
-
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
Add TypeDB. Refactor Custom Types, CreateDialog. #27566
Conversation
ee8ef6a
to
1a20eef
Compare
I am not completely against abstracting this because the logic for the create dialog could be used also in the resourece editor. However, it should be a very simple function to abstract parentship and it should never hide that the typet comes from a script. So, what is needed is not even close to a db. |
@reduz well, the reason I called it a DB at all was because the entire purpose of it was to cache what the inheritance relationships are, to prevent us from having to recompute which named types (script or engine class) are inheriting which. It is precisely attempting to figure all this stuff out at runtime that causes the CreateDialog to lag so badly when you add more and more script classes. Because I'm caching the information in this class in EditorData, there is no need to recompute inheritance hierarchies for every class every time the Tree in CreateDialog updates. Instead it simply looks up names in a HashMap. That's the only reason I made it a "DB" in the first place. When I was testing things, going with the traditional "if it's a script, check for script inheritance stuff" at runtime wasn't cutting it. |
Also, custom types currently display themselves in the CreateDialog with just the name, no filename next to them. This change causes them to display themselves just like script classes, so it actually removes ambiguity between scripted types and engine types further. Every record in the TypeDB has a path to the script matched with it. Engine types will have an empty path, so it is still very easy to check whether a given name belongs to a script vs. an engine class. I don't believe there is a lack of clarity on the part of the user here. |
Are you suggesting that I just update the method names to have specific |
ae78c3e
to
73638cc
Compare
Or maybe, reduz, you'd prefer that I make the TypeDB thing only contain information about the scripted types, so that it gives the appearance of not knowing anything about the C++ classes, i.e. make it a ScriptDB or something? |
It does not need to be a DB because you don't need to cache anything, this is not a performance problem at the moment, but more of a "Just give me anything that inherits from this, including custom types" function. |
Could this be cherrypicked for 3.1.2? Also the script loading for the database at start of the editor isn't so friendly with autoload classes, preload and some scripts, here are some of the error logs in my project at start with this patch:
utils and save_manager are autoload classes |
@HeartoLazor Thanks for the visual demonstration! I will try to look into the issues you brought up when I get a chance. I have a few PRs that need work and not a lot of time, but I'll switch to prioritizing this one. |
Well hopefully things get resolved. I do recall when I tried using |
@willnationsdev Hey here is a minimal test project with all the errors, those errors only happens with this patch. Tested using as base 3.1.1 stable, and some of them happens when I press play too. |
Does this have to do with custom types defined via |
@aaronfranke There are no user-facing changes to custom types involved here (no changes to the API). The backend implementation is just swapped to index custom type records by their class name (to easily pinpoint single records or look up parents) rather than by checking all the direct descendants of engine classes. This change also enables custom types to extend each other rather than only have a single level of inheritance from engine types. For the CreateDialog, aside from potentially seeing custom types inherit each other, there are no visual differences that users will see; only the performance of the dialog itself is improved (so no more lag). This has to do with both custom types and class names. Strictly speaking, when you have many user-defined types with names defined, the CreateDialog becomes too slow, so this contains changes to how the data is organized and cached to ensure that the user experience is smoother. |
Any progress on this? I'm experiencing the same performance issue, I'm considering unexposing some of the classes but I'd eventually end up with @HeartoLazor's situation anyway. |
There has not been much progress on this, but I plan on returning to this issue very soon. |
73638cc
to
5c35ab5
Compare
What's the status on this PR? Many of the issues it referenced are now closed, and I remember @reduz was not keen on adding a TypeDB API. I'm not saying this is not a good solution though, but we need to clarify what are the exact problems that this aims to solve in the current master branch, provided that they are still relevant. |
@akien-mga Most of this content is planned to be re-implemented entirely differently to fall in line with godotengine/godot-proposals#22 and godotengine/godot-proposals#68, some of godotengine/godot-proposals#43, etc. So this can really be closed as it will never be merged. |
ClassDB::can_instance(type)
returnsfalse
.Closes #27333, #24557, #24041 (Issues). Closes #25675 and #25676 (PRs).