20#ifdef PREVIEW_ENTITY_SHOW_REFERENCE
21 const ResourceName material =
"{D0126AF0E6A27141}Common/Materials/Colors/colorRed.emat";
27 SCR_RefPreviewEntity refEntity = SCR_RefPreviewEntity.Cast(SCR_RefPreviewEntity.SpawnPreviewFromEditableEntity(entity,
"SCR_RefPreviewEntity",
GetGame().GetWorld(), null, material,
flags));
30 Print(
"SCR_RefPreviewEntity:: refEntity was not spawned!",
LogLevel.WARNING);
34 refEntity.m_EditableEntity = entity;
35 refEntity.SetAsInstant();
36 refEntity.ApplyReference(param);
38#ifndef PREVIEW_ENTITY_SHOW_REFERENCE
50 array<ref Tuple2<vector, vector>> areas = {};
51 array<bool> redoAreas = {};
64 UpdateReference(transform, param.m_VerticalMode, param.m_bIsUnderwater);
67 SCR_RefPreviewEntity childRef;
74 childRef = SCR_RefPreviewEntity.Cast(child);
91 childRef = SCR_RefPreviewEntity.Cast(child);
109 if (!m_EditableEntity)
113 GetWorldTransform(transform);
115 bool changeTransformation =
true;
120 bool changeParent =
false;
125 newParent = param.m_Target;
127 changeTransformation =
false;
129 else if (param.m_Parent != currentParent && param.m_Parent != m_EditableEntity && (param.m_bParentChanged || !currentParent || !currentParent.
HasEntityFlag(
EEditableEntityFlag.INDIVIDUAL_CHILDREN)))
132 newParent = param.m_Parent;
139 if (m_EditableEntity == editableGroup || !editableGroup || editedEntities.Find(editableGroup) == -1)
147 if (changeTransformation)
151 if (!editableVehicle || editedEntities.Find(editableVehicle) == -1)
155 vector localPos = m_EditableEntity.GetOwner().CoordToLocal(transform[3]);
156 localPos -= m_EditableEntity.GetIconPos();
157 transform[3] = m_EditableEntity.GetOwner().CoordToParent(localPos);
160 if (!m_EditableEntity.SetTransform(transform, isDirectChild && !isInstant))
166 SCR_RefPreviewEntity childRef;
169 childRef = SCR_RefPreviewEntity.Cast(child);
171 childRef.ApplyChild(param,
false, editedEntities, isInstant);
186 trace.ExcludeArray = m_aExcludeArray;
192 vector currentPos = GetWorldTransformAxis(3);
197 float height = transform[3][1] - terrainY;
199 m_fHeightTerrain = 0;
200 SetPreviewTransform(transform, verticalMode, height - currentHeight, isUnderwater, trace);
206 super.EOnPreviewInit(entry, root);
208 SCR_RefPreviewEntity refRoot = SCR_RefPreviewEntity.Cast(root);
211 if (!refRoot.m_aEditedEntities)
212 refRoot.m_aEditedEntities =
new set<SCR_EditableEntityComponent>();
214 refRoot.m_aEditedEntities.Insert(m_EditableEntity);
SCR_EAIThreatSectorFlags flags
ArmaReforgerScripted GetGame()
enum SCR_ECompassType EntityEditorProps(category:"GameScripted/Gadgets", description:"Compass", color:"0 0 255 255")
Prefab data class for compass component.
void ApplyReference(SCR_EditorPreviewParams param)
SCR_RefPreviewEntityClass m_aEditedEntities
Reference entity used to position edited entities according to preview.
bool ApplyChild(SCR_EditorPreviewParams param, bool isDirectChild, set< SCR_EditableEntityComponent > editedEntities, bool isInstant)
void EOnPreviewInit(SCR_BasePreviewEntry entry, SCR_BasePreviewEntity root)
void UpdateReference(vector transform[4], EEditorTransformVertical verticalMode, bool isUnderwater)
void SetAsInstant()
Mark the reference entity as applied at the same time as it's created.
ref array< SCR_ScenarioFrameworkLayerBase > m_aChildren
void GetNavmeshRebuildAreas(IEntity entity, out notnull array< ref Tuple2< vector, vector > > outAreas, out notnull array< bool > redoRoads)
void RequestNavmeshRebuildAreas(notnull array< ref Tuple2< vector, vector > > areas, notnull array< bool > redoRoads)
bool HasEntityFlag(EEditableEntityFlag flag)
SCR_EditableEntityComponent GetVehicle()
SCR_EditableEntityComponent SetParentEntity(SCR_EditableEntityComponent parentEntity, bool changedByUser=false)
SCR_EditableEntityComponent GetParentEntity()
SCR_EditableEntityComponent GetAIGroup()
Network packet of variables for entity placing and transformation.
void GetWorldTransform(out vector outTransform[4])
static float GetTerrainY(vector pos, BaseWorld world=null, bool noUnderwater=false, TraceParam trace=null)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
EEditableEntityFlag
Unique flags of the entity.
EEditorTransformVertical
Vertical transformation mode.
EEditableEntityInteraction
Type of suggested interaction when hovering edited entity on top of another entity.