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


C++ TOptional::GetSourceFileData方法代码示例

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


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

示例1: HandleOnAssetRenamed

void FAssetSourceFilenameCache::HandleOnAssetRenamed(const FAssetData& AssetData, const FString& OldPath)
{
	TOptional<FAssetImportInfo> ImportData = ExtractAssetImportInfo(AssetData.TagsAndValues);
	if (ImportData.IsSet())
	{
		FName OldPathName = *OldPath;

		for (auto& SourceFile : ImportData->GetSourceFileData())
		{
			FString CleanFilename = FPaths::GetCleanFilename(SourceFile.RelativeFilename);

			if (auto* Objects = SourceFileToObjectPathCache.Find(CleanFilename))
			{
				Objects->Remove(OldPathName);
				if (Objects->Num() == 0)
				{
					SourceFileToObjectPathCache.Remove(CleanFilename);
				}
			}

			SourceFileToObjectPathCache.FindOrAdd(CleanFilename).Add(AssetData.ObjectPath);
		}
	}

	AssetRenamedEvent.Broadcast(AssetData, OldPath);
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:26,代码来源:AssetSourceFilenameCache.cpp

示例2: HandleOnAssetAdded

void FAssetSourceFilenameCache::HandleOnAssetAdded(const FAssetData& AssetData)
{
	TOptional<FAssetImportInfo> ImportData = ExtractAssetImportInfo(AssetData.TagsAndValues);
	if (ImportData.IsSet())
	{
		for (const auto& SourceFile : ImportData->GetSourceFileData())
		{
			SourceFileToObjectPathCache.FindOrAdd(FPaths::GetCleanFilename(SourceFile.RelativeFilename)).Add(AssetData.ObjectPath);
		}
	}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:11,代码来源:AssetSourceFilenameCache.cpp

示例3: HandleOnAssetRemoved

void FAssetSourceFilenameCache::HandleOnAssetRemoved(const FAssetData& AssetData)
{
	TOptional<FAssetImportInfo> ImportData = ExtractAssetImportInfo(AssetData.TagsAndValues);
	if (ImportData.IsSet())
	{
		for (auto& SourceFile : ImportData->GetSourceFileData())
		{
			FString CleanFilename = FPaths::GetCleanFilename(SourceFile.RelativeFilename);
			if (auto* Objects = SourceFileToObjectPathCache.Find(CleanFilename))
			{
				Objects->Remove(AssetData.ObjectPath);
				if (Objects->Num() == 0)
				{
					SourceFileToObjectPathCache.Remove(CleanFilename);
				}
			}
		}
	}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:19,代码来源:AssetSourceFilenameCache.cpp

示例4: ExtractAssetImportInfo

TArray<FAssetData> FAssetSourceFilenameCache::GetAssetsPertainingToFile(const IAssetRegistry& Registry, const FString& AbsoluteFilename) const
{
	TArray<FAssetData> Assets;
	
	if (const auto* ObjectPaths = SourceFileToObjectPathCache.Find(FPaths::GetCleanFilename(AbsoluteFilename)))
	{
		for (const FName& Path : *ObjectPaths)
		{
			FAssetData Asset = Registry.GetAssetByObjectPath(Path);
			TOptional<FAssetImportInfo> ImportInfo = ExtractAssetImportInfo(Asset.TagsAndValues);
			if (ImportInfo.IsSet())
			{
				auto AssetPackagePath = FPackageName::LongPackageNameToFilename(Asset.PackagePath.ToString() / TEXT(""));

				// Attempt to find the matching source filename in the list of imported sorce files (generally there are only one of these)
				const bool bWasImportedFromFile = ImportInfo->GetSourceFileData().ContainsByPredicate([&](const FAssetImportInfo::FSourceFile& File){

					if (AbsoluteFilename == FPaths::ConvertRelativePathToFull(AssetPackagePath / File.RelativeFilename) ||
						AbsoluteFilename == FPaths::ConvertRelativePathToFull(File.RelativeFilename))
					{
						return true;
					}

					return false;
				});

				if (bWasImportedFromFile)
				{
					Assets.Emplace();
					Swap(Asset, Assets[Assets.Num() - 1]);
				}
			}
		}
	}

	return Assets;
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:37,代码来源:AssetSourceFilenameCache.cpp


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