-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Implement hidden class in ScriptServer to replace EditorX class being hidden. #91020
base: master
Are you sure you want to change the base?
Conversation
e81494b
to
3dfb4c7
Compare
3dfb4c7
to
350113e
Compare
2b9fb92
to
3ab8c2a
Compare
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 |
modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/HideAttribute.cs
Outdated
Show resolved
Hide resolved
modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/ScriptManagerBridge.cs
Outdated
Show resolved
Hide resolved
The XMLDoc in the C# files should be the equivalent to the documentation you added in |
83ae3b8
to
8bb2abd
Compare
modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GlobalClassAttribute.cs
Outdated
Show resolved
Hide resolved
8bb2abd
to
f5092bc
Compare
<annotation name="@hide"> | ||
<return type="void" /> | ||
<description> | ||
Prevent the current class from appearing in the Create Node dialog. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also applies to Create Resource etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine on editor side.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The C# changes look good to me. It works as expected when using it with C# scripts.
core/object/script_language.cpp
Outdated
@@ -429,6 +431,10 @@ void ScriptServer::remove_global_class_by_path(const String &p_path) { | |||
bool ScriptServer::is_global_class(const StringName &p_class) { | |||
return global_classes.has(p_class); | |||
} | |||
bool ScriptServer::is_class_hidden(const StringName &p_class) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bool ScriptServer::is_class_hidden(const StringName &p_class) { | |
bool ScriptServer::is_class_hidden(const StringName &p_class) { |
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 |
Why would you hide a script that is not a global class? Those are already not shown in the Add Node/Create Resource dialogs. |
I fully agree we first need to get the parent PR merged which I just rebased and answered the last concern. After that we can get this one merged. It would have been great to add this one to 4.4 but unfortunately I was too taken with work and I couldn't push for it. |
f5092bc
to
59d0fcb
Compare
59d0fcb
to
d52b9e9
Compare
d52b9e9
to
6f1f1fc
Compare
ERR_FAIL_COND_MSG(p_class == p_base || (global_classes.has(p_base) && get_global_class_native_base(p_base) == p_class), "Cyclic inheritance in script class."); | ||
GlobalScriptClass *existing = global_classes.getptr(p_class); | ||
if (existing) { | ||
// Update an existing class (only set dirty if something changed). | ||
if (existing->base != p_base || existing->path != p_path || existing->language != p_language) { | ||
if (existing->base != p_base || existing->path != p_path || existing->language != p_language || existing->language != p_language) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new condition seems to be a duplicate.
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
but any place before class_name would work except for this