-
-
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
Expose ScriptServer & add all script class support. #44796
Expose ScriptServer & add all script class support. #44796
Conversation
b512788
to
820771c
Compare
Hi! It looks like something very useful, but I don't fully understand why :D Now all scripts with class_name register in ScriptServer and it will no longer be possible to write |
@DarkMessiah No, GDScript still has its global variables, but now there's an official Engine Singleton that makes these scripts available throughout the engine. So C#, NativeScript, and VisualScript can get a reference to the ScriptServer and do, e.g. in C#, |
That makes us close of proper Custom Resources in Editor using C# now that there's a reference for the C# Class names?
It's a temporary problem or it will never be done for 4.0 ? |
@vitorbalbio It means that, for this PR, it will never be done for 4.0. The feature itself, "being able to give names to classes and export custom resources" is something that may still happen for 4.0 or 4.1, but the way it will work will be different than how I'm doing it here because the manner in which this information will be gathered/tracked/updated/used by the engine will fundamentally change (but I don't know yet in what way). |
Also, maybe @Calinou you know(?), all of the failed builds complain about methods in the GDCLASS macro trying to override nonexistent base members, but idk what to do about that since I haven't touched any of that code. Is it just something that will resolve itself later? |
I don't know why that's happening, sorry. |
7d18822
to
b5ee44b
Compare
b5ee44b
to
3ba0aa4
Compare
This should be all ready for review now, afaik. I've worked out a lot of the kinks while developing and debugging custom resource support for all languages. |
Closing since this is now just included in its sequel PR #44879. |
This is is 3.2 port of #40147 since there are presumably going to be core changes that make these features inapplicable to 4.0.
I've created a demo of it:
Demo_GP22_3_2.zip
Relevant code samples:
VisualScript sample:
Output:
It seems as though the
is
keyword doesn't like to cooperate with non-GDScript script types on the right-hand side. Should I try to incorporate that into the feature? Iirc, it worked fine in my 4.0 demo project.Edit: Also, it looks like the C# glue generation code doesn't implement the
Get()
method for ScriptServer, so you have to useScriptServer.GetGlobalClassScript("MyGDClass")
, etc. instead.