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

Method Serialize

Source/Engine/Particles/ParticleEffect.cpp:661–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659}
660
661void ParticleEffect::Serialize(SerializeStream& stream, const void* otherObj)
662{
663 // Base
664 Actor::Serialize(stream, otherObj);
665
666 SERIALIZE_GET_OTHER_OBJ(ParticleEffect);
667
668 const auto& params = GetParameters();
669 const auto* otherParams = other ? &((ParticleEffect*)other)->GetParameters() : nullptr;
670 {
671 stream.JKEY("Overrides");
672 stream.StartArray();
673 for (int32 i = 0; i < params.Count(); i++)
674 {
675 auto& param = params[i];
676 if (otherParams)
677 {
678 if (otherParams->IsEmpty())
679 {
680 // Serialize only parameters values overriding the default value (from system)
681 if (param.GetValue() == param.GetDefaultValue())
682 continue;
683 }
684 else
685 {
686 // Serialize only parameters values overriding the other object value (from diff)
687 const auto& otherParam = (*otherParams)[i];
688 if (param.GetValue() == otherParam.GetValue())
689 continue;
690 }
691 }
692
693 stream.StartObject();
694
695 stream.JKEY("Track");
696 stream.String(param.GetTrackName());
697
698 stream.JKEY("Id");
699 stream.Guid(param.GetParamIdentifier());
700
701 stream.JKEY("Value");
702 Serialization::Serialize(stream, param.GetValue(), nullptr);
703
704 stream.EndObject();
705 }
706 stream.EndArray();
707 }
708
709 SERIALIZE(ParticleSystem);
710 SERIALIZE(UpdateMode);
711 SERIALIZE(FixedTimestep);
712 SERIALIZE(SimulationSpeed);
713 SERIALIZE(UseTimeScale);
714 SERIALIZE(IsLooping);
715 SERIALIZE(PlayOnStart);
716 SERIALIZE(UpdateWhenOffscreen);
717 SERIALIZE(DrawModes);
718 SERIALIZE(SortOrder);

Callers

nothing calls this directly

Calls 13

GuidMethod · 0.80
GetParamIdentifierMethod · 0.80
SerializeFunction · 0.50
GetParametersMethod · 0.45
StartArrayMethod · 0.45
CountMethod · 0.45
IsEmptyMethod · 0.45
GetValueMethod · 0.45
GetDefaultValueMethod · 0.45
StartObjectMethod · 0.45
StringMethod · 0.45
EndObjectMethod · 0.45

Tested by

no test coverage detected