1class CTKeyframe
extends ScriptedWidgetEventHandler
4 protected float m_InterpTime;
5 protected float m_TotalTimeBefore;
9 protected CameraToolsMenu
m_Menu;
12 protected TextWidget m_IndexWidget;
13 protected EditBoxWidget m_InterpTimeWidget;
14 protected EditBoxWidget m_FOVWidget;
15 protected EditBoxWidget m_DOFWidget;
16 protected EditBoxWidget m_PinWidget;
17 protected TextWidget m_TotalTimeWidget;
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 )
23 m_Root =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/camera_tools/keyframe_entry.layout", root );
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" ) );
33 m_TotalTimeBefore = time_before;
37 SetInterpTime( int_value );
41 m_IndexWidget.SetText( m_Index.ToString() );
52 string time_text = m_InterpTimeWidget.GetText();
53 m_InterpTime = time_text.ToFloat();
57 void SetPin(
int pin )
59 m_PinWidget.SetText( pin.ToString() );
64 return m_PinWidget.GetText().ToInt();
67 void SetFOV(
float fov )
69 m_FOVWidget.SetText( fov.ToString() );
74 return m_FOVWidget.GetText().ToFloat();
77 void SetDOF(
float dof )
79 m_DOFWidget.SetText( dof.ToString() );
84 return m_DOFWidget.GetText().ToFloat();
92 void SetOrientation( vector orient )
107 void SetTimeBefore(
float time )
109 m_TotalTimeBefore = time;
110 m_TotalTimeWidget.SetText( ( m_TotalTimeBefore + m_InterpTime ).
ToString() );
113 void SetInterpTime(
float time )
116 m_InterpTimeWidget.SetText( m_InterpTime.ToString() );
117 m_TotalTimeWidget.SetText( ( m_TotalTimeBefore + m_InterpTime ).
ToString() );
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 ) );
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 ) );
136 override bool OnClick( Widget w,
int x,
int y,
int button )
140 m_Menu.SelectKeyframe(
this );
146 override bool OnFocus( Widget w,
int x,
int y )
150 m_Menu.SelectKeyframe(
this );
160 return ( w == m_InterpTimeWidget || w == m_TotalTimeWidget || w == m_FOVWidget || w == m_DOFWidget );
override bool OnClick(Widget w, int x, int y, int button)
buttons clicks
vector m_Position
Cached world position.
proto native void SetPosition(vector position)
Set the world position of the Effect.
int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.
ServerBrowserMenuNew m_Menu
bool IsFocusable(Widget w)
override bool OnFocus(Widget w, int x, int y)