0 votes

I have a scene that is comprised of a root WindowDialog, that is opened using the popup_centered() function, with the popup_exclusive set true. This scene is then instanced a number of times. When each one is opened, multiple windows show up, but I can only interact with the last one opened. How can I make it so I can interact with all of them at the same time?

asked Feb 26, 2019 in Engine by DrewS (89 points)

Honestly, why do you actually set popup_exclusive when you do NOT want to use the popup exclusively?

OK, ok. I now read the docs. But it seems not to be intended anyway. Exclusive should mean that this popup is receiving the attention... and nothing else... (that is why it doesn't hide when you click elsewhere). It behaves like a modal dialogue.

Maybe just arrange the WindowDialogs without Popup so they can all be accessed? (Enumerate open controls an rearrange when more will open.)

Maybe a screenshot would help to understand what you exactly want to achieve.

I do not have a screenshot at the moment, as I broke the system refactoring my code. But, I think I can explain it, well enough. I am trying to effectively do something similar to the Divinity Original Sins loot/container UI like so. Where you can open multiple containers and drag items to/from them and the player inventory and move the windows around. Which is why I chose to use a WindowDialog.

3 Answers

0 votes
Best answer

I solved this problem by creating a custom Panel to control this, like @Zylann suggested.

On the panel I added a script to drag the windows around.

extends Panel

var _reset_position = Vector2()
var _previous_mouse_position = Vector2()
var _is_dragging = false

signal on_open
signal on_closed

func _ready():
    _reset_position = rect_position

func _process(delta):
    if _is_dragging:
        var mouse_delta = _previous_mouse_position - get_local_mouse_position()
        rect_position -= mouse_delta

func _gui_input(event):
    if event.is_action_pressed("ui_select"):
        _is_dragging = true
        _previous_mouse_position = get_local_mouse_position()
    if event.is_action_released("ui_select"):
        _is_dragging = false

func show():
    emit_signal("on_open")
    rect_position = _reset_position
    visible = true

func hide():
    emit_signal("on_closed")
    visible = false

func _on_TextureButton_pressed():
    hide()
answered Feb 28, 2019 by DrewS (89 points)
0 votes

This seems to be a difficult act, I have learned a lot about it but have not found a solution!

answered Feb 27, 2019 by fayolaa (14 points)
+2 votes

If you want them both on screen a workaround would be to simply use Panel which you customize to look like a window and show up on front, because popups are "shortcuts" which are heavily made to be single on top of everything else.

answered Feb 27, 2019 by Zylann (26,786 points)
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.