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

Improve type system and obsolete loading types by string path #2484

Closed
Shadowblitz16 opened this issue Mar 21, 2021 · 8 comments
Closed

Improve type system and obsolete loading types by string path #2484

Shadowblitz16 opened this issue Mar 21, 2021 · 8 comments

Comments

@Shadowblitz16
Copy link

Shadowblitz16 commented Mar 21, 2021

Describe the project you are working on

Non right now due to me running into bugs or missing features whenever I try to use godot

Describe the problem or limitation you are having in your project

Currently types are loaded with string paths which seems to be a issue in #2307

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Make the engine register custom types by name. this allows things like built in scripts to have class_name or tool keywords.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

class_name MyCustomType

var instance = MyCustomType()

If this enhancement will not be used often, can it be worked around with a few lines of script?

Most likely other languages load types by name and not by a filepath

Is there a reason why this should be core and not an add-on in the asset library?

It allows extending nodes into true custom types which can be linked in the header of a scene file

@Shadowblitz16
Copy link
Author

Shadowblitz16 commented Mar 21, 2021

I can't find the issue or user but can someone link this to willnationdev

@Calinou
Copy link
Member

Calinou commented Mar 21, 2021

cc @willnationsdev

@aaronfranke
Copy link
Member

You can already do what you want, you just need to add .new:

class_name MyCustomType

var instance = MyCustomType.new()

@Shadowblitz16
Copy link
Author

Shadowblitz16 commented Mar 26, 2021

@aaronfranke The main idea for this was so we didn't use string paths for inheritance and scenes.

everything could just be linked together with type names and we wouldn't need to worry about where files are.
one of the reasons I have a hard time using godot is due to the fact it has this weird artificial object oriented programming implementation even though its ideology is to be oop.

I mean nodes coded in gdscript aren't really inherited as much as just a script attached to a node.
and this makes it really awkward to make custom types because they don't feel like it and it still feels like your limited to what the engine can do under the hood.

Not only that but people can edit your script when you might not even want it to be visible but instead compiled into a package.

The final goal is to have true oop system where nodes don't attach scripts and everything is referenced by name.

I understand the devs of godot want to keep things easy but sometimes I feel they sacrifice the engines potential to do so and in this case its not easier.

@aaronfranke
Copy link
Member

@Shadowblitz16 My reply to you does not contain any strings. I don't understand what you mean.

@Shadowblitz16
Copy link
Author

Shadowblitz16 commented Mar 26, 2021

@aaronfranke yes I know. but I think scenes load types by file path don't they?

@fire fire changed the title Improve type system and obsoleate loading types by string path Improve type system and obsolete loading types by string path Mar 26, 2021
@me2beats
Copy link

Sometimes I really don't want to create custom types, for example when creating a plugin.
I just preload scripts by path.
This is a quite useful feature, so I don't think it shoud be obsolete

@Shadowblitz16
Copy link
Author

I'm closing my bad proposals

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

No branches or pull requests

5 participants