You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the problem or limitation you are having in your project
In 4.0-dev you can't change the background color of a Viewport (Window, SubViewport) in a simple way. In addition, you cannot set different clear colors for different Viewports.
3.x has the following methods:
VisualServer.black_bars_set_images;
VisualServer.black_bars_set_margins;
VisualServer.viewport_attach_to_screen;
Viewport.set_attach_to_screen_rect;
etc.
This allows you to set the window background color or texture. Also, although not documented, you can attach a Viewport with a background behind the root Viewport without changing the main scene and autoload hierarchy (without nesting them in a new Viewport) and keeping the project settings working (display/window section).
Another point is the integer scaling of Viewport size (or the rectangle on which it is displayed), which is necessary for some pixel games. In 4.0-dev, there is no analogue of the Viewport.set_attach_to_screen_rect method. An example of a plugin that uses the method: Yukitty/godot-addon-integer_resolution_handler.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add methods to set clear color, background color, background texture to Viewport. Add an analogue of the set_attach_to_screen_rect method.
I also had an idea to add theme properties to the Window (colors and StyleBox), but SubViewport doesn't support themes. Maybe move the theme functionality to the Viewport?
In addition, we can add project settings for the main window:
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
See above.
If this enhancement will not be used often, can it be worked around with a few lines of script?
You can ignore the display/window settings, display the background and SubViewportContainer in the root Window and implement the desired scaling logic. All content must be added to this SubViewport and not to the root of the scene tree. However, this is much less convenient, does not work well with autoloads and with the functionality of the editor (Run Current Scene (F6)).
Is there a reason why this should be core and not an add-on in the asset library?
This is the basic functionality. The workaround implementation described above will be awkward whether you implement it yourself or find it in AssetLib.
The text was updated successfully, but these errors were encountered:
Another point is the integer scaling of Viewport size (or the rectangle on which it is displayed), which is necessary for some pixel games. In 4.0-dev, there is no analogue of the Viewport.set_attach_to_screen_rect method. An example of a plugin that uses the method: Yukitty/godot-addon-integer_resolution_handler.
Describe the project you are working on
A game.
Describe the problem or limitation you are having in your project
In 4.0-dev you can't change the background color of a
Viewport
(Window
,SubViewport
) in a simple way. In addition, you cannot set different clear colors for differentViewport
s.3.x has the following methods:
VisualServer.black_bars_set_images
;VisualServer.black_bars_set_margins
;VisualServer.viewport_attach_to_screen
;Viewport.set_attach_to_screen_rect
;This allows you to set the window background color or texture. Also, although not documented, you can attach a
Viewport
with a background behind the rootViewport
without changing the main scene and autoload hierarchy (without nesting them in a newViewport
) and keeping the project settings working (display/window
section).Another point is the integer scaling of
Viewport
size (or the rectangle on which it is displayed), which is necessary for some pixel games. In 4.0-dev, there is no analogue of theViewport.set_attach_to_screen_rect
method. An example of a plugin that uses the method: Yukitty/godot-addon-integer_resolution_handler.Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add methods to set clear color, background color, background texture to
Viewport
. Add an analogue of theset_attach_to_screen_rect
method.I also had an idea to add theme properties to the Window (colors and
StyleBox
), butSubViewport
doesn't support themes. Maybe move the theme functionality to theViewport
?In addition, we can add project settings for the main window:
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
See above.
If this enhancement will not be used often, can it be worked around with a few lines of script?
You can ignore the
display/window
settings, display the background andSubViewportContainer
in the rootWindow
and implement the desired scaling logic. All content must be added to thisSubViewport
and not to the root of the scene tree. However, this is much less convenient, does not work well with autoloads and with the functionality of the editor (Run Current Scene (F6)).Is there a reason why this should be core and not an add-on in the asset library?
This is the basic functionality. The workaround implementation described above will be awkward whether you implement it yourself or find it in AssetLib.
The text was updated successfully, but these errors were encountered: