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