当前位置: 首页>>代码示例>>C++>>正文


C++ FArchive类代码示例

本文整理汇总了C++中FArchive的典型用法代码示例。如果您正苦于以下问题:C++ FArchive类的具体用法?C++ FArchive怎么用?C++ FArchive使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FArchive类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PossiblySerializeObjectGuid

void FLazyObjectPtr::PossiblySerializeObjectGuid(UObject *Object, FArchive& Ar)
{
	if (Ar.IsSaving() || Ar.IsCountingMemory())
	{
		FUniqueObjectGuid Guid = GuidAnnotation.GetAnnotation(Object);
		bool HasGuid = Guid.IsValid();
		Ar << HasGuid;
		if (HasGuid)
		{
			if (Ar.GetPortFlags() & PPF_DuplicateForPIE)
			{
				check(GPlayInEditorID != -1);
				FGuid &FoundGuid = PIEGuidMap[GPlayInEditorID % MAX_PIE_INSTANCES].FindOrAdd(Guid.GetGuid());
				if (!FoundGuid.IsValid())
				{
					Guid = FoundGuid = FGuid::NewGuid();
				}
				else
				{
					Guid = FoundGuid;
				}
			}

			Ar << Guid;
		}
	}
	else if (Ar.IsLoading())
	{
		bool HasGuid = false;
		Ar << HasGuid;
		if (HasGuid)
		{
			FUniqueObjectGuid Guid;
			Ar << Guid;

			// Don't try and resolve GUIDs when loading a package for diff'ing
			const UPackage* Package = Object->GetOutermost();
			bool bLoadedForDiff = (Package && (Package->PackageFlags & PKG_ForDiffing));
			if (!bLoadedForDiff && (!(Ar.GetPortFlags() & PPF_Duplicate) || (Ar.GetPortFlags() & PPF_DuplicateForPIE)))
			{
				check(!Guid.IsDefault());
				UObject* OtherObject = Guid.ResolveObject();
				if (OtherObject != Object) // on undo/redo, the object (potentially) already exists
				{
					if (OtherObject != NULL)
					{
						UE_CLOG(!((FApp::IsGame() || GIsPlayInEditorWorld) && Package && Package->ContainsMap()), LogUObjectGlobals, Warning, TEXT("Guid is in use by %s and %s, which should never happen in the editor but could happen at runtime with duplicate level loading or PIE"), *OtherObject->GetFullName(), !!Object ? *Object->GetFullName() : TEXT("NULL"));
						// This guid is in use, which should never happen in the editor but could happen at runtime with duplicate level loading or PIE. If so give it a new GUID to avoid crashing
						Guid = FGuid::NewGuid();
					}
					GuidAnnotation.AddAnnotation(Object, Guid);
					FUniqueObjectGuid::InvalidateTag();
				}
			}
		}
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:57,代码来源:LazyObjectPtr.cpp

示例2: Serialize

void FStreamedAudioChunk::Serialize(FArchive& Ar, UObject* Owner, int32 ChunkIndex)
{
	bool bCooked = Ar.IsCooking();
	Ar << bCooked;

	BulkData.Serialize(Ar, Owner, ChunkIndex);
	Ar << DataSize;

#if WITH_EDITORONLY_DATA
	if (!bCooked)
	{
		Ar << DerivedDataKey;
	}
#endif // #if WITH_EDITORONLY_DATA
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:15,代码来源:SoundWave.cpp

示例3: PostSerialize

void FGraphReference::PostSerialize(const FArchive& Ar)
{
#if WITH_EDITORONLY_DATA
	if (Ar.UE4Ver() >= VER_UE4_K2NODE_REFERENCEGUIDS)
	{
		// Because the macro instance could have been saved with a GUID that was allocated 
		// but the macro graph never actually saved with that value we are forced to make 
		// sure to refresh the GUID and make sure it is up to date
		if (MacroGraph)
		{
			GraphGuid = MacroGraph->GraphGuid;
		}
	}
#endif
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:15,代码来源:EdGraph.cpp

示例4: Serialize

void FUniformExpressionSet::Serialize(FArchive& Ar)
{
	Ar << UniformVectorExpressions;
	Ar << UniformScalarExpressions;
	Ar << Uniform2DTextureExpressions;
	Ar << UniformCubeTextureExpressions;

	Ar << ParameterCollections;

	// Recreate the uniform buffer struct after loading.
	if(Ar.IsLoading())
	{
		CreateBufferStruct();
	}
}
开发者ID:1vanK,项目名称:AHRUnrealEngine,代码行数:15,代码来源:MaterialUniformExpressions.cpp

示例5: Serialize

void FTextHistory_AsDateTime::Serialize(FArchive& Ar)
{
	if(Ar.IsSaving())
	{
		int8 HistoryType = (int8)ETextHistoryType::AsDateTime;
		Ar << HistoryType;
	}

	Ar << SourceDateTime;

	int8 DateStyleInt8 = (int8)DateStyle;
	Ar << DateStyleInt8;
	DateStyle = (EDateTimeStyle::Type)DateStyleInt8;

	int8 TimeStyleInt8 = (int8)TimeStyle;
	Ar << TimeStyleInt8;
	TimeStyle = (EDateTimeStyle::Type)TimeStyleInt8;

	Ar << TimeZone;

	if(Ar.IsSaving())
	{
		FString CultureName = TargetCulture.IsValid()? TargetCulture->GetName() : FString();
		Ar << CultureName;
	}
	else if(Ar.IsLoading())
	{
		FString CultureName;
		Ar << CultureName;

		if(!CultureName.IsEmpty())
		{
			TargetCulture = FInternationalization::Get().GetCulture(CultureName);
		}
	}
}
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:36,代码来源:TextHistory.cpp

示例6: SerializeLineageMoves

void UMeshAnimation::SerializeLineageMoves(FArchive &Ar)
{
	guard(UMeshAnimation::SerializeLineageMoves);
	if (Ar.ArVer < 123 || Ar.ArLicenseeVer < 0x19)
	{
		// standard UE2 format
		Ar << Moves;
		return;
	}
	assert(Ar.IsLoading);
	int pos, count;						// pos = global skip pos, count = data count
	Ar << pos << AR_INDEX(count);
	Moves.Empty(count);
	for (int i = 0; i < count; i++)
	{
		int localPos;
		Ar << localPos;
		MotionChunk *M = new(Moves) MotionChunk;
		Ar << *M;
		assert(Ar.Tell() == localPos);
	}
	assert(Ar.Tell() == pos);
	unguard;
}
开发者ID:amyvmiwei,项目名称:UModel,代码行数:24,代码来源:UnAnim2.cpp

示例7: Serialize

void FRawCurveTracks::Serialize(FArchive& Ar)
{
	// @TODO: If we're about to serialize vector curve, add here
	if(Ar.UE4Ver() >= VER_UE4_SKELETON_ADD_SMARTNAMES)
	{
		for(FFloatCurve& Curve : FloatCurves)
		{
			Curve.Serialize(Ar);
		}
	}
#if WITH_EDITORONLY_DATA
	if( !Ar.IsCooking() )
	{
		if( Ar.UE4Ver() >= VER_UE4_ANIMATION_ADD_TRACKCURVES )
		{
			for( FTransformCurve& Curve : TransformCurves )
			{
				Curve.Serialize( Ar );
			}

		}
	}
#endif // WITH_EDITORONLY_DATA
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:24,代码来源:AnimSequenceBase.cpp

示例8: Serialize

bool FBuildPatchAppManifest::Serialize(FArchive& Ar)
{
	if (Ar.IsLoading())
	{
		DestroyData();
	}

	Data->Serialize(Ar);

	if (Ar.IsLoading())
	{
		// If we didn't load the version number, we know it was skipped when saving therefore must be
		// the first UObject version
		if (Data->ManifestFileVersion == static_cast<uint8>(EBuildPatchAppManifestVersion::Invalid))
		{
			Data->ManifestFileVersion = EBuildPatchAppManifestVersion::StoredAsCompressedUClass;
		}

		// Setup internal lookups
		InitLookups();
	}

	return !Ar.IsError();
}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:24,代码来源:BuildPatchManifest.cpp

示例9: FILE_IO_STATS_GET_HANDLE

FArchive* FFileManagerWindows::InternalCreateFileWriter( const TCHAR* Filename, DWORD Flags, FOutputDevice* Error )
{
	INT StatsHandle = FILE_IO_STATS_GET_HANDLE( Filename );
	SCOPED_FILE_IO_WRITE_OPEN_STATS( StatsHandle );

	MakeDirectory(*FFilename(Filename).GetPath(), TRUE);

	if( (GFileManager->FileSize (Filename) >= 0) && (Flags & FILEWRITE_EvenIfReadOnly) )
	{
		SetFileAttributesW(Filename, 0);
	}
	DWORD  Access    = GENERIC_WRITE;
	DWORD  WinFlags  = (Flags & FILEWRITE_AllowRead) ? FILE_SHARE_READ : 0;
	DWORD  Create    = (Flags & FILEWRITE_Append) ? OPEN_ALWAYS : (Flags & FILEWRITE_NoReplaceExisting) ? CREATE_NEW : CREATE_ALWAYS;
	HANDLE Handle    = CreateFileW( Filename, Access, WinFlags, NULL, Create, FILE_ATTRIBUTE_NORMAL, NULL );
	INT    Pos       = 0;
	if( Handle==INVALID_HANDLE_VALUE )
	{
		if( Flags & FILEWRITE_NoFail )
		{
			const DWORD LastError = GetLastError();
			appErrorf( TEXT("Failed to create file: %s, GetLastError %u"), Filename, LastError );
		}
		return NULL;
	}
	if( Flags & FILEWRITE_Append )
	{
		Pos = SetFilePointer( Handle, 0, NULL, FILE_END );
	}
	FArchive* retArch = new FArchiveFileWriterWindows(Handle,StatsHandle,Filename,Error,Pos);
	if( retArch && (Flags & FILEWRITE_SaveGame) )
	{
		retArch->SetIsSaveGame( TRUE );
	}
	return retArch;
}
开发者ID:LiuKeHua,项目名称:colorful-engine,代码行数:36,代码来源:FFileManagerWindows.cpp

示例10: SerializeChain

void DBaseDecal::SerializeChain (FArchive &arc, DBaseDecal **first)
{
	DWORD numInChain;
	DBaseDecal *fresh;
	DBaseDecal **firstptr = first;

	if (arc.IsLoading ())
	{
		numInChain = arc.ReadCount ();
		
		while (numInChain--)
		{
			arc << fresh;
			*firstptr = fresh;
			fresh->WallPrev = firstptr;
			firstptr = &fresh->WallNext;
		}
	}
	else
	{
		numInChain = 0;
		fresh = *firstptr;
		while (fresh != NULL)
		{
			fresh = fresh->WallNext;
			++numInChain;
		}
		arc.WriteCount (numInChain);
		fresh = *firstptr;
		while (numInChain--)
		{
			arc << fresh;
			fresh = fresh->WallNext;
		}
	}
}
开发者ID:WChrisK,项目名称:Zandronum,代码行数:36,代码来源:a_decals.cpp

示例11: MakeShareable

FLocMetadataValueArray::FLocMetadataValueArray( FArchive& Archive )
{
	check(Archive.IsLoading());

	int32 ElementCount;
	Archive << ElementCount;

	Value.SetNum(ElementCount);

	for (TSharedPtr<FLocMetadataValue>& Element : Value)
	{
		FLocMetadataValue* ElementRawPointer = Element.Get();
		SerializeLocMetadataValue(Archive, ElementRawPointer);
		Element = MakeShareable(ElementRawPointer);
	}
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:16,代码来源:InternationalizationMetadata.cpp

示例12: Serialize

//==========================================================================
//
//
//
//==========================================================================
void ADynamicLight::Serialize(FArchive &arc)
{
	Super::Serialize (arc);
	arc << lightflags << lighttype;
	arc << m_tickCount << m_currentRadius;
	arc << m_Radius[0] << m_Radius[1];

	if (lighttype == PulseLight) arc << m_lastUpdate << m_cycler;
	if (arc.IsLoading())
	{
		// The default constructor which is used for creating objects before deserialization will not set this variable.
		// It needs to be true for all placed lights.
		visibletoplayer = true;
		LinkLight();
	}
}
开发者ID:Accusedbold,项目名称:zdoom,代码行数:21,代码来源:a_dynlight.cpp

示例13: checkf

/**
 * Loads the data from disk into the specified memory block. This requires us still being attached to an
 * archive we can use for serialization.
 *
 * @param Dest Memory to serialize data into
 */
void FUntypedBulkData::LoadDataIntoMemory( void* Dest )
{
#if WITH_EDITOR
	checkf( AttachedAr, TEXT( "Attempted to load bulk data without an attached archive. Most likely the bulk data was loaded twice on console, which is not supported" ) );

	// Keep track of current position in file so we can restore it later.
	int64 PushedPos = AttachedAr->Tell();
	// Seek to the beginning of the bulk data in the file.
	AttachedAr->Seek( BulkDataOffsetInFile );
		
	SerializeBulkData( *AttachedAr, Dest );

	// Restore file pointer.
	AttachedAr->Seek( PushedPos );
#else
	bool bWasLoadedSuccessfully = false;
	if (IsInGameThread() && Linker.IsValid())
	{
		ULinkerLoad* LinkerLoad = Linker.Get();
		if ( LinkerLoad && LinkerLoad->Loader && !LinkerLoad->IsCompressed() )
		{
			FArchive* Ar = LinkerLoad;
			// keep track of current position in this archive
			int64 CurPos = Ar->Tell();

			// Seek to the beginning of the bulk data in the file.
			Ar->Seek( BulkDataOffsetInFile );

			// serialize the bulk data
			SerializeBulkData( *Ar, Dest );

			// seek back to the position the archive was before
			Ar->Seek(CurPos);

			// note that we loaded it
			bWasLoadedSuccessfully = true;
		}
	}
	// if we weren't able to load via linker, load directly by filename
	if (!bWasLoadedSuccessfully)
	{
		// load from the specied filename when the linker has been cleared
		checkf( Filename != TEXT(""), TEXT( "Attempted to load bulk data without a proper filename." ) );
	
		FArchive* Ar = IFileManager::Get().CreateFileReader(*Filename, FILEREAD_Silent);
		checkf( Ar != NULL, TEXT( "Attempted to load bulk data from an invalid filename '%s'." ), *Filename );
	
		// Seek to the beginning of the bulk data in the file.
		Ar->Seek( BulkDataOffsetInFile );
		SerializeBulkData( *Ar, Dest );
		delete Ar;
	}
#endif // WITH_EDITOR
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:60,代码来源:BulkData.cpp

示例14:

void FGameplayDebuggerCategory_AI::FRepDataPath::Serialize(FArchive& Ar)
{
	int32 NumCorridor = PathCorridor.Num();
	Ar << NumCorridor;
	if (Ar.IsLoading())
	{
		PathCorridor.SetNum(NumCorridor);
	}

	for (int32 Idx = 0; Idx < NumCorridor; Idx++)
	{
		Ar << PathCorridor[Idx].Points;
		Ar << PathCorridor[Idx].Color;
	}

	Ar << PathPoints;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:17,代码来源:GameplayDebuggerCategory_AI.cpp

示例15: Serialize

void FStreamedAudioChunk::Serialize(FArchive& Ar, UObject* Owner, int32 ChunkIndex)
{
	DECLARE_SCOPE_CYCLE_COUNTER( TEXT("FStreamedAudioChunk::Serialize"), STAT_StreamedAudioChunk_Serialize, STATGROUP_LoadTime );

	bool bCooked = Ar.IsCooking();
	Ar << bCooked;

	BulkData.Serialize(Ar, Owner, ChunkIndex);
	Ar << DataSize;

#if WITH_EDITORONLY_DATA
	if (!bCooked)
	{
		Ar << DerivedDataKey;
	}
#endif // #if WITH_EDITORONLY_DATA
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:17,代码来源:SoundWave.cpp


注:本文中的FArchive类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。