Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EditableEntityCustomSlotUIComponent.c
Go to the documentation of this file.
2 {
3  [Attribute()]
4  protected string m_sBoneName;
5 
6  [Attribute()]
7  protected vector m_vOffset;
8 
9  [Attribute(defvalue: "0", desc: "How large the widget is going to be at 1 m distance.")]
10  protected float m_bScaleCoef;
11 
12  protected GenericEntity m_Owner;
13  protected int m_iBoneIndex;
14  protected CameraManager m_CameraManager;
15 
16  //------------------------------------------------------------------------------------------------
17  override vector UpdateSlot(int screenW, int screenH, vector posCenter, vector posCam)
18  {
19  if (m_iBoneIndex == -1)
20  return super.UpdateSlot(screenW, screenH, posCenter, posCam);
21 
22  if (m_Entity)
23  {
24  vector transform[4];
25  m_Owner.GetAnimation().GetBoneMatrix(m_iBoneIndex, transform);
26 
27  vector posWorld = m_Owner.CoordToParent(transform[3] + m_vOffset);
28  vector pos = m_Workspace.ProjWorldToScreen(posWorld, m_World);
29 
30  if (m_bShowOffScreen)
31  {
32  //--- Show on screen border when off-screen
33  if (m_bScaleCoef != 0)
34  FrameSlot.SetSize(m_Widget, m_bScaleCoef, m_bScaleCoef);
35 
36  return ShowOffScreen(pos, screenW, screenH, posCenter);
37  }
38  else
39  {
40  //--- On-screen only
41  if (pos[2] > 0)
42  {
43  if (m_bScaleCoef != 0)
44  {
45  CameraBase camera = m_CameraManager.CurrentCamera();
46  if (camera)
47  {
48  float size = (m_bScaleCoef * (70 / camera.GetVerticalFOV())) / vector.Distance(posWorld, camera.GetWorldTransformAxis(3));
49  FrameSlot.SetSize(m_Widget, size, size);
50  }
51  }
52 
53  FrameSlot.SetPos(m_Widget, pos[0], pos[1]);
54  m_Widget.SetZOrder(vector.Distance(posWorld, posCam)); //--- Don't use DistanceSq, can overflow int
55  m_Widget.SetVisible(true);
56  return pos;
57  }
58  }
59  }
60 
61  m_Widget.SetVisible(false);
62  return vector.Zero;
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  override void InitSlot(SCR_EditableEntityComponent entity)
67  {
68  super.InitSlot(entity);
69 
70  m_CameraManager = GetGame().GetCameraManager();
71 
72  m_Owner = m_Entity.GetOwner();
73  m_iBoneIndex = m_Owner.GetAnimation().GetBoneIndex(m_sBoneName);
74 
75  FrameSlot.SetAlignment(m_Widget, 0.5, 0.5);
76  }
77 }
SCR_EditableEntityCustomSlotUIComponent
Definition: SCR_EditableEntityCustomSlotUIComponent.c:1
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
m_Entity
enum EAITargetInfoCategory m_Entity
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_EditableEntitySceneSlotUIComponent
Definition: SCR_EditableEntitySceneSlotUIComponent.c:1
m_Workspace
protected WorkspaceWidget m_Workspace
Definition: SCR_EntitiesEditorUIComponent.c:13
m_World
protected BaseWorld m_World
Definition: SCR_PreviewEntityEditorUIComponent.c:46
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
m_Owner
SCR_AIGroupUtilityComponentClass m_Owner
m_vOffset
protected vector m_vOffset
Definition: SCR_PositionalInsectType.c:11