Update read and write streaming api to use the newest format

This commit is contained in:
Wojtek Figat
2024-12-29 23:00:40 +01:00
parent fee0ab74ff
commit 668f3fa68d
29 changed files with 444 additions and 378 deletions

View File

@@ -166,7 +166,7 @@ void CookAssetsStep::CacheData::Load(CookingData& data)
Guid id;
file->Read(id);
String typeName;
file->ReadString(&typeName);
file->Read(typeName);
DateTime fileModified;
file->Read(fileModified);
int32 fileDependenciesCount;
@@ -176,7 +176,7 @@ void CookAssetsStep::CacheData::Load(CookingData& data)
for (int32 j = 0; j < fileDependenciesCount; j++)
{
Pair<String, DateTime>& f = fileDependencies[j];
file->ReadString(&f.First, 10);
file->Read(f.First, 10);
file->Read(f.Second);
}
@@ -311,9 +311,9 @@ void CookAssetsStep::CacheData::Save(CookingData& data)
{
auto& e = i->Value;
file->Write(e.ID);
file->WriteString(e.TypeName);
file->Write(e.TypeName);
file->Write(e.FileModified);
file->WriteInt32(e.FileDependencies.Count());
file->Write(e.FileDependencies.Count());
for (auto& f : e.FileDependencies)
{
file->Write(f.First, 10);
@@ -1249,7 +1249,7 @@ bool CookAssetsStep::Perform(CookingData& data)
*(int32*)(bytes.Get() + 804) = contentKey;
*(Guid*)(bytes.Get() + 808) = gameSettings->SplashScreen;
Encryption::EncryptBytes(bytes.Get(), bytes.Count());
stream->WriteArray(bytes);
stream->Write(bytes);
Delete(stream);
}

View File

@@ -112,19 +112,19 @@ Asset::LoadResult SceneAnimation::load()
// Load properties
int32 version;
stream.ReadInt32(&version);
stream.Read(version);
switch (version)
{
case 2: // [Deprecated in 2020 expires on 03.09.2023]
case 3: // [Deprecated on 03.09.2021 expires on 03.09.2023]
case 4:
{
stream.ReadFloat(&FramesPerSecond);
stream.ReadInt32(&DurationFrames);
stream.Read(FramesPerSecond);
stream.Read(DurationFrames);
// Load tracks
int32 tracksCount;
stream.ReadInt32(&tracksCount);
stream.Read(tracksCount);
Tracks.Resize(tracksCount, false);
for (int32 i = 0; i < tracksCount; i++)
{
@@ -134,7 +134,7 @@ Asset::LoadResult SceneAnimation::load()
track.Flag = (Track::Flags)stream.ReadByte();
stream.ReadInt32(&track.ParentIndex);
stream.ReadInt32(&track.ChildrenCount);
stream.ReadString(&track.Name, -13);
stream.Read(track.Name, -13);
stream.Read(track.Color);
track.Disabled = (int32)track.Flag & (int32)Track::Flags::Mute || (track.ParentIndex != -1 && Tracks[track.ParentIndex].Disabled);
track.TrackStateIndex = -1;

View File

@@ -86,15 +86,17 @@ void Animation::LoadTimeline(BytesContainer& result) const
// Meta
float fps = (float)Data.FramesPerSecond;
const float fpsInv = 1.0f / fps;
stream.WriteFloat(fps);
stream.WriteInt32((int32)Data.Duration);
stream.Write(fps);
stream.Write((int32)Data.Duration);
int32 tracksCount = Data.Channels.Count() + NestedAnims.Count() + Events.Count();
for (auto& channel : Data.Channels)
{
tracksCount +=
(channel.Position.GetKeyframes().HasItems() ? 1 : 0) +
(channel.Rotation.GetKeyframes().HasItems() ? 1 : 0) +
(channel.Scale.GetKeyframes().HasItems() ? 1 : 0);
stream.WriteInt32(tracksCount);
}
stream.Write(tracksCount);
// Tracks
int32 trackIndex = 0;
@@ -107,11 +109,11 @@ void Animation::LoadTimeline(BytesContainer& result) const
(channel.Scale.GetKeyframes().HasItems() ? 1 : 0);
// Animation Channel track
stream.WriteByte(17); // Track Type
stream.WriteByte(0); // Track Flags
stream.WriteInt32(-1); // Parent Index
stream.WriteInt32(childrenCount); // Children Count
stream.WriteString(channel.NodeName, -13); // Name
stream.Write((byte)17); // Track Type
stream.Write((byte)0); // Track Flags
stream.Write(-1); // Parent Index
stream.Write(childrenCount); // Children Count
stream.Write(channel.NodeName, -13); // Name
stream.Write(Color32::White); // Color
const int32 parentIndex = trackIndex++;
@@ -119,17 +121,17 @@ void Animation::LoadTimeline(BytesContainer& result) const
if (position.HasItems())
{
// Animation Channel Data track (position)
stream.WriteByte(18); // Track Type
stream.WriteByte(0); // Track Flags
stream.WriteInt32(parentIndex); // Parent Index
stream.WriteInt32(0); // Children Count
stream.WriteString(String::Format(TEXT("Track_{0}_Position"), i), -13); // Name
stream.Write((byte)18); // Track Type
stream.Write((byte)0); // Track Flags
stream.Write(parentIndex); // Parent Index
stream.Write(0); // Children Count
stream.Write(String::Format(TEXT("Track_{0}_Position"), i), -13); // Name
stream.Write(Color32::White); // Color
stream.WriteByte(0); // Type
stream.WriteInt32(position.Count()); // Keyframes Count
stream.Write((byte)0); // Type
stream.Write(position.Count()); // Keyframes Count
for (auto& k : position)
{
stream.WriteFloat(k.Time * fpsInv);
stream.Write(k.Time * fpsInv);
stream.Write(k.Value);
}
trackIndex++;
@@ -139,17 +141,17 @@ void Animation::LoadTimeline(BytesContainer& result) const
if (rotation.HasItems())
{
// Animation Channel Data track (rotation)
stream.WriteByte(18); // Track Type
stream.WriteByte(0); // Track Flags
stream.WriteInt32(parentIndex); // Parent Index
stream.WriteInt32(0); // Children Count
stream.WriteString(String::Format(TEXT("Track_{0}_Rotation"), i), -13); // Name
stream.Write((byte)18); // Track Type
stream.Write((byte)0); // Track Flags
stream.Write(parentIndex); // Parent Index
stream.Write(0); // Children Count
stream.Write(String::Format(TEXT("Track_{0}_Rotation"), i), -13); // Name
stream.Write(Color32::White); // Color
stream.WriteByte(1); // Type
stream.WriteInt32(rotation.Count()); // Keyframes Count
stream.Write((byte)1); // Type
stream.Write(rotation.Count()); // Keyframes Count
for (auto& k : rotation)
{
stream.WriteFloat(k.Time * fpsInv);
stream.Write(k.Time * fpsInv);
stream.Write(k.Value);
}
trackIndex++;
@@ -159,17 +161,17 @@ void Animation::LoadTimeline(BytesContainer& result) const
if (scale.HasItems())
{
// Animation Channel Data track (scale)
stream.WriteByte(18); // Track Type
stream.WriteByte(0); // Track Flags
stream.WriteInt32(parentIndex); // Parent Index
stream.WriteInt32(0); // Children Count
stream.WriteString(String::Format(TEXT("Track_{0}_Scale"), i), -13); // Name
stream.Write((byte)18); // Track Type
stream.Write((byte)0); // Track Flags
stream.Write(parentIndex); // Parent Index
stream.Write(0); // Children Count
stream.Write(String::Format(TEXT("Track_{0}_Scale"), i), -13); // Name
stream.Write(Color32::White); // Color
stream.WriteByte(2); // Type
stream.WriteInt32(scale.Count()); // Keyframes Count
stream.Write((byte)2); // Type
stream.Write(scale.Count()); // Keyframes Count
for (auto& k : scale)
{
stream.WriteFloat(k.Time * fpsInv);
stream.Write(k.Time * fpsInv);
stream.Write(k.Value);
}
trackIndex++;
@@ -186,33 +188,33 @@ void Animation::LoadTimeline(BytesContainer& result) const
Guid id = nestedAnim.Anim.GetID();
// Nested Animation track
stream.WriteByte(20); // Track Type
stream.WriteByte(flags); // Track Flags
stream.WriteInt32(-1); // Parent Index
stream.WriteInt32(0); // Children Count
stream.WriteString(e.First, -13); // Name
stream.Write((byte)20); // Track Type
stream.Write(flags); // Track Flags
stream.Write(-1); // Parent Index
stream.Write(0); // Children Count
stream.Write(e.First, -13); // Name
stream.Write(Color32::White); // Color
stream.Write(id);
stream.WriteFloat(nestedAnim.Time);
stream.WriteFloat(nestedAnim.Duration);
stream.WriteFloat(nestedAnim.Speed);
stream.WriteFloat(nestedAnim.StartTime);
stream.Write(nestedAnim.Time);
stream.Write(nestedAnim.Duration);
stream.Write(nestedAnim.Speed);
stream.Write(nestedAnim.StartTime);
}
for (auto& e : Events)
{
// Animation Event track
stream.WriteByte(19); // Track Type
stream.WriteByte(0); // Track Flags
stream.WriteInt32(-1); // Parent Index
stream.WriteInt32(0); // Children Count
stream.WriteString(e.First, -13); // Name
stream.Write((byte)19); // Track Type
stream.Write((byte)0); // Track Flags
stream.Write(-1); // Parent Index
stream.Write(0); // Children Count
stream.Write(e.First, -13); // Name
stream.Write(Color32::White); // Color
stream.WriteInt32(e.Second.GetKeyframes().Count()); // Events Count
stream.Write(e.Second.GetKeyframes().Count()); // Events Count
for (const auto& k : e.Second.GetKeyframes())
{
stream.WriteFloat(k.Time);
stream.WriteFloat(k.Value.Duration);
stream.WriteStringAnsi(k.Value.TypeName, 13);
stream.Write(k.Time);
stream.Write(k.Value.Duration);
stream.Write(k.Value.TypeName, 13);
stream.WriteJson(k.Value.Instance);
}
}
@@ -237,7 +239,7 @@ bool Animation::SaveTimeline(BytesContainer& data)
// Version
int32 version;
stream.ReadInt32(&version);
stream.Read(version);
switch (version)
{
case 3: // [Deprecated on 03.09.2021 expires on 03.09.2023]
@@ -245,13 +247,13 @@ bool Animation::SaveTimeline(BytesContainer& data)
{
// Meta
float fps;
stream.ReadFloat(&fps);
stream.Read(fps);
Data.FramesPerSecond = static_cast<double>(fps);
int32 duration;
stream.ReadInt32(&duration);
stream.Read(duration);
Data.Duration = static_cast<double>(duration);
int32 tracksCount;
stream.ReadInt32(&tracksCount);
stream.Read(tracksCount);
// Tracks
Data.Channels.Clear();
@@ -264,10 +266,10 @@ bool Animation::SaveTimeline(BytesContainer& data)
const byte trackType = stream.ReadByte();
const byte trackFlags = stream.ReadByte();
int32 parentIndex, childrenCount;
stream.ReadInt32(&parentIndex);
stream.ReadInt32(&childrenCount);
stream.Read(parentIndex);
stream.Read(childrenCount);
String name;
stream.ReadString(&name, -13);
stream.Read(name, -13);
Color32 color;
stream.Read(color);
switch (trackType)
@@ -286,7 +288,7 @@ bool Animation::SaveTimeline(BytesContainer& data)
// Animation Channel Data track
const byte type = stream.ReadByte();
int32 keyframesCount;
stream.ReadInt32(&keyframesCount);
stream.Read(keyframesCount);
int32 channelIndex;
if (!animationChannelTrackIndexToChannelIndex.TryGet(parentIndex, channelIndex))
{
@@ -301,7 +303,7 @@ bool Animation::SaveTimeline(BytesContainer& data)
for (int32 i = 0; i < keyframesCount; i++)
{
LinearCurveKeyframe<Float3>& k = channel.Position.GetKeyframes()[i];
stream.ReadFloat(&k.Time);
stream.Read(k.Time);
k.Time *= fps;
stream.Read(k.Value);
}
@@ -311,7 +313,7 @@ bool Animation::SaveTimeline(BytesContainer& data)
for (int32 i = 0; i < keyframesCount; i++)
{
LinearCurveKeyframe<Quaternion>& k = channel.Rotation.GetKeyframes()[i];
stream.ReadFloat(&k.Time);
stream.Read(k.Time);
k.Time *= fps;
stream.Read(k.Value);
}
@@ -321,7 +323,7 @@ bool Animation::SaveTimeline(BytesContainer& data)
for (int32 i = 0; i < keyframesCount; i++)
{
LinearCurveKeyframe<Float3>& k = channel.Scale.GetKeyframes()[i];
stream.ReadFloat(&k.Time);
stream.Read(k.Time);
k.Time *= fps;
stream.Read(k.Value);
}
@@ -340,9 +342,9 @@ bool Animation::SaveTimeline(BytesContainer& data)
for (int32 i = 0; i < count; i++)
{
auto& k = eventTrack.Second.GetKeyframes()[i];
stream.ReadFloat(&k.Time);
stream.ReadFloat(&k.Value.Duration);
stream.ReadStringAnsi(&k.Value.TypeName, 13);
stream.Read(k.Time);
stream.Read(k.Value.Duration);
stream.Read(k.Value.TypeName, 13);
const ScriptingTypeHandle typeHandle = Scripting::FindScriptingType(k.Value.TypeName);
k.Value.Instance = NewObject<AnimEvent>(typeHandle);
stream.ReadJson(k.Value.Instance);
@@ -367,10 +369,10 @@ bool Animation::SaveTimeline(BytesContainer& data)
auto& nestedAnim = nestedTrack.Second;
Guid id;
stream.Read(id);
stream.ReadFloat(&nestedAnim.Time);
stream.ReadFloat(&nestedAnim.Duration);
stream.ReadFloat(&nestedAnim.Speed);
stream.ReadFloat(&nestedAnim.StartTime);
stream.Read(nestedAnim.Time);
stream.Read(nestedAnim.Duration);
stream.Read(nestedAnim.Speed);
stream.Read(nestedAnim.StartTime);
nestedAnim.Anim = id;
nestedAnim.Enabled = (trackFlags & (byte)SceneAnimation::Track::Flags::Mute) == 0;
nestedAnim.Loop = (trackFlags & (byte)SceneAnimation::Track::Flags::Loop) != 0;
@@ -415,18 +417,18 @@ bool Animation::Save(const StringView& path)
MemoryWriteStream stream(4096);
// Info
stream.WriteInt32(103);
stream.WriteDouble(Data.Duration);
stream.WriteDouble(Data.FramesPerSecond);
stream.WriteByte((byte)Data.RootMotionFlags);
stream.WriteString(Data.RootNodeName, 13);
stream.Write(103);
stream.Write(Data.Duration);
stream.Write(Data.FramesPerSecond);
stream.Write((byte)Data.RootMotionFlags);
stream.Write(Data.RootNodeName, 13);
// Animation channels
stream.WriteInt32(Data.Channels.Count());
for (int32 i = 0; i < Data.Channels.Count(); i++)
{
auto& anim = Data.Channels[i];
stream.WriteString(anim.NodeName, 172);
stream.Write(anim.NodeName, 172);
Serialization::Serialize(stream, anim.Position);
Serialization::Serialize(stream, anim.Rotation);
Serialization::Serialize(stream, anim.Scale);
@@ -437,13 +439,13 @@ bool Animation::Save(const StringView& path)
for (int32 i = 0; i < Events.Count(); i++)
{
auto& e = Events[i];
stream.WriteString(e.First, 172);
stream.WriteInt32(e.Second.GetKeyframes().Count());
stream.Write(e.First, 172);
stream.Write(e.Second.GetKeyframes().Count());
for (const auto& k : e.Second.GetKeyframes())
{
stream.WriteFloat(k.Time);
stream.WriteFloat(k.Value.Duration);
stream.WriteStringAnsi(k.Value.TypeName, 17);
stream.Write(k.Time);
stream.Write(k.Value.Duration);
stream.Write(k.Value.TypeName, 17);
stream.WriteJson(k.Value.Instance);
}
}
@@ -453,7 +455,7 @@ bool Animation::Save(const StringView& path)
for (int32 i = 0; i < NestedAnims.Count(); i++)
{
auto& e = NestedAnims[i];
stream.WriteString(e.First, 172);
stream.Write(e.First, 172);
auto& nestedAnim = e.Second;
Guid id = nestedAnim.Anim.GetID();
byte flags = 0;
@@ -461,12 +463,12 @@ bool Animation::Save(const StringView& path)
flags |= 1;
if (nestedAnim.Loop)
flags |= 2;
stream.WriteByte(flags);
stream.Write(flags);
stream.Write(id);
stream.WriteFloat(nestedAnim.Time);
stream.WriteFloat(nestedAnim.Duration);
stream.WriteFloat(nestedAnim.Speed);
stream.WriteFloat(nestedAnim.StartTime);
stream.Write(nestedAnim.Time);
stream.Write(nestedAnim.Duration);
stream.Write(nestedAnim.Speed);
stream.Write(nestedAnim.StartTime);
}
// Set data to the chunk asset
@@ -563,24 +565,24 @@ Asset::LoadResult Animation::load()
switch (headerVersion)
{
case 103:
stream.ReadInt32(&headerVersion);
stream.ReadDouble(&Data.Duration);
stream.ReadDouble(&Data.FramesPerSecond);
stream.ReadByte((byte*)&Data.RootMotionFlags);
stream.ReadString(&Data.RootNodeName, 13);
stream.Read(headerVersion);
stream.Read(Data.Duration);
stream.Read(Data.FramesPerSecond);
stream.Read((byte&)Data.RootMotionFlags);
stream.Read(Data.RootNodeName, 13);
break;
case 100:
case 101:
case 102:
stream.ReadInt32(&headerVersion);
stream.ReadDouble(&Data.Duration);
stream.ReadDouble(&Data.FramesPerSecond);
stream.Read(headerVersion);
stream.Read(Data.Duration);
stream.Read(Data.FramesPerSecond);
Data.RootMotionFlags = stream.ReadBool() ? AnimationRootMotionFlags::RootPositionXZ : AnimationRootMotionFlags::None;
stream.ReadString(&Data.RootNodeName, 13);
stream.Read(Data.RootNodeName, 13);
break;
default:
stream.ReadDouble(&Data.Duration);
stream.ReadDouble(&Data.FramesPerSecond);
stream.Read(Data.Duration);
stream.Read(Data.FramesPerSecond);
break;
}
if (Data.Duration < ZeroTolerance || Data.FramesPerSecond < ZeroTolerance)
@@ -597,7 +599,7 @@ Asset::LoadResult Animation::load()
{
auto& anim = Data.Channels[i];
stream.ReadString(&anim.NodeName, 172);
stream.Read(anim.NodeName, 172);
bool failed = Serialization::Deserialize(stream, anim.Position);
failed |= Serialization::Deserialize(stream, anim.Rotation);
failed |= Serialization::Deserialize(stream, anim.Scale);
@@ -613,7 +615,7 @@ Asset::LoadResult Animation::load()
if (headerVersion >= 101)
{
int32 eventTracksCount;
stream.ReadInt32(&eventTracksCount);
stream.Read(eventTracksCount);
Events.Resize(eventTracksCount, false);
#if !USE_EDITOR
StringAnsi typeName;
@@ -621,18 +623,18 @@ Asset::LoadResult Animation::load()
for (int32 i = 0; i < eventTracksCount; i++)
{
auto& e = Events[i];
stream.ReadString(&e.First, 172);
stream.Read(e.First, 172);
int32 eventsCount;
stream.ReadInt32(&eventsCount);
stream.Read(eventsCount);
e.Second.GetKeyframes().Resize(eventsCount);
for (auto& k : e.Second.GetKeyframes())
{
stream.ReadFloat(&k.Time);
stream.ReadFloat(&k.Value.Duration);
stream.Read(k.Time);
stream.Read(k.Value.Duration);
#if USE_EDITOR
StringAnsi& typeName = k.Value.TypeName;
#endif
stream.ReadStringAnsi(&typeName, 17);
stream.Read(typeName, 17);
const ScriptingTypeHandle typeHandle = Scripting::FindScriptingType(typeName);
k.Value.Instance = NewObject<AnimEvent>(typeHandle);
stream.ReadJson(k.Value.Instance);
@@ -656,24 +658,24 @@ Asset::LoadResult Animation::load()
if (headerVersion >= 102)
{
int32 nestedAnimationsCount;
stream.ReadInt32(&nestedAnimationsCount);
stream.Read(nestedAnimationsCount);
NestedAnims.Resize(nestedAnimationsCount, false);
for (int32 i = 0; i < nestedAnimationsCount; i++)
{
auto& e = NestedAnims[i];
stream.ReadString(&e.First, 172);
stream.Read(e.First, 172);
auto& nestedAnim = e.Second;
byte flags;
stream.ReadByte(&flags);
stream.Read(flags);
nestedAnim.Enabled = flags & 1;
nestedAnim.Loop = flags & 2;
Guid id;
stream.Read(id);
nestedAnim.Anim = id;
stream.ReadFloat(&nestedAnim.Time);
stream.ReadFloat(&nestedAnim.Duration);
stream.ReadFloat(&nestedAnim.Speed);
stream.ReadFloat(&nestedAnim.StartTime);
stream.Read(nestedAnim.Time);
stream.Read(nestedAnim.Duration);
stream.Read(nestedAnim.Speed);
stream.Read(nestedAnim.StartTime);
}
}

View File

@@ -29,7 +29,7 @@ Asset::LoadResult SkeletonMask::load()
_maskedNodes.Resize(maskedNodesCount);
for (auto& e : _maskedNodes)
{
stream.ReadString(&e, -13);
stream.Read(e, -13);
}
Skeleton = skeletonId;
@@ -87,7 +87,7 @@ bool SkeletonMask::Save(const StringView& path)
stream.WriteInt32(_maskedNodes.Count());
for (auto& e : _maskedNodes)
{
stream.WriteString(e, -13);
stream.Write(e, -13);
}
// Save

View File

@@ -433,7 +433,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
if (version == 4)
{
signature.IsStatic = stream.ReadBool();
stream.ReadVariantType(&signature.ReturnType);
stream.Read(signature.ReturnType);
int32 signatureParamsCount;
stream.ReadInt32(&signatureParamsCount);
signature.Params.Resize(signatureParamsCount);
@@ -443,7 +443,7 @@ void VisualScriptExecutor::ProcessGroupFunction(Box* boxBase, Node* node, Value&
int32 parameterNameLength;
stream.ReadInt32(&parameterNameLength);
stream.SetPosition(stream.GetPosition() + parameterNameLength * sizeof(Char));
stream.ReadVariantType(&param.Type);
stream.Read(param.Type);
param.IsOut = stream.ReadBool();
}
}
@@ -1317,13 +1317,13 @@ Asset::LoadResult VisualScript::load()
return LoadResult::MissingDataChunk;
MemoryReadStream metadataStream(metadataChunk->Get(), metadataChunk->Size());
int32 version;
metadataStream.ReadInt32(&version);
metadataStream.Read(version);
switch (version)
{
case 1:
{
metadataStream.ReadString(&Meta.BaseTypename, 31);
metadataStream.ReadInt32((int32*)&Meta.Flags);
metadataStream.Read(Meta.BaseTypename, 31);
metadataStream.Read((int32&)Meta.Flags);
break;
}
default:
@@ -1376,10 +1376,10 @@ Asset::LoadResult VisualScript::load()
{
case 1:
{
signatureStream.ReadStringAnsi(&method.Name, 71);
signatureStream.Read(method.Name, 71);
method.MethodFlags = (MethodFlags)signatureStream.ReadByte();
method.Signature.IsStatic = ((byte)method.MethodFlags & (byte)MethodFlags::Static) != 0;
signatureStream.ReadVariantType(&method.Signature.ReturnType);
signatureStream.Read(method.Signature.ReturnType);
int32 parametersCount;
signatureStream.ReadInt32(&parametersCount);
method.Signature.Params.Resize(parametersCount);
@@ -1387,8 +1387,8 @@ Asset::LoadResult VisualScript::load()
for (int32 i = 0; i < parametersCount; i++)
{
auto& param = method.Signature.Params[i];
signatureStream.ReadStringAnsi(&method.ParamNames[i], 13);
signatureStream.ReadVariantType(&param.Type);
signatureStream.Read(method.ParamNames[i], 13);
signatureStream.Read(param.Type);
param.IsOut = signatureStream.ReadByte() != 0;
bool hasDefaultValue = signatureStream.ReadByte() != 0;
}
@@ -1699,9 +1699,9 @@ ScriptingObject* VisualScriptingBinaryModule::VisualScriptObjectSpawn(const Scri
{
// Special case for C# object property in Visual Script so duplicate the object instead of cloning the reference to it
MemoryWriteStream writeStream;
writeStream.WriteVariant(param);
writeStream.Write(param);
MemoryReadStream readStream(writeStream.GetHandle(), writeStream.GetPosition());
readStream.ReadVariant(&param);
readStream.Read(param);
}
}
@@ -2227,9 +2227,9 @@ bool VisualScript::SaveSurface(const BytesContainer& data, const Metadata& meta)
// Set metadata
MemoryWriteStream metaStream(512);
{
metaStream.WriteInt32(1);
metaStream.WriteString(meta.BaseTypename, 31);
metaStream.WriteInt32((int32)meta.Flags);
metaStream.Write(1);
metaStream.Write(meta.BaseTypename, 31);
metaStream.Write((int32)meta.Flags);
}
GetOrCreateChunk(1)->Data.Copy(metaStream.GetHandle(), metaStream.GetPosition());

View File

@@ -65,7 +65,7 @@ public:
/// <summary>
/// Visual Script flag types.
/// </summary>
API_ENUM(Attributes="Flags") enum class Flags
API_ENUM(Attributes="Flags") enum class Flags : int32
{
/// <summary>
/// No flags.

View File

@@ -43,7 +43,7 @@ void AssetsCache::Init()
// Load version
int32 version;
stream->ReadInt32(&version);
stream->Read(version);
if (version != FLAXENGINE_VERSION_BUILD)
{
LOG(Warning, "Corrupted or not supported Asset Cache file. Version: {0}", version);
@@ -52,12 +52,12 @@ void AssetsCache::Init()
// Load paths
String enginePath, projectPath;
stream->ReadString(&enginePath, -410);
stream->ReadString(&projectPath, -410);
stream->Read(enginePath, -410);
stream->Read(projectPath, -410);
// Flags
AssetsCacheFlags flags;
stream->ReadInt32((int32*)&flags);
stream->Read((int32&)flags);
// Check if other workspace instance used this cache
if (EnumHasNoneFlags(flags, AssetsCacheFlags::RelativePaths) && enginePath != Globals::StartupFolder)
@@ -75,7 +75,7 @@ void AssetsCache::Init()
_isDirty = false;
// Load elements count
stream->ReadInt32(&count);
stream->Read(count);
_registry.Clear();
_registry.EnsureCapacity(count);
@@ -84,8 +84,8 @@ void AssetsCache::Init()
for (int32 i = 0; i < count; i++)
{
stream->Read(e.Info.ID);
stream->ReadString(&e.Info.TypeName, i - 13);
stream->ReadString(&e.Info.Path, i);
stream->Read(e.Info.TypeName, i - 13);
stream->Read(e.Info.Path, i);
#if ENABLE_ASSETS_DISCOVERY
stream->Read(e.FileModified);
#else
@@ -115,7 +115,7 @@ void AssetsCache::Init()
Guid id;
stream->Read(id);
String mappedPath;
stream->ReadString(&mappedPath, i + 73);
stream->Read(mappedPath, i + 73);
if (EnumHasAnyFlags(flags, AssetsCacheFlags::RelativePaths) && mappedPath.HasChars())
{
@@ -177,17 +177,17 @@ bool AssetsCache::Save(const StringView& path, const Registry& entries, const Pa
return true;
// Version
stream->WriteInt32(FLAXENGINE_VERSION_BUILD);
stream->Write((int32)FLAXENGINE_VERSION_BUILD);
// Paths
stream->WriteString(Globals::StartupFolder, -410);
stream->WriteString(Globals::ProjectFolder, -410);
stream->Write(Globals::StartupFolder, -410);
stream->Write(Globals::ProjectFolder, -410);
// Flags
stream->WriteInt32((int32)flags);
stream->Write((int32)flags);
// Items count
stream->WriteInt32(entries.Count());
stream->Write(entries.Count());
// Data
int32 index = 0;
@@ -195,12 +195,12 @@ bool AssetsCache::Save(const StringView& path, const Registry& entries, const Pa
{
auto& e = i->Value;
stream->Write(e.Info.ID);
stream->WriteString(e.Info.TypeName, index - 13);
stream->WriteString(e.Info.Path, index);
stream->Write(e.Info.TypeName, index - 13);
stream->Write(e.Info.Path, index);
#if ENABLE_ASSETS_DISCOVERY
stream->Write(e.FileModified);
#else
stream->WriteInt64(0);
stream->Write((int64)0);
#endif
index++;
}
@@ -211,7 +211,7 @@ bool AssetsCache::Save(const StringView& path, const Registry& entries, const Pa
for (auto i = pathsMapping.Begin(); i.IsNotEnd(); ++i)
{
stream->Write(i->Value);
stream->WriteString(i->Key, index + 73);
stream->Write(i->Key, index + 73);
index++;
}

View File

@@ -19,7 +19,7 @@ class FlaxStorage;
/// <summary>
/// Assets cache flags.
/// </summary>
enum class AssetsCacheFlags
enum class AssetsCacheFlags : int32
{
/// <summary>
/// The none.

View File

@@ -544,8 +544,8 @@ bool FlaxStorage::Load()
DateTime tmpDate;
String strTmp;
stream->Read(tmpDate);
stream->ReadString(&strTmp, -76);
stream->ReadString(&strTmp, 1301);
stream->Read(strTmp, -76);
stream->Read(strTmp, 1301);
}
// Check char
@@ -974,9 +974,9 @@ bool FlaxStorage::Create(WriteStream* stream, const AssetInitData* data, int32 d
stream->WriteUint32(header.SerializedVersion);
// Chunks mapping
for (int32 chunkIndex = 0; chunkIndex < ARRAY_COUNT(header.Header.Chunks); chunkIndex++)
for (FlaxChunk* chunk : header.Header.Chunks)
{
const int32 index = chunks.Find(header.Header.Chunks[chunkIndex]);
const int32 index = chunks.Find(chunk);
stream->WriteInt32(index);
}
@@ -1250,8 +1250,8 @@ bool FlaxStorage::LoadAssetHeader(const Entry& e, AssetInitData& data)
DateTime importDate;
String importPath, importUsername;
stream->Read(importDate);
stream->ReadString(&importPath, -76);
stream->ReadString(&importUsername, 1301);
stream->Read(importPath, -76);
stream->Read(importUsername, 1301);
#if USE_EDITOR
// Convert old metadata into the new format

View File

@@ -24,20 +24,20 @@ public:
MemoryWriteStream stream(256);
{
// Info
stream.WriteInt32(102);
stream.WriteDouble(5 * 60.0);
stream.WriteDouble(60.0);
stream.WriteBool(false);
stream.WriteString(StringView::Empty, 13);
stream.Write(102);
stream.Write(5 * 60.0);
stream.Write(60.0);
stream.Write(false);
stream.Write(StringView::Empty, 13);
// Animation channels
stream.WriteInt32(0);
stream.Write(0);
// Animation events
stream.WriteInt32(0);
stream.Write(0);
// Nested animations
stream.WriteInt32(0);
stream.Write(0);
}
// Copy to asset chunk

View File

@@ -41,9 +41,9 @@ public:
return CreateAssetResult::CannotAllocateChunk;
{
MemoryWriteStream stream(256);
stream.WriteInt32(1);
stream.WriteString(*baseTypename, 31);
stream.WriteInt32((int32)VisualScript::Flags::None);
stream.Write(1);
stream.Write(*baseTypename, 31);
stream.Write((int32)VisualScript::Flags::None);
context.Data.Header.Chunks[1]->Data.Copy(stream.GetHandle(), stream.GetPosition());
}

View File

@@ -43,17 +43,17 @@ bool ImportTexture::TryGetImportOptions(const StringView& path, Options& options
{
MemoryReadStream stream(chunk15->Data.Get(), chunk15->Data.Length());
int32 tilesVersion, tilesCount;
stream.ReadInt32(&tilesVersion);
stream.Read(tilesVersion);
if (tilesVersion == 1)
{
options.Sprites.Clear();
stream.ReadInt32(&tilesCount);
stream.Read(tilesCount);
for (int32 i = 0; i < tilesCount; i++)
{
// Load sprite
Sprite t;
stream.Read(t.Area);
stream.ReadString(&t.Name, 49);
stream.Read(t.Name, 49);
options.Sprites.Add(t);
}
}
@@ -168,13 +168,13 @@ CreateAssetResult ImportTexture::Create(CreateAssetContext& context, const Textu
if (options.IsAtlas)
{
MemoryWriteStream stream(256);
stream.WriteInt32(1); // Version
stream.WriteInt32(options.Sprites.Count()); // Amount of tiles
stream.Write(1); // Version
stream.Write(options.Sprites.Count()); // Amount of tiles
for (int32 i = 0; i < options.Sprites.Count(); i++)
{
auto& sprite = options.Sprites[i];
stream.Write(sprite.Area);
stream.WriteString(sprite.Name, 49);
stream.Write(sprite.Name, 49);
}
if (context.AllocateChunk(15))
return CreateAssetResult::CannotAllocateChunk;
@@ -307,13 +307,13 @@ CreateAssetResult ImportTexture::Create(CreateAssetContext& context, const Textu
if (options.IsAtlas)
{
MemoryWriteStream stream(256);
stream.WriteInt32(1); // Version
stream.WriteInt32(options.Sprites.Count()); // Amount of tiles
stream.Write(1); // Version
stream.Write(options.Sprites.Count()); // Amount of tiles
for (int32 i = 0; i < options.Sprites.Count(); i++)
{
auto& sprite = options.Sprites[i];
stream.Write(sprite.Area);
stream.WriteString(sprite.Name, 49);
stream.Write(sprite.Name, 49);
}
if (context.AllocateChunk(15))
return CreateAssetResult::CannotAllocateChunk;

View File

@@ -14,22 +14,21 @@
class GameplayGlobalsUpgrader : public BinaryAssetUpgrader
{
public:
GameplayGlobalsUpgrader()
{
static const Upgrader upgraders[] =
const Upgrader upgraders[] =
{
{ 1, 2, &Upgrade_1_To_2 },
{ 1, 2, &Upgrade_1_To_2 }, // [Deprecated on 31.07.2020, expires on 31.07.2022]
};
setup(upgraders, ARRAY_COUNT(upgraders));
}
private:
static bool Upgrade_1_To_2(AssetMigrationContext& context)
{
// [Deprecated on 31.07.2020, expires on 31.07.2022]
PRAGMA_DISABLE_DEPRECATION_WARNINGS
ASSERT(context.Input.SerializedVersion == 1 && context.Output.SerializedVersion == 2);
if (context.AllocateChunk(0))
return true;
auto& data = context.Input.Header.Chunks[0]->Data;
@@ -41,13 +40,14 @@ private:
String name;
for (int32 i = 0; i < count; i++)
{
stream.ReadString(&name, 71);
stream.Read(name, 71);
CommonValue commonValue;
stream.ReadCommonValue(&commonValue);
Variant variant(commonValue);
output.WriteVariant(variant);
}
context.Output.Header.Chunks[0]->Data.Copy(output.GetHandle(), output.GetPosition());
PRAGMA_ENABLE_DEPRECATION_WARNINGS
return false;
}
@@ -170,11 +170,11 @@ bool GameplayGlobals::Save(const StringView& path)
// Save to bytes
MemoryWriteStream stream(1024);
stream.WriteInt32(Variables.Count());
stream.Write(Variables.Count());
for (auto& e : Variables)
{
stream.WriteString(e.Key, 71);
stream.WriteVariant(e.Value.DefaultValue);
stream.Write(e.Key, 71);
stream.Write(e.Value.DefaultValue);
}
// Set chunk data
@@ -226,14 +226,14 @@ Asset::LoadResult GameplayGlobals::load()
// Load all variables
int32 count;
stream.ReadInt32(&count);
stream.Read(count);
Variables.EnsureCapacity(count);
String name;
for (int32 i = 0; i < count; i++)
{
stream.ReadString(&name, 71);
stream.Read(name, 71);
auto& e = Variables[name];
stream.ReadVariant(&e.DefaultValue);
stream.Read(e.DefaultValue);
e.Value = e.DefaultValue;
}
if (stream.HasError())

View File

@@ -812,7 +812,7 @@ bool MaterialParams::Load(ReadStream* stream)
stream->Read(param->_paramId);
param->_isPublic = stream->ReadBool();
param->_override = stream->ReadBool();
stream->ReadString(&param->_name, 10421);
stream->Read(param->_name, 10421);
param->_registerIndex = stream->ReadByte();
stream->ReadUint16(&param->_offset);
@@ -826,7 +826,7 @@ bool MaterialParams::Load(ReadStream* stream)
case MaterialParameterType::SceneTexture:
case MaterialParameterType::ChannelMask:
case MaterialParameterType::TextureGroupSampler:
stream->ReadInt32(&param->_asInteger);
stream->Read(param->_asInteger);
break;
case MaterialParameterType::Float:
stream->ReadFloat(&param->_asFloat);
@@ -904,7 +904,7 @@ void MaterialParams::Save(WriteStream* stream)
stream->Write(param->_paramId);
stream->WriteBool(param->_isPublic);
stream->WriteBool(param->_override);
stream->WriteString(param->_name, 10421);
stream->Write(param->_name, 10421);
stream->WriteByte(param->_registerIndex);
stream->WriteUint16(param->_offset);
@@ -980,7 +980,7 @@ void MaterialParams::Save(WriteStream* stream, const Array<SerializedMaterialPar
stream->Write(param.ID);
stream->WriteBool(param.IsPublic);
stream->WriteBool(param.Override);
stream->WriteString(param.Name, 10421);
stream->Write(param.Name, 10421);
stream->WriteByte(param.RegisterIndex);
stream->WriteUint16(param.Offset);

View File

@@ -136,7 +136,7 @@ bool IsValidShaderCache(DataContainer<byte>& shaderCache, Array<String>& include
for (int32 i = 0; i < includesCount; i++)
{
String& include = includes.AddOne();
stream.ReadString(&include, 11);
stream.Read(include, 11);
include = ShadersCompilation::ResolveShaderPath(include);
DateTime lastEditTime;
stream.Read(lastEditTime);

View File

@@ -65,7 +65,7 @@ bool GPUShader::Create(MemoryReadStream& stream)
ASSERT(Math::IsInRange(permutationsCount, 1, SHADER_PERMUTATIONS_MAX_COUNT));
// Load shader name
stream.ReadStringAnsi(&initializer.Name, 11);
stream.Read(initializer.Name, 11);
ASSERT(initializer.Name.HasChars());
// Load shader flags

View File

@@ -1639,7 +1639,7 @@ bool Actor::ToBytes(const Array<Actor*>& actors, MemoryWriteStream& output)
output.WriteInt32(FLAXENGINE_VERSION_BUILD);
// Serialized objects ids (for references mapping)
output.WriteArray(ids);
output.Write(ids);
// Objects data
rapidjson_flax::StringBuffer buffer;
@@ -1694,7 +1694,7 @@ bool Actor::FromBytes(const Span<byte>& data, Array<Actor*>& output, ISerializeM
// Serialized objects ids (for references mapping)
Array<Guid> ids;
stream.ReadArray(&ids);
stream.Read(ids);
int32 objectsCount = ids.Count();
if (objectsCount < 0)
return true;
@@ -1866,7 +1866,7 @@ Array<Guid> Actor::TryGetSerializedObjectsIds(const Span<byte>& data)
if (engineBuild <= FLAXENGINE_VERSION_BUILD && engineBuild >= 6165)
{
// Serialized objects ids (for references mapping)
stream.ReadArray(&result);
stream.Read(result);
}
}

View File

@@ -152,7 +152,7 @@ void NetworkStream::Read(Quaternion& data)
NetworkQuaternion::Read(this, data);
}
void NetworkStream::Read(Transform& data)
void NetworkStream::Read(Transform& data, bool useDouble)
{
struct NonQuantized
{
@@ -181,7 +181,7 @@ void NetworkStream::Write(const Quaternion& data)
NetworkQuaternion::Write(this, data);
}
void NetworkStream::Write(const Transform& data)
void NetworkStream::Write(const Transform& data, bool useDouble)
{
struct NonQuantized
{

View File

@@ -73,13 +73,13 @@ public:
void Read(INetworkSerializable& obj);
void Read(INetworkSerializable* obj);
void Read(Quaternion& data);
void Read(Transform& data);
void Read(Transform& data, bool useDouble = false);
using WriteStream::Write;
void Write(INetworkSerializable& obj);
void Write(INetworkSerializable* obj);
void Write(const Quaternion& data);
void Write(const Transform& data);
void Write(const Transform& data, bool useDouble = false);
public:
// [Stream]

View File

@@ -74,7 +74,7 @@ BytesContainer ParticleSystem::LoadTimeline()
stream.WriteByte((byte)track.Flag);
stream.WriteInt32(track.ParentIndex);
stream.WriteInt32(track.ChildrenCount);
stream.WriteString(track.Name, -13);
stream.Write(track.Name, -13);
stream.Write(track.Color);
Guid id;
@@ -102,7 +102,7 @@ BytesContainer ParticleSystem::LoadTimeline()
{
stream.WriteInt32(i->Key.First);
stream.Write(i->Key.Second);
stream.WriteVariant(i->Value);
stream.Write(i->Value);
}
}
}
@@ -212,7 +212,7 @@ Asset::LoadResult ParticleSystem::load()
MemoryReadStream stream(chunk0->Data.Get(), chunk0->Data.Length());
int32 version;
stream.ReadInt32(&version);
stream.Read(version);
#if USE_EDITOR
// Skip unused parameters
#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
@@ -394,7 +394,7 @@ Asset::LoadResult ParticleSystem::load()
track.Flag = (Track::Flags)stream.ReadByte();
stream.ReadInt32(&track.ParentIndex);
stream.ReadInt32(&track.ChildrenCount);
stream.ReadString(&track.Name, -13);
stream.Read(track.Name, -13);
track.Disabled = (int32)track.Flag & (int32)Track::Flags::Mute || (track.ParentIndex != -1 && Tracks[track.ParentIndex].Disabled);
stream.Read(track.Color);
@@ -422,19 +422,22 @@ Asset::LoadResult ParticleSystem::load()
Emitters[i]->WaitForLoaded();
}
// Load parameters overrides
int32 overridesCount = 0;
if (stream.CanRead())
stream.ReadInt32(&overridesCount);
if (overridesCount != 0)
if (version <= 3)
{
// [Deprecated on 03.09.2021 expires on 03.09.2023]
}
else
{
// Load parameters overrides
int32 overridesCount = 0;
stream.ReadInt32(&overridesCount);
EmitterParameterOverrideKey key;
Variant value;
for (int32 i = 0; i < overridesCount; i++)
{
stream.ReadInt32(&key.First);
stream.Read(key.Second);
stream.ReadVariant(&value);
stream.Read(value);
SKIP_UNUSED_PARAM_OVERRIDE();
EmittersParametersOverrides[key] = value;
}

View File

@@ -108,12 +108,12 @@ bool SpriteAtlas::SaveSprites()
// Write sprites data
MemoryWriteStream stream(1024);
stream.WriteInt32(1); // Version
stream.WriteInt32(Sprites.Count()); // Sprites Count
stream.Write(1); // Version
stream.Write(Sprites.Count()); // Sprites Count
for (Sprite& t : Sprites)
{
stream.Write(t.Area);
stream.WriteString(t.Name, 49);
stream.Write(t.Name, 49);
}
// Link sprites data (unlink after safe)
@@ -148,7 +148,7 @@ bool SpriteAtlas::LoadSprites(ReadStream& stream)
Sprites.Clear();
int32 tilesVersion, tilesCount;
stream.ReadInt32(&tilesVersion);
stream.Read(tilesVersion);
if (tilesVersion != 1)
{
#if USE_EDITOR
@@ -158,12 +158,12 @@ bool SpriteAtlas::LoadSprites(ReadStream& stream)
LOG(Warning, "Invalid tiles version.");
return true;
}
stream.ReadInt32(&tilesCount);
stream.Read(tilesCount);
Sprites.Resize(tilesCount);
for (Sprite& t : Sprites)
{
stream.Read(t.Area);
stream.ReadString(&t.Name, 49);
stream.Read(t.Name, 49);
}
#if USE_EDITOR

View File

@@ -167,9 +167,9 @@ public:
}
/// <summary>
/// Read data array
/// Reads array.
/// </summary>
/// <param name="data">Array to read</param>
/// <param name="data">Array to read.</param>
template<typename T, typename AllocationType = HeapAllocation>
void Read(Array<T, AllocationType>& data)
{
@@ -189,9 +189,9 @@ public:
}
/// <summary>
/// Read data dictionary
/// Reads dictionary.
/// </summary>
/// <param name="data">Dictionary to read</param>
/// <param name="data">Dictionary to read.</param>
template<typename KeyType, typename ValueType, typename AllocationType = HeapAllocation>
void Read(Dictionary<KeyType, ValueType, AllocationType>& data)
{
@@ -214,34 +214,41 @@ public:
/// <param name="obj">The object to deserialize.</param>
void ReadJson(ISerializable* obj);
// Deserialization of math types with float or double depending on the context (must match serialization)
// Set useDouble=true to explicitly use 64-bit precision for serialized data
void Read(BoundingBox& box, bool useDouble = false);
void Read(BoundingSphere& sphere, bool useDouble = false);
void Read(Transform& transform, bool useDouble = false);
void Read(Ray& ray, bool useDouble = false);
public:
// Reads StringAnsi from the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
void ReadStringAnsi(StringAnsi* data);
DEPRECATED("Use Read method") void ReadStringAnsi(StringAnsi* data);
// Reads StringAnsi from the stream with a key
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
void ReadStringAnsi(StringAnsi* data, int8 lock);
DEPRECATED("Use Read method") void ReadStringAnsi(StringAnsi* data, int8 lock);
// Reads String from the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
void ReadString(String* data);
DEPRECATED("Use Read method") void ReadString(String* data);
// Reads String from the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
void ReadString(String* data, int16 lock);
DEPRECATED("Use Read method") void ReadString(String* data, int16 lock);
// Reads CommonValue from the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
void ReadCommonValue(CommonValue* data);
DEPRECATED("Use Read method") void ReadCommonValue(CommonValue* data);
// Reads VariantType from the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
void ReadVariantType(VariantType* data);
DEPRECATED("Use Read method") void ReadVariantType(VariantType* data);
// Reads Variant from the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
void ReadVariant(Variant* data);
DEPRECATED("Use Read method") void ReadVariant(Variant* data);
/// <summary>
/// Read data array
@@ -249,18 +256,21 @@ public:
/// </summary>
/// <param name="data">Array to read</param>
template<typename T, typename AllocationType = HeapAllocation>
void ReadArray(Array<T, AllocationType>* data)
DEPRECATED("Use Read method") void ReadArray(Array<T, AllocationType>* data)
{
Read(*data);
}
public:
// Deserialization of math types with float or double depending on the context (must match serialization)
// Set useDouble=true to explicitly use 64-bit precision for serialized data
void ReadBoundingBox(BoundingBox* box, bool useDouble = false);
void ReadBoundingSphere(BoundingSphere* sphere, bool useDouble = false);
void ReadTransform(Transform* transform, bool useDouble = false);
void ReadRay(Ray* ray, bool useDouble = false);
// [Deprecated in v1.10]
DEPRECATED("Use Read method") void ReadBoundingBox(BoundingBox* box, bool useDouble = false);
// [Deprecated in v1.10]
DEPRECATED("Use Read method") void ReadBoundingSphere(BoundingSphere* sphere, bool useDouble = false);
// [Deprecated in v1.10]
DEPRECATED("Use Read method") void ReadTransform(Transform* transform, bool useDouble = false);
// [Deprecated in v1.10]
DEPRECATED("Use Read method") void ReadRay(Ray* ray, bool useDouble = false);
public:
// [Stream]

View File

@@ -167,14 +167,14 @@ void ReadStream::Read(CommonValue& data)
case CommonType::String:
{
String v;
ReadString(&v, 953);
Read(v, 953);
data.Set(v);
}
break;
case CommonType::Box:
{
BoundingBox v;
ReadBoundingBox(&v);
Read(v);
data.Set(v);
}
break;
@@ -188,14 +188,14 @@ void ReadStream::Read(CommonValue& data)
case CommonType::Transform:
{
Transform v;
ReadTransform(&v);
Read(v);
data.Set(v);
}
break;
case CommonType::Sphere:
{
BoundingSphere v;
ReadBoundingSphere(&v);
Read(v);
data.Set(v);
}
break;
@@ -208,7 +208,7 @@ void ReadStream::Read(CommonValue& data)
case CommonType::Ray:
{
Ray v;
ReadRay(&v);
Read(v);
data.Set(v);
}
break;
@@ -277,7 +277,7 @@ void ReadStream::Read(VariantType& data)
void ReadStream::Read(Variant& data)
{
VariantType type;
ReadVariantType(&type);
Read(type);
data.SetType(MoveTemp(type));
switch (data.Type.Type)
{
@@ -360,7 +360,7 @@ void ReadStream::Read(Variant& data)
{
// Json
StringAnsi json;
ReadStringAnsi(&json, -71);
Read(json, -71);
#if USE_CSHARP
MCore::Thread::Attach();
MClass* klass = MUtils::GetClass(data.Type);
@@ -430,22 +430,22 @@ void ReadStream::Read(Variant& data)
ReadBytes(&data.AsData, sizeof(Guid));
break;
case VariantType::BoundingBox:
ReadBoundingBox(&data.AsBoundingBox());
Read(data.AsBoundingBox());
break;
case VariantType::BoundingSphere:
ReadBoundingSphere(&data.AsBoundingSphere());
Read(data.AsBoundingSphere());
break;
case VariantType::Quaternion:
ReadBytes(&data.AsData, sizeof(Quaternion));
break;
case VariantType::Transform:
ReadTransform(&data.AsTransform());
Read(data.AsTransform());
break;
case VariantType::Rectangle:
ReadBytes(&data.AsData, sizeof(Rectangle));
break;
case VariantType::Ray:
ReadRay(&data.AsRay());
Read(data.AsRay());
break;
case VariantType::Matrix:
ReadBytes(data.AsBlob.Data, sizeof(Matrix));
@@ -453,25 +453,25 @@ void ReadStream::Read(Variant& data)
case VariantType::Array:
{
int32 count;
ReadInt32(&count);
Read(count);
auto& array = *(Array<Variant>*)data.AsData;
array.Resize(count);
for (int32 i = 0; i < count; i++)
ReadVariant(&array[i]);
Read(array[i]);
break;
}
case VariantType::Dictionary:
{
int32 count;
ReadInt32(&count);
Read(count);
auto& dictionary = *data.AsDictionary;
dictionary.Clear();
dictionary.EnsureCapacity(count);
for (int32 i = 0; i < count; i++)
{
Variant key;
ReadVariant(&key);
ReadVariant(&dictionary[MoveTemp(key)]);
Read(key);
Read(dictionary[MoveTemp(key)]);
}
break;
}
@@ -562,18 +562,18 @@ void ReadStream::ReadVariant(Variant* data)
Read(*data);
}
void ReadStream::ReadBoundingBox(BoundingBox* box, bool useDouble)
void ReadStream::Read(BoundingBox& box, bool useDouble)
{
#if USE_LARGE_WORLDS
if (useDouble)
Read(box);
ReadBytes(&box, sizeof(BoundingBox));
else
{
Float3 min, max;
Read(min);
Read(max);
box->Minimum = min;
box->Maximum = max;
box.Minimum = min;
box.Maximum = max;
}
#else
if (useDouble)
@@ -581,27 +581,27 @@ void ReadStream::ReadBoundingBox(BoundingBox* box, bool useDouble)
Double3 min, max;
Read(min);
Read(max);
box->Minimum = min;
box->Maximum = max;
box.Minimum = min;
box.Maximum = max;
}
else
Read(*box);
ReadBytes(&box, sizeof(BoundingBox));
#endif
}
void ReadStream::ReadBoundingSphere(BoundingSphere* sphere, bool useDouble)
void ReadStream::Read(BoundingSphere& sphere, bool useDouble)
{
#if USE_LARGE_WORLDS
if (useDouble)
Read(*sphere);
ReadBytes(&sphere, sizeof(BoundingSphere));
else
{
Float3 center;
float radius;
Read(center);
Read(radius);
sphere->Center = center;
sphere->Radius = radius;
sphere.Center = center;
sphere.Radius = radius;
}
#else
if (useDouble)
@@ -610,53 +610,53 @@ void ReadStream::ReadBoundingSphere(BoundingSphere* sphere, bool useDouble)
double radius;
Read(center);
Read(radius);
sphere->Center = center;
sphere->Radius = (float)radius;
sphere.Center = center;
sphere.Radius = (float)radius;
}
else
Read(*sphere);
ReadBytes(&sphere, sizeof(BoundingSphere));
#endif
}
void ReadStream::ReadTransform(Transform* transform, bool useDouble)
void ReadStream::Read(Transform& transform, bool useDouble)
{
#if USE_LARGE_WORLDS
if (useDouble)
Read(*transform);
ReadBytes(&transform, sizeof(Transform));
else
{
Float3 translation;
Read(translation);
Read(transform->Orientation);
Read(transform->Scale);
transform->Translation = translation;
Read(transform.Orientation);
Read(transform.Scale);
transform.Translation = translation;
}
#else
if (useDouble)
{
Double3 translation;
Read(translation);
Read(transform->Orientation);
Read(transform->Scale);
transform->Translation = translation;
Read(transform.Orientation);
Read(transform.Scale);
transform.Translation = translation;
}
else
Read(*transform);
ReadBytes(&transform, sizeof(Transform));
#endif
}
void ReadStream::ReadRay(Ray* ray, bool useDouble)
void ReadStream::Read(Ray& ray, bool useDouble)
{
#if USE_LARGE_WORLDS
if (useDouble)
Read(*ray);
ReadBytes(&ray, sizeof(Ray));
else
{
Float3 position, direction;
Read(position);
Read(direction);
ray->Position = position;
ray->Direction = direction;
ray.Position = position;
ray.Direction = direction;
}
#else
if (useDouble)
@@ -664,14 +664,34 @@ void ReadStream::ReadRay(Ray* ray, bool useDouble)
Double3 position, direction;
Read(position);
Read(direction);
ray->Position = position;
ray->Direction = direction;
ray.Position = position;
ray.Direction = direction;
}
else
Read(*ray);
ReadBytes(&ray, sizeof(Ray));
#endif
}
void ReadStream::ReadBoundingBox(BoundingBox* box, bool useDouble)
{
Read(*box);
}
void ReadStream::ReadBoundingSphere(BoundingSphere* sphere, bool useDouble)
{
Read(*sphere);
}
void ReadStream::ReadTransform(Transform* transform, bool useDouble)
{
Read(*transform);
}
void ReadStream::ReadRay(Ray* ray, bool useDouble)
{
Read(*ray);
}
void WriteStream::WriteText(const StringView& text)
{
WriteBytes(text.Get(), sizeof(Char) * text.Length());
@@ -722,13 +742,13 @@ void WriteStream::Write(const CommonValue& data)
switch (data.Type)
{
case CommonType::Bool:
WriteBool(data.AsBool);
Write(data.AsBool);
break;
case CommonType::Integer:
WriteInt32(data.AsInteger);
Write(data.AsInteger);
break;
case CommonType::Float:
WriteFloat(data.AsFloat);
Write(data.AsFloat);
break;
case CommonType::Vector2:
Write(data.AsVector2);
@@ -746,25 +766,25 @@ void WriteStream::Write(const CommonValue& data)
Write(data.AsGuid);
break;
case CommonType::String:
WriteString(data.AsString, 953);
Write(data.AsString, 953);
break;
case CommonType::Box:
WriteBoundingBox(data.AsBox);
Write(data.AsBox);
break;
case CommonType::Rotation:
Write(data.AsRotation);
break;
case CommonType::Transform:
WriteTransform(data.AsTransform);
Write(data.AsTransform);
break;
case CommonType::Sphere:
WriteBoundingSphere(data.AsSphere);
Write(data.AsSphere);
break;
case CommonType::Rectangle:
Write(data.AsRectangle);
break;
case CommonType::Ray:
WriteRay(data.AsRay);
Write(data.AsRay);
break;
case CommonType::Matrix:
Write(data.AsMatrix);
@@ -782,12 +802,12 @@ void WriteStream::Write(const VariantType& data)
{
WriteByte((byte)data.Type);
WriteInt32(MAX_int32);
WriteStringAnsi(StringAnsiView(data.TypeName), 77);
Write(StringAnsiView(data.TypeName), 77);
}
void WriteStream::Write(const Variant& data)
{
WriteVariantType(data.Type);
Write(data.Type);
Guid id;
switch (data.Type.Type)
{
@@ -826,7 +846,7 @@ void WriteStream::Write(const Variant& data)
WriteUint64((uint64)(uintptr)data.AsPointer);
break;
case VariantType::String:
WriteString((StringView)data, -14);
Write((StringView)data, -14);
break;
case VariantType::Object:
id = data.AsObject ? data.AsObject->GetID() : Guid::Empty;
@@ -837,13 +857,13 @@ void WriteStream::Write(const Variant& data)
WriteBytes(data.AsBlob.Data, data.AsBlob.Length);
break;
case VariantType::BoundingBox:
WriteBoundingBox(data.AsBoundingBox());
Write(data.AsBoundingBox());
break;
case VariantType::Transform:
WriteTransform(data.AsTransform());
Write(data.AsTransform());
break;
case VariantType::Ray:
WriteRay(data.AsRay());
Write(data.AsRay());
break;
case VariantType::Matrix:
WriteBytes(data.AsBlob.Data, sizeof(Matrix));
@@ -883,24 +903,24 @@ void WriteStream::Write(const Variant& data)
WriteBytes(data.AsData, sizeof(Rectangle));
break;
case VariantType::BoundingSphere:
WriteBoundingSphere(data.AsBoundingSphere());
Write(data.AsBoundingSphere());
break;
case VariantType::Array:
id.A = ((Array<Variant>*)data.AsData)->Count();
WriteInt32(id.A);
for (uint32 i = 0; i < id.A; i++)
WriteVariant(((Array<Variant>*)data.AsData)->At(i));
Write(((Array<Variant>*)data.AsData)->At(i));
break;
case VariantType::Dictionary:
WriteInt32(data.AsDictionary->Count());
for (auto i = data.AsDictionary->Begin(); i.IsNotEnd(); ++i)
{
WriteVariant(i->Key);
WriteVariant(i->Value);
Write(i->Key);
Write(i->Value);
}
break;
case VariantType::Typename:
WriteStringAnsi((StringAnsiView)data, -14);
Write((StringAnsiView)data, -14);
break;
case VariantType::ManagedObject:
case VariantType::Structure:
@@ -918,7 +938,7 @@ void WriteStream::Write(const Variant& data)
CompactJsonWriter writerObj(json);
MCore::Thread::Attach();
ManagedSerialization::Serialize(writerObj, obj);
WriteStringAnsi(StringAnsiView(json.GetString(), (int32)json.GetSize()), -71);
Write(StringAnsiView(json.GetString(), (int32)json.GetSize()), -71);
}
else
#endif
@@ -992,11 +1012,11 @@ void WriteStream::WriteVariant(const Variant& data)
Write(data);
}
void WriteStream::WriteBoundingBox(const BoundingBox& box, bool useDouble)
void WriteStream::Write(const BoundingBox& box, bool useDouble)
{
#if USE_LARGE_WORLDS
if (useDouble)
Write(box);
WriteBytes(&box, sizeof(BoundingBox));
else
{
Float3 min = box.Minimum, max = box.Maximum;
@@ -1011,15 +1031,15 @@ void WriteStream::WriteBoundingBox(const BoundingBox& box, bool useDouble)
Write(max);
}
else
Write(box);
WriteBytes(&box, sizeof(BoundingBox));
#endif
}
void WriteStream::WriteBoundingSphere(const BoundingSphere& sphere, bool useDouble)
void WriteStream::Write(const BoundingSphere& sphere, bool useDouble)
{
#if USE_LARGE_WORLDS
if (useDouble)
Write(sphere);
WriteBytes(&sphere, sizeof(BoundingSphere));
else
{
Float3 center = sphere.Center;
@@ -1036,15 +1056,15 @@ void WriteStream::WriteBoundingSphere(const BoundingSphere& sphere, bool useDoub
Write(radius);
}
else
Write(sphere);
WriteBytes(&sphere, sizeof(BoundingSphere));
#endif
}
void WriteStream::WriteTransform(const Transform& transform, bool useDouble)
void WriteStream::Write(const Transform& transform, bool useDouble)
{
#if USE_LARGE_WORLDS
if (useDouble)
Write(transform);
WriteBytes(&transform, sizeof(Transform));
else
{
Float3 translation = transform.Translation;
@@ -1061,15 +1081,15 @@ void WriteStream::WriteTransform(const Transform& transform, bool useDouble)
Write(transform.Scale);
}
else
Write(transform);
WriteBytes(&transform, sizeof(Transform));
#endif
}
void WriteStream::WriteRay(const Ray& ray, bool useDouble)
void WriteStream::Write(const Ray& ray, bool useDouble)
{
#if USE_LARGE_WORLDS
if (useDouble)
Write(ray);
WriteBytes(&ray, sizeof(Ray));
else
{
Float3 position = ray.Position, direction = ray.Direction;
@@ -1084,10 +1104,30 @@ void WriteStream::WriteRay(const Ray& ray, bool useDouble)
Write(direction);
}
else
Write(ray);
WriteBytes(&ray, sizeof(Ray));
#endif
}
void WriteStream::WriteBoundingBox(const BoundingBox& box, bool useDouble)
{
Write(box, useDouble);
}
void WriteStream::WriteBoundingSphere(const BoundingSphere& sphere, bool useDouble)
{
Write(sphere, useDouble);
}
void WriteStream::WriteTransform(const Transform& transform, bool useDouble)
{
Write(transform, useDouble);
}
void WriteStream::WriteRay(const Ray& ray, bool useDouble)
{
Write(ray, useDouble);
}
Array<byte> JsonSerializer::SaveToBytes(ISerializable* obj)
{
Array<byte> result;

View File

@@ -178,6 +178,23 @@ public:
Write(v.Get());
}
template<typename T>
void Write(const Span<T>& data)
{
const int32 size = data.Length();
WriteInt32(size);
if (size > 0)
{
if (TIsPODType<T>::Value && !TIsPointer<T>::Value)
WriteBytes(data.Get(), size * sizeof(T));
else
{
for (int32 i = 0; i < size; i++)
Write(data[i]);
}
}
}
template<typename T, typename AllocationType = HeapAllocation>
void Write(const Array<T, AllocationType>& data)
{
@@ -216,42 +233,49 @@ public:
void WriteJson(ISerializable* obj, const void* otherObj = nullptr);
void WriteJson(const StringAnsiView& json);
// Serialization of math types with float or double depending on the context (must match deserialization)
// Set useDouble=true to explicitly use 64-bit precision for serialized data
void Write(const BoundingBox& box, bool useDouble = false);
void Write(const BoundingSphere& sphere, bool useDouble = false);
void Write(const Transform& transform, bool useDouble = false);
void Write(const Ray& ray, bool useDouble = false);
public:
// Writes String to the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
// @param data Data to write
void WriteString(const StringView& data);
DEPRECATED("Use Write method") void WriteString(const StringView& data);
// Writes String to the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
// @param data Data to write
// @param lock Characters pass in the stream
void WriteString(const StringView& data, int16 lock);
DEPRECATED("Use Write method") void WriteString(const StringView& data, int16 lock);
// Writes Ansi String to the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
void WriteStringAnsi(const StringAnsiView& data);
DEPRECATED("Use Write method") void WriteStringAnsi(const StringAnsiView& data);
// Writes Ansi String to the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
// @param data Data to write
// @param lock Characters pass in the stream
void WriteStringAnsi(const StringAnsiView& data, int8 lock);
DEPRECATED("Use Write method") void WriteStringAnsi(const StringAnsiView& data, int8 lock);
// Writes CommonValue to the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
// @param data Data to write
void WriteCommonValue(const CommonValue& data);
DEPRECATED("Use Write method") void WriteCommonValue(const CommonValue& data);
// Writes VariantType to the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
// @param data Data to write
void WriteVariantType(const VariantType& data);
DEPRECATED("Use Write method") void WriteVariantType(const VariantType& data);
// Writes Variant to the stream
/// [Deprecated on 11.10.2022, expires on 11.10.2024]
// @param data Data to write
void WriteVariant(const Variant& data);
DEPRECATED("Use Write method") void WriteVariant(const Variant& data);
/// <summary>
/// Write data array
@@ -259,18 +283,21 @@ public:
/// </summary>
/// <param name="data">Array to write</param>
template<typename T, typename AllocationType = HeapAllocation>
FORCE_INLINE void WriteArray(const Array<T, AllocationType>& data)
DEPRECATED("Use Write method") FORCE_INLINE void WriteArray(const Array<T, AllocationType>& data)
{
Write(data);
}
public:
// Serialization of math types with float or double depending on the context (must match deserialization)
// Set useDouble=true to explicitly use 64-bit precision for serialized data
void WriteBoundingBox(const BoundingBox& box, bool useDouble = false);
void WriteBoundingSphere(const BoundingSphere& sphere, bool useDouble = false);
void WriteTransform(const Transform& transform, bool useDouble = false);
void WriteRay(const Ray& ray, bool useDouble = false);
// [Deprecated in v1.10]
DEPRECATED("Use Write method") void WriteBoundingBox(const BoundingBox& box, bool useDouble = false);
// [Deprecated in v1.10]
DEPRECATED("Use Write method") void WriteBoundingSphere(const BoundingSphere& sphere, bool useDouble = false);
// [Deprecated in v1.10]
DEPRECATED("Use Write method") void WriteTransform(const Transform& transform, bool useDouble = false);
// [Deprecated in v1.10]
DEPRECATED("Use Write method") void WriteRay(const Ray& ray, bool useDouble = false);
public:
// [Stream]

View File

@@ -67,11 +67,11 @@ bool ShaderCompiler::Compile(ShaderCompilationContext* context)
return true;
// [Output] Constant Buffers
output->WriteByte((byte)_constantBuffers.Count());
output->Write((byte)_constantBuffers.Count());
for (const ShaderResourceBuffer& cb : _constantBuffers)
{
output->WriteByte(cb.Slot);
output->WriteUint32(cb.Size);
output->Write((byte)cb.Slot);
output->Write((uint32)cb.Size);
}
// Additional Data Start
@@ -82,7 +82,7 @@ bool ShaderCompiler::Compile(ShaderCompilationContext* context)
for (auto& include : context->Includes)
{
String compactPath = ShadersCompilation::CompactShaderPath(include.Item);
output->WriteString(compactPath, 11);
output->Write(compactPath, 11);
const auto date = FileSystem::GetFileLastEditTime(include.Item);
output->Write(date);
}
@@ -261,19 +261,10 @@ bool ShaderCompiler::OnCompileEnd()
bool ShaderCompiler::WriteShaderFunctionBegin(ShaderCompilationContext* context, ShaderFunctionMeta& meta)
{
auto output = context->Output;
// [Output] Type
output->WriteByte(static_cast<byte>(meta.GetStage()));
// [Output] Permutations count
output->WriteByte(meta.Permutations.Count());
// [Output] Shader function name
output->WriteStringAnsi(meta.Name, 11);
// [Output] Shader flags
output->WriteUint32((uint32)meta.Flags);
output->Write((byte)meta.GetStage());
output->Write((byte)meta.Permutations.Count());
output->Write(meta.Name, 11);
output->Write((uint32)meta.Flags);
return false;
}
@@ -281,28 +272,19 @@ bool ShaderCompiler::WriteShaderFunctionPermutation(ShaderCompilationContext* co
{
auto output = context->Output;
// [Output] Write compiled shader cache
output->WriteUint32(cacheSize + headerSize);
output->Write((uint32)(cacheSize + headerSize));
output->WriteBytes(header, headerSize);
output->WriteBytes(cache, cacheSize);
// [Output] Shader bindings meta
output->Write(bindings);
return false;
}
bool ShaderCompiler::WriteShaderFunctionPermutation(ShaderCompilationContext* context, ShaderFunctionMeta& meta, int32 permutationIndex, const ShaderBindings& bindings, const void* cache, int32 cacheSize)
{
auto output = context->Output;
// [Output] Write compiled shader cache
output->WriteUint32(cacheSize);
output->Write((uint32)cacheSize);
output->WriteBytes(cache, cacheSize);
// [Output] Shader bindings meta
output->Write(bindings);
return false;
}

View File

@@ -402,7 +402,7 @@ void ShadersCompilation::ExtractShaderIncludes(byte* shaderCache, int32 shaderCa
for (int32 i = 0; i < includesCount; i++)
{
String& include = includes.AddOne();
stream.ReadString(&include, 11);
stream.Read(include, 11);
include = ShadersCompilation::ResolveShaderPath(include);
DateTime lastEditTime;
stream.Read(lastEditTime);

View File

@@ -101,11 +101,11 @@ public:
for (int32 i = 0; i < Parameters.Count(); i++)
{
const Parameter* param = &Parameters[i];
stream->WriteVariantType(param->Type);
stream->Write(param->Type);
stream->Write(param->Identifier);
stream->WriteString(param->Name, 97);
stream->Write(param->Name, 97);
stream->WriteBool(param->IsPublic);
stream->WriteVariant(param->Value);
stream->Write(param->Value);
if (param->Meta.Save(stream, saveMeta))
return true;
}
@@ -119,7 +119,7 @@ public:
// Values
stream->WriteInt32(node->Values.Count());
for (int32 j = 0; j < node->Values.Count(); j++)
stream->WriteVariant(node->Values[j]);
stream->Write(node->Values[j]);
// Boxes
node->GetBoxes(boxes);
@@ -128,7 +128,7 @@ public:
{
const Box* box = boxes[j];
stream->WriteByte(box->ID);
stream->WriteVariantType(box->Type);
stream->Write(box->Type);
stream->WriteUint16(box->Connections.Count());
for (int32 k = 0; k < box->Connections.Count(); k++)
{
@@ -222,7 +222,7 @@ public:
// Properties
auto type = stream->ReadByte();
stream->Read(param->Identifier);
stream->ReadString(&param->Name, 97);
stream->Read(param->Name, 97);
param->IsPublic = stream->ReadBool();
bool isStatic = stream->ReadBool();
bool isUIVisible = stream->ReadBool();
@@ -358,11 +358,11 @@ public:
for (int32 i = 0; i < parametersCount; i++)
{
auto param = &Parameters[i];
stream->ReadVariantType(&param->Type);
stream->Read(param->Type);
stream->Read(param->Identifier);
stream->ReadString(&param->Name, 97);
stream->Read(param->Name, 97);
param->IsPublic = stream->ReadBool();
stream->ReadVariant(&param->Value);
stream->Read(param->Value);
if (param->Meta.Load(stream, loadMeta))
return true;
if (onParamCreated(param))
@@ -379,7 +379,7 @@ public:
stream->ReadInt32(&valuesCnt);
node->Values.Resize(valuesCnt);
for (int32 j = 0; j < valuesCnt; j++)
stream->ReadVariant(&node->Values[j]);
stream->Read(node->Values[j]);
// Boxes
uint16 boxesCount;
@@ -392,7 +392,7 @@ public:
Box* box = &node->Boxes[boxID];
box->Parent = node;
box->ID = boxID;
stream->ReadVariantType(&box->Type);
stream->Read(box->Type);
uint16 connectionsCount;
stream->ReadUint16(&connectionsCount);
box->Connections.Resize(connectionsCount);

View File

@@ -62,6 +62,7 @@ enum class GraphConnectionType_Deprecated : uint32
#include "Engine/Core/Types/CommonValue.h"
#include "Engine/Level/Actor.h"
PRAGMA_DISABLE_DEPRECATION_WARNINGS
FLAXENGINE_API void ReadOldGraphParamValue_Deprecated(byte graphParamType, ReadStream* stream, GraphParameter* param)
{
// [Deprecated on 31.07.2020, expires on 31.07.2022]
@@ -290,6 +291,7 @@ FLAXENGINE_API StringView GetGraphFunctionTypeName_Deprecated(const Variant& v)
}
return StringView::Empty;
}
PRAGMA_ENABLE_DEPRECATION_WARNINGS
void GraphUtilities::ApplySomeMathHere(Variant& v, Variant& a, MathOp1 op)
{

View File

@@ -625,9 +625,9 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
{
box = &node->Boxes[boxId];
String fieldName;
stream.ReadString(&fieldName, 11);
stream.Read(fieldName, 11);
VariantType fieldType;
stream.ReadVariantType(&fieldType);
stream.Read(fieldType);
if (box && box->HasConnection())
{
StringAsANSI<40> fieldNameAnsi(*fieldName, fieldName.Length());
@@ -666,9 +666,9 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
{
box = &node->Boxes[boxId];
String fieldName;
stream.ReadString(&fieldName, 11);
stream.Read(fieldName, 11);
VariantType fieldType;
stream.ReadVariantType(&fieldType);
stream.Read(fieldType);
if (box && box->HasConnection())
{
const Variant fieldValue = eatBox(node, box->FirstConnection());
@@ -720,9 +720,9 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
for (int32 boxId = 1; boxId < node->Boxes.Count(); boxId++)
{
String fieldName;
stream.ReadString(&fieldName, 11);
stream.Read(fieldName, 11);
VariantType fieldType;
stream.ReadVariantType(&fieldType);
stream.Read(fieldType);
if (box->ID == boxId)
{
StringAsANSI<40> fieldNameAnsi(*fieldName, fieldName.Length());
@@ -768,9 +768,9 @@ void VisjectExecutor::ProcessGroupPacking(Box* box, Node* node, Value& value)
for (int32 boxId = 1; boxId < node->Boxes.Count(); boxId++)
{
String fieldName;
stream.ReadString(&fieldName, 11);
stream.Read(fieldName, 11);
VariantType fieldType;
stream.ReadVariantType(&fieldType);
stream.Read(fieldType);
if (box->ID == boxId)
{
type.Struct.GetField(structureValue.AsBlob.Data, fieldName, value);