Check out our latest project ✨ OpenChapter.io: free ebooks the way its meant to be 📖

Dynamic Connection: Remove Signal Connection Boilerplate

An asset by TamerSoup625
The page banner background of a mountain and forest
Dynamic Connection: Remove Signal Connection Boilerplate hero image

Quick Information

0 ratings
Dynamic Connection: Remove Signal Connection Boilerplate icon image
TamerSoup625
Dynamic Connection: Remove Signal Connection Boilerplate

This plugin adds the DynamicConnection class for handling a signal/callable connection and modifying it during runtime.DynamicConnection represents a connection between a Signal and a Callable or the absence of one. This class ensures there's at most only one connection and avoids leaving leftover connections if its state ever changes.Repository includes an example scene.

Supported Engine Version
4.3
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Dynamic Connection: Remove Signal Connection Boilerplate

This plugin adds the DynamicConnection class for handling a signal/callable connection and modifying it during runtime.

DynamicConnection represents a connection between a Signal and a Callable or the absence of one. This class ensures there's at most only one connection and avoids leaving leftover connections if its state ever changes.

Example use

extends Node2D
var _button_connection = DynamicConnection.new()

func _ready():
    var button1 = Button.new()
    var button2 = Button.new()
    # Connects "button1.pressed" signal to method "hide"
    _button_connection.set_connection(button1.pressed, hide)
    # Removes the old connection,
    # and connects the signal "button2.pressed" to "hide"
    _button_connection.set_signal(button2.pressed)
    # With the call below, "button2.pressed" is no longer connected
    # to "hide", but instead to the method "show"
    _button_connection.set_callable(show)
    # Disconnects "button2.pressed" from "show"
    _button_connection.remove_connection()

This plugin adds the DynamicConnection class for handling a signal/callable connection and modifying it during runtime.
DynamicConnection represents a connection between a Signal and a Callable or the absence of one. This class ensures there's at most only one connection and avoids leaving leftover connections if its state ever changes.
Repository includes an example scene.

Reviews

0 ratings

Your Rating

Headline must be at least 3 characters but not more than 50
Review must be at least 5 characters but not more than 500
Please sign in to add a review

Quick Information

0 ratings
Dynamic Connection: Remove Signal Connection Boilerplate icon image
TamerSoup625
Dynamic Connection: Remove Signal Connection Boilerplate

This plugin adds the DynamicConnection class for handling a signal/callable connection and modifying it during runtime.DynamicConnection represents a connection between a Signal and a Callable or the absence of one. This class ensures there's at most only one connection and avoids leaving leftover connections if its state ever changes.Repository includes an example scene.

Supported Engine Version
4.3
Version String
1.0
License Version
MIT
Support Level
community
Modified Date
1 year ago
Git URL
Issue URL

Open Source

Released under the AGPLv3 license

Plug and Play

Browse assets directly from Godot

Community Driven

Created by developers for developers