Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_ViewLinkManualCameraComponent.c
Go to the documentation of this file.
1
2
4[BaseContainerProps(), SCR_BaseManualCameraComponentTitle()]
6{
7 //------------------------------------------------------------------------------------------------
8 override void EOnCameraFrame(SCR_ManualCameraParam param)
9 {
10 if (DiagMenu.GetBool(SCR_DebugMenuID.DEBUGUI_MANUAL_CAMERA_VIEW_LINK))
11 {
12 const string prefix = "enfusion://WorldEditor/"; // TODO: check for good const usage
13 string link = System.ImportFromClipboard();
14 if (link.StartsWith(prefix))
15 {
16 array<string> values = {};
17 link.Split(";", values, false);
18 if (values.Count() >= 2)
19 {
20 string fullLink = GetGame().GetWorldFile();
21 int begin = fullLink.IndexOf(":") + 1;
22 string worldPath = fullLink.Substring(begin, fullLink.Length() - begin);
23 if (values[0] == prefix + worldPath)
24 {
25 array<string> valuesPos = {}, valuesDir = {};
26 values[1].Split(",", valuesPos, false);
27 values[2].Split(",", valuesDir, false);
28
29 vector pos = Vector(valuesPos[0].ToFloat(), valuesPos[1].ToFloat(), valuesPos[2].ToFloat());
30 vector dir = Vector(valuesDir[1].ToFloat(), valuesDir[0].ToFloat(), valuesDir[2].ToFloat());
31
32 vector transform[4];
33 Math3D.AnglesToMatrix(dir, transform);
34 transform[3] = pos;
35 GetCameraEntity().SetWorldTransform(transform);
36
37 PrintFormat("View link applied: %1", link);
38 }
39 }
40 }
41 DiagMenu.SetValue(SCR_DebugMenuID.DEBUGUI_MANUAL_CAMERA_VIEW_LINK, 0);
42 }
43 }
44
45 //------------------------------------------------------------------------------------------------
46 override bool EOnCameraInit()
47 {
48 DiagMenu.RegisterBool(SCR_DebugMenuID.DEBUGUI_MANUAL_CAMERA_VIEW_LINK, "lshift+lalt+l", "Paste view link", "Manual Camera");
49 return true;
50 }
51
52 //------------------------------------------------------------------------------------------------
53 override void EOnCameraExit()
54 {
55 DiagMenu.Unregister(SCR_DebugMenuID.DEBUGUI_MANUAL_CAMERA_VIEW_LINK);
56 }
57}
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition DebugMenuID.c:4
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Diagnostic and developer menu system.
Definition DiagMenu.c:18
Parent class from which all SCR_ManualCamera components inherit.
void EOnCameraExit()
Terminate the component.
Parameter for carrying information between individual camera components.
proto void PrintFormat(string fmt, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL, LogLevel level=LogLevel.NORMAL)
proto native vector Vector(float x, float y, float z)