Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_BasePreviewEntry.c
Go to the documentation of this file.
3 {
4  [Attribute()]
5  int m_iParentID;
6 
7  [Attribute(uiwidget: UIWidgets.ResourcePickerThumbnail, params: "xob et")]
8  ResourceName m_Mesh;
9 
10  [Attribute(uiwidget: UIWidgets.Flags, enums: ParamEnumArray.FromEnum(EPreviewEntityFlag))]
11  EPreviewEntityFlag m_Flags;
12 
13  [Attribute(uiwidget: UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EPreviewEntityShape))]
14  EPreviewEntityShape m_Shape;
15 
16  [Attribute("-1")]
17  string m_iPivotID;
18 
19  [Attribute(defvalue: "1 1 1")]
20  vector m_vScale;
21 
22  [Attribute()]
23  vector m_vPosition;
24 
25  [Attribute()]
26  vector m_vAngles;
27 
28  float m_fQuat[4]; //--- Optional quaternion, used only in run-time, i.e., not on prefab
29  vector m_vAnglesTerrain;
30  float m_vHeightTerrain;
31  IEntity m_Entity;
32  IEntitySource m_EntitySource;
33 
38  void SetScale(float scale)
39  {
40  m_vScale = Vector(scale, scale, scale);
41  }
42 
48  float GetScale()
49  {
50  return m_vScale[0];
51  }
52 
57  void SaveTransform(vector transform[4])
58  {
59  m_vAngles = Math3D.MatrixToAngles(transform);
60  Math3D.MatrixToQuat(transform, m_fQuat);
61  m_vPosition = transform[3];
62  }
67  void LoadTransform(vector outTransform[4])
68  {
69  if (m_fQuat[0] != 0 || m_fQuat[1] != 0 || m_fQuat[2] != 0 || m_fQuat[3] != 0)
70  Math3D.QuatToMatrix(m_fQuat, outTransform);
71  else
72  Math3D.AnglesToMatrix(Vector(m_vAngles[1], m_vAngles[0], m_vAngles[2]), outTransform); //--- Convert XYZ to XZY
73 
74  outTransform[3] = m_vPosition;
75  }
76 
77  void Log(int index)
78  {
79  string mesh = m_Mesh;
80  mesh = string.Format("%1: %2", typename.EnumToString(EPreviewEntityShape, m_Shape), mesh);
81  string flagNames = SCR_Enum.FlagsToString(EPreviewEntityFlag, m_Flags);
82  string text = string.Format("prt: %1 | pvt: '%2' | scl: %3 | pos: %4 | ang: %5 | angT: %6 | hT: %7 | flg: %8 | shape: '%9'", m_iParentID, m_iPivotID, m_vScale, m_vPosition, m_vAngles, m_vAnglesTerrain, m_vHeightTerrain, flagNames, mesh);
83  PrintFormat("%1: %2", index, text);
84  }
85  void CopyFrom(SCR_BasePreviewEntry from)
86  {
87  m_iParentID = from.m_iParentID;
88  m_Mesh = from.m_Mesh;
89  m_Flags = from.m_Flags;
90  m_Shape = from.m_Shape;
91  m_iPivotID = from.m_iPivotID;
92  m_vScale = from.m_vScale;
93  m_vPosition = from.m_vPosition;
94  m_fQuat = from.m_fQuat;
95  m_vAngles = from.m_vAngles;
96  m_vAnglesTerrain = from.m_vAnglesTerrain;
97  m_vHeightTerrain = from.m_vHeightTerrain;
98  m_Entity = from.m_Entity;
99  m_EntitySource = from.m_EntitySource;
100  }
101  void SCR_BasePreviewEntry(bool init = false)
102  {
103  if (init)
104  {
105  SetScale(1);
106  }
107  }
108 #ifdef WORKBENCH
109  void SaveToContainer(WorldEditorAPI api, IEntitySource entitySource, array<ref ContainerIdPathEntry> entryPath)
110  {
111  api.SetVariableValue(entitySource, entryPath, "m_iParentID", m_iParentID.ToString());
112  api.SetVariableValue(entitySource, entryPath, "m_Mesh", m_Mesh);
113  api.SetVariableValue(entitySource, entryPath, "m_Shape", m_Shape.ToString());
114  api.SetVariableValue(entitySource, entryPath, "m_iPivotID", m_iPivotID);
115  api.SetVariableValue(entitySource, entryPath, "m_vScale", m_vScale.ToString(false));
116  api.SetVariableValue(entitySource, entryPath, "m_vPosition", m_vPosition.ToString(false));
117  api.SetVariableValue(entitySource, entryPath, "m_vAngles", m_vAngles.ToString(false));
118  api.SetVariableValue(entitySource, entryPath, "m_Flags", m_Flags.ToString());
119  }
120 #endif
121 };
SCR_Enum
Definition: SCR_Enum.c:1
SCR_BasePreviewEntry
Definition: SCR_BasePreviewEntry.c:2
SCR_BaseContainerCustomTitleResourceName
SCR_CampaignMilitaryBaseComponent SCR_MilitaryBaseComponent SCR_BaseContainerCustomTitleResourceName("m_sBaseName", true)
Definition: SCR_CampaignMilitaryBaseComponent.c:2522
EPreviewEntityShape
EPreviewEntityShape
Definition: EPreviewEntityMesh.c:1
m_Entity
enum EAITargetInfoCategory m_Entity
EPreviewEntityFlag
EPreviewEntityFlag
Definition: EPreviewEntityFlag.c:1
Attribute
typedef Attribute
Post-process effect of scripted camera.
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
m_Shape
private ref Shape m_Shape
Definition: UnitDisplayComponent.c:11
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
m_vPosition
vector m_vPosition
Definition: SCR_AITalkRequest.c:23
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468