Godot Version
4.6.1
Question
I have a grid container full of slots that are navigated with the keyboard. On focus, they light up.
I noticed that Godot seems to have some sort of built in focus-mapping, as even without neighbors set, it seems like I can navigate around the grid of buttons with the keyboard. I cannot figure out how to make that stop.
Additionally, when something else is active, I’ve made called to disable input, disable unhandled input, block signals, AND stop processing, but even so, if I hit the arrow keys while the other thing that supposedly disabled the grid is active, I can still navigate the grid.
I did notice that the finally thing I added (stop processing) made it seem to stop invoking certain things in my FocusEntered handler, so it feels like this is all related to some built in functionality overriding my own.
SetProcessInput(false);
SetProcessUnhandledInput(false);
SetBlockSignals(true);
SetProcess(false);
Thanks!
Set button’s focus_mode property to None.
I was afraid youd say that. Theres sixty buttons, and I thought disabling the parent control would prevent this?
The packed scene is a control node with a child gridcontainer, with all of the buttons inside.
Shouldnt disabling the parent (root) control nodes input processing, signals, etc. Stop this?
Or do I really need to loop the whole container and disable/reenable each manually?
Thanks!
What do you mean by “disable”?
SetProcess(false) is being done on the root node, so I thought that would mean everything just stops processing for it and all of it’s children.
It seems like if you were to set the root FocusMode to FocusModeEnum.None, the children should inherit it, but it seems like that may only be done at instantiation, so updating it after the fact programatically doesn’t do anything.
More importantly, why is it doing what it is doing anyways? GridContainer seems to just automatically inject it’s own focus handling onto the children nodes inside of it, even if all the focus neighbors are set to nothing. When it’s like that, I would have assumed it doesn’t know what to do with focus and shouldn’t be doing anything.
My code might be working as intended(ish), but whatever that is doing is overriding it.
set process only disables the one node’s _process override, it shouldn’t disable the node from running in any other way.
Can you make a minimal reproduction example?
If the root is disabled (not processing), the children will continue to process?
I will make a small example
set process does not disable the node. It is different from ProcessMode.
Processing has nothing to do with focusing.
Make a reproducible example of focus mode not being inherited when it should.
OK I may see what is going on now.
The children are set to FocusMode.All, the parent is set to None.
I thought that the inheritence meant it would inherit the FocusMode, but rather than setting focusMode to none on the parent, it seems like I need to just set the FocusModeRecursive to disabled, and then the children inherit that and override their own setting of All.
Does that sound right?
Really what I was hoping for was to just do something at the very root akin to “shut this entire thing off except for the visuals”, which is what I thought you would accomplish with SetProcess(false), but even setting the process mode, I think it may be independent from the UI and will only disable physics/process call, but will still get these input/focus events?