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

Method Serialize

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

Source from the content-addressed store, hash-verified

437}
438
439void StaticModel::Serialize(SerializeStream& stream, const void* otherObj)
440{
441 // Base
442 ModelInstanceActor::Serialize(stream, otherObj);
443
444 SERIALIZE_GET_OTHER_OBJ(StaticModel);
445
446 SERIALIZE_MEMBER(ScaleInLightmap, _scaleInLightmap);
447 SERIALIZE_MEMBER(BoundsScale, _boundsScale);
448 SERIALIZE(Model);
449 SERIALIZE_MEMBER(LODBias, _lodBias);
450 SERIALIZE_MEMBER(ForcedLOD, _forcedLod);
451 SERIALIZE_MEMBER(SortOrder, _sortOrder);
452 SERIALIZE_MEMBER(DrawModes, _drawModes);
453
454 if (HasLightmap()
455#if USE_EDITOR
456 && !PrefabManager::IsCreatingPrefab
457#endif
458 )
459 {
460 stream.JKEY("LightmapIndex");
461 stream.Int(Lightmap.TextureIndex);
462
463 stream.JKEY("LightmapArea");
464 stream.Rectangle(Lightmap.UVsArea);
465 }
466
467 stream.JKEY("Buffer");
468 stream.Object(&Entries, other ? &other->Entries : nullptr);
469
470 if (_vertexColorsCount)
471 {
472 stream.JKEY("VertexColors");
473 stream.StartArray();
474 Array<char> encodedData;
475 for (int32 lodIndex = 0; lodIndex < _vertexColorsCount; lodIndex++)
476 {
477 auto& vertexColorsData = _vertexColorsData[lodIndex];
478 if (vertexColorsData.HasItems())
479 {
480 const int32 size = vertexColorsData.Count() * sizeof(Color32);
481 Encryption::Base64Encode((byte*)vertexColorsData.Get(), size, encodedData);
482 stream.String(encodedData.Get(), encodedData.Count());
483 }
484 else
485 {
486 stream.String("", 0);
487 }
488 }
489 stream.EndArray();
490 }
491}
492
493void StaticModel::Deserialize(DeserializeStream& stream, ISerializeModifier* modifier)
494{

Callers

nothing calls this directly

Calls 11

SerializeFunction · 0.50
HasLightmapFunction · 0.50
IntMethod · 0.45
RectangleMethod · 0.45
ObjectMethod · 0.45
StartArrayMethod · 0.45
HasItemsMethod · 0.45
CountMethod · 0.45
GetMethod · 0.45
StringMethod · 0.45
EndArrayMethod · 0.45

Tested by

no test coverage detected