DayZ 1.24
Loading...
Searching...
No Matches
CameraToolsMenu.c
Go to the documentation of this file.
1class CameraToolsMenu extends UIScriptedMenu
2{
3 protected static CameraToolsMenu m_Instance;
4 vector m_FreeflightCamTransform[4];
6
7 protected float m_Time;
8
9 protected Camera m_Camera1;
10 protected Camera m_Camera2;
11
13 protected bool m_IsPlaying;
14 protected int m_NextCameraIndex = 1;
15
16 protected float m_FollowingTimeFinished;
18
19 protected CTKeyframe m_SelectedKeyframe;
20 protected CTEvent m_SelectedEvent;
21 protected CTActor m_SelectedActor;
22
26
29
34
37
45
50
55
60
62 {
63 m_Cameras = new array<ref CTKeyframe>;
64 m_Events = new array<ref CTEvent>;
65 m_Actors = new array<ref CTActor>;
66
67 m_Camera1 = Camera.Cast(GetGame().CreateObject("staticcamera", GetGame().GetPlayer().GetPosition(), true));
68 m_Camera2 = Camera.Cast(GetGame().CreateObject("staticcamera", GetGame().GetPlayer().GetPosition(), true));
69
70 m_Instance = this;
71 }
72
74 {
75 m_Camera1.SetActive(false);
76 m_Camera2.SetActive(false);
77
78 //GetGame().ObjectDelete( m_Camera1 );
79 //GetGame().ObjectDelete( m_Camera2 );
80
82
83 MissionGameplay ms = MissionGameplay.Cast(GetGame().GetMission());
84 if (ms)
85 ms.GetHud().Show(true);
86 }
87
88 override void OnShow()
89 {
90 super.OnShow();
91 if (!m_IsPlaying)
92 {
93 GetGame().GetMission().AddActiveInputExcludes({"menu"});
94 }
95 }
96
97 override void OnHide()
98 {
99 super.OnHide();
100 if (!m_IsPlaying && GetGame() && GetGame().GetMission() && GetGame().GetUIManager())
101 {
102 GetGame().GetUIManager().ShowUICursor(false);
103 GetGame().GetMission().RemoveActiveInputExcludes({"menu"}, true);
104 }
105 }
106
107 void SelectKeyframe(CTKeyframe kf)
108 {
109 if (m_SelectedKeyframe)
110 m_SelectedKeyframe.Unselect();
111
112 m_SelectedKeyframe = kf;
113 m_SelectedKeyframe.Select();
114 }
115
116 void SelectEvent(CTEvent ev)
117 {
118 m_SelectedEvent = ev;
119 }
120
121 void SelectActor(CTActor ac)
122 {
123 m_SelectedActor = ac;
124 }
125
126 override Widget Init()
127 {
128 layoutRoot = GetGame().GetWorkspace().CreateWidgets("gui/layouts/camera_tools/camera_tools.layout");
129
130 m_KeyframeContent = layoutRoot.FindAnyWidget("keyframe_list_content");
131 m_EventContent = layoutRoot.FindAnyWidget("events_list_content");
132 m_InterpTypeCombo = XComboBoxWidget.Cast(layoutRoot.FindAnyWidget("interp_type"));
133 m_InterpTypeSpeedCombo = XComboBoxWidget.Cast(layoutRoot.FindAnyWidget("interp_speed_type"));
134 m_BlurEditWidget = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("blur_value"));
135 m_ActorTypeWidget = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("add_actor_type"));
136 m_ActorIdWidget = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("add_actor_id"));
137 m_ActorItemTypeWidget = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("add_item_type"));
138
139 m_AddKeyframe = ButtonWidget.Cast(layoutRoot.FindAnyWidget("add_keyframe"));
140 m_AddEvent = ButtonWidget.Cast(layoutRoot.FindAnyWidget("add_event"));
141
142 m_AddItem = ButtonWidget.Cast(layoutRoot.FindAnyWidget("add_actor_item"));
143 m_AddHandsItem = ButtonWidget.Cast(layoutRoot.FindAnyWidget("add_actor_item_hands"));
144 m_AddActor = ButtonWidget.Cast(layoutRoot.FindAnyWidget("add_actor"));
145 m_Play = ButtonWidget.Cast(layoutRoot.FindAnyWidget("play"));
146 m_Stop = ButtonWidget.Cast(layoutRoot.FindAnyWidget("stop"));
147 m_Save = ButtonWidget.Cast(layoutRoot.FindAnyWidget("save"));
148 m_Load = ButtonWidget.Cast(layoutRoot.FindAnyWidget("load"));
149
150 m_SaveKeyframe = ButtonWidget.Cast(layoutRoot.FindAnyWidget("save_keyframe"));
151 m_DeleteKeyframe = ButtonWidget.Cast(layoutRoot.FindAnyWidget("delete_keyframe"));
152 m_ViewKeyframe = ButtonWidget.Cast(layoutRoot.FindAnyWidget("snap_to_keyframe"));
153 m_SaveEvent = ButtonWidget.Cast(layoutRoot.FindAnyWidget("save_event"));
154 m_DeleteEvent = ButtonWidget.Cast(layoutRoot.FindAnyWidget("delete_event"));
155 m_ViewEvent = ButtonWidget.Cast(layoutRoot.FindAnyWidget("snap_to_event"));
156
157 m_CopyButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("CopyButton"));
158 m_ApplyButton = ButtonWidget.Cast(layoutRoot.FindAnyWidget("ApplyButton"));
159 m_CameraEditbox = EditBoxWidget.Cast(layoutRoot.FindAnyWidget("CameraEditbox"));
160 m_CameraValues = TextWidget.Cast(layoutRoot.FindAnyWidget("CameraValues"));
161
162 MissionGameplay ms = MissionGameplay.Cast(GetGame().GetMission());
163 ms.GetHud().Show(false);
165
166 m_BlurEditWidget.SetText("0.0");
167 return layoutRoot;
168 }
169
171 {
172 if (index > -1 && index < m_Actors.Count())
173 return PlayerBase.Cast(m_Actors.Get(index).GetObj());
174 else
175 return null;
176 }
177
178 static void PlayAnimOnActor(int actor, int anim)
179 {
180 if (m_Instance)
181 {
182 PlayerBase p = m_Instance.GetActor(actor);
183 if (p)
184 {
185 EmoteCB cb = EmoteCB.Cast(p.StartCommand_Action(anim, EmoteCB, DayZPlayerConstants.STANCEMASK_ALL));
186 cb.EnableCancelCondition(true);
187 }
188 }
189 }
190
191 void LoadData()
192 {
193 if (!FileExist(g_Game.GetMissionFolderPath() + "/CameraTools"))
194 MakeDirectory(g_Game.GetMissionFolderPath() + "/CameraTools");
195
196 m_Cameras.Clear();
197 m_Events.Clear();
198 m_Actors.Clear();
199
200 string errorMessage;
202 if (!JsonFileLoader<ref CTSaveStructure>.LoadFile(g_Game.GetMissionFolderPath() + "/CameraTools/keyframe_data.json", save_data, errorMessage))
204
205 m_InterpTypeCombo.SetCurrentItem(save_data.m_InterpType);
206 m_InterpTypeSpeedCombo.SetCurrentItem(save_data.m_InterpSpeed);
207 SetBlurValue(save_data.m_BlurValue);
208
210 {
211 CTKeyframe kf = new CTKeyframe(m_Cameras.Count(), transform.param1, transform.param2, transform.param3, transform.param4, transform.param5, transform.param6, GetTotalTime(m_Cameras.Count()), m_KeyframeContent, this);
212 kf.SetInterpTime(transform.param3);
213 m_Cameras.Insert(kf);
214 }
215
217 {
218 CTEvent ev = new CTEvent(m_Events.Count(), event_t.param1, m_EventContent, event_t.param4, this);
219 ev.SetEventType(event_t.param2);
220 ev.SetEventTime(event_t.param3);
221 m_Events.Insert(ev);
222 }
223
224 foreach (Param5<vector, vector, string, ref array<string>, string> actor_t : save_data.m_Actors)
225 {
226 CTActor ac = new CTActor(m_Actors.Count(), actor_t.param1, actor_t.param2, actor_t.param3, actor_t.param4, actor_t.param5, this);
227 m_Actors.Insert(ac);
228 }
229 }
230
231 void SaveData()
232 {
233 if (!FileExist(g_Game.GetMissionFolderPath() + "/CameraTools"))
234 MakeDirectory(g_Game.GetMissionFolderPath() + "/CameraTools");
235
237 save_data.m_InterpType = m_InterpTypeCombo.GetCurrentItem();
238 save_data.m_InterpSpeed = m_InterpTypeSpeedCombo.GetCurrentItem();
239 save_data.m_BlurValue = GetBlurValue();
240
241 foreach (CTKeyframe keyframe : m_Cameras)
242 {
244 save_data.m_Cameras.Insert(transform);
245 }
246
247 foreach (CTEvent event_t : m_Events)
248 {
249 Param4<int, int, float, bool> ev = new Param4<int, int, float, bool>(event_t.GetEventActor(), event_t.GetEventType(), event_t.GetEventTime(), event_t.GetEventWalk());
250 save_data.m_Events.Insert(ev);
251 }
252
253 foreach (CTActor actor_t : m_Actors)
254 {
255 Param5<vector, vector, string, ref array<string>, string> ac = new Param5<vector, vector, string, ref array<string>, string>(actor_t.GetPosition(), actor_t.GetRotation(), actor_t.GetActorType(), actor_t.GetItems(), actor_t.GetHandsItem());
256 save_data.m_Actors.Insert(ac);
257 }
258
259 string errorMessage;
260 if (!JsonFileLoader<ref CTSaveStructure>.SaveFile(g_Game.GetMissionFolderPath() + "/CameraTools/keyframe_data.json", save_data, errorMessage))
262 }
263
265 {
266 float time;
267 index = Math.Clamp(index, 0, m_Cameras.Count());
268 for (int i = 0; i < index; i++)
269 time += m_Cameras.Get(i).GetInterpTime();
270 return time;
271 }
272
274 {
275 if (Camera.GetCurrentCamera())
276 {
277 vector pos = Camera.GetCurrentCamera().GetWorldPosition();
278 vector orient = Camera.GetCurrentCamera().GetOrientation();
279 CTKeyframe kf = new CTKeyframe(m_Cameras.Count(), pos, orient, 1, 70, 50, -1, GetTotalTime(m_Cameras.Count()), m_KeyframeContent, this);
280 m_Cameras.Insert(kf);
281 SelectKeyframe(kf);
282 }
283 }
284
286 {
287 if (m_SelectedKeyframe && Camera.GetCurrentCamera())
288 {
289 m_SelectedKeyframe.SetPosition(Camera.GetCurrentCamera().GetWorldPosition());
290 m_SelectedKeyframe.SetOrientation(Camera.GetCurrentCamera().GetOrientation());
291 }
292 }
293
295 {
296 if (m_SelectedKeyframe)
297 {
298 int index = m_Cameras.Find(m_SelectedKeyframe);
299 m_Cameras.Remove(index);
300 index = Math.Clamp(index, 0, m_Cameras.Count() - 1);
301 if (m_Cameras.Count() > 0)
302 SelectKeyframe(m_Cameras.Get(index));
303 }
304 }
305
307 {
308 if (m_SelectedKeyframe && Camera.GetCurrentCamera())
309 {
310 Camera.GetCurrentCamera().SetPosition(m_SelectedKeyframe.GetPosition());
311 Camera.GetCurrentCamera().SetOrientation(m_SelectedKeyframe.GetOrientation());
312 }
313 }
314
315 void AddActor(string actor_type)
316 {
317 vector pos = GetCameraLookDir();
318 CTActor ac = new CTActor(m_Actors.Count(), pos, "0 0 0", actor_type, new array<string>, "", this);
319 if (ac.GetObj())
320 m_Actors.Insert(ac);
321 }
322
324 {
325 if (actor_index > -1)
326 {
327 CTEvent ev = new CTEvent(m_Events.Count(), actor_index, m_EventContent, false, this);
328 m_Events.Insert(ev);
329 }
330 }
331
332
333 void AddItem(string id, string type)
334 {
335 int id_int = id.ToInt();
336 if (m_Actors.Count() > id_int && id_int > -1)
337 {
338 CTActor ac = m_Actors.Get(id_int);
339 if (ac)
340 ac.AddItem(type);
341 }
342 }
343
344 void AddHandsItem(string id, string type)
345 {
346 int id_int = id.ToInt();
347 if (m_Actors.Count() > id_int && id_int > -1)
348 {
349 CTActor ac = m_Actors.Get(id_int);
350 if (ac)
351 ac.SetHandsItem(type);
352 }
353 }
354
356 {
357
358 }
359
361 {
362
363 }
364
366 {
367
368 }
369
371 {
372 if (index > -1 && index < m_CameraLines.Count())
373 return m_CameraLines[index];
374 return null;
375 }
376
377 void Play()
378 {
379 if (Camera.GetCurrentCamera())
380 Camera.GetCurrentCamera().GetTransform(m_FreeflightCamTransform);
381 if (m_Cameras.Count() > 0)
382 {
383 layoutRoot.Show(false);
384 GetGame().GetUIManager().ShowUICursor(false);
386
387 foreach (CTKeyframe keyframe : m_Cameras)
388 {
390 m_CameraLines.Insert(transform);
391
392 }
393
394 foreach (CTActor ac : m_Actors)
395 ac.Hide();
396
397 foreach (CTEvent ev : m_Events)
398 ev.GetEventTime();
399
401
402 int time = SetCameraData(GetCameraLine(0), GetCameraLine(1));
403
404 if (GetCameraLine(0).param6 > -1)
405 {
406 m_FollowingTimeFinished = time;
407 m_NextCamPosition = "0 0 0";
408 m_Camera1.SetActive(true);
409 }
410 else
411 {
412 m_NextCamPosition = m_Camera2.GetPosition();
413 m_FollowingTimeFinished = -1;
414 m_Camera1.SetActive(true);
415 m_Camera1.InterpolateTo(m_Camera2, time, m_InterpTypeCombo.GetCurrentItem());
416 }
417
418 m_NextCameraIndex = 1;
419 m_IsPlaying = true;
420 m_Time = 0;
421 }
422 }
423
424 void Stop()
425 {
426 layoutRoot.Show(true);
427 GetGame().GetUIManager().ShowUICursor(true);
428
429 m_Camera1.SetActive(false);
430 m_Camera2.SetActive(false);
431 FreeDebugCamera.GetInstance().SetActive(true);
432
433 m_NextCameraIndex = 1;
434 m_IsPlaying = false;
435
436 foreach (CTEvent ev : m_Events)
437 ev.Stop();
438
439 foreach (CTActor ac : m_Actors)
440 {
441 ac.Reset();
442 ac.Show();
443 }
444
445 Camera.GetCurrentCamera().SetTransform(m_FreeflightCamTransform);
446 }
447
449 {
450 vector dir = FreeDebugCamera.GetInstance().GetDirection();
451 vector from = FreeDebugCamera.GetInstance().GetPosition();
452 vector to = from + (dir * 10000);
457 if (m_SelectedEvent)
458 ev_obj = GetActor(m_SelectedEvent.GetEventActor());
460 return contact_pos;
461
462 return "0 0 0";
463 }
464
466 {
467 vector dir = GetGame().GetPointerDirection();
468 vector from = FreeDebugCamera.GetInstance().GetPosition();
469 vector to = from + (dir * 10000);
474 if (m_SelectedEvent)
475 ev_obj = GetActor(m_SelectedEvent.GetEventActor());
477 return contact_pos;
478
479 return "0 0 0";
480 }
481
482 override void Update(float timeslice)
483 {
484
485 string camPos = MiscGameplayFunctions.TruncateVecToS(FreeDebugCamera.GetInstance().GetPosition(), 0);
486 string camOri = MiscGameplayFunctions.TruncateVecToS(FreeDebugCamera.GetInstance().GetOrientation(), 0);
487 m_CameraValues.SetText("Pos:" + camPos + " | Rot:" + camOri);
488
489#ifdef DIAG_DEVELOPER
490 if (DiagMenu.GetBool(DiagMenuIDs.CAMERATOOLS_ENABLE_REMOTE_CAMERA_BROADCAST))
491 {
492 Camera cam = Camera.GetCurrentCamera();
493
494 if (!cam && m_Camera1)
495 cam = m_Camera1;
496 if (cam)
497 {
498 Param4<vector, vector, float, float> p4 = new Param4<vector, vector, float, float>(GetGame().GetCurrentCameraPosition(), GetGame().GetCurrentCameraDirection(), cam.GetNearPlane(), cam.GetCurrentFOV());
499 GetGame().RPCSingleParam(null, ERPCs.DIAG_CAMERATOOLS_CAM_DATA, p4, false);
500 }
501
502 }
503#endif
504
505 if (m_CameraLines && m_IsPlaying)
506 {
507 foreach (CTEvent ev : m_Events)
508 {
509 if (ev.IsTime(m_Time, m_Time + timeslice))
510 ev.Play();
511 }
512
513 m_Time += timeslice;
514
515 if (!Camera.GetCurrentCamera() || !m_Camera1 || !m_Camera2)
516 return;
517
518 if (m_FollowingBone)
519 {
520 PlayerBase p = GetActor(m_FollowingBone.param1);
521 if (p)
522 {
523 vector pos = p.GetBonePositionWS(m_FollowingBone.param2);
524
525 int bone_index = p.GetBoneIndexByName("LeftHand_Dummy");
526 float bone_rot[4];
527 p.GetBoneRotationWS(bone_index, bone_rot);
528
530
531 //Print("Rot: "+ new_orient[0] +", "+ new_orient[1] +", "+ new_orient[2]);
532
533 float temp = new_orient[1];
534 new_orient[0] = new_orient[0] + 325; // vertical
535 new_orient[1] = new_orient[2] + 245;// horizontal
536 new_orient[2] = temp + 290; // tilt
537
538 //Print("PostRot: "+ new_orient[0] +", "+ new_orient[1] +", "+ new_orient[2]);
539
540 m_Camera1.SetPosition(pos);
541 m_Camera1.SetOrientation(new_orient);
542 }
543 }
544
545 if (m_NextCameraIndex + 1 == m_CameraLines.Count())
546 {
547 Stop();
549 foreach (CTEvent ev2 : m_Events)
550 ev2.Stop();
551 return;
552 }
553
554 if (Camera.GetCurrentCamera().GetPosition() == m_NextCamPosition || (m_FollowingTimeFinished != -1 && m_Time >= m_FollowingTimeFinished))
555 {
556 int time;
557 if (GetCameraLine(m_NextCameraIndex - 1).param6 > -1)
558 {
559 m_NextCameraIndex--;
560 GetCameraLine(m_NextCameraIndex).param6 = -1;
561
562 time = SetCameraData(GetCameraLine(m_NextCameraIndex), GetCameraLine(m_NextCameraIndex + 1));
563 }
564 else
565 time = SetCameraData(GetCameraLine(m_NextCameraIndex), GetCameraLine(m_NextCameraIndex + 1));
566
567 m_NextCameraIndex++;
568 if (GetCameraLine(m_NextCameraIndex - 1).param6 > -1)
569 {
570 m_FollowingTimeFinished = time + m_Time;
571 m_NextCamPosition = "0 0 0";
572 m_Camera1.SetActive(true);
573 }
574 else if (GetCameraLine(m_NextCameraIndex))
575 {
576 m_NextCamPosition = GetCameraLine(m_NextCameraIndex).param1;
577 m_FollowingTimeFinished = -1;
578 m_Camera1.SetActive(true);
579 m_Camera1.InterpolateTo(m_Camera2, time, m_InterpTypeCombo.GetCurrentItem());
580 }
581 else
582 {
583 Stop();
585 FreeDebugCamera.GetInstance().SetOrientation("0 0 0");
586 foreach (CTEvent ev3 : m_Events)
587 ev3.Stop();
588 }
589 }
590 }
591 else
592 {
593 if (m_Camera1.GetPosition() == m_NextCamPosition)
595
596 for (int i = 0; i < (m_Cameras.Count() - 1); i++)
597 {
598 vector pos0 = m_Cameras.Get(i).GetPosition();
599 vector pos1 = m_Cameras.Get(i + 1).GetPosition();
601 }
602
603 if (m_SelectedActor)
604 {
605 if (!g_Game.IsLeftCtrlDown())
606 m_SelectedActor.SetPosition(GetMouseLookDir());
607 else
608 {
609 vector from = m_SelectedActor.GetPosition();
610 vector to = GetMouseLookDir();
612 m_SelectedActor.SetRotation(vector.Direction(from, to).Normalized().VectorToAngles());
613 }
614
615 }
616
617 foreach (CTActor ac : m_Actors)
618 ac.Update(timeslice);
619 }
620 }
621
623 {
624 float int_value = transform1.param3;
625 if (m_InterpTypeSpeedCombo.GetCurrentItem() == 1)
628 float pQuat[4];
629 int b_index;
630 if (transform1.param6 > -1)
631 {
632 p = GetActor(transform1.param6);
633 if (p)
634 {
635 b_index = p.GetBoneIndexByName("LeftHand_Dummy");
636 m_FollowingBone = new Param2<int, int>(transform1.param6, b_index);
637 }
638 }
639 else
640 {
641 m_Camera1.SetPosition(transform1.param1);
642 m_Camera1.SetOrientation(transform1.param2);
643 m_FollowingBone = null;
644 }
645 m_Camera1.SetFOV(transform1.param4 * Math.DEG2RAD);
646 m_Camera1.SetFocus(transform1.param5, GetBlurValue());
647
648 if (transform2)
649 {
650 if (transform2.param6 > -1)
651 {
652 pQuat[4];
653 p = GetActor(transform2.param6);
654 if (p)
655 {
656 b_index = p.GetBoneIndexByName("LeftHand_Dummy");
657 if (b_index != -1)
658 {
659 m_Camera2.SetPosition(p.GetBonePositionWS(b_index));
660
661 p.GetBoneRotationWS(b_index, pQuat);
663 v[0] = fixAngle_180_180(v[0] - 180);
664 v[1] = fixAngle_180_180(v[1] - 270);
665 v[2] = fixAngle_180_180(v[2] + 90);
666 DbgUI.Text(v.ToString());
667 m_Camera2.SetYawPitchRoll(v);
668 }
669 }
670 }
671 else
672 {
673 m_Camera2.SetPosition(transform2.param1);
674 m_Camera2.SetOrientation(transform2.param2);
675 }
676
677 m_Camera2.SetFOV(transform2.param4 * Math.DEG2RAD);
678 m_Camera2.SetFocus(transform2.param5, GetBlurValue());
679 }
680
681 return int_value;
682 }
683
684 void SetBlurValue(float blur)
685 {
686 m_BlurEditWidget.SetText(blur.ToString());
687 }
688
690 {
691 return m_BlurEditWidget.GetText().ToFloat();
692 }
693
694 override bool OnMouseButtonDown(Widget w, int x, int y, int button)
695 {
696 if (w == layoutRoot && button == MouseState.RIGHT && !m_IsPlaying)
697 {
698 GetGame().GetInput().ResetGameFocus();
699 GetGame().GetInput().ChangeGameFocus(-1);
700 GetGame().GetUIManager().ShowUICursor(false);
701 GetGame().GetMission().RemoveActiveInputExcludes({"menu"});
702 SetFocus(layoutRoot);
703 return true;
704 }
705 else if (!IsFocusable(w))
706 SetFocus(layoutRoot);
707 return false;
708 }
709
710 override bool OnMouseButtonUp(Widget w, int x, int y, int button)
711 {
712 if (w == layoutRoot && button == MouseState.LEFT)
713 {
714 SelectActor(null);
715 return true;
716 }
717 return false;
718 }
719
720 override bool OnClick(Widget w, int x, int y, int button)
721 {
722 if (button == MouseState.LEFT)
723 {
724 if (w == m_SaveKeyframe)
725 {
726 SaveKeyframe();
727 return true;
728 }
729 else if (w == m_DeleteKeyframe)
730 {
731 DeleteKeyframe();
732 return true;
733 }
734 else if (w == m_ViewKeyframe)
735 {
736 ViewKeyframe();
737 return true;
738 }
739 else if (w == m_SaveEvent)
740 {
741 SaveEvent();
742 return true;
743 }
744 else if (w == m_DeleteEvent)
745 {
746 DeleteEvent();
747 return true;
748 }
749 else if (w == m_ViewEvent)
750 {
751 ViewEvent();
752 return true;
753 }
754 else if (w == m_AddKeyframe)
755 {
756 AddKeyframe();
757 return true;
758 }
759 else if (w == m_AddEvent)
760 {
761 AddEvent(0);
762 return true;
763 }
764 else if (w == m_Play)
765 {
766 Play();
767 return true;
768 }
769 else if (w == m_Stop)
770 {
771 Stop();
772 return true;
773 }
774 else if (w == m_Save)
775 {
776 SaveData();
777 return true;
778 }
779 else if (w == m_Load)
780 {
781 LoadData();
782 return true;
783 }
784 else if (w == m_AddActor)
785 AddActor(m_ActorTypeWidget.GetText());
786 else if (w == m_AddItem)
787 AddItem(m_ActorIdWidget.GetText(), m_ActorItemTypeWidget.GetText());
788 else if (w == m_AddHandsItem)
789 AddHandsItem(m_ActorIdWidget.GetText(), m_ActorItemTypeWidget.GetText());
790 else if (w == m_CopyButton)
791 {
792 string clipboardIn = FreeDebugCamera.GetInstance().GetPosition().ToString(false) + "|" + FreeDebugCamera.GetInstance().GetOrientation().ToString(false);
793 GetGame().CopyToClipboard(clipboardIn);
794
795 //Print(clipboardIn);
796 }
797 else if (w == m_ApplyButton)
798 {
799 string camText = m_CameraEditbox.GetText();
800 if (camText && camText.IndexOf("|") != -1)
801 {
802 int seperatorIndex = camText.IndexOf("|");
803 int length = camText.Length();
804
805 string posStr = camText.Substring(0, seperatorIndex);
806 string oriStr = camText.Substring(seperatorIndex + 1, length - seperatorIndex - 1);
807 FreeDebugCamera.GetInstance().SetPosition(posStr.ToVector());
808 FreeDebugCamera.GetInstance().SetOrientation(oriStr.ToVector());
809 }
810 }
811 }
812 return false;
813 }
814
815
816 override bool OnMouseEnter(Widget w, int x, int y)
817 {
818 if (w == m_CameraEditbox)
819 m_CameraEditbox.SetText("");
820 return true;
821 }
822
823 override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
824 {
825 return true;
826 }
827
828 override bool OnFocus(Widget w, int x, int y)
829 {
830 if (IsFocusable(w))
831 {
832 ColorRed(w);
833 return true;
834 }
835 return false;
836 }
837
838 override bool OnFocusLost(Widget w, int x, int y)
839 {
840 if (IsFocusable(w))
841 {
842 ColorWhite(w, null);
843 return true;
844 }
845 return false;
846 }
847
849 {
850 if (w)
851 return (w == m_SaveKeyframe || w == m_DeleteKeyframe || w == m_ViewKeyframe || w == m_SaveEvent || w == m_DeleteEvent || w == m_ViewEvent || w == m_AddKeyframe || w == m_AddEvent || w == m_Play || w == m_Stop || w == m_Save || w == m_Load || w == m_InterpTypeCombo);
852 return false;
853 }
854
855 override bool OnKeyPress(Widget w, int x, int y, int key)
856 {
857 if (!w && key == KeyCode.KC_P)
858 {
859 if (!m_IsPlaying)
860 {
861 Play();
862 return true;
863 }
864 else
865 {
866 Stop();
867 return true;
868 }
869 return false;
870 }
871 else if (g_Game.IsLeftCtrlDown() && key == KeyCode.KC_S)
872 {
873 SaveKeyframe();
874 return true;
875 }
876 else if (g_Game.IsLeftCtrlDown() && key == KeyCode.KC_Q)
877 {
878 AddKeyframe();
879 return true;
880 }
881 else if (g_Game.IsLeftCtrlDown() && key == KeyCode.KC_E)
882 {
883 DeleteKeyframe();
884 return true;
885 }
886
887 else if (!w && g_Game.IsLeftCtrlDown())
888 {
889 SelectActor(null);
890 return true;
891 }
892 return false;
893 }
894
895 //Coloring functions (Until WidgetStyles are useful)
897 {
898 //SetFocus( w );
899 if (w.IsInherited(ButtonWidget))
900 {
902 button.SetTextColor(ARGB(255, 255, 0, 0));
903 button.SetAlpha(0.9);
904 }
905 }
906
908 {
909 if (w.IsInherited(ButtonWidget))
910 {
912 if (button)
913 {
914 button.SetTextColor(ARGB(255, 255, 255, 255));
915 button.SetAlpha(0.75);
916 }
917 }
918 }
919}
float m_Time
Definition CarScript.c:144
DayZGame g_Game
Definition DayZGame.c:3528
float fixAngle_180_180(float pAngle)
DiagMenuIDs
Definition EDiagMenuIDs.c:2
ERPCs
Definition ERPCs.c:2
void Stop()
Stops all elements this effect consists of.
Definition Effect.c:175
bool m_IsPlaying
Whether the Effect is currently playing.
Definition Effect.c:37
Icon x
Icon y
PlayerBase GetPlayer()
static ref RadialMenu m_Instance
Definition RadialMenu.c:55
bool IsFocusable(Widget w)
EAnimPlayState Play()
class JsonUndergroundAreaTriggerData GetPosition
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.
Definition DbgUI.c:60
Definition Debug.c:14
static Shape DrawArrow(vector from, vector to, float size=0.5, int color=0xFFFFFFFF, int flags=0)
Definition Debug.c:511
static void EnableFreeCameraSceneEditor(PlayerBase player)
static void DisableFreeCamera(PlayerBase player, bool teleport_player=false)
Definition EnMath.c:7
void SelectActor(CTActor ac)
override bool OnMouseEnter(Widget w, int x, int y)
override void OnShow()
ButtonWidget m_Save
override bool OnFocus(Widget w, int x, int y)
override void Update(float timeslice)
ButtonWidget m_AddEvent
ButtonWidget m_Stop
TextWidget m_CameraValues
ButtonWidget m_DeleteKeyframe
ButtonWidget m_ApplyButton
void SelectKeyframe(CTKeyframe kf)
EditBoxWidget m_ActorIdWidget
vector m_NextCamPosition
EditBoxWidget m_ActorTypeWidget
Param6< vector, vector, float, float, float, int > GetCameraLine(int index)
bool IsFocusable(Widget w)
ButtonWidget m_ViewEvent
ButtonWidget m_ViewKeyframe
float SetCameraData(Param6< vector, vector, float, float, float, int > transform1, Param6< vector, vector, float, float, float, int > transform2)
ButtonWidget m_AddKeyframe
void AddItem(string id, string type)
ButtonWidget m_SaveEvent
ButtonWidget m_CopyButton
void ColorWhite(Widget w, Widget enterW)
override bool OnKeyPress(Widget w, int x, int y, int key)
float m_FollowingTimeFinished
override void OnHide()
CTEvent m_SelectedEvent
float GetTotalTime(int index)
override bool OnMouseButtonUp(Widget w, int x, int y, int button)
override bool OnFocusLost(Widget w, int x, int y)
override bool OnMouseLeave(Widget w, Widget enterW, int x, int y)
static void PlayAnimOnActor(int actor, int anim)
ButtonWidget m_SaveKeyframe
void AddActor(string actor_type)
override bool OnMouseButtonDown(Widget w, int x, int y, int button)
ref Param2< int, int > m_FollowingBone
CTKeyframe m_SelectedKeyframe
ButtonWidget m_DeleteEvent
ButtonWidget m_Load
void ColorRed(Widget w)
ButtonWidget m_Play
ButtonWidget m_AddActor
EditBoxWidget m_CameraEditbox
CTActor m_SelectedActor
XComboBoxWidget m_InterpTypeCombo
ref array< ref Param6< vector, vector, float, float, float, int > > m_CameraLines
static CameraToolsMenu m_Instance
ref array< ref CTActor > m_Actors
vector GetCameraLookDir()
XComboBoxWidget m_InterpTypeSpeedCombo
ButtonWidget m_AddItem
EditBoxWidget m_BlurEditWidget
EditBoxWidget m_ActorItemTypeWidget
override Widget Init()
void SetBlurValue(float blur)
PlayerBase GetActor(int index)
override bool OnClick(Widget w, int x, int y, int button)
vector GetMouseLookDir()
void SelectEvent(CTEvent ev)
void AddHandsItem(string id, string type)
ref array< ref CTKeyframe > m_Cameras
ref array< ref CTEvent > m_Events
void AddEvent(int actor_index)
ButtonWidget m_AddHandsItem
static vector Direction(vector p1, vector p2)
Returns direction vector from point p1 to point p2.
Definition EnConvert.c:220
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
DayZPlayerConstants
defined in C++
Definition dayzplayer.c:597
proto native CGame GetGame()
const int COLOR_RED
Definition constants.c:64
enum ShapeType ErrorEx
ShapeFlags
Definition EnDebug.c:126
static proto native void Text(string label)
static proto bool GetBool(int id, bool reverse=false)
Get value as bool from the given script id.
proto native bool MakeDirectory(string name)
Makes a directory.
proto bool FileExist(string name)
Check existence of file.
KeyCode
Definition EnSystem.c:157
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
Definition EnMath.c:17
MouseState
Definition EnSystem.c:311
proto native void SetFocus(Widget w)
int ARGB(int a, int r, int g, int b)
Definition proto.c:322