Refresh signal connections in editor?

Godot Version

4.4-stable

Question

I’ve got a node with an @tool script to automate signal connections for certain nodes with a common set of signals: you give it a target node and it connects a bunch of signals from the source node to the target. The problem I’m having is that after I do that signal connection through the script, the signal pane in the editor doesn’t refresh, and I need to click away and click back to the node before I see the connections. That’s kind of inconvenient. Is there some method I can call to refresh the signal panel after I make those connections?

My first thought was notify_property_list_changed, but for whatever reason that doesn’t seem to refresh signal connections.

You need to use CONNECT_PERSIST when connecting the signal.

@tool
extends Node


func _ready() -> void:
	$Area2D.body_entered.connect(_on_body_entered, CONNECT_PERSIST)


func _on_body_entered(body:Node2D) -> void:
	pass

1 Like

Sorry, I was unclear. Your example is the reverse of what I’m talking about: I’ve got a node selected, then I run the script to connect that node’s signal to a method of another node. The signal is connected correctly behind the scenes, but the editor’s signal dock doesn’t reflect this until I unselect & re-select the node.

See this demonstration. (Also, how do I embed video? I’m new here. Sorry!)

I would expect the signal dock to be updated immediately, but it isn’t updated until I re-select the node.

I was just reloading the scene so the _ready() function gets executed in that video. It’s basically doing the same as you do.

The signal gets connected correctly, it’s just that the Signals dock is not updated until you re-select the node. I don’t think there’s a way to update it without jumping a few hoops. Feel free to open an issue if there isn’t one already open for that.

1 Like