3 [
Attribute(
desc:
"%1: vertical FOV (multiplier)\n%2: focal length (mm)\n%3 focus distance (m)")]
7 protected int m_CameraLens;
10 protected TextWidget m_TextWidget;
16 protected void Refresh()
18 float verticalFOV =
m_Camera.GetVerticalFOV();
19 float zoomCoef =
m_Camera.GetDefaultFOV() / verticalFOV;
20 int focalLength = zoomCoef * m_CameraLens;
22 float focusDistance = -1;
24 focusDistance = m_FocusComponent.GetFocusDistance();
26 string focusDistanceString =
"-";
27 if (focusDistance != -1)
28 focusDistanceString = focusDistance.ToString(1, 1);
30 m_TextWidget.SetTextFormat(m_Text, zoomCoef.ToString(1, 1), focalLength, focusDistanceString);
40 m_ZoomComponent.GetOnZoomChange().Insert(Refresh);
44 m_FocusComponent.GetOnFocusDistanceChange().Insert(Refresh);
55 cameraManager.GetOnCameraCreate().Remove(OnCameraCreate);
59 override void HandlerAttachedScripted(Widget w)
64 Debug.Error(
"SCR_CameraInfoEditorUIComponent must be attached to a text widget!");
79 cameraManager.GetOnCameraCreate().Insert(OnCameraCreate);
85 override void HandlerDeattached(Widget w)
87 super.HandlerDeattached(w);
90 m_ZoomComponent.GetOnZoomChange().Remove(Refresh);
93 m_FocusComponent.GetOnFocusDistanceChange().Remove(Refresh);