diff options
author | Haoyu Qiu <timothyqiu32@gmail.com> | 2022-11-15 17:02:20 +0800 |
---|---|---|
committer | Haoyu Qiu <timothyqiu32@gmail.com> | 2022-11-15 17:31:53 +0800 |
commit | 6c5dc78f59c78657525cd2301a7e945a30835888 (patch) | |
tree | ce2daa03dc2e6b677c9aef5f99fc55a79469539a /scene | |
parent | 245e6454a03a24bf074eb3715776125842e3b666 (diff) |
Make Camera3D gizmo the same aspect ratio as its viewport
Diffstat (limited to 'scene')
-rw-r--r-- | scene/3d/camera_3d.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/scene/3d/camera_3d.cpp b/scene/3d/camera_3d.cpp index 304e56326d..2a50575749 100644 --- a/scene/3d/camera_3d.cpp +++ b/scene/3d/camera_3d.cpp @@ -112,6 +112,12 @@ void Camera3D::_notification(int p_what) { if (current || first_camera) { viewport->_camera_3d_set(this); } + +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + viewport->connect(SNAME("size_changed"), callable_mp((Node3D *)this, &Camera3D::update_gizmos)); + } +#endif } break; case NOTIFICATION_TRANSFORM_CHANGED: { @@ -133,6 +139,11 @@ void Camera3D::_notification(int p_what) { } if (viewport) { +#ifdef TOOLS_ENABLED + if (Engine::get_singleton()->is_editor_hint()) { + viewport->disconnect(SNAME("size_changed"), callable_mp((Node3D *)this, &Camera3D::update_gizmos)); + } +#endif viewport->_camera_3d_remove(this); viewport = nullptr; } |