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

Method load

Source/Engine/Particles/ParticleSystem.cpp:204–311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

202#endif
203
204Asset::LoadResult ParticleSystem::load()
205{
206 PROFILE_MEM(Particles);
207 Version++;
208
209 // Get the data chunk
210 if (LoadChunk(0))
211 return LoadResult::CannotLoadData;
212 const auto chunk0 = GetChunk(0);
213 if (chunk0 == nullptr || chunk0->IsMissing())
214 return LoadResult::MissingDataChunk;
215 MemoryReadStream stream(chunk0->Data.Get(), chunk0->Data.Length());
216
217 int32 version;
218 stream.Read(version);
219#if USE_EDITOR
220 // Skip unused parameters
221#define SKIP_UNUSED_PARAM_OVERRIDE() if (key.First < 0 || key.First >= Emitters.Count() || Emitters[key.First] == nullptr || Emitters[key.First]->Graph.GetParameter(key.Second) == nullptr) continue
222#else
223#define SKIP_UNUSED_PARAM_OVERRIDE()
224#endif
225 switch (version)
226 {
227 case 3: // [Deprecated on 03.09.2021 expires on 03.09.2023]
228 MARK_CONTENT_DEPRECATED();
229 case 4:
230 {
231 // Load properties
232 stream.ReadFloat(&FramesPerSecond);
233 stream.ReadInt32(&DurationFrames);
234
235 // Load emitters
236 int32 emittersCount;
237 stream.ReadInt32(&emittersCount);
238 Emitters.Resize(emittersCount, false);
239
240 // Load tracks
241 Guid id;
242 int32 tracksCount;
243 stream.ReadInt32(&tracksCount);
244 Tracks.Resize(tracksCount, false);
245 for (int32 i = 0; i < tracksCount; i++)
246 {
247 auto& track = Tracks[i];
248
249 track.Type = (Track::Types)stream.ReadByte();
250 track.Flag = (Track::Flags)stream.ReadByte();
251 stream.ReadInt32(&track.ParentIndex);
252 stream.ReadInt32(&track.ChildrenCount);
253 stream.Read(track.Name, -13);
254 track.Disabled = (int32)track.Flag & (int32)Track::Flags::Mute || (track.ParentIndex != -1 && Tracks[track.ParentIndex].Disabled);
255 stream.Read(track.Color);
256
257 switch (track.Type)
258 {
259 case Track::Types::Emitter:
260 stream.Read(id);
261 stream.ReadInt32(&track.AsEmitter.Index);

Callers

nothing calls this directly

Calls 11

GetChunkFunction · 0.85
GetPathFunction · 0.85
IsMissingMethod · 0.80
WaitForLoadedMethod · 0.80
GetMethod · 0.45
LengthMethod · 0.45
ReadMethod · 0.45
ReadInt32Method · 0.45
ResizeMethod · 0.45
ReadByteMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected