Remove first_draw
and reset visibility when entering tree
This commit is contained in:
parent
eac22e3eb4
commit
fc17d3563d
2 changed files with 4 additions and 9 deletions
|
@ -64,9 +64,6 @@ void CanvasItem::_propagate_visibility_changed(bool p_parent_visible_in_tree) {
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (p_parent_visible_in_tree && first_draw) { // Avoid propagating it twice.
|
|
||||||
first_draw = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_handle_visibility_change(p_parent_visible_in_tree);
|
_handle_visibility_change(p_parent_visible_in_tree);
|
||||||
}
|
}
|
||||||
|
@ -133,10 +130,6 @@ void CanvasItem::_update_callback() {
|
||||||
RenderingServer::get_singleton()->canvas_item_clear(get_canvas_item());
|
RenderingServer::get_singleton()->canvas_item_clear(get_canvas_item());
|
||||||
//todo updating = true - only allow drawing here
|
//todo updating = true - only allow drawing here
|
||||||
if (is_visible_in_tree()) {
|
if (is_visible_in_tree()) {
|
||||||
if (first_draw) {
|
|
||||||
notification(NOTIFICATION_VISIBILITY_CHANGED);
|
|
||||||
first_draw = false;
|
|
||||||
}
|
|
||||||
drawing = true;
|
drawing = true;
|
||||||
current_item_drawn = this;
|
current_item_drawn = this;
|
||||||
notification(NOTIFICATION_DRAW);
|
notification(NOTIFICATION_DRAW);
|
||||||
|
@ -268,7 +261,6 @@ void CanvasItem::_notification(int p_what) {
|
||||||
switch (p_what) {
|
switch (p_what) {
|
||||||
case NOTIFICATION_ENTER_TREE: {
|
case NOTIFICATION_ENTER_TREE: {
|
||||||
ERR_FAIL_COND(!is_inside_tree());
|
ERR_FAIL_COND(!is_inside_tree());
|
||||||
first_draw = true;
|
|
||||||
|
|
||||||
Node *parent = get_parent();
|
Node *parent = get_parent();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
|
@ -307,6 +299,10 @@ void CanvasItem::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RenderingServer::get_singleton()->canvas_item_set_visible(canvas_item, is_visible_in_tree()); // The visibility of the parent may change.
|
||||||
|
if (is_visible_in_tree()) {
|
||||||
|
notification(NOTIFICATION_VISIBILITY_CHANGED); // Considered invisible until entered.
|
||||||
|
}
|
||||||
_enter_canvas();
|
_enter_canvas();
|
||||||
|
|
||||||
_update_texture_filter_changed(false);
|
_update_texture_filter_changed(false);
|
||||||
|
|
|
@ -83,7 +83,6 @@ private:
|
||||||
int light_mask = 1;
|
int light_mask = 1;
|
||||||
|
|
||||||
Window *window = nullptr;
|
Window *window = nullptr;
|
||||||
bool first_draw = false;
|
|
||||||
bool visible = true;
|
bool visible = true;
|
||||||
bool parent_visible_in_tree = false;
|
bool parent_visible_in_tree = false;
|
||||||
bool clip_children = false;
|
bool clip_children = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue