-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce a SubViewportContainer
config for drag-and-drop target locations
#99270
Conversation
doc/classes/SubViewportContainer.xml
Outdated
@@ -20,6 +20,10 @@ | |||
</method> | |||
</methods> | |||
<members> | |||
<member name="consume_drag_and_drop" type="bool" setter="set_consume_drag_and_drop" getter="is_consume_drag_and_drop_enabled" default="false"> | |||
If [code]false[/code], the [SubViewportContainer] is not available as drop location in drag-and-drop operations, but all of the [Control] nodes inside its [Viewport] children. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If [code]false[/code], the [SubViewportContainer] is not available as drop location in drag-and-drop operations, but all of the [Control] nodes inside its [Viewport] children. | |
If [code]false[/code], the [SubViewportContainer] is not available as a drop location in drag-and-drop operations, but all of the [Control] nodes inside its [Viewport] children. |
Missing word?
Also, why is the false
case listed before the true
case? I think most of the time we list the true
case first, but I'm not sure if it's a hard rule
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
false
is the default value of the parameter, so I put its description first. If the other order would make more sense, I am happy to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, and there is some precedent for putting false
first. See what everyone else thinks
4fdd850
to
020e318
Compare
@Sauermann if I understood correctly this #99155 will make only SubViewportContainer receive the drag and drop events when the option is checked. But I have inside this SubViewportContainer all my game components like inventory slots, equipment slots that depend on the drag and drop system. So I'm afraid we will still face some regression that can't be worked around. Wouldn't we? Before in 4.3 even with the SubViewportContainer occupying the entire screen and physics picking enabled, it was still possible to perform drag and drop in the children of the SubViewportContainer, is this what going to happen with #99155? |
I would like to understand the problem you are facing, but I am not entirely sure, if I understand you correctly. Let me try to explain your situation in my words and please let me know, if you agree: You want to utilize for drag-and-drop at the same time:
Can you please elaborate, what you would expect to happen, when the user uses drag-and-drop and drops to the location of a Control node inside the SubViewport, the problem being, that both the SubViewportContainer and the Control node inside the SubViewport are located at this position. Should either the SubViewportContainer receive the drop event, or alternatively should the Control node receive the drop event? For reference: Before #67531, drag-and-drop with Control nodes in SubViewports was mostly unusable. For example, it was impossible to use drag&drop from Control nodes of the main viewport to Control nodes in the SubViewport. It was also impossible in secondary Windows to drop to Control nodes in SubViewports from anywhere. Another impossible thing was to drag from Control nodes in the SubViewport to Control nodes in the main viewport. So I am not entirely sure, which regression it is, that you mention. |
That's exactly my setup in 4.3, and it worked out of the box. Top layer SubViewportContainer with drop events then a Subviewport with physics picking and inside it some controls with drag and drop events. I'm not at home right now to show some screenshots of my game setup, as soon as I'm able to do it I will update this comment. But basically why not setup some order to call the event? Maybe bottom up to call the drag and drop events? As soon as it find a viable drop control inside mouse position it call the event for that specific container, also consider the canvas layer index? This would create a previsible and consistent manner of how events are called. |
@conde2 Thanks for your answer. To clarify more. Is the following description correct?
|
Thanks for the answering and help with this issue @Sauermann. I just got home, here is how my game nodes setup:
Thats correct, I by mistake said that the drag and drop was coming from a child of the SubViewport but thats not true, sorry for that, I will clarify better what is happening.Here I'm dragging from a Control that is child of the MainViewport to the SubViewportContainer. The.Last.Magic.DEBUG.2024-11-17.19-37-25.mp4Here I'm dragging from a Control that is child of the MainViewport to another Child of the MainViewport The.Last.Magic.DEBUG.2024-11-17.19-38-18.mp4Here I'm moving my mouse on top of the Item with a CollisionArea to detect the mouse and item area. That requires physics picking in the subviewport. The.Last.Magic.DEBUG.2024-11-17.19-42-25.mp4 |
@conde2 thank you for the clarification. So you don't have any Control nodes inside the SubViewport, that are drag-and-drop drop-locations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me overall, based on the linked issue it sounds like this needs to be configurable behavior.
With the drag-and-drop rewrite, `SubViewportContainer` nodes were no longer available as drop-locations. This PR introduces a configuration option, that allows `SubViewportContainer` to be considered as drop-location, but disables the `Control` nodes inside its `SubViewport` children as drop-location.
020e318
to
117158d
Compare
@akien-mga is it possible to get his in time for 4.4 dev5 ? It makes 4.4dev unusable for me without this fix. And adding this I can test and check if its all good. |
4.4 dev 5 was already built and will be released later today, so this will be for dev 6. |
Thanks! |
With the drag-and-drop rewrite #67531,
SubViewportContainer
nodes were no longer available as drop-locations.A detailed explanation of this situation is available in #99155 (comment).
This PR introduces a configuration option, that allows
SubViewportContainer
to be considered as drop-location, but disables theControl
nodes inside itsSubViewport
children as drop-locations. The reasoning for this either-or-approach is also explained in #99155 (comment).With this setup, it is possible to use the
SubViewportContainer
as drop-location, while at the same time use physics-picking inside theSubViewports
of theSubViewportContainer
.SubViewportContainer
as a potential candidate for dropping in Drag&Drop #99209