diff options
author | reduz <reduzio@gmail.com> | 2021-06-29 13:36:32 -0300 |
---|---|---|
committer | reduz <reduzio@gmail.com> | 2021-06-29 17:40:45 -0300 |
commit | d07f7c8d2516a338547dc4bbd73e17d3b357c8d7 (patch) | |
tree | dd46a26b78e4fb92f78b4cdac3a3acb9ca95607c /servers/rendering | |
parent | 916c37de09871be0f5578f2f23f700ecaa08f836 (diff) |
Fixes to 2D viewport
* Editor 2D viewport now uses embedded subwindows (windows no longer pop up)
* Restored the ability to disable 3D on the 2D viewport (makes 3D not display on 2D when there is a camera on the scene)
Diffstat (limited to 'servers/rendering')
-rw-r--r-- | servers/rendering/renderer_viewport.cpp | 9 | ||||
-rw-r--r-- | servers/rendering/renderer_viewport.h | 2 | ||||
-rw-r--r-- | servers/rendering/rendering_server_default.h | 1 |
3 files changed, 11 insertions, 1 deletions
diff --git a/servers/rendering/renderer_viewport.cpp b/servers/rendering/renderer_viewport.cpp index e34d36bfff..2cf4c035a9 100644 --- a/servers/rendering/renderer_viewport.cpp +++ b/servers/rendering/renderer_viewport.cpp @@ -122,7 +122,7 @@ void RendererViewport::_draw_viewport(Viewport *p_viewport, uint32_t p_view_coun } } - bool can_draw_3d = RSG::scene->is_camera(p_viewport->camera); + bool can_draw_3d = RSG::scene->is_camera(p_viewport->camera) && !p_viewport->disable_3d; if (p_viewport->clear_mode != RS::VIEWPORT_CLEAR_NEVER) { if (p_viewport->transparent_bg) { @@ -812,6 +812,13 @@ void RendererViewport::viewport_set_disable_environment(RID p_viewport, bool p_d viewport->disable_environment = p_disable; } +void RendererViewport::viewport_set_disable_3d(RID p_viewport, bool p_disable) { + Viewport *viewport = viewport_owner.getornull(p_viewport); + ERR_FAIL_COND(!viewport); + + viewport->disable_3d = p_disable; +} + void RendererViewport::viewport_attach_camera(RID p_viewport, RID p_camera) { Viewport *viewport = viewport_owner.getornull(p_viewport); ERR_FAIL_COND(!viewport); diff --git a/servers/rendering/renderer_viewport.h b/servers/rendering/renderer_viewport.h index 8fedf32c04..ca40829648 100644 --- a/servers/rendering/renderer_viewport.h +++ b/servers/rendering/renderer_viewport.h @@ -71,6 +71,7 @@ public: bool hide_scenario; bool hide_canvas; bool disable_environment; + bool disable_3d = false; bool measure_render_time; bool snap_2d_transforms_to_pixel; @@ -220,6 +221,7 @@ public: void viewport_set_hide_scenario(RID p_viewport, bool p_hide); void viewport_set_hide_canvas(RID p_viewport, bool p_hide); void viewport_set_disable_environment(RID p_viewport, bool p_disable); + void viewport_set_disable_3d(RID p_viewport, bool p_disable); void viewport_attach_camera(RID p_viewport, RID p_camera); void viewport_set_scenario(RID p_viewport, RID p_scenario); diff --git a/servers/rendering/rendering_server_default.h b/servers/rendering/rendering_server_default.h index 16e9f1fc77..b9afeafbab 100644 --- a/servers/rendering/rendering_server_default.h +++ b/servers/rendering/rendering_server_default.h @@ -585,6 +585,7 @@ public: FUNC2(viewport_set_hide_scenario, RID, bool) FUNC2(viewport_set_hide_canvas, RID, bool) FUNC2(viewport_set_disable_environment, RID, bool) + FUNC2(viewport_set_disable_3d, RID, bool) FUNC2(viewport_attach_camera, RID, RID) FUNC2(viewport_set_scenario, RID, RID) |