You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Add editor vital redraws only option
When editor continuous redraws is switched off, the editor only redraws when a redraw_request was issued by an element in the scene. This works well in most situations, but when scenes have dynamic content they will continuously issue redraw_requests. This can be fine on high power desktops but can be an annoyance on lower power machines. This PR splits redraw requests into high and low priority requests, defaulting to high priority. Requests due to e.g. shaders using TIME are assigned low priority. An extra editor setting is used to record the user preference and an extra option is added to the editor spinner menu, to allow the user to select between 3 modes: * Continuous * Update all changes * Update vital changes
This commit is contained in:
@@ -2277,7 +2277,16 @@ bool Main::iteration() {
|
||||
|
||||
if (OS::get_singleton()->can_draw() && VisualServer::get_singleton()->is_render_loop_enabled()) {
|
||||
if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) {
|
||||
if (VisualServer::get_singleton()->has_changed()) {
|
||||
// We can choose whether to redraw as a result of any redraw request, or redraw only for vital requests.
|
||||
VisualServer::ChangedPriority priority = (OS::get_singleton()->is_update_pending() ? VisualServer::CHANGED_PRIORITY_ANY : VisualServer::CHANGED_PRIORITY_HIGH);
|
||||
|
||||
// Determine whether the scene has changed, to know whether to draw.
|
||||
// If it has changed, inform the update pending system so it can keep
|
||||
// particle systems etc updating when running in vital updates only mode.
|
||||
bool has_changed = VisualServer::get_singleton()->has_changed(priority);
|
||||
OS::get_singleton()->set_update_pending(has_changed);
|
||||
|
||||
if (has_changed) {
|
||||
VisualServer::get_singleton()->draw(true, scaled_step); // flush visual commands
|
||||
Engine::get_singleton()->frames_drawn++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user