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


C++ FArchive::IsSaving方法代码示例

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


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

示例1: Serialize

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

	Ar << SourceDateTime;

	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,代码行数:32,代码来源:TextHistory.cpp

示例2: 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
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:33,代码来源:PhysicsConstraintTemplate.cpp

示例3: Serialize

bool FLevelSequenceObjectReferenceMap::Serialize(FArchive& Ar)
{
	int32 Num = Map.Num();
	Ar << Num;

	if (Ar.IsLoading())
	{
		while(Num-- > 0)
		{
			FGuid Key;
			Ar << Key;

			FLevelSequenceObjectReference Value;
			Ar << Value;

			Map.Add(Key, Value);
		}
	}
	else if (Ar.IsSaving() || Ar.IsCountingMemory() || Ar.IsObjectReferenceCollector())
	{
		for (auto& Pair : Map)
		{
			Ar << Pair.Key;
			Ar << Pair.Value;
		}
	}
	return true;
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:28,代码来源:LevelSequenceObjectReference.cpp

示例4: 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);
}
开发者ID:PopCap,项目名称:GameIdea,代码行数:25,代码来源:K2Node_VariableGet.cpp

示例5: Serialize

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

	if( Ar.IsCountingMemory() )
	{
		// Can't use CountBytes as ExportMap is array of structs of arrays.
		Ar << ImportMap;
		Ar << ExportMap;
		Ar << DependsMap;

		if (Ar.IsSaving() || Ar.UE4Ver() >= VER_UE4_ADD_STRING_ASSET_REFERENCES_MAP)
		{
			Ar << StringAssetReferencesMap;
		}
	}

	// Prevent garbage collecting of linker's names and package.
	Ar << NameMap << LinkerRoot;
	{
		for( int32 i=0; i<ExportMap.Num(); i++ )
		{
			FObjectExport& E = ExportMap[i];
			Ar << E.ObjectName;
		}
	}
	{
		for( int32 i=0; i<ImportMap.Num(); i++ )
		{
			FObjectImport& I = ImportMap[i];
			Ar << (UObject*&)I.SourceLinker;
			Ar << I.ClassPackage << I.ClassName;
		}
	}
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:35,代码来源:Linker.cpp

示例6: 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();
			const bool bLoadedForDiff = (Package && Package->HasAnyPackageFlags(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 an invalid GUID and don't add to the annotation map.
						Guid = FGuid();
					}
					else
					{
						GuidAnnotation.AddAnnotation(Object, Guid);
					}
					FUniqueObjectGuid::InvalidateTag();
				}
			}
		}
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:60,代码来源:LazyObjectPtr.cpp

示例7: NetSerialize

bool FGameplayTagContainer::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
	uint8 NumTags;
	if (Ar.IsSaving())
	{
		NumTags = GameplayTags.Num();
		Ar << NumTags;
		for (FGameplayTag& Tag : GameplayTags)
		{
			Tag.NetSerialize(Ar, Map, bOutSuccess);
		}
	}
	else
	{
		Ar << NumTags;
		GameplayTags.Empty(NumTags);
		GameplayTags.AddDefaulted(NumTags);
		for (uint8 idx = 0; idx < NumTags; ++idx)
		{
			GameplayTags[idx].NetSerialize(Ar, Map, bOutSuccess);
		}

	}

	bOutSuccess  = true;
	return true;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:27,代码来源:GameplayTagContainer.cpp

示例8: Serialize

void USubstanceImageInput::Serialize(FArchive& Ar)
{
	Super::Serialize(Ar);
	Ar.UsingCustomVersion(FSubstanceCoreCustomVersion::GUID);

	//! todo: remove image date if all consumers are freezed
	if (Ar.IsSaving())
	{
		ImageRGB.StoreCompressedOnDisk(0 == CompressionRGB ? COMPRESS_ZLIB : COMPRESS_None);
		ImageA.StoreCompressedOnDisk(0 == CompressionAlpha ? COMPRESS_ZLIB : COMPRESS_None);
	}

	ImageRGB.Serialize(Ar, this);
	ImageA.Serialize(Ar, this);

	// image inputs can be used multiple times
	ImageRGB.ClearBulkDataFlags(BULKDATA_SingleUse); 
	ImageA.ClearBulkDataFlags(BULKDATA_SingleUse);

	Ar << CompressionRGB;
	Ar << CompressionAlpha;

	if (Ar.IsCooking())
	{
		SourceFilePath = FString();
		SourceFileTimestamp = FString();
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:28,代码来源:SubstanceImageInput.cpp

示例9: Serialize

void USoundCue::Serialize(FArchive& Ar)
{
	// Always force the duration to be updated when we are saving or cooking
	if (Ar.IsSaving() || Ar.IsCooking())
	{
		Duration = (FirstNode ? FirstNode->GetDuration() : 0.f);
	}

	Super::Serialize(Ar);

	if (Ar.UE4Ver() >= VER_UE4_COOKED_ASSETS_IN_EDITOR_SUPPORT)
	{
		FStripDataFlags StripFlags(Ar);
#if WITH_EDITORONLY_DATA
		if (!StripFlags.IsEditorDataStripped())
		{
			Ar << SoundCueGraph;
		}
#endif
	}
#if WITH_EDITOR
	else
	{
		Ar << SoundCueGraph;
	}
#endif
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:27,代码来源:SoundCue.cpp

示例10: Serialize

void FLocMetadataValueBoolean::Serialize( const FLocMetadataValueBoolean& Value, FArchive& Archive )
{
	check(Archive.IsSaving());

	bool BoolValue = Value.Value;
	Archive << BoolValue;
}
开发者ID:frobro98,项目名称:UnrealSource,代码行数:7,代码来源:InternationalizationMetadata.cpp

示例11: Serialize

PRAGMA_POP

bool FStringAssetReference::Serialize(FArchive& Ar)
{
#if WITH_EDITOR
	if (Ar.IsSaving() && Ar.IsPersistent() && FCoreUObjectDelegates::StringAssetReferenceSaving.IsBound())
	{
		SetPath(FCoreUObjectDelegates::StringAssetReferenceSaving.Execute(ToString()));
	}
#endif // WITH_EDITOR
	Ar << *this;
#if WITH_EDITOR
	if (Ar.IsLoading() && Ar.IsPersistent() && FCoreUObjectDelegates::StringAssetReferenceLoaded.IsBound())
	{
		FCoreUObjectDelegates::StringAssetReferenceLoaded.Execute(ToString());
	}
#endif // WITH_EDITOR

	if (Ar.IsLoading() && (Ar.GetPortFlags()&PPF_DuplicateForPIE))
	{
		// Remap unique ID if necessary
		FixupForPIE();
	}

	return true;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:26,代码来源:StringAssetReference.cpp

示例12: Serialize

void UPendingNetGame::Serialize( FArchive& Ar )
{
	Super::Serialize(Ar);
	if( !Ar.IsLoading() && !Ar.IsSaving() )
	{
		Ar << NetDriver;
	}
}
开发者ID:WasPedro,项目名称:UnrealEngine4.11-HairWorks,代码行数:8,代码来源:PendingNetGame.cpp

示例13: NetSerialize

bool FMinimalReplicationTagCountMap::NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess)
{
	const int32 CountBits = UAbilitySystemGlobals::Get().MinimalReplicationTagCountBits;
	const int32 MaxCount = ((1 << CountBits)-1);

	if (Ar.IsSaving())
	{
		int32 Count = TagMap.Num();
		if (Count > MaxCount)
		{
			ABILITY_LOG(Error, TEXT("FMinimapReplicationTagCountMap has too many tags (%d). This will cause tags to not replicate. See FMinimapReplicationTagCountMap::NetSerialize"), TagMap.Num());
			Count = MaxCount;
		}

		Ar.SerializeBits(&Count, CountBits);
		for(auto& It : TagMap)
		{
			FGameplayTag& Tag = It.Key;
			Tag.NetSerialize(Ar, Map, bOutSuccess);
			if (--Count <= 0)
			{
				break;
			}
		}
	}
	else
	{
		int32 Count = TagMap.Num();
		Ar.SerializeBits(&Count, CountBits);

		// Reset our local map
		for(auto& It : TagMap)
		{
			It.Value = 0;
		}

		// See what we have
		while(Count-- > 0)
		{
			FGameplayTag Tag;
			Tag.NetSerialize(Ar, Map, bOutSuccess);
			TagMap.FindOrAdd(Tag) = 1;
		}

		if (Owner)
		{
			// Update our tags with owner tags
			for(auto& It : TagMap)
			{
				Owner->SetTagMapCount(It.Key, It.Value);
			}
		}
	}


	bOutSuccess = true;
	return true;
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:58,代码来源:GameplayEffectTypes.cpp

示例14: S

bool operator<<(FArchive& Ar,FVertexFactoryParameterRef& Ref)
{
	bool bShaderHasOutdatedParameters = false;

	Ar << Ref.VertexFactoryType;

	uint8 ShaderFrequencyByte = Ref.ShaderFrequency;
	Ar << ShaderFrequencyByte;
	if(Ar.IsLoading())
	{
		Ref.ShaderFrequency = (EShaderFrequency)ShaderFrequencyByte;
	}

	Ar << Ref.VFHash;


	if (Ar.IsLoading())
	{
		delete Ref.Parameters;
		if (Ref.VertexFactoryType)
		{
			Ref.Parameters = Ref.VertexFactoryType->CreateShaderParameters(Ref.ShaderFrequency);
		}
		else
		{
			bShaderHasOutdatedParameters = true;
			Ref.Parameters = NULL;
		}
	}

	// Need to be able to skip over parameters for no longer existing vertex factories.
	int32 SkipOffset = Ar.Tell();
	{
		FArchive::FScopeSetDebugSerializationFlags S(Ar, DSF_IgnoreDiff);
		// Write placeholder.
		Ar << SkipOffset;
	}


	if(Ref.Parameters)
	{
		Ref.Parameters->Serialize(Ar);
	}
	else if(Ar.IsLoading())
	{
		Ar.Seek( SkipOffset );
	}

	if( Ar.IsSaving() )
	{
		int32 EndOffset = Ar.Tell();
		Ar.Seek( SkipOffset );
		Ar << EndOffset;
		Ar.Seek( EndOffset );
	}

	return bShaderHasOutdatedParameters;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:58,代码来源:VertexFactory.cpp

示例15: SerializeItem

/*-----------------------------------------------------------------------------
	UByteProperty.
-----------------------------------------------------------------------------*/
void UByteProperty::SerializeItem( FArchive& Ar, void* Value, void const* Defaults ) const
{
	if(Enum && Ar.UseToResolveEnumerators())
	{
		 const int32 ResolvedIndex = Enum->ResolveEnumerator(Ar, *(uint8*)Value);
		 *(uint8*)Value = static_cast<uint8>(ResolvedIndex);
		 return;
	}

	// Serialize enum values by name unless we're not saving or loading OR for backwards compatibility
	const bool bUseBinarySerialization = (Enum == NULL) || (!Ar.IsLoading() && !Ar.IsSaving());
	if( bUseBinarySerialization )
	{
		Super::SerializeItem(Ar, Value, Defaults);
	}
	// Loading
	else if (Ar.IsLoading())
	{
		FName EnumValueName;
		Ar << EnumValueName;
		// Make sure enum is properly populated
		if( Enum->HasAnyFlags(RF_NeedLoad) )
		{
			Ar.Preload(Enum);
		}

		// There's no guarantee EnumValueName is still present in Enum, in which case Value will be set to the enum's max value.
		// On save, it will then be serialized as NAME_None.
		int32 EnumIndex = Enum->FindEnumIndex(EnumValueName);
		if (EnumIndex == INDEX_NONE)
		{
			*(uint8*)Value = Enum->GetMaxEnumValue();
		}
		else
		{
			*(uint8*)Value = Enum->GetValueByIndex(EnumIndex);
		}
	}
	// Saving
	else
	{
		FName EnumValueName;
		uint8 ByteValue = *(uint8*)Value;

		// subtract 1 because the last entry in the enum's Names array
		// is the _MAX entry
		if ( Enum->IsValidEnumValue(ByteValue) )
		{
			EnumValueName = Enum->GetNameByValue(ByteValue);
		}
		else
		{
			EnumValueName = NAME_None;
		}
		Ar << EnumValueName;
	}
}
开发者ID:zhaoyizheng0930,项目名称:UnrealEngine,代码行数:60,代码来源:PropertyByte.cpp


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