This addon gives you access to global scripts using the class_name
keyword, while removing the unwanted behaviour of user-created nodes in the Create New Node
tab.
It is not very useful on its own, but it helps with this problem:
There are two ways to access the type of another script in one script.
The first is to preload
the script into a constant, which makes you write preload
a lot and can break because the path is hardcoded.
The second option is to use the class_name
keyword. This lets you access the script type without preloading it. However, it makes the Create New Node
tab cluttered, slows it down, and if the script only works in a specific scene, it will not load the scene when added with the Create New Node
tab. Instead, it will add a new node with only the script attached to it.
- Note that this addon only hides the nodes in the
Create New Node
tab, it does not disable/remove them. - The addon assumes that your scripts are in snake_case and the class_name name is the name of the script in PascalCase. (e.g. my_script.gd -> class_name MyScript)
- This addon is primarily intended for users who use the static typing (because duck typing is used with dynamic typing)
- Download the addon from GitHub or AssetLib.
- Copy the addons folder into your project if you downloaded it from GitHub.
- Enable the addons in your project settings.
- By default, the addon hides all user-created scripts with the
class_name
keyword. To keep custom scripts in theCreate New Node
tab, add the folders name containing the scripts to theclass_name_hider/excluded_folders
settings. - Click on the button
Project > Tools > Generate class_name Hider Profile
. - Add the generated profile to the
Editor > Manage Editor Features...
, click on theImport
button and select thehider_script.profile
. Click onMake current
if necessary.
The class that is hidden from the editor is in the `disabled_classes' array of the profile.
If you have any trouble:
- After adding excluded folders the tools may not be actualised, if the profile file still has excluded folder's script, try generating it again.
- After generating a profile, try removing all profiles from the Manage Editor Features window and re-importing the profile.
This project is licensed under the terms of the Mozilla Public License, version 2.0.