diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-11-02 11:33:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-02 11:33:22 +0100 |
commit | a3501c096f32506bf2262e36a302bf65f4ad0f4a (patch) | |
tree | 129a19c6e81903753d7d72c001c52354a00a6bc9 /editor/plugins | |
parent | 5beaea989146a7ac6d4e5fa74d084d911622e543 (diff) | |
parent | 621a5457ed2da37fd09a0a999925b00024a471e4 (diff) |
Merge pull request #21897 from Calinou/3d-display-camera-coordinates
Display camera coordinates in the 3D viewport's information pane
Diffstat (limited to 'editor/plugins')
-rw-r--r-- | editor/plugins/spatial_editor_plugin.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp index ab89d170da..fa2f54d0b3 100644 --- a/editor/plugins/spatial_editor_plugin.cpp +++ b/editor/plugins/spatial_editor_plugin.cpp @@ -2231,8 +2231,21 @@ void SpatialEditorViewport::_notification(int p_what) { bool show_info = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_INFORMATION)); info_label->set_visible(show_info); + Camera *current_camera; + + if (previewing) { + current_camera = previewing; + } else { + current_camera = camera; + } + if (show_info) { String text; + text += "X: " + rtos(current_camera->get_translation().x).pad_decimals(1) + "\n"; + text += "Y: " + rtos(current_camera->get_translation().y).pad_decimals(1) + "\n"; + text += "Z: " + rtos(current_camera->get_translation().z).pad_decimals(1) + "\n"; + text += TTR("Pitch") + ": " + itos(Math::round(current_camera->get_rotation_degrees().x)) + "\n"; + text += TTR("Yaw") + ": " + itos(Math::round(current_camera->get_rotation_degrees().y)) + "\n\n"; text += TTR("Objects Drawn") + ": " + itos(viewport->get_render_info(Viewport::RENDER_INFO_OBJECTS_IN_FRAME)) + "\n"; text += TTR("Material Changes") + ": " + itos(viewport->get_render_info(Viewport::RENDER_INFO_MATERIAL_CHANGES_IN_FRAME)) + "\n"; text += TTR("Shader Changes") + ": " + itos(viewport->get_render_info(Viewport::RENDER_INFO_SHADER_CHANGES_IN_FRAME)) + "\n"; |