| 134 | } |
| 135 | |
| 136 | BytesContainer AnimationGraph::LoadSurface() const |
| 137 | { |
| 138 | if (!IsVirtual() && WaitForLoaded()) |
| 139 | return BytesContainer(); |
| 140 | ScopeLock lock(Locker); |
| 141 | |
| 142 | if (IsVirtual()) |
| 143 | { |
| 144 | // Serialize runtime graph |
| 145 | MemoryWriteStream stream(512); |
| 146 | if (!Graph.Save(&stream, USE_EDITOR)) |
| 147 | { |
| 148 | BytesContainer result; |
| 149 | result.Copy(ToSpan(stream)); |
| 150 | return result; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | // Load data from asset |
| 155 | if (!LoadChunks(GET_CHUNK_FLAG(0))) |
| 156 | { |
| 157 | const auto data = GetChunk(0); |
| 158 | BytesContainer result; |
| 159 | result.Copy(data->Data); |
| 160 | return result; |
| 161 | } |
| 162 | |
| 163 | LOG(Warning, "Animation Graph \'{0}\' surface data is missing.", ToString()); |
| 164 | return BytesContainer(); |
| 165 | } |
| 166 | |
| 167 | #if USE_EDITOR |
| 168 | |