MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Deserialize

Method Deserialize

Source/Engine/Level/Actor.cpp:1190–1312  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1188}
1189
1190void Actor::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
1191{
1192 // Base
1193 SceneObject::Deserialize(stream, modifier);
1194
1195 DESERIALIZE_BIT_MEMBER(IsActive, _isActive);
1196 DESERIALIZE_MEMBER(StaticFlags, _staticFlags);
1197 DESERIALIZE(HideFlags);
1198 DESERIALIZE_MEMBER(Layer, _layer);
1199 DESERIALIZE_MEMBER(Name, _name);
1200 DESERIALIZE_MEMBER(Transform, _localTransform);
1201
1202 {
1203 const auto member = SERIALIZE_FIND_MEMBER(stream, "ParentID");
1204 if (member != stream.MemberEnd())
1205 {
1206 Guid parentId;
1207 Serialization::Deserialize(member->value, parentId, modifier);
1208 const auto parent = Scripting::FindObject<Actor>(parentId);
1209 if (_parent != parent)
1210 {
1211 if (IsDuringPlay())
1212 {
1213 SetParent(parent, false, false);
1214 }
1215 else
1216 {
1217 if (_parent)
1218 _parent->Children.RemoveKeepOrder(this);
1219 _parent = parent;
1220 if (_parent)
1221 _parent->Children.Add(this);
1222 OnParentChanged();
1223 }
1224 }
1225 else if (!parent && parentId.IsValid())
1226 {
1227 // Skip warning if object was mapped to empty id (intentionally ignored)
1228 Guid tmpId;
1229 if (!modifier->IdsMapping.TryGet(parentId, tmpId) || tmpId.IsValid())
1230 {
1231 if (_prefabObjectID.IsValid())
1232 LOG(Warning, "Missing parent actor {0} for \'{1}\', prefab object {2}", parentId, ToString(), _prefabObjectID);
1233 else
1234 LOG(Warning, "Missing parent actor {0} for \'{1}\'", parentId, ToString());
1235 }
1236 }
1237 }
1238 }
1239
1240 // StaticFlags update - added StaticFlags::Navigation
1241 // [Deprecated on 17.05.2020, expires on 17.05.2021]
1242 if (modifier->EngineBuild < 6178 && (int32)_staticFlags == (1 + 2 + 4))
1243 {
1244 MARK_CONTENT_DEPRECATED();
1245 _staticFlags |= StaticFlags::Navigation;
1246 }
1247

Callers

nothing calls this directly

Calls 15

SetParentFunction · 0.85
MemberEndMethod · 0.80
RemoveKeepOrderMethod · 0.80
FindMemberMethod · 0.80
WaitForLoadedMethod · 0.80
GetRootObjectIdMethod · 0.80
DeserializeFunction · 0.50
ToStringFunction · 0.50
GetFunction · 0.50
AddMethod · 0.45
IsValidMethod · 0.45
TryGetMethod · 0.45

Tested by

no test coverage detected