Open kodkuce opened 3 years ago
Other way around could be useful too, i.e. connecting autoload signal to a node.
For anyone looking for simple workaround, i made class you can attach to any node and just type path. it uses an array so you can connect multiple stuff, i use this mainly on buttons to connect to Singleton but can be used for anything i guess
Example on slider:
using Godot;
using System;
public class CustomNodeSignals : Node
{
[Export]
public string[] connections;
public override void _Ready()
{
foreach( string c in connections)
{
string[] parts = c.Split(';');
if( parts.Length == 3)
{
Node n = GetNode(parts[1]);
Connect( parts[0], n, parts[2] );
}
}
}
}
I tried to chop C++ source but from what i see, possible i got it wrong, but there connection is somehow attached prestart and i don't have ref to Singleton until runtime :(
I imagine this could also be expanded to cover a few other popups, like the "NodePath" popup dialog, though maybe each dialog with the missing singletons would need its own issue.
Describe the project you are working on: Project with singletons and signals
Describe the problem or limitation you are having in your project: I can not connect an signal to Singleton node mothod
Describe the feature / enhancement and how it helps to overcome the problem or limitation: So limitation is for each button i would now need to make a script and in script a method that will call that signal/delagate on Singleton instance...
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams: Hmm my proposal would work this way, we add a TextField named oweridePath that will be empty by default and ignored, but if you put text in it it will be used similar as connect method ".connect(, , )".
So this way i when i click on button_up() signal i can in oweridePath type /root/MySingleton/method
and it will work np :)
If this enhancement will not be used often, can it be worked around with a few lines of script?: My issue is i think this enchantment will be used a lot, cuz you can have a lot of signal connections, but ye you can create a class for each button just to connect it to SIngleton
Is there a reason why this should be core and not an add-on in the asset library?: Because adding one TextField in dialog has no bad effect