Open lapspider45 opened 2 years ago
@lapspider45 Please upload a minimal reproduction project to make this easier to troubleshoot.
Done.
In my opinion, SubViewport
seems to be a pipe. Render a 2D/3D scene to a 2D texture. And SubViewportContainer
is an adapter that converts SubViewport
to Control
.
In this way, the size
property is the sampling resolution of the source, and size_2d_override
is the resolution of the render target. Currently, size_2d_override
only seems to work in get_visible_rect
. size
does the work that size_2d_override
should.
This is just my guess, maybe I'm wrong.
I can confirm that this still happens with Beta 10
The workarounds also don't work anymore. The data of the subviewports size property properly changes, but the SVPs don't properly fill the viewport
Still happens in Godot v4.1.1 stable. As a workaround I set in the SubViewportContainer the "stretch_shrink" property to 2, to half the render resolution of the child SubViewport. This isn't ideal, because my display resolution is 1280x720, so the SubViewport will be 640x360 and I need another resolution...
I can't reproduce this. Downloaded the minimal project, resized the subviewportContainer, and the icon does not stretch.
@djpeach it looks to me like you are reproducing the issue. Right now there is no sensible way to scale a SubViewport, since SubViewportContainer enforces a 1:1 pixel ratio in all cases
I am actually reproducing that as well on 4.1.3 A subviewport cannot have resolution stretch as a window can get.
Still happens in Godot v4.1.1 stable. As a workaround I set in the SubViewportContainer the "stretch_shrink" property to 2, to half the render resolution of the child SubViewport. This isn't ideal, because my display resolution is 1280x720, so the SubViewport will be 640x360 and I need another resolution...
This indeed resize the actual Subviewport from origin resolution, but then requires unticking scale parameter to apply. And this workaround being integer based, any resolution between 1 and 2 are unavailable.
EDIT: Setting the original resolution on Subviewport "size_2d_override", and target resolution on its "size" makes the viewport actually respect its resolution and scale to. Which works for me 🎉
EDIT: Setting the original resolution on Subviewport "size_2d_override", and target resolution on its "size" makes the viewport actually respect its resolution and scale to. Which works for me 🎉
Yes, it works. It might be worth detailing in the documentation the correct usage of these related properties.
Or when stretch
of SubViewportContainer
is checked, the current size
of SubViewport
is automatically used to set size_2d_override
.
Godot version
v4.0.alpha9.official.fc18891db
System information
Linux
Issue description
When resizing a SubViewportContainer with
stretch
enabled, thesize
of the child SubViewport is changed to the size of the container. What this does is to undo all the "stretching", since the resolution of the viewport is now the same as the displayed resolution. This is unexpected of a property namedstretch
, if this were intentional a more fitting name would beauto_resize
. This problem was present in Godot 3 as well, but it wasn't hard to write something like this to preserve the size of the viewport:But in newer alpha versions Godot 4, this workaround stopped working consistently, especially inside nested containers. So this is what I resorted to:
This is very inelegant, and I don't see how SubViewportContainer messing with viewport sizes would be intended behavior in the first place.
Steps to reproduce
stretch
on SubViewportContainericon.png
or an image of your choice to the SubViewport, and set viewportsize
to the image dimensionsSTRETCH_SCALE
size
of the SubViewport to changeMinimal reproduction project
MRP_SubViewportContainer.zip