Open Lazy-Rabbit-2001 opened 9 months ago
While interesting as an idea the serialisation and construction of Callable
and binding to them isn't trivial, and that's why they aren't available here, there's various possible issues with it
Worth investigating but it's quite complicated to handle
Closed this proposal for the limitation mentioned in the previous post.
Please don't mark this as archived
becasuse this post would be reopen one day the tech gets improved.
Please don't mark this as archived since this proposal could be reopened in the future.
I prefer marking any proposal that hasn't been implemented as archived
for organizational purposes. We can remove the label later if you decide to reopen it :slightly_smiling_face:
I came up with an idea, but not the best performance-booster:
We can have something to get the memeber and callable by String
or StringName
in the signal connection dock, for example:
==== Passed-in Members ====
Argument1: [member's name here] (`String` or `StringName`)
==== Passed-in Methods ====
Argument1: [method's name here] (Same)
Then at the post-initialization or initialization of the node, get the memebers and methods from these String
s or StringName
s and passes them in the ready-to-connect signals correspondingly. As String
s and StringName
s are more easy to be serialized and saved in .tscn
, I think this could be a better idea than getting members or methods directly.
Describe the project you are working on
Any project, with signal frequently used
Describe the problem or limitation you are having in your project
Currently, only static data can be passed as parameters of a signal in the signal dock: They are bool, int, float, String, Vector2/3/4(i), Rect2(i), Transform2D/3D, Plane, Quaternion, AABB, Basis, Projection, Color, StringName, NodePath, Dictionary and Arrays(including PackedArrays), which are certain numbers.
However, as the frequency of signal connection in the editor grows, it's not sufficient to only allow the static data to be passed as parameters in the signal connection in the signal dock, but more expected to add something dynamic, like members and methods to make the signal connection more flexible in the editor.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add two options in the advanced mode of signal dock: Extend the dock right and add two column containers: Passed-in members and Passed-in methods, by the right side of which are added two buttons:
Add from Node
andRemove
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
When the button
Add from Node
is pressed, there will be a pop showing the node tree, and the developer can choose one node from it, after which a new pop will display, listing the members/methods of the node, and he/she can double click on the one he/she needs to add and there will be a column created, with letters in this form:(The way works almost the same for passed-in methods container)
And if a user wants to remove the passed-in param, just choose the column and click
Remove
Note: The order of each column is strictly mapped, which means that the order of the column is the order of the params to be passed into the connected method(s)
If this enhancement will not be used often, can it be worked around with a few lines of script?
No, because this is related to core of editor, and needs to write from source code
Is there a reason why this should be core and not an add-on in the asset library?
No, the reason is the same as the previous chapter