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

Method Deserialize

Source/Engine/Level/Actors/StaticModel.cpp:493–577  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

491}
492
493void StaticModel::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
494{
495 // Base
496 ModelInstanceActor::Deserialize(stream, modifier);
497
498 DESERIALIZE_MEMBER(ScaleInLightmap, _scaleInLightmap);
499 DESERIALIZE_MEMBER(BoundsScale, _boundsScale);
500 DESERIALIZE(Model);
501 DESERIALIZE_MEMBER(LODBias, _lodBias);
502 DESERIALIZE_MEMBER(ForcedLOD, _forcedLod);
503 DESERIALIZE_MEMBER(SortOrder, _sortOrder);
504 DESERIALIZE_MEMBER(DrawModes, _drawModes);
505 DESERIALIZE_MEMBER(LightmapIndex, Lightmap.TextureIndex);
506 DESERIALIZE_MEMBER(LightmapArea, Lightmap.UVsArea);
507
508 Entries.DeserializeIfExists(stream, "Buffer", modifier);
509
510 {
511 const auto member = stream.FindMember("VertexColors");
512 if (member != stream.MemberEnd() && member->value.IsArray())
513 {
514 // TODO: don't stall but just check the length of the loaded vertex colors arrays size later when asset gets loaded
515 if (Model && !Model->WaitForLoaded())
516 {
517 RemoveVertexColors();
518 auto& array = member->value;
519 _vertexColorsCount = array.Size();
520 Array<byte> decodedData;
521 if (_vertexColorsCount == Model->GetLODsCount())
522 {
523 for (int32 lodIndex = 0; lodIndex < _vertexColorsCount; lodIndex++)
524 {
525 _vertexColorsBuffer[lodIndex] = nullptr;
526 auto& vertexColorsData = _vertexColorsData[lodIndex];
527 vertexColorsData.Clear();
528 auto& v = array[lodIndex];
529 if (v.IsString())
530 {
531 Encryption::Base64Decode(v.GetString(), v.GetStringLength(), decodedData);
532 const int32 length = decodedData.Count() / sizeof(Color32);
533 vertexColorsData.Resize(length);
534 Platform::MemoryCopy(vertexColorsData.Get(), decodedData.Get(), decodedData.Count());
535 }
536 }
537 }
538 else
539 {
540 LOG(Error, "Loaded vertex colors data for {0} has different size than the model {1} LODs count.", ToString(), Model->ToString());
541 }
542 _vertexColorsDirty = true;
543 }
544 }
545 }
546
547 // [Deprecated on 11.10.2019, expires on 11.10.2020]
548 if (modifier->EngineBuild <= 6187)
549 {
550 const auto member = stream.FindMember("HiddenShadow");

Callers

nothing calls this directly

Calls 15

DeserializeIfExistsMethod · 0.80
FindMemberMethod · 0.80
MemberEndMethod · 0.80
WaitForLoadedMethod · 0.80
GetIntMethod · 0.80
DeserializeFunction · 0.50
ToStringFunction · 0.50
SizeMethod · 0.45
GetLODsCountMethod · 0.45
ClearMethod · 0.45
GetStringMethod · 0.45
GetStringLengthMethod · 0.45

Tested by

no test coverage detected