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

Bindora : a reactive data binding library

An asset by Roanne
The page banner background of a mountain and forest
Bindora : a reactive data binding library hero image

Quick Information

0 ratings
Bindora : a reactive data binding library icon image
Roanne
Bindora : a reactive data binding library

Bindora is a reactive data binding library for Godot 4.x. Based on Godot's design philosophy, it provides a declarative and component-based approach to help you manage relationships between nodes and data.

Supported Engine Version
4.4
Version String
0.1.0
License Version
MIT
Support Level
community
Modified Date
2 months ago
Git URL
Issue URL

Bindora

English/中文

Bindora is a reactive data binding library for Godot 4.x. Based on Godot's design philosophy, it provides a declarative and component-based approach to help you manage relationships between nodes and data.

Core Features

Reactive Data System

  • Provides the Ref class as the base data type
  • Supports multiple data types
  • Supports serialization and deserialization
  • Automatic type conversion and checking
  • Provides lifecycle hooks

Comprehensive Binding Support

Data Monitoring

  • Provides the Watcher class for data monitoring
  • Supports single and multi-value monitoring
  • Supports custom callback functions

Quick Start

Installing Bindora

Copy the bindora folder into your Godot project.

Basic Usage

Create a Label node and set its text to "Text is {{value}}". Then add a script to the node with the following code:

extends Label

# Declare data
var text_ref = RefString.new("Hello World")

# Create text binding
text_ref.bind_text(self)

# Create a watcher
text_ref.create_watcher(func(watcher,new_value):
    print("Text changed to: ", new_value)
)

# Wait for a while
await get_tree().create_timer(3.0).timeout

# Modify data
text_ref.value = "New Text"
# Or
text_ref.set_value("New Text") # Using set_value is recommended as it includes type checking

The Ref class provides many convenient binding methods, which you can explore in the API Reference.

Using ReactiveResource

Create a resource class that extends ReactiveResource and declare Ref variables within it.

Note: Ref variables declared in ReactiveResource do not need to be exported with @export. They are automatically handled and exported upon declaration. Using @export may cause unexpected errors.

class MyResource extends ReactiveResource:

var text_ref = RefString.new("Hello World")

Using RefArray in combination.

var packed_scene = preload("res://path/to/your/packed_scene.tscn")
var array = RefArray.new()
array.bind_list($Container, packed_scene, func(item, data , index):
    data.text_ref.bind_text(item)
)
for i in 3:
    var new_item = MyResource.new()
    new_item.text_ref.set_value("Item " + i)
    array.append(new_item)

API Reference

Basic Variable Types - RefVariant

RefBool, RefInt, RefFloat, RefString, RefVector2, RefVector2i, RefVector3, RefVector3i, RefVector4, RefVector4i, RefRect2, RefRect2i, RefColor

Binding methods:

  • bind_text(_node: CanvasItem, _property: String = "value",_template: String = "") -> TextBinding
  • bind_input(_node: CanvasItem, _property: String = "") -> InputBinding
  • bind_multi_input(_dict: Dictionary[CanvasItem, String]) -> Dictionary[CanvasItem, InputBinding]
  • bind_property(_node: CanvasItem, _property: String, _use_node_data: bool = false) -> PropertyBinding
  • bind_multi_property(_dict: Dictionary[CanvasItem, String]) -> Dictionary[CanvasItem, PropertyBinding]
  • bind_radios(_nodes: Array[CanvasItem]) -> Dictionary[CanvasItem, RadioBinding]
  • bind_radios_custom(_dict: Dictionary[CanvasItem, String]) -> Dictionary[CanvasItem, RadioBinding]
  • bind_shader(_node: CanvasItem, _property: String) -> ShaderBinding
  • bind_show(_node: CanvasItem, _callable: Callable) -> ShowBinding
  • bind_theme_override(_node: CanvasItem, _property: String) -> ThemeOverrideBinding
  • bind_toggle(_node: CanvasItem, _opposite: bool = false) -> ToggleBinding
  • bind_multi_toggle(_dict: Dictionary[CanvasItem, bool]) -> Dictionary[CanvasItem, ToggleBinding]

Special Types

RefArray

  • bind_text(_node: CanvasItem, _keyword: String = "value", _template: String = "") -> TextBinding
  • bind_check_boxes(_nodes: Array[CanvasItem]) -> Dictionary[CanvasItem, CheckBoxBinding]
  • bind_check_boxes_custom(_dict: Dictionary[CanvasItem, String]) -> Dictionary[CanvasItem, CheckBoxBinding]
  • bind_list(_parent: Node, _packed_scene: PackedScene, _callable: Callable) -> ListBinding

RefDictionary

  • bind_text(_node: CanvasItem, _template: String = "") -> TextBinding

Resource Types - RefResource

  • RefFont
  • RefLabelSettings
  • RefMaterial
  • RefStyleBox

Contributing

If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

License

Bindora is an open-source project under the MIT license.

Bindora is a reactive data binding library for Godot 4.x. Based on Godot's design philosophy, it provides a declarative and component-based approach to help you manage relationships between nodes and data.

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
Bindora : a reactive data binding library icon image
Roanne
Bindora : a reactive data binding library

Bindora is a reactive data binding library for Godot 4.x. Based on Godot's design philosophy, it provides a declarative and component-based approach to help you manage relationships between nodes and data.

Supported Engine Version
4.4
Version String
0.1.0
License Version
MIT
Support Level
community
Modified Date
2 months 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