-
-
Notifications
You must be signed in to change notification settings - Fork 97
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
Addon (plugin) nodes cannot have custom scripts or receive signals #2420
Comments
I don't understand the issue whatsoever. First of all, it talks at the same time about instancing nodes within a plugin and about declaring custom types from a plugin, which are two different things. But in both cases you can use signals and whatnot. It seems to me you miss something in understanding how plugins work, not that there is an issue or a missing feature in the engine. Please describe your problem/limitation in more detail. |
Yep perhaps you are correct! Here's an example of one of my plugin nodes. Note that when I try to add an incoming signal to that custom node, it is inaccessible in the tree (meaning I can't add the signal there) Here's the code used to generate that editor plugin: tool
extends EditorPlugin
func _enter_tree():
add_custom_type("cs-Data Source", "MarginContainer", preload("data.gd"), preload("icon.png"))
func _exit_tree():
remove_custom_type("cs-Data Source") Am I doing something wrong there? |
Indeed, there is such a limitation. The problem is that custom nodes are not treated the same as built-in nodes, which means that, basically, this node already has a script, and you cannot override it. There are several proposals linked to this problem but everything more or less comes to #22 and a better type system for custom type. As a workaround you can, for example, set up an exported property for a custom script. It can be a script extending
I don't connect signals from the UI, so I'm not sure why it looks like that and what can be a limitation. It shouldn't, IMO, be grayed out and unaccessible. |
If i remember correctly, you can still at least extend from the custom script. That's what I do when I want to add code to a plugin node. |
Yep I'm already following this pattern as seen in the screenshot above. The problem with Signals still exists however, as I cannot send signals to that child script (or child node)
I can extend from a custom script in my Addons folder, but that means I lose the nice features of the EditorPlugin, and the node does not have the custom icon etc. |
Seems like this signal thing is closer to a bug report if that should be working |
Current workaround for signals seems to be just double clicking on the addon node, it does not show as clickable but works when you double click. I've marked this as a bug here: godotengine/godot#46772 Thanks guys! |
Describe the project you are working on
I would like to make some of my more common utilities into addons (plugin), so they can be reused across different projects.
Describe the problem or limitation you are having in your project
When instancing a node from a plugin, that node cannot accept a new custom script (as the plugin itself is a script)
The instanced plugin cannot receive any signals from other nodes either, which makes it very hard to make them useful.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
I would like to be able to use
.tscn
files as the root of the plugin.add_custom_type
would support.tscn
files instead of only.script
filesDescribe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
Pretty much as above, add_custom_type would support
.tscn
If this enhancement will not be used often, can it be worked around with a few lines of script?
I've not found a workaround for this
Is there a reason why this should be core and not an add-on in the asset library?
It's part of the editor plugin system
Related
The text was updated successfully, but these errors were encountered: