Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_SelectedEditableEntityFilter.c
Go to the documentation of this file.
7 {
8  protected ref map<int, ref set<SCR_EditableEntityComponent>> m_SavedSelections = new map<int, ref set<SCR_EditableEntityComponent>>();
9 
14  void SaveSelection(int index)
15  {
16  set<SCR_EditableEntityComponent> selection = new set<SCR_EditableEntityComponent>();
17  selection.Copy(m_Entities);
18  m_SavedSelections.Set(index, selection);
19  }
24  void LoadSelection(int index)
25  {
26  set<SCR_EditableEntityComponent> selection = new set<SCR_EditableEntityComponent>();
27  if (GetSelection(index, selection))
28  {
29  Replace(selection);
30  }
31  }
36  void TeleportSelection(int index)
37  {
38  SCR_ManualCamera camera = SCR_CameraEditorComponent.GetCameraInstance();
39  if (!camera)
40  return;
41 
42  set<SCR_EditableEntityComponent> selection = new set<SCR_EditableEntityComponent>();
43  if (GetSelection(index, selection))
44  {
46  if (teleportComponent)
47  {
48  vector position;
49  if (selection[0].GetPos(position))
50  {
51  teleportComponent.TeleportCamera(position);
52  //Replace(selection); //--- Not needed, single-click of the key already selects the entity
53  }
54  }
55  }
56  }
57  protected bool GetSelection(int index, out notnull set<SCR_EditableEntityComponent> outSelection)
58  {
59  if (!m_SavedSelections.Find(index, outSelection))
60  return false;
61 
62  for (int i = outSelection.Count() - 1; i >= 0; i--)
63  {
64  if (!outSelection[i])
65  outSelection.Remove(i);
66  }
67  return !outSelection.IsEmpty();
68  }
69 
70  protected void OnParentEntityChanged(SCR_EditableEntityComponent entity, SCR_EditableEntityComponent parentEntity, SCR_EditableEntityComponent parentEntityPrev)
71  {
72  //--- Select if the parent is selected as well
73  if (parentEntity && parentEntity.HasEntityState(EEditableEntityState.SELECTED))
74  Add(entity);
75  }
76 
77  override void EOnEditorActivate()
78  {
79  if (!GetCore()) return;
80  GetCore().Event_OnParentEntityChanged.Insert(OnParentEntityChanged);
81  }
82  override void EOnEditorDeactivate()
83  {
84  if (!GetCore()) return;
85  GetCore().Event_OnParentEntityChanged.Remove(OnParentEntityChanged);
86  }
87 };
EEditableEntityState
EEditableEntityState
Definition: EEditableEntityState.c:37
SCR_ManualCamera
Definition: SCR_ManualCamera.c:16
SCR_BaseContainerCustomTitleEnum
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
Definition: SCR_CampaignHintStorage.c:22
SCR_CameraEditorComponent
Definition: SCR_CameraEditorComponent.c:13
SCR_SelectedEditableEntityFilter
Definition: SCR_SelectedEditableEntityFilter.c:6
GetPos
override bool GetPos(out vector pos)
Definition: SCR_EditableFactionComponent.c:325
m_Entities
protected ref SCR_SortedArray< SCR_EditableEntityComponent > m_Entities
Definition: SCR_EntitiesToolbarEditorUIComponent.c:31
SCR_BaseEditableEntityFilter
Definition: SCR_BaseEditableEntityFilter.c:13
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_TeleportToCursorManualCameraComponent
Teleport the camera to the cursor's world position.
Definition: SCR_TeleportToCursorManualCameraComponent.c:5
position
vector position
Definition: SCR_DestructibleTreeV2.c:30
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