-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
[Feature Proposal]: Allow add_custom_type to register new 'engine-like' types #17093
Comments
@Web-eWorks @reduz The issue at hand here is that reduz doesn't want to have custom type information tracked by the core of the engine, and I think I finally get WHY. What you and I think of as "custom types" are really just the ability to assign script constraints on an Now, the The big question right now is whether @reduz will permit us to setup the script constraints on the All I need to do is create corresponding namespacing / custom type definitions in the The other big issue is, even if @reduz acquiesces to let |
@willnationsdev I think I get what you are thinking of - just restricting it to a script that inherits the 'base script'. That's fine, and maybe that's even a better idea. My idea was to bundle a base class and a If the parties involved want to go with your idea, then this issue can be archived for later reference, perhaps to be re-opened when I actually get an implementation for my idea. |
IMO, this is getting a bit overwhelming to understand. It needs to be reduced, reduced and reduced again. I believe this is a case of |
@Web-eWorks And that might have worked in another setting, but the whole reason I am abandoning that concept (which would require |
@girng It is, in the reduced sense, the request for...
On a basic level, that is the main "want". On a secondary level, building on those ideas, is an additional desire for namespacing the script global identifiers, so that engine types, a game's scripts, and each of the plugins' scripts can all have global identifiers in GDScript without having name collisions. That's the short version of everything. |
@Web-eWorks I think I just figured out the best solution that meets reduz's needs as well as ours. I wrote it in the original Issue, but I'll re-post it here for more easily locating it. Content: So, just reviewing some of the information in
This would allow us to keep both Then all you'd need to do is define |
Alright then. Closing this to be revisited later. |
A more concise version of #6067, as that is slightly confusing and long.
The point of the feature is to allow the mechanism for registering custom types in GDScript -
EditorPlugin::add_custom_type
, (as well as creating a mechanism for PluginScript/GDNative) to create 'engine-like' types. I'll explain what those are in a moment.Currently
add_custom_type
is a thin factory for creating a node and assigning a script to it - a functionality already present via instancing of Scenes. The only 'custom type' related feature currently present is that it adds an entry in the Create A Node dialog.An 'engine-like' type - for the purpose of this issue - is a custom type defined by GDNative / PluginScript / GDScript that extends an Engine class. (Likely either Resource or Node and its subclasses.)
'Engine-like' types may have scripts assigned to them as is normal for an engine or 'built-in' type, and shall transparently execute the functionality of the 'base script', regardless of whether a script is assigned to them or not.
'Engine-like' types will be present in the Create A Node dialog as normal (if they inherit from Node).
An 'engine-like' type is not a C++ type compiled into the engine, nor are they designed to allow C++ types compiled into the engine to inherit from them. They are, however, intended to allow a plugin - written in GDScript, GDNative, Mono, PluginScript, etc. to extend the engine's built-in type list with useful types, without having to code and compile the types directly into the engine.
A 'base script' is the custom behavior, implemented in GDNative, PluginScript, GDScript, or similar, that is bound to the custom type when the type is registered. This script or behavior shall, like C++ classes, always be executed and shall transparently behave like a C++ class to the perspective of the user.
Thus, a custom type with a script attached shall execute both the base script and the 'user' script, regardless of whether the 'user' script inherits directly from the 'base script' or a class higher in the inheritance tree, following the normal conventions for executing parent-class methods.
Creating 'engine-like' types that inherit other 'engine-like' types shall follow the above behavior, including that each 'engine-like' type in the inheritance hierarchy shall have their 'base scripts' executed as is normal for 'built-in' inheritance trees.
'Engine-like' types shall be loaded as early as possible in the engine lifecycle, to allow custom Resource types to be loaded from disk without issue.
TL;DR: You can define custom types and resources in a way that just works. More better, less hassle.
Implementation features:
Pinging @willnationsdev, @Zylann. Did I miss anything? If I did, please get it to me ASAP.
The text was updated successfully, but these errors were encountered: