DayZ 1.24
Loading...
Searching...
No Matches
CTKeyframe.c
Go to the documentation of this file.
1class CTKeyframe extends ScriptedWidgetEventHandler
2{
3 protected int m_Index;
4 protected float m_InterpTime;
5 protected float m_TotalTimeBefore;
6
7 protected vector m_Position;
9 protected CameraToolsMenu m_Menu;
10
11 protected Widget m_Root;
12 protected TextWidget m_IndexWidget;
18
19 void CTKeyframe(int index, vector pos, vector orient, float int_value, float fov, float dof, int pin, float time_before, Widget root, CameraToolsMenu parent)
20 {
21 m_Menu = parent;
22
23 m_Root = GetGame().GetWorkspace().CreateWidgets("gui/layouts/camera_tools/keyframe_entry.layout", root);
24
25 m_IndexWidget = TextWidget.Cast(m_Root.FindAnyWidget("keyframe_id"));
26 m_InterpTimeWidget = EditBoxWidget.Cast(m_Root.FindAnyWidget("keyframe_time_edit"));
27 m_FOVWidget = EditBoxWidget.Cast(m_Root.FindAnyWidget("keyframe_fov_edit"));
28 m_DOFWidget = EditBoxWidget.Cast(m_Root.FindAnyWidget("keyframe_dof_edit"));
29 m_PinWidget = EditBoxWidget.Cast(m_Root.FindAnyWidget("keyframe_pin_edit"));
30 m_TotalTimeWidget = TextWidget.Cast(m_Root.FindAnyWidget("keyframe_time"));
31
32 m_Index = index;
33 m_TotalTimeBefore = time_before;
34 m_Position = pos;
36
38 SetFOV(fov);
39 SetDOF(dof);
40 SetPin(pin);
41 m_IndexWidget.SetText(m_Index.ToString());
42 m_Root.SetHandler(this);
43 }
44
46 {
47 delete m_Root;
48 }
49
51 {
52 string time_text = m_InterpTimeWidget.GetText();
53 m_InterpTime = time_text.ToFloat();
54 return m_InterpTime;
55 }
56
57 void SetPin(int pin)
58 {
59 m_PinWidget.SetText(pin.ToString());
60 }
61
62 int GetPin()
63 {
64 return m_PinWidget.GetText().ToInt();
65 }
66
67 void SetFOV(float fov)
68 {
69 m_FOVWidget.SetText(fov.ToString());
70 }
71
72 float GetFOV()
73 {
74 return m_FOVWidget.GetText().ToFloat();
75 }
76
77 void SetDOF(float dof)
78 {
79 m_DOFWidget.SetText(dof.ToString());
80 }
81
82 float GetDOF()
83 {
84 return m_DOFWidget.GetText().ToFloat();
85 }
86
88 {
89 m_Position = pos;
90 }
91
96
98 {
99 return m_Position;
100 }
101
103 {
104 return m_Orientation;
105 }
106
107 void SetTimeBefore(float time)
108 {
109 m_TotalTimeBefore = time;
110 m_TotalTimeWidget.SetText((m_TotalTimeBefore + m_InterpTime).ToString());
111 }
112
113 void SetInterpTime(float time)
114 {
115 m_InterpTime = time;
116 m_InterpTimeWidget.SetText(m_InterpTime.ToString());
117 m_TotalTimeWidget.SetText((m_TotalTimeBefore + m_InterpTime).ToString());
118 }
119
120 void Select()
121 {
122 m_Root.FindAnyWidget("spacer").SetAlpha(1);
123 m_IndexWidget.SetColor(ARGBF(1, 1, 0, 0));
124 m_InterpTimeWidget.SetColor(ARGBF(1, 1, 0, 0));
125 m_TotalTimeWidget.SetColor(ARGBF(1, 1, 0, 0));
126 }
127
128 void Unselect()
129 {
130 m_Root.FindAnyWidget("spacer").SetAlpha(0.625);
131 m_IndexWidget.SetColor(ARGBF(1, 1, 1, 1));
132 m_InterpTimeWidget.SetColor(ARGBF(1, 1, 1, 1));
133 m_TotalTimeWidget.SetColor(ARGBF(1, 1, 1, 1));
134 }
135
136 override bool OnClick(Widget w, int x, int y, int button)
137 {
138 if (w == m_Root)
139 {
140 m_Menu.SelectKeyframe(this);
141 return true;
142 }
143 return false;
144 }
145
146 override bool OnFocus(Widget w, int x, int y)
147 {
148 if (IsFocusable(w))
149 {
150 m_Menu.SelectKeyframe(this);
151 return true;
152 }
153 return false;
154 }
155
157 {
158 if (w)
159 return (w == m_InterpTimeWidget || w == m_TotalTimeWidget || w == m_FOVWidget || w == m_DOFWidget);
160 return false;
161 }
162}
vector m_Orientation
vector m_Position
Cached world position.
Definition Effect.c:41
proto string ToString()
Icon x
Icon y
ServerBrowserMenuNew m_Menu
Widget m_Root
Definition SizeToChild.c:85
map: item x vector(index, width, height)
Definition EnWidgets.c:651
void SetDOF(float dof)
Definition CTKeyframe.c:77
EditBoxWidget m_FOVWidget
Definition CTKeyframe.c:14
void SetFOV(float fov)
Definition CTKeyframe.c:67
EditBoxWidget m_DOFWidget
Definition CTKeyframe.c:15
EditBoxWidget m_PinWidget
Definition CTKeyframe.c:16
CameraToolsMenu m_Menu
Definition CTEvent.c:8
void CTKeyframe(int index, vector pos, vector orient, float int_value, float fov, float dof, int pin, float time_before, Widget root, CameraToolsMenu parent)
Definition CTKeyframe.c:19
void SetInterpTime(float time)
Definition CTKeyframe.c:113
override bool OnClick(Widget w, int x, int y, int button)
Definition CTKeyframe.c:136
void SetPosition(vector pos)
Definition CTKeyframe.c:87
void SetOrientation(vector orient)
Definition CTKeyframe.c:92
EditBoxWidget m_InterpTimeWidget
Definition CTKeyframe.c:13
bool IsFocusable(Widget w)
Definition CTKeyframe.c:156
void SetTimeBefore(float time)
Definition CTKeyframe.c:107
override bool OnFocus(Widget w, int x, int y)
Definition CTKeyframe.c:146
proto string ToString()
proto native CGame GetGame()
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
Definition proto.c:332