Skip to content

Commit 6c1e50a

Browse files
committed
Make initialization settings take effect in SubViewport
`SubViewport` has some initialization settings of its own, but these settings are not synchronized to the `RenderingServer` when initialized, which causes some problems. Split from godotengine#62854. This is a prerequisite to resolve godotengine#55471, still need to modify `update_mode` manually, or add as a child to `SubViewportContainer` (`update_mode` is automatically set to `UPDATE_ALWAYS`). Currently, `UPDATE_WHEN_VISIBLE` has no meaning for `SubViewport`. Presumably for **visible**, `RenderingServer` has different rules, viewport needs to have a visible **rect** to be considered **visible**, while `SubViewport` has only `size` and **no** `position`, so it is not considered **visible** even if it is set to be an active viewport (`RS::viewport_set_active`).
1 parent 7355dfb commit 6c1e50a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

scene/main/viewport.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -4148,6 +4148,10 @@ void SubViewport::_bind_methods() {
41484148
BIND_ENUM_CONSTANT(UPDATE_ALWAYS);
41494149
}
41504150

4151-
SubViewport::SubViewport() {}
4151+
SubViewport::SubViewport() {
4152+
RS::get_singleton()->viewport_set_clear_mode(get_viewport_rid(), RS::ViewportClearMode(clear_mode));
4153+
RS::get_singleton()->viewport_set_update_mode(get_viewport_rid(), RS::ViewportUpdateMode(update_mode));
4154+
set_size(_get_size());
4155+
}
41524156

41534157
SubViewport::~SubViewport() {}

0 commit comments

Comments
 (0)