diff options
| author | Yuri Sizov <11782833+YuriSizov@users.noreply.github.com> | 2023-03-27 20:14:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-27 20:14:47 +0200 |
| commit | 19501f8eb19481b029f67ecf78e711d42f2fc431 (patch) | |
| tree | 933ea3320b35bce6ba65ab1e1d1aa8ad662c90d4 /scene/main/viewport.cpp | |
| parent | cacf49999e3fb37281d66cc591ca8bebc5712d4d (diff) | |
| parent | 843f5adbc523ad2511322b4f09b5ce5a3fb9e225 (diff) | |
Merge pull request #75397 from YuriSizov/4.0-cherrypicks
Cherry-picks for the 4.0 branch (future 4.0.2) - 1st batch
Diffstat (limited to 'scene/main/viewport.cpp')
| -rw-r--r-- | scene/main/viewport.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 244e0d5b93..8cd57536bf 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -4281,6 +4281,11 @@ void SubViewport::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { RS::get_singleton()->viewport_set_active(get_viewport_rid(), true); + + SubViewportContainer *parent_svc = Object::cast_to<SubViewportContainer>(get_parent()); + if (parent_svc) { + parent_svc->recalc_force_viewport_sizes(); + } } break; case NOTIFICATION_EXIT_TREE: { @@ -4323,6 +4328,17 @@ void SubViewport::_bind_methods() { BIND_ENUM_CONSTANT(UPDATE_ALWAYS); } +void SubViewport::_validate_property(PropertyInfo &p_property) const { + if (p_property.name == "size") { + SubViewportContainer *parent_svc = Object::cast_to<SubViewportContainer>(get_parent()); + if (parent_svc && parent_svc->is_stretch_enabled()) { + p_property.usage = PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_READ_ONLY; + } else { + p_property.usage = PROPERTY_USAGE_DEFAULT; + } + } +} + SubViewport::SubViewport() { RS::get_singleton()->viewport_set_size(get_viewport_rid(), get_size().width, get_size().height); } |