godot icon indicating copy to clipboard operation
godot copied to clipboard

Implement hidden class in ScriptServer to replace EditorX class being hidden.

Open ajreckof opened this issue 1 year ago • 2 comments

Implements godotengine/godot-proposals#1047 This is the ScriptServer counterpart of #90765

This enables marking scripts as hidden for any ScriptServer. I have done the GdScript implementation (similar to @tool) but have yet to do the same for C# (never built or even used C# so might need some help with that).

For the GdScript syntax this is what I went for as a recommended syntax

@hide class_name CustomClass
extends RichTextLabel

but any place before class_name would work except for this

extends RichTextLabel
@hide class_name CustomClass

ajreckof avatar Apr 22 '24 16:04 ajreckof

So I've added the C# implementation and separated the C# and Gdscript implementation into their own commits separate from the base one introducing the change in ScriptServer for easier reviewing (could be squashed later). I'm not sure where to document the new C# attribute if someone could indicate the right place to put it ? (maybe it should be in the godot-docs repo?)

ajreckof avatar Apr 23 '24 19:04 ajreckof

I'm not sure where to document the new C# attribute if someone could indicate the right place to put it ? (maybe it should be in the godot-docs repo?)

The XMLDoc in the C# files should be the equivalent to the documentation you added in @GDScript.xml. For additional documentation you could add it to godot-docs: GDScript reference: Registering named classes for GDScript and C# global classes for C#.

raulsntos avatar Apr 23 '24 20:04 raulsntos

Hi there @ajreckof, my friend! I made a PR not knowing about yours.

I saw your code and it seems very complicated compared to my version. I don't know why we should bind the "hidden" property only to global classes, as it can simply be a boolean set the same way @tool sets is_tool to be true in scripts.

adamscott avatar Aug 20 '24 13:08 adamscott

Why would you hide a script that is not a global class? Those are already not shown in the Add Node/Create Resource dialogs.

raulsntos avatar Aug 20 '24 14:08 raulsntos