Avoid function signals in ColorPicker to access the tree when it isn't in the tree
This commit is contained in:
parent
4384605cb1
commit
5ec1eee6b1
@ -579,6 +579,8 @@ void ColorPicker::_preset_input(const Ref<InputEvent> &p_event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ColorPicker::_screen_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;
|
Ref<InputEventMouseButton> bev = p_event;
|
||||||
if (bev.is_valid() && bev->get_button_index() == BUTTON_LEFT && !bev->is_pressed()) {
|
if (bev.is_valid() && bev->get_button_index() == BUTTON_LEFT && !bev->is_pressed()) {
|
||||||
@ -609,6 +611,9 @@ void ColorPicker::_add_preset_pressed() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ColorPicker::_screen_pick_pressed() {
|
void ColorPicker::_screen_pick_pressed() {
|
||||||
|
if (!is_inside_tree())
|
||||||
|
return;
|
||||||
|
|
||||||
Viewport *r = get_tree()->get_root();
|
Viewport *r = get_tree()->get_root();
|
||||||
if (!screen) {
|
if (!screen) {
|
||||||
screen = memnew(Control);
|
screen = memnew(Control);
|
||||||
|
Loading…
Reference in New Issue
Block a user