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

Method Save

Source/Engine/Content/Assets/SkeletonMask.cpp:69–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

67#if USE_EDITOR
68
69bool SkeletonMask::Save(const StringView& path)
70{
71 if (OnCheckSave(path))
72 return true;
73 ScopeLock lock(Locker);
74
75 // Write data
76 MemoryWriteStream stream(4096);
77 const auto skeletonId = Skeleton.GetID();
78 stream.Write(skeletonId);
79 stream.WriteInt32(_maskedNodes.Count());
80 for (auto& e : _maskedNodes)
81 {
82 stream.Write(e, -13);
83 }
84
85 // Save
86 bool result;
87 if (IsVirtual())
88 {
89 FlaxChunk* tmpChunks[ASSET_FILE_DATA_CHUNKS];
90 Platform::MemoryClear(tmpChunks, sizeof(tmpChunks));
91 FlaxChunk chunk;
92 tmpChunks[0] = &chunk;
93 tmpChunks[0]->Data.Link(ToSpan(stream));
94
95 AssetInitData initData;
96 initData.SerializedVersion = SerializedVersion;
97 Platform::MemoryCopy(_header.Chunks, tmpChunks, sizeof(_header.Chunks));
98 result = path.HasChars() ? SaveAsset(path, initData) : SaveAsset(initData, true);
99 Platform::MemoryClear(_header.Chunks, sizeof(_header.Chunks));
100 }
101 else
102 {
103 auto chunk0 = GetChunk(0);
104 chunk0->Data.Copy(ToSpan(stream));
105
106 AssetInitData initData;
107 initData.SerializedVersion = SerializedVersion;
108 result = path.HasChars() ? SaveAsset(path, initData) : SaveAsset(initData, true);
109
110 chunk0->Data.Unlink();
111 }
112
113 return result;
114}
115
116#endif
117

Callers

nothing calls this directly

Calls 12

IsVirtualFunction · 0.85
MemoryClearFunction · 0.85
GetChunkFunction · 0.85
GetIDMethod · 0.80
ToSpanFunction · 0.50
WriteMethod · 0.45
WriteInt32Method · 0.45
CountMethod · 0.45
LinkMethod · 0.45
HasCharsMethod · 0.45
CopyMethod · 0.45
UnlinkMethod · 0.45

Tested by

no test coverage detected