Skip to content

Commit

Permalink
Fix Viewport Texture must be set to use it
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilderin committed Sep 15, 2024
1 parent 6681f25 commit a0adc4a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ void ViewportTexture::set_viewport_path_in_scene(const NodePath &p_path) {
if (get_local_scene() && !path.is_empty()) {
setup_local_to_scene();
} else {
if (path.is_empty()) {
vp_changed = false;
}
emit_changed();
}
}
Expand All @@ -121,7 +124,7 @@ NodePath ViewportTexture::get_viewport_path_in_scene() const {

int ViewportTexture::get_width() const {
if (!vp) {
if (!vp_pending) {
if (!vp_pending && !vp_changed) {
ERR_PRINT("Viewport Texture must be set to use it.");
}
return 0;
Expand All @@ -131,7 +134,7 @@ int ViewportTexture::get_width() const {

int ViewportTexture::get_height() const {
if (!vp) {
if (!vp_pending) {
if (!vp_pending && !vp_changed) {
ERR_PRINT("Viewport Texture must be set to use it.");
}
return 0;
Expand All @@ -141,7 +144,7 @@ int ViewportTexture::get_height() const {

Size2 ViewportTexture::get_size() const {
if (!vp) {
if (!vp_pending) {
if (!vp_pending && !vp_changed) {
ERR_PRINT("Viewport Texture must be set to use it.");
}
return Size2();
Expand All @@ -163,7 +166,7 @@ bool ViewportTexture::has_alpha() const {

Ref<Image> ViewportTexture::get_image() const {
if (!vp) {
if (!vp_pending) {
if (!vp_pending && !vp_changed) {
ERR_PRINT("Viewport Texture must be set to use it.");
}
return Ref<Image>();
Expand Down

0 comments on commit a0adc4a

Please sign in to comment.