0 votes

why can't i exit the color picker and press another button, normally?

Godot version 3.2.3
in Engine by (17 points)
edited by

1 Answer

0 votes

ColorPickers are more like scenes than they are like individual Nodes. I didn't add any children to my ColorPicker, but it ended up giving itself a bunch of children at runtime:

ColorPicker
    HBoxContainer
        Control
        Control
    HBoxContainer
        TextureRect
        ToolButton
    VBoxContainer
    HSeparator
    VBoxContainer
        HBoxContainer
            Label
            HSlider
            SpinBox
                LineEdit
                    Timer
                    PopupMenu
                        Timer
                Timer
        HBoxContainer
            Label
            HSlider
            SpinBox
                LineEdit
                    Timer
                    PopupMenu
                        Timer
                Timer
        HBoxContainer
            Label
            HSlider
            SpinBox
                LineEdit
                    Timer
                    PopupMenu
                        Timer
                Timer
        HBoxContainer
            Label
            HSlider
            SpinBox
                LineEdit
                    Timer
                    PopupMenu
                        Timer
                Timer
        HBoxContainer
            CheckButton
            CheckButton
            Button
            LineEdit
                Timer
                PopupMenu
                    Timer
    HSeparator
    HBoxContainer
        TextureRect
    HBoxContainer
        Button

You must release focus from the child who has it, not from the ColorPicker itself. You can use this function to make sure that a Node and none of its children have focus:

func recursively_release_focus(node):
    if node is Control:
        node.release_focus()
    for child in node.get_children():
        recursively_release_focus(child)
by (361 points)

what is, when you change the color, "the child who has it"

It looks like the focus doesn't change when you change the color. To figure this out, I added this to the ColorPicker's parent:

func _physics_process(delta):
    print(get_focus_owner())

gives me the previous button i clicked (which is appearently, not a child of the color picker). so, why can't i exit the color picker and press another button, normally?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.