Add top-level @export to separate class_name. #63758
Open
+210
−78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes godotengine/godot-proposals#4493.
Depends on #62411. Can be rebased after it is merged.
It also involves a change to the filesystem cache just like #60606.
Modifies
@export
annotation in GDScript so that it can be used similarly to@tool
, but for the purpose of exposing a given class to the editor. Without it, the class will not be visible in theCreateDialog
orEditorResourcePicker
. This would be a compatibility-breaking change needed for 4.0 IF we do indeed want the default behavior ofclass_name
to not include editor exposure.Under the hood, I've added a
GlobalScriptFlags
enum to global script class information stored by theScriptServer
andEditorFileSystem
cache. It can have - for now - eitherGLOBAL_SCRIPT_NONE
orGLOBAL_SCRIPT_EXPORT
, with the potential for additional flags to be added over time (perhapsGLOBAL_SCRIPT_ABSTRACT
orGLOBAL_SCRIPT_STATIC
, etc.). Adding the@export
class annotation merely changes what value is exposed for theflags
value passed toScriptServer::get_global_class_name(...)
.Edit: I noticed that there was a template for creating VisualScriptNodes using GDScript that relies on
class_name
definitions. Should that functionality also be dependent on the givenGDScript
having the@export
class annotation?