本文整理汇总了C++中FArchive::IsTransacting方法的典型用法代码示例。如果您正苦于以下问题:C++ FArchive::IsTransacting方法的具体用法?C++ FArchive::IsTransacting怎么用?C++ FArchive::IsTransacting使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FArchive
的用法示例。
在下文中一共展示了FArchive::IsTransacting方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
void UPhysicsConstraintTemplate::Serialize(FArchive& Ar)
{
#if WITH_EDITOR
FConstraintProfileProperties CurrentProfile = DefaultInstance.ProfileInstance; //Save off current profile in case they save in editor and we don't want to lose their work
if(Ar.IsSaving() && !Ar.IsTransacting())
{
DefaultInstance.ProfileInstance = DefaultProfile;
}
#endif
Super::Serialize(Ar);
// If old content, copy properties out of setup into instance
if(Ar.UE4Ver() < VER_UE4_ALL_PROPS_TO_CONSTRAINTINSTANCE)
{
CopySetupPropsToInstance(&DefaultInstance);
}
if(!Ar.IsTransacting())
{
//Make sure to keep default profile and instance in sync
if (Ar.IsLoading())
{
DefaultProfile = DefaultInstance.ProfileInstance;
}
#if WITH_EDITOR
else if(Ar.IsSaving())
{
DefaultInstance.ProfileInstance = CurrentProfile; //recover their settings before we saved
}
#endif
}
}
示例2: GetVarNameString
void UK2Node_VariableGet::Serialize(FArchive& Ar)
{
// The following code is to attempt to log info related to UE-19729
if (Ar.IsSaving() && !Ar.IsTransacting())
{
if (UEdGraph* Graph = Cast<UEdGraph>(GetOuter()))
{
if (UBlueprint* Blueprint = FBlueprintEditorUtils::FindBlueprintForGraph(Graph))
{
if (!Blueprint->bBeingCompiled)
{
FString VariableName = GetVarNameString();
FString BlueprintPath = Blueprint->GetPathName();
FString SetupStyle = bIsPureGet? TEXT("pure") : TEXT("validated");
UE_LOG(LogBlueprintUserMessages, Log, TEXT("Serialization for Get node for variable '%s' in Blueprint '%s' which is setup as %s"), *VariableName, *BlueprintPath, *SetupStyle);
// The following line may spur the crash noted in UE-19729 and will confirm that the crash happens before the FiB gather.
GetNodeTitle(ENodeTitleType::ListView);
}
}
}
}
Super::Serialize(Ar);
}
示例3: Serialize
void UPolys::Serialize( FArchive& Ar )
{
Super::Serialize( Ar );
if( Ar.IsTransacting() )
{
Ar << Element;
}
else
{
Element.CountBytes( Ar );
int32 DbNum=Element.Num(), DbMax=DbNum;
Ar << DbNum << DbMax;
UObject* ElementOwner = Element.GetOwner();
Ar << ElementOwner;
Element.SetOwner(ElementOwner);
if( Ar.IsLoading() )
{
Element.Empty( DbNum );
Element.AddZeroed( DbNum );
}
for( int32 i=0; i<Element.Num(); i++ )
{
Ar << Element[i];
}
}
}
示例4: Serialize
bool FKeyHandleMap::Serialize(FArchive& Ar)
{
if( Ar.IsTransacting() )
{
// Only allow this map to be saved to the transaction buffer
Ar << KeyHandlesToIndices;
}
return true;
}
示例5: Serialize
/**
* Serializer
* Save the value of bDirty into the transaction buffer, so that undo/redo will also mark/unmark the package as dirty, accordingly
*/
void UPackage::Serialize( FArchive& Ar )
{
Super::Serialize(Ar);
if ( Ar.IsTransacting() )
{
Ar << bDirty;
}
}
示例6: SerializeItem
void UInterfaceProperty::SerializeItem( FArchive& Ar, void* Value, void const* Defaults ) const
{
FScriptInterface* InterfaceValue = (FScriptInterface*)Value;
Ar << InterfaceValue->GetObjectRef();
if ( Ar.IsLoading() || Ar.IsTransacting() )
{
if ( InterfaceValue->GetObject() != NULL )
{
InterfaceValue->SetInterface(InterfaceValue->GetObject()->GetInterfaceAddress(InterfaceClass));
}
else
{
InterfaceValue->SetInterface(NULL);
}
}
}
示例7: Serialize
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
}
示例8: Serialize
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
}
}
示例9: Serialize
/**
* Serialize function used to serialize this bulk data structure.
*
* @param Ar Archive to serialize with
* @param Owner Object owning the bulk data
* @param Idx Index of bulk data item being serialized
*/
void FUntypedBulkData::Serialize( FArchive& Ar, UObject* Owner, int32 Idx )
{
check( LockStatus == LOCKSTATUS_Unlocked );
if(Ar.IsTransacting())
{
// Special case for transacting bulk data arrays.
// constructing the object during load will save it to the transaction buffer. If it tries to load the bulk data now it will try to break it.
bool bActuallySave = Ar.IsSaving() && (!Owner || !Owner->HasAnyFlags(RF_NeedLoad));
Ar << bActuallySave;
if (bActuallySave)
{
if(Ar.IsLoading())
{
// Flags for bulk data.
Ar << BulkDataFlags;
// Number of elements in array.
Ar << ElementCount;
// Allocate bulk data.
check(bShouldFreeOnEmpty);
BulkData = FMemory::Realloc( BulkData, GetBulkDataSize() );
// Deserialize bulk data.
SerializeBulkData( Ar, BulkData );
}
else if(Ar.IsSaving())
{
// Flags for bulk data.
Ar << BulkDataFlags;
// Number of elements in array.
Ar << ElementCount;
// Don't attempt to load or serialize BulkData if the current size is 0.
// This could be a newly constructed BulkData that has not yet been loaded,
// and allocating 0 bytes now will cause a crash when we load.
if (GetBulkDataSize() > 0)
{
// Make sure bulk data is loaded.
MakeSureBulkDataIsLoaded();
// Serialize bulk data.
SerializeBulkData(Ar, BulkData);
}
}
}
}
else if( Ar.IsPersistent() && !Ar.IsObjectReferenceCollector() && !Ar.ShouldSkipBulkData() )
{
#if TRACK_BULKDATA_USE
FThreadSafeBulkDataToObjectMap::Get().Add( this, Owner );
#endif
// Offset where the bulkdata flags are stored
int64 SavedBulkDataFlagsPos = Ar.Tell();
Ar << BulkDataFlags;
// Number of elements in array.
Ar << ElementCount;
// We're loading from the persistent archive.
if( Ar.IsLoading() )
{
Filename = TEXT("");
// @todo when Landscape (and others?) only Lock/Unlock once, we can enable this
if (false) // FPlatformProperties::RequiresCookedData())
{
// Bulk data that is being serialized via seekfree loading is single use only. This allows us
// to free the memory as e.g. the bulk data won't be attached to an archive in the case of
// seek free loading.
BulkDataFlags |= BULKDATA_SingleUse;
}
// Size on disk, which in the case of compression is != GetBulkDataSize()
Ar << BulkDataSizeOnDisk;
Ar << BulkDataOffsetInFile;
// fix up the file offset
if (Owner != NULL && Owner->GetLinker())
{
BulkDataOffsetInFile += Owner->GetLinker()->Summary.BulkDataStartOffset;
}
// determine whether the payload is stored inline or at the end of the file
bool bPayloadInline = !(BulkDataFlags&BULKDATA_PayloadAtEndOfFile);
// check( (bPayloadInline && BulkDataOffsetInFile == Ar.Tell()) ||
// (!bPayloadInline && BulkDataOffsetInFile > Ar.Tell()));
//.........这里部分代码省略.........
示例10: Serialize
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
}
}