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

Method Deserialize

Source/Engine/Scripting/Script.cpp:336–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336void Script::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
337{
338 // Base
339 SceneObject::Deserialize(stream, modifier);
340
341 DESERIALIZE_BIT_MEMBER(Enabled, _enabled);
342 DESERIALIZE_MEMBER(PrefabID, _prefabID);
343
344 {
345 const auto member = SERIALIZE_FIND_MEMBER(stream, "ParentID");
346 if (member != stream.MemberEnd())
347 {
348 Guid parentId;
349 Serialization::Deserialize(member->value, parentId, modifier);
350 const auto parent = Scripting::FindObject<Actor>(parentId);
351 if (_parent != parent)
352 {
353 if (IsDuringPlay())
354 {
355 SetParent(parent, false);
356 }
357 else
358 {
359 if (_parent)
360 _parent->Scripts.RemoveKeepOrder(this);
361 _parent = parent;
362 if (_parent)
363 _parent->Scripts.Add(this);
364 }
365 }
366 else if (!parent && parentId.IsValid())
367 {
368 LOG(Warning, "Missing parent actor {0} for \'{1}\'", parentId, ToString());
369 }
370 }
371 }
372}

Callers

nothing calls this directly

Calls 7

SetParentFunction · 0.85
MemberEndMethod · 0.80
RemoveKeepOrderMethod · 0.80
DeserializeFunction · 0.70
ToStringFunction · 0.50
AddMethod · 0.45
IsValidMethod · 0.45

Tested by

no test coverage detected