Fix ViewportTexture error when viewport is used from a child scene

Fix invalid errors when a separate child scene file contains a viewport and
that viewport is used for a texture in the current scene.

Fixes #27790.
This commit is contained in:
jitspoe 2021-09-02 20:40:52 -04:00 committed by Rémi Verschelde
parent 98e1b730c8
commit d2637ca950
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 5 additions and 5 deletions

View File

@ -53,17 +53,17 @@
#include "servers/physics_2d_server.h"
void ViewportTexture::setup_local_to_scene() {
Node *local_scene = get_local_scene();
if (!local_scene) {
return;
}
if (vp) {
vp->viewport_textures.erase(this);
}
vp = nullptr;
Node *local_scene = get_local_scene();
if (!local_scene) {
return;
}
Node *vpn = local_scene->get_node(path);
ERR_FAIL_COND_MSG(!vpn, "ViewportTexture: Path to node is invalid.");