Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Dictionary? #22

Closed
univeous opened this issue Oct 20, 2024 · 2 comments
Closed

Support for Dictionary? #22

univeous opened this issue Oct 20, 2024 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@univeous
Copy link

It would be easier to integrate this plugin into my existing system if it could be bind to Dictionary like this

var dict := {
	"value" : 0.0
}
var _data = BindingSource.new(dict)

func _ready():
	_data.bind("value").to_slider($Col1/HSlider)
@univeous
Copy link
Author

univeous commented Oct 20, 2024

Another approach:

var dict := {
	"value" : 0.0
}
var _data = BindingSource.new(self)


func _ready():
	_data.bind("dict").using(func(d):return str(d.value)).to_label($Col1/DisplayRow/ValueLabel)
	_data.bind("dict").using(func(d):return d.value).to_slider($Col1/HSlider)

There is no problem with the display, but there will be problems when updating the data.
Perhaps providing a way to customize how the data is updated could be a solution.
It would be great if there were built-in convenient using and custom updating functions for Dictionary.

Or provide a special form for bind to handle dict? e.g. bind("dict/key"). I believe Godot doesn't allow you to use / in variable names, so it's probably safe.

@HotariTobu HotariTobu added enhancement New feature or request good first issue Good for newcomers labels Oct 20, 2024
@HotariTobu
Copy link
Owner

Please wait for the release of v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants