12 protected ref set<SCR_EditableEntityComponent> m_aEditedEntities;
13 protected bool m_bIsInstant;
22 ResourceName material;
23 #ifdef PREVIEW_ENTITY_SHOW_REFERENCE
24 material =
"{D0126AF0E6A27141}Common/Materials/Colors/colorRed.emat";
31 Print(
"SCR_RefPreviewEntity:: refEntity was not spawned!", LogLevel.WARNING);
35 refEntity.m_EditableEntity = entity;
36 refEntity.SetAsInstant();
37 refEntity.ApplyReference(param);
39 #ifndef PREVIEW_ENTITY_SHOW_REFERENCE
52 array<ref Tuple2<vector, vector>> areas =
new array<ref Tuple2<vector, vector>>;
53 array<bool> redoAreas =
new array<bool>;
59 aiWorld.GetNavmeshRebuildAreas(child.m_Entity, areas, redoAreas);
65 param.GetWorldTransform(transform);
66 UpdateReference(transform, param.m_VerticalMode, param.m_bIsUnderwater);
79 childRef.ApplyChild(param,
true, m_aEditedEntities, m_bIsInstant);
81 aiWorld.GetNavmeshRebuildAreas(child.m_Entity, areas, redoAreas);
85 aiWorld.RequestNavmeshRebuildAreas(areas, redoAreas);
95 childRef.ApplyChild(param,
true, m_aEditedEntities, m_bIsInstant);
107 protected void ApplyChild(
SCR_EditorPreviewParams param,
bool isDirectChild, set<SCR_EditableEntityComponent> editedEntities,
bool isInstant)
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)
142 param.m_Parent = m_EditableEntity.SetParentEntity(newParent,
true);
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);
159 m_EditableEntity.SetTransform(transform, isDirectChild && !isInstant);
169 childRef.ApplyChild(param,
false, editedEntities, isInstant);
179 trace =
new TraceParam();
180 trace.ExcludeArray = m_aExcludeArray;
186 vector currentPos = GetWorldTransformAxis(3);
189 float height = transform[3][1] -
SCR_TerrainHelper.GetTerrainY(transform[3], GetWorld(), !isUnderwater, trace);
191 m_fHeightTerrain = 0;
192 SetPreviewTransform(transform, verticalMode, height - currentHeight, isUnderwater, trace);
196 super.EOnPreviewInit(entry, root);
201 if (!refRoot.m_aEditedEntities)
202 refRoot.m_aEditedEntities =
new set<SCR_EditableEntityComponent>();
204 refRoot.m_aEditedEntities.Insert(m_EditableEntity);