Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions scene/main/canvas_item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1622,13 +1622,25 @@ bool CanvasItem::get_visibility_layer_bit(uint32_t p_visibility_layer) const {
return (visibility_layer & (1 << p_visibility_layer));
}

CanvasItem *CanvasItem::_get_parent_item_deep() const {
Node *parent = get_parent();
while (parent) {
CanvasItem *ci = Object::cast_to<CanvasItem>(parent);
if (ci) {
return ci;
}
parent = parent->get_parent();
}
return nullptr;
}

void CanvasItem::_refresh_texture_filter_cache() const {
if (!is_inside_tree()) {
return;
}

if (texture_filter == TEXTURE_FILTER_PARENT_NODE) {
CanvasItem *parent_item = get_parent_item();
CanvasItem *parent_item = _get_parent_item_deep();
if (parent_item) {
texture_filter_cache = parent_item->texture_filter_cache;
} else {
Expand Down Expand Up @@ -1684,7 +1696,7 @@ void CanvasItem::_refresh_texture_repeat_cache() const {
}

if (texture_repeat == TEXTURE_REPEAT_PARENT_NODE) {
CanvasItem *parent_item = get_parent_item();
CanvasItem *parent_item = _get_parent_item_deep();
if (parent_item) {
texture_repeat_cache = parent_item->texture_repeat_cache;
} else {
Expand Down
2 changes: 2 additions & 0 deletions scene/main/canvas_item.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ class CanvasItem : public Node {
virtual void _top_level_changed();
virtual void _top_level_changed_on_parent();

CanvasItem *_get_parent_item_deep() const;

void _redraw_callback();

void _enter_canvas();
Expand Down