diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-05-16 15:11:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-16 15:11:20 +0200 |
commit | 93c4274941cf755c738a870eaeb71521da05cad3 (patch) | |
tree | 9ae7a8a5fa5cca37941bedf8e027d95c9dae498a | |
parent | dfd1331690fab7e634e2e18fd7269bab8f759b3a (diff) | |
parent | 0fc4f2252205f9c51168026ab757f095532b441a (diff) |
Merge pull request #18928 from BastiaanOlij/fix_viewport_flags
Store flags so it isn't lost when viewport isn't setup yet
-rw-r--r-- | scene/main/viewport.cpp | 14 | ||||
-rw-r--r-- | scene/main/viewport.h | 1 |
2 files changed, 9 insertions, 6 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index 5a3447bec0..f631fd6f3a 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -72,6 +72,9 @@ void ViewportTexture::setup_local_to_scene() { vp->viewport_textures.insert(this); VS::get_singleton()->texture_set_proxy(proxy, vp->texture_rid); + + vp->texture_flags = flags; + VS::get_singleton()->texture_set_flags(vp->texture_rid, flags); } void ViewportTexture::set_viewport_path_in_scene(const NodePath &p_path) { @@ -122,20 +125,18 @@ Ref<Image> ViewportTexture::get_data() const { return VS::get_singleton()->texture_get_data(vp->texture_rid); } void ViewportTexture::set_flags(uint32_t p_flags) { + flags = p_flags; if (!vp) return; - vp->texture_flags = p_flags; - VS::get_singleton()->texture_set_flags(vp->texture_rid, p_flags); + vp->texture_flags = flags; + VS::get_singleton()->texture_set_flags(vp->texture_rid, flags); } uint32_t ViewportTexture::get_flags() const { - if (!vp) - return 0; - - return vp->texture_flags; + return flags; } void ViewportTexture::_bind_methods() { @@ -149,6 +150,7 @@ void ViewportTexture::_bind_methods() { ViewportTexture::ViewportTexture() { vp = NULL; + flags = 0; set_local_to_scene(true); proxy = VS::get_singleton()->texture_create(); } diff --git a/scene/main/viewport.h b/scene/main/viewport.h index 363414bbad..c1ef58de69 100644 --- a/scene/main/viewport.h +++ b/scene/main/viewport.h @@ -58,6 +58,7 @@ class ViewportTexture : public Texture { friend class Viewport; Viewport *vp; + uint32_t flags; RID proxy; |