82 layoutRoot.Show(
false );
83 g_Game.GetUIManager().ShowUICursor(
false);
84 g_Game.GetMission().RemoveActiveInputExcludes({
"menu"},
true);
94 MissionGameplay ms = MissionGameplay.Cast(
g_Game.GetMission());
96 ms.GetHud().Show(
true);
105 g_Game.GetMission().AddActiveInputExcludes({
"menu"});
115 g_Game.GetUIManager().ShowUICursor(
false);
116 g_Game.GetMission().RemoveActiveInputExcludes({
"menu"},
true);
141 layoutRoot =
g_Game.GetWorkspace().CreateWidgets(
"gui/layouts/camera_tools/camera_tools.layout" );
144 m_EventContent = layoutRoot.FindAnyWidget(
"events_list_content" );
145 m_InterpTypeCombo = XComboBoxWidget.Cast( layoutRoot.FindAnyWidget(
"interp_type" ) );
152 m_AddKeyframe = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"add_keyframe" ) );
153 m_AddEvent = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"add_event" ) );
155 m_AddItem = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"add_actor_item" ) );
156 m_AddHandsItem = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"add_actor_item_hands" ) );
157 m_AddActor = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"add_actor" ) );
158 m_Play = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"play" ) );
159 m_Stop = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"stop" ) );
160 m_Save = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"save" ) );
161 m_Load = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"load" ) );
162 m_Reset = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"reset" ) );
164 m_SaveKeyframe = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"save_keyframe" ) );
165 m_DeleteKeyframe = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"delete_keyframe" ) );
166 m_ViewKeyframe = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"snap_to_keyframe" ) );
167 m_SaveEvent = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"save_event" ) );
168 m_DeleteEvent = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"delete_event" ) );
169 m_ViewEvent = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"snap_to_event" ) );
171 m_CopyButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"CopyButton" ) );
172 m_ApplyButton = ButtonWidget.Cast( layoutRoot.FindAnyWidget(
"ApplyButton" ) );
176 MissionGameplay ms = MissionGameplay.Cast(
g_Game.GetMission() );
177 ms.GetHud().Show(
false );
189 if ( index > -1 && index <
m_Actors.Count() )
203 cb.EnableCancelCondition(
true);
219 if (!JsonFileLoader<ref CTSaveStructure>.LoadFile(
m_CameraToolsDataPath +
"/keyframe_data.json", saveData, errorMessage))
226 foreach (Param6<vector, vector, float, float, float, int> transform : saveData.
m_Cameras)
228 CTKeyframe keyFrame =
new CTKeyframe(
241 keyFrame.SetInterpTime(transform.param3);
245 foreach (Param4<int, int, float, bool> eventEntry : saveData.
m_Events)
247 CTEvent ev =
new CTEvent(
255 ev.SetEventType(eventEntry.param2);
256 ev.SetEventTime(eventEntry.param3);
262 CTActor ac =
new CTActor(
m_Actors.Count(), actorEntry.param1, actorEntry.param2, actorEntry.param3, actorEntry.param4, actorEntry.param5,
this);
277 foreach (CTKeyframe keyframe :
m_Cameras)
279 Param6<vector, vector, float, float, float, int> transform =
new Param6<vector, vector, float, float, float, int>(
280 keyframe.GetPosition(),
281 keyframe.GetOrientation(),
282 keyframe.GetInterpTime(),
290 foreach (CTEvent eventEntry :
m_Events)
292 Param4<int, int, float, bool> ev =
new Param4<int, int, float, bool>(
293 eventEntry.GetEventActor(),
294 eventEntry.GetEventType(),
295 eventEntry.GetEventTime(),
296 eventEntry.GetEventWalk(),
301 foreach (CTActor actorEntry :
m_Actors)
303 Param5<vector, vector, string, ref array<string>,
string> ac =
new Param5<vector, vector, string, ref array<string>,
string>(
304 actorEntry.GetPosition(),
305 actorEntry.GetRotation(),
306 actorEntry.GetActorType(),
307 actorEntry.GetItems(),
308 actorEntry.GetHandsItem(),
314 if (!JsonFileLoader<ref CTSaveStructure>.SaveFile(
m_CameraToolsDataPath +
"/keyframe_data.json", saveData, errorMessage))
323 if (!JsonFileLoader<ref CTSaveStructure>.SaveFile(
m_CameraToolsDataPath +
"/keyframe_data.json", saveData, errorMessage))
333 for (
int i = 0; i < index; i++ )
335 time +=
m_Cameras.Get( i ).GetInterpTime();
342 if (
Camera.GetCurrentCamera() )
344 vector pos =
Camera.GetCurrentCamera().GetWorldPosition();
345 vector orient =
Camera.GetCurrentCamera().GetOrientation();
394 if ( actor_index > -1 )
404 int id_int =
id.ToInt();
405 if (
m_Actors.Count() > id_int && id_int > -1 )
407 CTActor ac =
m_Actors.Get( id_int );
415 int id_int =
id.ToInt();
416 if (
m_Actors.Count() > id_int && id_int > -1 )
418 CTActor ac =
m_Actors.Get( id_int );
420 ac.SetHandsItem( type );
450 if (
Camera.GetCurrentCamera())
454 layoutRoot.Show(
false );
455 g_Game.GetUIManager().ShowUICursor(
false );
458 foreach ( CTKeyframe keyframe :
m_Cameras )
460 Param6<vector, vector, float, float, float, int> transform =
new Param6<vector, vector, float, float, float, int>( keyframe.GetPosition(), keyframe.GetOrientation(), keyframe.GetInterpTime(), keyframe.GetFOV(), keyframe.GetDOF(), keyframe.GetPin() );
502 layoutRoot.Show(
true );
503 g_Game.GetUIManager().ShowUICursor(
true );
508 FreeDebugCamera.GetInstance().SetActive(
true);
529 vector dir = FreeDebugCamera.GetInstance().GetDirection();
530 vector from = FreeDebugCamera.GetInstance().GetPosition();
531 vector to = from + ( dir * 10000 );
534 int contact_component;
538 if (
DayZPhysics.
RaycastRV(from, to, contact_pos, contact_dir, contact_component, null, null, ev_obj) )
549 vector from = FreeDebugCamera.GetInstance().GetPosition();
550 vector to = from + ( dir * 10000 );
553 int contact_component;
557 if (
DayZPhysics.
RaycastRV(from, to, contact_pos, contact_dir, contact_component, null, null, ev_obj) )
568 string camPos = MiscGameplayFunctions.TruncateVecToS(FreeDebugCamera.GetInstance().GetPosition(),0);
569 string camOri = MiscGameplayFunctions.TruncateVecToS(FreeDebugCamera.GetInstance().GetOrientation(),0);
572 #ifdef DIAG_DEVELOPER
581 Param4<vector, vector,float,float> p4 =
new Param4<vector, vector,float,float>(
g_Game.GetCurrentCameraPosition(),
g_Game.GetCurrentCameraDirection(), cam.GetNearPlane(), cam.GetCurrentFOV());
582 g_Game.RPCSingleParam(null,
ERPCs.DIAG_CAMERATOOLS_CAM_DATA, p4,
false);
612 int bone_index = p.GetBoneIndexByName(
"LeftHand_Dummy");
614 p.GetBoneRotationWS( bone_index, bone_rot );
620 float temp = new_orient[1];
621 new_orient[0] = new_orient[0] + 325;
622 new_orient[1] = new_orient[2] + 245;
623 new_orient[2] = temp + 290;
676 FreeDebugCamera.GetInstance().SetOrientation(
"0 0 0" );
691 for (
int i = 0; i < (
m_Cameras.Count() - 1 ); i++ )
700 if ( !
g_Game.IsLeftCtrlDown() )
714 ac.Update( timeslice );
719 float SetCameraData( Param6<vector, vector, float, float, float,int> transform1, Param6<vector, vector, float, float, float, int> transform2 )
721 float int_value = transform1.param3;
724 int_value =
vector.
Distance( transform1.param1, transform2.param1 ) / int_value;
729 if ( transform1.param6 > -1 )
734 b_index = p.GetBoneIndexByName(
"LeftHand_Dummy" );
740 m_Camera1.SetPosition( transform1.param1 );
741 m_Camera1.SetOrientation( transform1.param2 );
749 if ( transform2.param6 > -1 )
755 b_index = p.GetBoneIndexByName(
"LeftHand_Dummy" );
758 m_Camera2.SetPosition( p.GetBonePositionWS( b_index ) );
760 p.GetBoneRotationWS( b_index, pQuat);
772 m_Camera2.SetPosition( transform2.param1 );
773 m_Camera2.SetOrientation( transform2.param2 );
797 g_Game.GetInput().ResetGameFocus();
798 g_Game.GetInput().ChangeGameFocus(-1);
799 g_Game.GetUIManager().ShowUICursor(
false);
800 g_Game.GetMission().RemoveActiveInputExcludes({
"menu"});
813 if ( w == layoutRoot && button ==
MouseState.LEFT )
904 string clipboardIn = FreeDebugCamera.GetInstance().GetPosition().ToString(
false)+
"|"+ FreeDebugCamera.GetInstance().GetOrientation().ToString(
false);
905 g_Game.CopyToClipboard( clipboardIn );
912 if (camText && camText.
IndexOf(
"|") !=-1)
914 int seperatorIndex = camText.
IndexOf(
"|");
915 int length = camText.
Length();
917 string posStr = camText.
Substring(0,seperatorIndex);
918 string oriStr = camText.
Substring(seperatorIndex+1, length - seperatorIndex - 1);
919 FreeDebugCamera.GetInstance().SetPosition(posStr.
ToVector());
920 FreeDebugCamera.GetInstance().SetOrientation(oriStr.
ToVector());
971 if (!w && key ==
KeyCode.KC_P )
1001 else if ( !w &&
g_Game.IsLeftCtrlDown() )
1013 if ( w.IsInherited( ButtonWidget ) )
1015 ButtonWidget button = ButtonWidget.Cast( w );
1016 button.SetTextColor(
ARGB( 255, 255, 0, 0 ) );
1017 button.SetAlpha( 0.9 );
1023 if ( w.IsInherited( ButtonWidget ) )
1025 ButtonWidget button = ButtonWidget.Cast( w );
1028 button.SetTextColor(
ARGB( 255, 255, 255, 255 ) );
1029 button.SetAlpha( 0.75 );
float fixAngle_180_180(float pAngle)
bool IsFocusable(Widget w)
ref array< ref Param6< vector, vector, float, float, float, int > > m_Cameras
ref array< ref Param5< vector, vector, string, ref array< string >, string > > m_Actors
ref array< ref Param4< int, int, float, bool > > m_Events
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
static void EnableFreeCameraSceneEditor(PlayerBase player)
static void DisableFreeCamera(PlayerBase player, bool teleport_player=false)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
proto string ToString(bool simple=true)
proto vector Normalized()
return normalized vector (keeps orginal vector untouched)
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto string ToString(bool beautify=true)
Vector to string.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
DayZPlayerConstants
defined in C++
static proto native void Text(string label)
proto native bool MakeDirectory(string name)
Makes a directory.
proto bool FileExist(string name)
Check existence of file.
static proto vector QuatToAngles(float q[4])
Returns Angles vector from quaternion.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static const float DEG2RAD
void Stop()
Stops all elements this effect consists of.
proto native int Length()
Returns length of string.
proto vector ToVector()
Returns a vector from a string.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto native int IndexOf(string sample)
Finds 'sample' in 'str'. Returns -1 when not found.
int ARGB(int a, int r, int g, int b)