-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
ColorPickerButton with color_changed signal attached won't show color on button #42755
Comments
You have to call
|
At the moment there is no mention of the It would be interesting to know how @Animus-Surge came to this point. There is no mention of
It seems there as been a misunderstanding at some point because overriding the function is not connecting to and handling a signal. If we can find out where this comes from we could improve the documentation. |
I figured that it was already a thing, because, like the
That makes perfect sense to me. I guess didn't I remember that connecting the signal is different than attaching a script with the overridden function in it. (I'm doing it so I can just use one function to handle six different I can probably see about adding something to the documentation, at least a placeholder until it can be better documented by someone with far more experience than me in these matters. |
Alright, so I did a little test. I made a script that looks like this extends ColorPickerButton
func _pressed():
print("This was pressed!")
func _color_changed(color):
._color_changed(color)
print(color) and attached it to a ColorPickerButton (edit: forgot this whoops) The thing that I find interesting is the (edit 2): Yes I did explicitly call |
Just tested it with current master and this issue does not occur in v4. Creating a func
|
For reference, even when those methods are no longer available in GDScript, #40670 might also impact this in |
I think this issue is not specific to just Also, it seems like it's not required to That said, relying on "semi-public" API like this should likely be discouraged in the documentation somewhere. The problem is that I don't see a way to figure out whether a callback is already exposed/reserved by C++. |
To demonstrate, this works (without defining extends ColorPickerButton
func _ready():
assert(has_method("_color_changed")) As I'm thinking about this, perhaps there might be a way to check whether a script method conflicts with C++ private callback while parsing GDScript, and simply emit a warning if this is the case. This shouldn't affect virtual methods because they are registered via |
I've come up with a way to show a warning for cases like in this issue with #42968.
I've just checked, this is because |
Godot version:
3.2.3 stable, also happens in 3.2.2 stable
OS/device including version:
Windows 10 20.04, Intel HD graphics 4600 with GLES 2 and 3 have this problem
Issue description:
When changing the color of a ColorPickerButton with a script that connects to the button's
color_changed
signal, the button will not show the selected color.Steps to reproduce:
In the project I provided, simply change the color of the button without the provided script attached.
Then attach the script and do the same thing.
Minimal reproduction project:
testerproject.zip
The text was updated successfully, but these errors were encountered: