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

Annotation to Hide Node with class_name Displaying in the Node Dock #7349

Closed
Lazy-Rabbit-2001 opened this issue Jul 22, 2023 · 2 comments
Closed

Comments

@Lazy-Rabbit-2001
Copy link

Describe the project you are working on

A random 2D project, with class_name highly used.

Describe the problem or limitation you are having in your project

When making a new scene and giving it a script, I prefer to use class_name so that other scripts can get access to the class by its name. As time goes by, the project started being larger and larger, with nodes headed with class_name shown more and more in the node dock when I want to create a new node, which is annoying because I have to surf through tons of nodes and select one I want. However, the actual situation is that some nodes are unnecessary to get displayed in the dock, but they keep class_name as the head assignement so that every node can have access to the script via its name following class_name, which is convenient.
So, how to make both situation together standing?

  1. class_name keeps still in the script
  2. the class extending from Node assigned with the keyword won't be shown in the node dock

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

So we can implement a new annotation @hide_global that modifies the keyword class_name, so that the node will have no displaying in the dock window.

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

When you have written a script extending from Node with class_name, just put the annotation @hide_global ahead of it.

extends Node
@hide_global
class_name TestClass
...

After the assignment, you will see the node not shown in the dock anymore

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

  1. I don't think it will get less used; instead, I believe most people want this feature implemented
  2. This implement is not coverable with some lines of code; instead, before we have this, we need to extend a node via its file path, and when we need to get access to the class, we need a const or var to preload() or load() its path and use the identifier as its name of access, which is very complex to operate.

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

First, most of the people want this feature implemented, so that they can not only get rid of disgusting nodes displaying in the dock, but also keep class_name work, make the script/class extendable and improve the convenience of operation of access to other classes

@Lazy-Rabbit-2001 Lazy-Rabbit-2001 changed the title Annotation to hide node with class_name displaying in the node dock Annotation to Hide Node with class_name Displaying in the Node Dock Jul 22, 2023
@theraot
Copy link

theraot commented Jul 22, 2023

Related:

@dalexeev
Copy link
Member

Duplicate of #1047 and #4493.

#1047 proposes the same solution but with a different name (@no_editor annotation). Let's close this so as not to fragment the discussion even more. Thanks for your contribution nonetheless.

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

4 participants