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 b1c6826b9f
commit 2ceba818c3
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -57,17 +57,17 @@
#include "servers/audio_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.");