You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-30 16:26:50 +00:00
Clamps fov/size for Camera gizmo
This commit is contained in:
@@ -1275,7 +1275,7 @@ void CameraSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx
|
|||||||
if (camera->get_projection() == Camera::PROJECTION_PERSPECTIVE) {
|
if (camera->get_projection() == Camera::PROJECTION_PERSPECTIVE) {
|
||||||
Transform gt2 = camera->get_global_transform();
|
Transform gt2 = camera->get_global_transform();
|
||||||
float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt2);
|
float a = _find_closest_angle_to_half_pi_arc(s[0], s[1], 1.0, gt2);
|
||||||
camera->set("fov", a * 2.0);
|
camera->set("fov", CLAMP(a * 2.0, 1, 179));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
Vector3 ra, rb;
|
Vector3 ra, rb;
|
||||||
@@ -1285,8 +1285,7 @@ void CameraSpatialGizmoPlugin::set_handle(EditorSpatialGizmo *p_gizmo, int p_idx
|
|||||||
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
d = Math::stepify(d, SpatialEditor::get_singleton()->get_translate_snap());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d < 0)
|
d = CLAMP(d, 0.1, 16384);
|
||||||
d = 0;
|
|
||||||
|
|
||||||
camera->set("size", d);
|
camera->set("size", d);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -583,12 +583,14 @@ Camera::Projection Camera::get_projection() const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Camera::set_fov(float p_fov) {
|
void Camera::set_fov(float p_fov) {
|
||||||
|
ERR_FAIL_COND(p_fov < 1 || p_fov > 179);
|
||||||
fov = p_fov;
|
fov = p_fov;
|
||||||
_update_camera_mode();
|
_update_camera_mode();
|
||||||
_change_notify("fov");
|
_change_notify("fov");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Camera::set_size(float p_size) {
|
void Camera::set_size(float p_size) {
|
||||||
|
ERR_FAIL_COND(p_size < 0.1 || p_size > 16384);
|
||||||
size = p_size;
|
size = p_size;
|
||||||
_update_camera_mode();
|
_update_camera_mode();
|
||||||
_change_notify("size");
|
_change_notify("size");
|
||||||
|
|||||||
Reference in New Issue
Block a user