Skip to content
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

Fix SubViewport physics picking #87385

Merged

Conversation

Sauermann
Copy link
Contributor

@Sauermann Sauermann commented Jan 19, 2024

Apply the logic of handle_input_locally for physics picking.

resolve #84258
cherry-pick of #85665 from 4.2 to master.

I see this as an interim solution until #77926 gets reviewed.
I believe, that it is unlikely that #77926 gets reviews anytime soon, but since #84258 is quite nasty, I want to provide a bugfix-PR, that is easier to review and that already received some testing in 4.2.

Apply the logic of `handle_input_locally` for physics picking.
@Sauermann Sauermann added this to the 4.3 milestone Jan 19, 2024
@Sauermann Sauermann requested a review from a team as a code owner January 19, 2024 20:57
Comment on lines +741 to +748
if (!handle_input_locally) {
Viewport *vp = this;
while (!Object::cast_to<Window>(vp) && vp->get_parent()) {
vp = vp->get_parent()->get_viewport();
}
vp->local_input_handled = false;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, you seem to skip every viewport (even ones with local_input_handled == true until the last one, then you set local_input_handled to false.
Is this what you want?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR intends to treat handle_input_locally for physics picking in the same way as it is treated in other places. That includes skipping viewports with local_input_handled == true.
The fact that currently handle_input_locally is treated differently in different parts of the code-base is the reason for the linked issue.

@YuriSizov YuriSizov merged commit 91ac53e into godotengine:master Jan 25, 2024
16 checks passed
@YuriSizov
Copy link
Contributor

Thanks!

@Sauermann Sauermann deleted the fix-subviewport-physics-picking branch January 25, 2024 20:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mouse input events not being detected from Area2D inside a SubViewport unless a key is pressed
5 participants