| 248 | #endif |
| 249 | |
| 250 | Asset::LoadResult SceneAnimation::load() |
| 251 | { |
| 252 | TrackStatesCount = 0; |
| 253 | PROFILE_MEM(AnimationsData); |
| 254 | |
| 255 | // Get the data chunk |
| 256 | if (LoadChunk(0)) |
| 257 | return LoadResult::CannotLoadData; |
| 258 | const auto chunk0 = GetChunk(0); |
| 259 | if (chunk0 == nullptr || chunk0->IsMissing()) |
| 260 | return LoadResult::MissingDataChunk; |
| 261 | _data.Swap(chunk0->Data); |
| 262 | MemoryReadStream stream(_data.Get(), _data.Length()); |
| 263 | _runtimeData.SetPosition(0); |
| 264 | |
| 265 | // Tracks data documentation: |
| 266 | // - load the whole timeline data from asset chunk 0 |
| 267 | // - use runtime data container (as memory stream) to reference the data and prepare it for usage at runtime |
| 268 | // - data itself is read-only here but runtime data can be adjusted |
| 269 | // - also read tracks data to create cached tracks array to iterate over |
| 270 | |
| 271 | // Load properties |
| 272 | int32 version; |
| 273 | stream.Read(version); |
| 274 | switch (version) |
| 275 | { |
| 276 | case 2: // [Deprecated in 2020 expires on 03.09.2023] |
| 277 | case 3: // [Deprecated on 03.09.2021 expires on 03.09.2023] |
| 278 | MARK_CONTENT_DEPRECATED(); |
| 279 | case 4: |
| 280 | { |
| 281 | stream.Read(FramesPerSecond); |
| 282 | stream.Read(DurationFrames); |
| 283 | |
| 284 | // Load tracks |
| 285 | int32 tracksCount; |
| 286 | stream.Read(tracksCount); |
| 287 | Tracks.Resize(tracksCount, false); |
| 288 | for (int32 i = 0; i < tracksCount; i++) |
| 289 | { |
| 290 | auto& track = Tracks[i]; |
| 291 | |
| 292 | track.Type = (Track::Types)stream.ReadByte(); |
| 293 | track.Flag = (Track::Flags)stream.ReadByte(); |
| 294 | stream.ReadInt32(&track.ParentIndex); |
| 295 | stream.ReadInt32(&track.ChildrenCount); |
| 296 | stream.Read(track.Name, -13); |
| 297 | stream.Read(track.Color); |
| 298 | track.Disabled = (int32)track.Flag & (int32)Track::Flags::Mute || (track.ParentIndex != -1 && Tracks[track.ParentIndex].Disabled); |
| 299 | track.TrackStateIndex = -1; |
| 300 | track.Data = nullptr; |
| 301 | track.RuntimeData = nullptr; |
| 302 | |
| 303 | bool needsParent = false; |
| 304 | switch (track.Type) |
| 305 | { |
| 306 | case Track::Types::Folder: |
| 307 | break; |
nothing calls this directly
no test coverage detected