godot-proposals icon indicating copy to clipboard operation
godot-proposals copied to clipboard

Ability to customize `can_draw()` behavior / Add a project setting to continue drawing while the window is minimized

Open abb128 opened this issue 4 years ago • 2 comments

Describe the project you are working on

An OpenVR dashboard overlay

Describe the problem or limitation you are having in your project

I am currently passing the texture of a Viewport to SteamVR through a GDNative module in order to create a dashboard. This dashboard is accessible within SteamVR and it can be viewed even if the window is minimized on the desktop, or even if there's no window at all.

In Windows Mixed Reality, entering VR mode can minimize all of your desktop windows depending on your settings, in order to improve performance for VR.

Godot Engine currently stops rendering if the window is minimized on desktop, presumably to avoid unnecessarily rendering:

bool OS_Windows::can_draw() const {

	return !minimized;
};

( https://github.com/godotengine/godot/blob/3.2.3-stable/platform/windows/os_windows.cpp#L272 )

All of these factors combined make it so that my dashboard is useless and does not re-render unless the user manually makes sure to open the window on their desktop, so that the engine can continue rendering.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The ability to override can_draw(), or even just an option to allow rendering while minimized, would allow the dashboard to continue rendering regardless of the state of the actual window.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

I'm unsure about how to actually design overriding that method (ideas would be appreciated), but one simpler solution would be to simply have a boolean project setting called display/window/energy_saving/render_while_minimized.

If this enhancement will not be used often, can it be worked around with a few lines of script?

This is not scriptable functionality as it is part of the engine. For now, I had to build a custom version of the engine with the can_draw method above replaced with

bool OS_Windows::can_draw() const {

	return true;
};

Is there a reason why this should be core and not an add-on in the asset library?

See above

abb128 avatar Dec 03 '20 06:12 abb128