summaryrefslogtreecommitdiffstats
path: root/editor/plugins/gizmos
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/gizmos')
-rw-r--r--editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp20
-rw-r--r--editor/plugins/gizmos/camera_3d_gizmo_plugin.h1
2 files changed, 1 insertions, 20 deletions
diff --git a/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp b/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp
index 63a48d4165..359bb59098 100644
--- a/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp
+++ b/editor/plugins/gizmos/camera_3d_gizmo_plugin.cpp
@@ -46,24 +46,6 @@ Camera3DGizmoPlugin::Camera3DGizmoPlugin() {
create_handle_material("handles");
}
-Size2i Camera3DGizmoPlugin::_get_viewport_size(Camera3D *p_camera) {
- Viewport *viewport = p_camera->get_viewport();
-
- Window *window = Object::cast_to<Window>(viewport);
- if (window) {
- return window->get_size();
- }
-
- SubViewport *sub_viewport = Object::cast_to<SubViewport>(viewport);
- ERR_FAIL_NULL_V(sub_viewport, Size2i());
-
- if (sub_viewport == EditorNode::get_singleton()->get_scene_root()) {
- return Size2(GLOBAL_GET("display/window/size/viewport_width"), GLOBAL_GET("display/window/size/viewport_height"));
- }
-
- return sub_viewport->get_size();
-}
-
bool Camera3DGizmoPlugin::has_gizmo(Node3D *p_spatial) {
return Object::cast_to<Camera3D>(p_spatial) != nullptr;
}
@@ -166,7 +148,7 @@ void Camera3DGizmoPlugin::redraw(EditorNode3DGizmo *p_gizmo) {
Ref<Material> material = get_material("camera_material", p_gizmo);
Ref<Material> icon = get_material("camera_icon", p_gizmo);
- const Size2i viewport_size = _get_viewport_size(camera);
+ const Size2i viewport_size = Node3DEditor::get_camera_viewport_size(camera);
const real_t viewport_aspect = viewport_size.x > 0 && viewport_size.y > 0 ? viewport_size.aspect() : 1.0;
const Size2 size_factor = viewport_aspect > 1.0 ? Size2(1.0, 1.0 / viewport_aspect) : Size2(viewport_aspect, 1.0);
diff --git a/editor/plugins/gizmos/camera_3d_gizmo_plugin.h b/editor/plugins/gizmos/camera_3d_gizmo_plugin.h
index ba65ebb8de..94238704c1 100644
--- a/editor/plugins/gizmos/camera_3d_gizmo_plugin.h
+++ b/editor/plugins/gizmos/camera_3d_gizmo_plugin.h
@@ -37,7 +37,6 @@ class Camera3DGizmoPlugin : public EditorNode3DGizmoPlugin {
GDCLASS(Camera3DGizmoPlugin, EditorNode3DGizmoPlugin);
private:
- static Size2i _get_viewport_size(Camera3D *p_camera);
static float _find_closest_angle_to_half_pi_arc(const Vector3 &p_from, const Vector3 &p_to, float p_arc_radius, const Transform3D &p_arc_xform);
public: