Can I freeze a part of my GUI?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Nuno Donato
:warning: Old Version Published before Godot 3 was released.

I’m coding my own popup/confirm dialog, but the current problem is that I can still focus and click on stuff behind it (buttons, etc).
So I’d like to, when this popup is shown, the rest of the GUI is frozen and taking and inputs at all.

I’m not using the process_input function, just connecting the buttons signals, so is there a way to disable it easily for all controls under a specific node?

Pause does not work?

eons | 2017-04-23 14:11

nop, I can still click buttons

Nuno Donato | 2017-04-23 15:11

Godot 2 or 3?

On 2 tried with a button and a dialog and works just ignoring mouse (still, you need to get all the controls in a group to set the ignore mouse on and off, and grab and restore focus).

Do you have a small scene that does not work to test?

eons | 2017-04-23 17:18

:bust_in_silhouette: Reply From: volzhs

I often use full screen size Control node for it.
if Control node has Stop Mouse flag on, it will stop event propagation under it.

- root control
   - some ui  # this will not get gui event.
   - full screen size control  # this node will consume all gui event.
      - some ui

works for mouse, but I can still tab and enter to select other GUI controls behind

Nuno Donato | 2017-04-23 15:19

oh, I didn’t think about that…

volzhs | 2017-04-23 17:29

:bust_in_silhouette: Reply From: Mariano Javier Sulig

i would use a combination of get_tree().set_pause(bool) and set_pause_mode(MODE)

By default all nodes have a pause mode on “INHERIT”, this means it will have the same mode as it’s parent. Take for example this tree:

GUI (Canvas Layer)
-menu (Control)
--submenu (Control - hiden)

to enable main manu you call


this way your gui will work only with the visible childs of GUI

func _open_submenu():

Now only the visible childs of submenu will receibe input

:bust_in_silhouette: Reply From: vybr

If you use set_focus_mode(FOCUS_NONE) the control cannot be focused.

Alternatively, if your popup has a single control to interact with, you can use the “focus_exit” signal to call “grab_focus” on the main control. That way, nothing else can be focused.