void UTextureCube::Serialize(FArchive& Ar) { DECLARE_SCOPE_CYCLE_COUNTER(TEXT("UTextureCube::Serialize"), STAT_TextureCube_Serialize, STATGROUP_LoadTime); Super::Serialize(Ar); FStripDataFlags StripFlags(Ar); bool bCooked = Ar.IsCooking(); Ar << bCooked; if (bCooked || Ar.IsCooking()) { SerializeCookedPlatformData(Ar); } #if WITH_EDITOR if (Ar.IsLoading() && !Ar.IsTransacting() && !bCooked) { BeginCachePlatformData(); } #endif // #if WITH_EDITOR }
void USoundWave::Serialize( FArchive& Ar ) { Super::Serialize( Ar ); bool bCooked = Ar.IsCooking(); Ar << bCooked; if (FPlatformProperties::RequiresCookedData() && !bCooked && Ar.IsLoading()) { UE_LOG(LogAudio, Fatal, TEXT("This platform requires cooked packages, and audio data was not cooked into %s."), *GetFullName()); } if (Ar.IsCooking()) { CompressionName = Ar.CookingTarget()->GetWaveFormat(this); } if (Ar.UE4Ver() >= VER_UE4_SOUND_COMPRESSION_TYPE_ADDED) { Ar << CompressionName; } if (bCooked) { // Only want to cook/load full data if we don't support streaming if (!IsStreaming() || (Ar.IsLoading() && !FPlatformProperties::SupportsAudioStreaming()) || (Ar.IsCooking() && !Ar.CookingTarget()->SupportsFeature(ETargetPlatformFeatures::AudioStreaming))) { if (Ar.IsCooking()) { #if WITH_ENGINE TArray<FName> ActualFormatsToSave; if (!Ar.CookingTarget()->IsServerOnly()) { // for now we only support one format per wav FName Format = Ar.CookingTarget()->GetWaveFormat(this); GetCompressedData(Format); // Get the data from the DDC or build it ActualFormatsToSave.Add(Format); } CompressedFormatData.Serialize(Ar, this, &ActualFormatsToSave); #endif } else { CompressedFormatData.Serialize(Ar, this); } } } else { // only save the raw data for non-cooked packages RawData.Serialize( Ar, this ); } Ar << CompressedDataGuid; if (IsStreaming()) { if (bCooked) { // only cook/load streaming data if it's supported if ((Ar.IsLoading() && FPlatformProperties::SupportsAudioStreaming()) || (Ar.IsCooking() && Ar.CookingTarget()->SupportsFeature(ETargetPlatformFeatures::AudioStreaming))) { SerializeCookedPlatformData(Ar); } } #if WITH_EDITORONLY_DATA if (Ar.IsLoading() && !Ar.IsTransacting() && !bCooked && !(GetOutermost()->PackageFlags & PKG_ReloadingForCooker)) { BeginCachePlatformData(); } #endif // #if WITH_EDITORONLY_DATA } }
void USoundWave::Serialize( FArchive& Ar ) { DECLARE_SCOPE_CYCLE_COUNTER( TEXT("USoundWave::Serialize"), STAT_SoundWave_Serialize, STATGROUP_LoadTime ); Super::Serialize( Ar ); bool bCooked = Ar.IsCooking(); Ar << bCooked; if (FPlatformProperties::RequiresCookedData() && !bCooked && Ar.IsLoading()) { UE_LOG(LogAudio, Fatal, TEXT("This platform requires cooked packages, and audio data was not cooked into %s."), *GetFullName()); } Ar.UsingCustomVersion(FFrameworkObjectVersion::GUID); if (Ar.IsLoading() && (Ar.UE4Ver() >= VER_UE4_SOUND_COMPRESSION_TYPE_ADDED) && (Ar.CustomVer(FFrameworkObjectVersion::GUID) < FFrameworkObjectVersion::RemoveSoundWaveCompressionName)) { FName DummyCompressionName; Ar << DummyCompressionName; } bool bSupportsStreaming = false; if (Ar.IsLoading() && FPlatformProperties::SupportsAudioStreaming()) { bSupportsStreaming = true; } else if (Ar.IsCooking() && Ar.CookingTarget()->SupportsFeature(ETargetPlatformFeatures::AudioStreaming)) { bSupportsStreaming = true; } if (bCooked) { // Only want to cook/load full data if we don't support streaming if (!IsStreaming() || !bSupportsStreaming) { if (Ar.IsCooking()) { #if WITH_ENGINE TArray<FName> ActualFormatsToSave; if (!Ar.CookingTarget()->IsServerOnly()) { // for now we only support one format per wav FName Format = Ar.CookingTarget()->GetWaveFormat(this); GetCompressedData(Format); // Get the data from the DDC or build it ActualFormatsToSave.Add(Format); } CompressedFormatData.Serialize(Ar, this, &ActualFormatsToSave); #endif } else { CompressedFormatData.Serialize(Ar, this); } } } else { // only save the raw data for non-cooked packages RawData.Serialize( Ar, this ); } Ar << CompressedDataGuid; if (IsStreaming()) { if (bCooked) { // only cook/load streaming data if it's supported if (bSupportsStreaming) { SerializeCookedPlatformData(Ar); } } #if WITH_EDITORONLY_DATA if (Ar.IsLoading() && !Ar.IsTransacting() && !bCooked && !GetOutermost()->HasAnyPackageFlags(PKG_ReloadingForCooker)) { BeginCachePlatformData(); } #endif // #if WITH_EDITORONLY_DATA } }