Merge pull request #80325 from lawnjelly/fti2d_check_skel_attach

[3.x] Hierarchical culling - Add extra check to `skeleton_attach_canvas_item`
This commit is contained in:
Rémi Verschelde 2023-08-15 09:04:09 +02:00
commit c685501f51
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 14 additions and 0 deletions

View file

@ -3806,6 +3806,13 @@ void RasterizerStorageGLES2::skeleton_attach_canvas_item(RID p_skeleton, RID p_c
ERR_FAIL_COND(!p_canvas_item.is_valid());
if (p_attach) {
#ifdef DEV_ENABLED
// skeleton_attach_canvas_item() is not bound,
// and checks in canvas_item_attach_skeleton() should prevent this,
// but there isn't much harm in a DEV_ENABLED check here.
int64_t found = skeleton->linked_canvas_items.find(p_canvas_item);
ERR_FAIL_COND(found != -1);
#endif
skeleton->linked_canvas_items.push_back(p_canvas_item);
} else {
int64_t found = skeleton->linked_canvas_items.find(p_canvas_item);

View file

@ -5348,6 +5348,13 @@ void RasterizerStorageGLES3::skeleton_attach_canvas_item(RID p_skeleton, RID p_c
ERR_FAIL_COND(!p_canvas_item.is_valid());
if (p_attach) {
#ifdef DEV_ENABLED
// skeleton_attach_canvas_item() is not bound,
// and checks in canvas_item_attach_skeleton() should prevent this,
// but there isn't much harm in a DEV_ENABLED check here.
int64_t found = skeleton->linked_canvas_items.find(p_canvas_item);
ERR_FAIL_COND(found != -1);
#endif
skeleton->linked_canvas_items.push_back(p_canvas_item);
} else {
int64_t found = skeleton->linked_canvas_items.find(p_canvas_item);