You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
There are specific snippets of code that query Godot's type system for various purposes.
Check if a class A exists.
Check if class A inherits from class B.
Get the base class of A.
Get the native base class of A.
Get the Script associated with class of name A (if any).
Instantiate class A.
Find the name A associated with a resource file path P (if any).
These sorts of checks may involve different backend data structures from different sources (ClassDB, ScriptServer, EditorData custom type map, evaluating a particular Script resource or Object instance).
The checks may involve completely different algorithms depending on whether the request takes place in an editor context or not (e.g. script path to name lookup is cached in Editor context).
Each time a query of this nature is needed, the local code manually checks each applicable data source and performs inline logic for how the results of the sub-queries map to the desired result of the overall query for that use case. However, most of the time, this logic is identical and can be generalized. Currently the code is usually duplicated completely (adding to maintenance work over time) or inaccurately (leading to logical errors that need fixing).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Just like how similar checks for class-name-based editor icon lookups were abstracted into EditorNode::get_class_icon and EditorNode::get_object_icon, we should add a TypeServer singleton that abstracts and consolidates all logic for the 7 operations mentioned above and replaces all code in the codebase that attempts to deal with such operations. This will reduce the maintenance burden on core devs and improve both the clarity and readability of code throughout Godot Engine's codebase.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Add TypeServer singleton that abstracts class-related query methods.
Find and replace all references to ClassDB, ScriptServer, and EditorData custom type method calls that deal with the aforementioned query methods.
If this enhancement will not be used often, can it be worked around with a few lines of script?
Is there a reason why this should be core and not an add-on in the asset library?
Relates only to internal engine operations. Irrelevant to script code.
The text was updated successfully, but these errors were encountered:
Describe the project you are working on
Working on godotengine/godot#44879 and godotengine/godot#48201, among many other related things.
Describe the problem or limitation you are having in your project
There are specific snippets of code that query Godot's type system for various purposes.
These sorts of checks may involve different backend data structures from different sources (ClassDB, ScriptServer, EditorData custom type map, evaluating a particular Script resource or Object instance).
The checks may involve completely different algorithms depending on whether the request takes place in an editor context or not (e.g. script path to name lookup is cached in Editor context).
Each time a query of this nature is needed, the local code manually checks each applicable data source and performs inline logic for how the results of the sub-queries map to the desired result of the overall query for that use case. However, most of the time, this logic is identical and can be generalized. Currently the code is usually duplicated completely (adding to maintenance work over time) or inaccurately (leading to logical errors that need fixing).
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Just like how similar checks for class-name-based editor icon lookups were abstracted into
EditorNode::get_class_icon
andEditorNode::get_object_icon
, we should add a TypeServer singleton that abstracts and consolidates all logic for the 7 operations mentioned above and replaces all code in the codebase that attempts to deal with such operations. This will reduce the maintenance burden on core devs and improve both the clarity and readability of code throughout Godot Engine's codebase.Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
If this enhancement will not be used often, can it be worked around with a few lines of script?
Is there a reason why this should be core and not an add-on in the asset library?
Relates only to internal engine operations. Irrelevant to script code.
The text was updated successfully, but these errors were encountered: