-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
SubViewport not refreshing properly in-editor when reducing its size #86292
Comments
Fixed in #86302 |
Hold on now. This is desired behavior in my case. I want the subviewport to be stretched to the containers size if it is smaller. That's a feature. |
@TheDuriel this cannot be a feature if hiding and showing it causes to render differently. Also, just moving the container will cause to render correctly. There is no safe way to use this bug as a feature imho (unless im missing something). |
If you want this effect and in a consistent way, use |
Could this actually be a symptom of the container not shrinking down when the viewport does? It's not certain what should happen in that case. We're in undefined behavior land now, and the proposed PR does not address that, since it forces a redraw but not a resort? If you make a container at 100x100, and a viewport at 200x200, the container becomes 200x200. Then when you change the viewport to 100x100, the container remains at 200x200 so long as it does not get sorted by a parent container or shown/hidden. This is behavior which is being used by games. Should the fix then not be, to queue a sorting of the container, which will in turn cause a redrawing? This then gives the correct result regardless of the uncertainty. Additionally I wish to point out that the stretch shrink setting, does not allow the use of precise values. Which is necessary in some cases. - Though there may be some obscure combination of settings still achieving the desired effect. (I need to make an issue about how utterly obnoxiously obtuse window and resolution settings have become. You shouldn't need to rely on a combination of 4 or more properties to render and display at different resolutions.) |
The docs states SubViewportContainer will use the combined size of the SubViewports as minimum size, not as its size, so i believe the behaviour is the intended. This way you can have it work correctly with
If i understood you correctly, you want the subviewport rendered image be always at a resolution, and stretched to cover the entire viewport container. If so, you dont need |
I just tried and it was difficult to tell which combination of settings would actually achieve this. Especially with the inconsistency created by resizing the container/viewport. It's a mess. So lets focus on the thing at hand: ViewportContainers will display different images depending on whether the viewport has been "redrawn". I will note that this isn't limited to static images. The viewport is still rendering frames fine. I suggest that an attempt is made to queue a sorting of the container when the viewport changes size. Which in turn will cause the viewport to redraw. Achieving the same effect, but also respecting the fact that: Control nodes assume the size of their contents. Unless otherwise specified by the user. Example: Changing the texture in a TextureRect node, will shrink the rect if the new texture is of a smaller size. SubViewportContainer does not behave the same, despite seemingly sharing the same stretch settings! |
Tested versions
System information
Godot v4.2.1.stable - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.3623) - AMD Ryzen 9 5900X 12-Core Processor (24 Threads)
Issue description
When reducing the size of a SubViewport in the editor, the viewport will show an incorrect stretched image (the SubViewport at the new size stretched to fit the previous size). Toggling the SubViewport Container visibility off and on fixes it.
viewport_bug.mp4
Steps to reproduce
Steps for the MRP:
Minimal reproduction project (MRP)
_viewport_bug.zip
The text was updated successfully, but these errors were encountered: