Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CameraParticlesEditorComponent.c
Go to the documentation of this file.
1 [ComponentEditorProps(category: "GameScripted/Editor", description: "Camera for in-game editor. Works only with SCR_EditorBaseEntity!", icon: "WBData/ComponentEditorProps/componentEditor.png")]
3 {
4  [Attribute()]
5  private ref array<ref SCR_CameraParticleEditor> m_Effects;
6 
7  int GetEffects(notnull array<SCR_CameraParticleEditor> outEffects)
8  {
9  outEffects.Clear();
10  foreach (SCR_CameraParticleEditor effect: m_Effects)
11  {
12  outEffects.Insert(effect);
13  }
14  return outEffects.Count();
15  }
16  int GetEffectsCount()
17  {
18  return m_Effects.Count();
19  }
20  SCR_CameraParticleEditor GetEffect(int index)
21  {
22  return m_Effects[index];
23  }
24 };
25 
29 {
30  private int m_iCurrentEffect;
31  private SCR_CameraEditorComponent m_CameraManager;
32 
33  int GetEffects(notnull array<SCR_CameraParticleEditor> outEffects)
34  {
35  SCR_CameraParticlesEditorComponentClass prefabData = SCR_CameraParticlesEditorComponentClass.Cast(GetEditorComponentData());
36  if (!prefabData) return 0;
37 
38  return prefabData.GetEffects(outEffects);
39  }
40  void RefreshCurrentEffect(SCR_ManualCamera manualCamera)
41  {
42  SetCurrentEffect(m_iCurrentEffect);
43  }
44  void SetCurrentEffect(int index)
45  {
46  SCR_CameraParticlesEditorComponentClass prefabData = SCR_CameraParticlesEditorComponentClass.Cast(GetEditorComponentData());
47  if (!prefabData || index < 0 || index >= prefabData.GetEffectsCount()) return;
48 
49  SCR_CameraParticleEditor effect = prefabData.GetEffect(m_iCurrentEffect);
50  if (effect) effect.Destroy();
51 
52  m_iCurrentEffect = index;
53 
54  effect = prefabData.GetEffect(m_iCurrentEffect);
55  if (effect) effect.Create(m_CameraManager.GetCamera());
56  }
57  int GetCurrentEffect()
58  {
59  return m_iCurrentEffect;
60  }
61  override void EOnEditorPostActivate()
62  {
63  m_CameraManager = SCR_CameraEditorComponent.Cast(SCR_CameraEditorComponent.GetInstance(SCR_CameraEditorComponent, true));
64  if (!m_CameraManager) return;
65 
66  if (m_CameraManager.GetCamera())
67  RefreshCurrentEffect(null);
68  else
69  m_CameraManager.GetOnCameraCreate().Insert(RefreshCurrentEffect);
70  }
71  override void EOnEditorDeactivate()
72  {
73  if (m_CameraManager) m_CameraManager.GetOnCameraCreate().Remove(RefreshCurrentEffect);
74 
75  SCR_CameraParticlesEditorComponentClass prefabData = SCR_CameraParticlesEditorComponentClass.Cast(GetEditorComponentData());
76  if (prefabData)
77  {
78  SCR_CameraParticleEditor effect = prefabData.GetEffect(m_iCurrentEffect);
79  if (effect) effect.Destroy();
80  }
81  }
82 };
83 
86 {
87  [Attribute()]
88  private LocalizedString m_sDisplayName;
89 
90  [Attribute(params: "ptc", uiwidget: UIWidgets.ResourcePickerThumbnail)]
91  private ResourceName m_Effect;
92 
93  private ParticleEffectEntity m_Emitter;
94 
95  string GetDisplayName()
96  {
97  return m_sDisplayName;
98  }
99 
100  void Create(IEntity target)
101  {
102  if (m_Effect.IsEmpty()) return;
103 
104  ParticleEffectEntitySpawnParams spawnParams();
105  spawnParams.Parent = target;
106  m_Emitter = ParticleEffectEntity.SpawnParticleEffect(m_Effect, spawnParams);
107  }
108  void Destroy()
109  {
110  delete m_Emitter;
111  }
112 };
ComponentEditorProps
SCR_FragmentEntityClass ComponentEditorProps
m_sDisplayName
protected string m_sDisplayName
Definition: SCR_KeybindDialogs.c:39
SCR_ManualCamera
Definition: SCR_ManualCamera.c:16
SCR_CameraEditorComponent
Definition: SCR_CameraEditorComponent.c:13
BaseContainerCustomTitleField
class SCR_KeyBindingFilter BaseContainerCustomTitleField("m_sBindString")
Definition: SCR_KeyBindingMenuConfig.c:113
SCR_BaseEditorComponent
Definition: SCR_BaseEditorComponent.c:119
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_CameraParticlesEditorComponent
Definition: SCR_CameraParticlesEditorComponent.c:28
SCR_CameraParticlesEditorComponentClass
Definition: SCR_CameraParticlesEditorComponent.c:2
SCR_BaseEditorComponentClass
Definition: SCR_BaseEditorComponent.c:2
index
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
Definition: SCR_DestructionSynchronizationComponent.c:17
SCR_CameraParticleEditor
Definition: SCR_CameraParticlesEditorComponent.c:85
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
LocalizedString
Definition: LocalizedString.c:21
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
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180