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


C++ TArray::BulkSerialize方法代码示例

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


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

示例1: Serialize

void UModel::Serialize( FArchive& Ar )
{
	Super::Serialize( Ar );

	const int32 StripVertexBufferFlag = 1;
	FStripDataFlags StripFlags( Ar, GetOuter() && GetOuter()->IsA(ABrush::StaticClass()) ? StripVertexBufferFlag : FStripDataFlags::None );

	Ar << Bounds;

	if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_BSP_UNDO_FIX )
	{
		TTransArray<FVector> OldVectors(this);
		TTransArray<FVector> OldPoints(this);
		TTransArray<FBspNode> OldNodes(this);
		OldVectors.BulkSerialize(Ar);
		OldPoints.BulkSerialize(Ar);
		OldNodes.BulkSerialize(Ar);

		Vectors = OldVectors;
		Points = OldPoints;
		Nodes = OldNodes;
	}
	else
	{
		Vectors.BulkSerialize(Ar);
		Points.BulkSerialize(Ar);
		Nodes.BulkSerialize(Ar);
	}
	if( Ar.IsLoading() )
	{
		for( int32 NodeIndex=0; NodeIndex<Nodes.Num(); NodeIndex++ )
		{
			Nodes[NodeIndex].NodeFlags &= ~(NF_IsNew|NF_IsFront|NF_IsBack);
		}
	}
	
	if (Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_BSP_UNDO_FIX )
	{
		TTransArray<FBspSurf> OldSurfs(this);
		TTransArray<FVert> OldVerts(this);

		Ar << OldSurfs;
		OldVerts.BulkSerialize(Ar);

		Surfs = OldSurfs;
		Verts = OldVerts;
	}
	else
	{
		Ar << Surfs;
		Verts.BulkSerialize(Ar);
	}

	if( Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_REMOVE_ZONES_FROM_MODEL)
	{
		int32 NumZones;
		Ar << NumSharedSides << NumZones;

		FZoneProperties DummyZones[FBspNode::MAX_ZONES];
		for( int32 i=0; i<NumZones; i++ )
		{
			Ar << DummyZones[i];
		}
	}
	else
	{
		Ar << NumSharedSides;
	}

#if WITH_EDITOR
	bool bHasEditorOnlyData = !Ar.IsFilterEditorOnly();
	
	if ( Ar.UE4Ver() < VER_UE4_REMOVE_UNUSED_UPOLYS_FROM_UMODEL )
	{
		bHasEditorOnlyData = true;
	}

	// if we are cooking then don't save this stuff out
	if ( bHasEditorOnlyData )
	{
		Ar << Polys;
		LeafHulls.BulkSerialize( Ar );
		Leaves.BulkSerialize( Ar );
	}
#else
	bool bHasEditorOnlyData = !Ar.IsFilterEditorOnly();
	
	if ( Ar.UE4Ver() < VER_UE4_REMOVE_UNUSED_UPOLYS_FROM_UMODEL )
	{
		bHasEditorOnlyData = true;
	}

	if((Ar.IsLoading() || Ar.IsSaving()) && bHasEditorOnlyData)
	{
		UPolys* DummyPolys = NULL;
		Ar << DummyPolys;

		TArray<int32> DummyLeafHulls;
		DummyLeafHulls.BulkSerialize( Ar );

//.........这里部分代码省略.........
开发者ID:amyvmiwei,项目名称:UnrealEngine4,代码行数:101,代码来源:Model.cpp

示例2: Serialize

void UModel::Serialize( FArchive& Ar )
{
	Super::Serialize( Ar );

	const int32 StripVertexBufferFlag = 1;
	FStripDataFlags StripFlags( Ar, GetOuter() && GetOuter()->IsA(ABrush::StaticClass()) ? StripVertexBufferFlag : FStripDataFlags::None );

	Ar << Bounds;

	Vectors.BulkSerialize( Ar );
	Points.BulkSerialize( Ar );
	Nodes.BulkSerialize( Ar );
	if( Ar.IsLoading() )
	{
		for( int32 NodeIndex=0; NodeIndex<Nodes.Num(); NodeIndex++ )
		{
			Nodes[NodeIndex].NodeFlags &= ~(NF_IsNew|NF_IsFront|NF_IsBack);
		}
	}
	Ar << Surfs;
	Verts.BulkSerialize( Ar );

	if( Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_REMOVE_ZONES_FROM_MODEL)
	{
		int32 NumZones;
		Ar << NumSharedSides << NumZones;

		FZoneProperties DummyZones[FBspNode::MAX_ZONES];
		for( int32 i=0; i<NumZones; i++ )
		{
			Ar << DummyZones[i];
		}
	}
	else
	{
		Ar << NumSharedSides;
	}

#if WITH_EDITOR
	Ar << Polys;
	LeafHulls.BulkSerialize( Ar );
	Leaves.BulkSerialize( Ar );
#else
	if(Ar.IsLoading())
	{
		UPolys* DummyPolys;
		Ar << DummyPolys;

		TArray<int32> DummyLeafHulls;
		DummyLeafHulls.BulkSerialize( Ar );

		TArray<FLeaf> DummyLeaves;
		DummyLeaves.BulkSerialize( Ar );
	}
#endif

	Ar << RootOutside << Linked;

	if(Ar.IsLoading() && Ar.UE4Ver() < VER_UE4_REMOVE_ZONES_FROM_MODEL)
	{
		TArray<int32> DummyPortalNodes;
		DummyPortalNodes.BulkSerialize( Ar );
	}

	Ar << NumUniqueVertices; 
	// load/save vertex buffer
	if( StripFlags.IsEditorDataStripped() == false || StripFlags.IsClassDataStripped( StripVertexBufferFlag ) == false )
	{
		Ar << VertexBuffer;
	}

#if WITH_EDITOR
	if(GIsEditor)
	{
		CalculateUniqueVertCount();
	}
#endif // WITH_EDITOR

	// serialize the lighting guid if it's there
	Ar << LightingGuid;

	Ar << LightmassSettings;
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:83,代码来源:Model.cpp

示例3: if

FArchive& operator<<(FArchive& Ar, package_t*& P)
{
	Ar << P->SubstanceUids << P->Guid;
	Ar << P->SourceFilePath << P->SourceFileTimestamp;

	TArray<uint8> arArchive;
	if (Ar.IsLoading())
	{
		arArchive.BulkSerialize(Ar);
		P->LinkData.reset(new Substance::Details::LinkDataAssembly(&arArchive[0], arArchive.Num()));
	}
	else if(Ar.IsSaving())
	{
		Substance::Details::LinkDataAssembly *linkdata = 
			static_cast<Substance::Details::LinkDataAssembly*>(
				P->getLinkData().get());

		arArchive.AddZeroed(linkdata->getAssembly().size());

		FMemory::Memcpy(
			&arArchive[0],
			(void*)&linkdata->getAssembly()[0],
			linkdata->getAssembly().size());

		arArchive.BulkSerialize(Ar);
	}

	int32 GraphCount = 0;

	if (Ar.IsSaving())
	{
		GraphCount =  P->Graphs.Num();
	}
	
	Ar << GraphCount;

	if (Ar.IsLoading())
	{
		P->Graphs.AddZeroed(GraphCount);
	}

	for (int32 Idx=0 ; Idx<GraphCount ; ++Idx)
	{
		Ar << P->Graphs[Idx];

		if (Ar.IsLoading())
		{
			P->Graphs[Idx]->Parent = P;

			Substance::List<output_desc_t>::TIterator itO(P->Graphs[Idx]->OutputDescs.itfront());
			for (; itO ; ++itO)
			{
				Substance::Details::LinkDataAssembly *linkdata = 
					(Substance::Details::LinkDataAssembly *)P->getLinkData().get();

				if (linkdata)
				{
					linkdata->setOutputFormat(
						(*itO).Uid,
						(*itO).Format);
				}
			}
		}
	}

	return Ar;
}
开发者ID:Glowder,项目名称:UE4_Project,代码行数:67,代码来源:SubstanceStructuresSerialization.cpp


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