mirror of
https://github.com/godotengine/godot.git
synced 2025-01-23 11:03:13 -05:00
Merge pull request #46170 from gongpha/jr-_-avoid-get_tree-when-flying-colorpicker-master
Avoid signal methods in ColorPicker to access the tree when it isn't in the tree
This commit is contained in:
commit
82033bf9b4
1 changed files with 8 additions and 0 deletions
|
@ -578,6 +578,10 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
|
|||
}
|
||||
|
||||
void ColorPicker::_screen_input(const Ref<InputEvent> &p_event) {
|
||||
if (!is_inside_tree()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<InputEventMouseButton> bev = p_event;
|
||||
if (bev.is_valid() && bev->get_button_index() == BUTTON_LEFT && !bev->is_pressed()) {
|
||||
emit_signal("color_changed", color);
|
||||
|
@ -607,6 +611,10 @@ void ColorPicker::_add_preset_pressed() {
|
|||
}
|
||||
|
||||
void ColorPicker::_screen_pick_pressed() {
|
||||
if (!is_inside_tree()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Viewport *r = get_tree()->get_root();
|
||||
if (!screen) {
|
||||
screen = memnew(Control);
|
||||
|
|
Loading…
Add table
Reference in a new issue