You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-10 13:00:37 +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:
@@ -40,7 +40,7 @@
|
||||
|
||||
// careful, these may run in different threads than the visual server
|
||||
|
||||
int VisualServerRaster::changes = 0;
|
||||
int VisualServerRaster::changes[2] = { 0 };
|
||||
|
||||
/* BLACK BARS */
|
||||
|
||||
@@ -98,7 +98,8 @@ void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {
|
||||
//needs to be done before changes is reset to 0, to not force the editor to redraw
|
||||
VS::get_singleton()->emit_signal("frame_pre_draw");
|
||||
|
||||
changes = 0;
|
||||
changes[0] = 0;
|
||||
changes[1] = 0;
|
||||
|
||||
VSG::rasterizer->begin_frame(frame_step);
|
||||
|
||||
@@ -127,8 +128,19 @@ void VisualServerRaster::draw(bool p_swap_buffers, double frame_step) {
|
||||
}
|
||||
void VisualServerRaster::sync() {
|
||||
}
|
||||
bool VisualServerRaster::has_changed() const {
|
||||
return changes > 0;
|
||||
|
||||
bool VisualServerRaster::has_changed(ChangedPriority p_priority) const {
|
||||
switch (p_priority) {
|
||||
default: {
|
||||
return (changes[0] > 0) || (changes[1] > 0);
|
||||
} break;
|
||||
case CHANGED_PRIORITY_LOW: {
|
||||
return changes[0] > 0;
|
||||
} break;
|
||||
case CHANGED_PRIORITY_HIGH: {
|
||||
return changes[1] > 0;
|
||||
} break;
|
||||
}
|
||||
}
|
||||
void VisualServerRaster::init() {
|
||||
VSG::rasterizer->initialize();
|
||||
|
||||
Reference in New Issue
Block a user