Don't redraw invisible CanvasItems
This commit is contained in:
@ -136,9 +136,11 @@ void CanvasItem::_redraw_callback() {
|
||||
return;
|
||||
}
|
||||
|
||||
RID ci = get_canvas_item();
|
||||
RenderingServer::get_singleton()->canvas_item_clear(ci);
|
||||
//todo updating = true - only allow drawing here
|
||||
if (draw_commands_dirty) {
|
||||
RenderingServer::get_singleton()->canvas_item_clear(get_canvas_item());
|
||||
draw_commands_dirty = false;
|
||||
}
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
drawing = true;
|
||||
Ref<TextServer> ts = TextServerManager::get_singleton()->get_primary_interface();
|
||||
@ -154,9 +156,9 @@ void CanvasItem::_redraw_callback() {
|
||||
ts->set_current_drawn_item_oversampling(0.0);
|
||||
}
|
||||
drawing = false;
|
||||
draw_commands_dirty = true;
|
||||
}
|
||||
//todo updating = false
|
||||
pending_update = false; // don't change to false until finished drawing (avoid recursive update)
|
||||
pending_update = false; // Don't change to false until finished drawing (avoid recursive update).
|
||||
}
|
||||
|
||||
Transform2D CanvasItem::get_global_transform_with_canvas() const {
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
class CanvasLayer;
|
||||
class MultiMesh;
|
||||
class StyleBox;
|
||||
class SubViewport;
|
||||
class Window;
|
||||
class World2D;
|
||||
|
||||
@ -97,6 +98,7 @@ private:
|
||||
bool visible = true;
|
||||
bool parent_visible_in_tree = false;
|
||||
bool pending_update = false;
|
||||
bool draw_commands_dirty = false;
|
||||
bool top_level = false;
|
||||
bool drawing = false;
|
||||
bool block_transform_notify = false;
|
||||
|
||||
Reference in New Issue
Block a user