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


C++ TWeakObjectPtr::IsMemberOfEngineTargetSet方法代码示例

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


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

示例1: ExportAllCulturesForTargetToOneSky

void FOneSkyLocalizationServiceProvider::ExportAllCulturesForTargetToOneSky(TWeakObjectPtr<ULocalizationTarget> LocalizationTarget, bool bIsTargetSet)
{
	check(LocalizationTarget.IsValid());

	// If this is only one target, not a whole set, get confirmation and do export here (otherwise this is handled in the calling function)
	if (!bIsTargetSet)
	{
		bool bAccepted = GWarn->YesNof(FText::Format(
			LOCTEXT("ExportAllCulturesForTargetToOneSkyConfirm", "All data in OneSky for target {0} will be overwritten with your local copy!\nThis cannot be undone.\nAre you sure you want to export all cultures for this target to OneSky?"),
			FText::FromString(LocalizationTarget->Settings.Name)));
		
		if (!bAccepted)
		{
			return;
		}

		IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame"));
		const TSharedPtr<SWindow>& MainFrameParentWindow = MainFrameModule.GetParentWindow();
		FString EngineOrGamePath = LocalizationTarget->IsMemberOfEngineTargetSet() ? "Engine" : "Game";
		FString AbsoluteFolderPath = FPaths::ConvertRelativePathToFull(FPaths::ProjectSavedDir() / "Temp" / EngineOrGamePath / LocalizationTarget->Settings.Name);
		
		// Delete old files if they exists so we don't accidentally export old data
		IPlatformFile &PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
		PlatformFile.DeleteDirectoryRecursively(*AbsoluteFolderPath);

		// Export to file
		LocalizationCommandletTasks::ExportTextForTarget(MainFrameParentWindow.ToSharedRef(), LocalizationTarget.Get(), AbsoluteFolderPath);

		GWarn->BeginSlowTask(LOCTEXT("ExportingToOneSky", "Exporting Latest to OneSky..."), true);
	}

	for (FCultureStatistics CultureStats : LocalizationTarget->Settings.SupportedCulturesStatistics)
	{
		ILocalizationServiceProvider& Provider = ILocalizationServiceModule::Get().GetProvider();
		TSharedRef<FUploadLocalizationTargetFile, ESPMode::ThreadSafe> UploadFileOp = ILocalizationServiceOperation::Create<FUploadLocalizationTargetFile>();
		UploadFileOp->SetInTargetGuid(LocalizationTarget->Settings.Guid);
		UploadFileOp->SetInLocale(CultureStats.CultureName);
		FString EngineOrGamePath = LocalizationTarget->IsMemberOfEngineTargetSet() ? "Engine" : "Game";

		// Put the intermediary .po files in a temporary directory in Saved for now
		FString Path = FPaths::ProjectSavedDir() / "Temp" / EngineOrGamePath / LocalizationTarget->Settings.Name / CultureStats.CultureName / LocalizationTarget->Settings.Name + ".po";
		FPaths::MakePathRelativeTo(Path, *FPaths::ProjectDir());
		UploadFileOp->SetInRelativeInputFilePathAndName(Path);

		FilesUploadingForExportToOneSky.Add(Path);

		Provider.Execute(UploadFileOp, TArray<FLocalizationServiceTranslationIdentifier>(), ELocalizationServiceOperationConcurrency::Asynchronous, 
			FLocalizationServiceOperationComplete::CreateRaw(this, &FOneSkyLocalizationServiceProvider::ExportCultureForTargetToOneSky_Callback, bIsTargetSet));
	}
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:50,代码来源:OneSkyLocalizationServiceProvider.cpp

示例2: ImportAllCulturesForTargetFromOneSky

void FOneSkyLocalizationServiceProvider::ImportAllCulturesForTargetFromOneSky(TWeakObjectPtr<ULocalizationTarget> LocalizationTarget, bool bIsTargetSet)
{
	check(LocalizationTarget.IsValid());

	if (!bIsTargetSet)
	{
		GWarn->BeginSlowTask(LOCTEXT("ImportingFromLocalizationService", "Importing Latest from Localization Service..."), true);
	}

	FString EngineOrGamePath = LocalizationTarget->IsMemberOfEngineTargetSet() ? "Engine" : "Game";

	for (FCultureStatistics CultureStats : LocalizationTarget->Settings.SupportedCulturesStatistics)
	{
		ILocalizationServiceProvider& Provider = ILocalizationServiceModule::Get().GetProvider();
		TSharedRef<FDownloadLocalizationTargetFile, ESPMode::ThreadSafe> DownloadTargetFileOp = ILocalizationServiceOperation::Create<FDownloadLocalizationTargetFile>();
		DownloadTargetFileOp->SetInTargetGuid(LocalizationTarget->Settings.Guid);
		DownloadTargetFileOp->SetInLocale(CultureStats.CultureName);

		// Put the intermediary .po files in a temporary directory in Saved for now
		FString Path = FPaths::ProjectSavedDir() / "Temp" / EngineOrGamePath / LocalizationTarget->Settings.Name / CultureStats.CultureName / LocalizationTarget->Settings.Name + ".po";
		FPaths::MakePathRelativeTo(Path, *FPaths::ProjectDir());
		DownloadTargetFileOp->SetInRelativeOutputFilePathAndName(Path);

		FilesDownloadingForImportFromOneSky.Add(Path);
		IPlatformFile &PlatformFile = FPlatformFileManager::Get().GetPlatformFile();
		// Delete this file if it exists so we don't accidentally import old data
		PlatformFile.DeleteFile(*Path);

		auto OperationCompleteDelegate = FLocalizationServiceOperationComplete::CreateRaw(this, &FOneSkyLocalizationServiceProvider::ImportCultureForTargetFromOneSky_Callback, bIsTargetSet);

		Provider.Execute(DownloadTargetFileOp, TArray<FLocalizationServiceTranslationIdentifier>(), ELocalizationServiceOperationConcurrency::Asynchronous, OperationCompleteDelegate);
	}
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:33,代码来源:OneSkyLocalizationServiceProvider.cpp

示例3: AddTargetToolbarButtons

void FOneSkyLocalizationServiceProvider::AddTargetToolbarButtons(FToolBarBuilder& ToolbarBuilder, TWeakObjectPtr<ULocalizationTarget> InLocalizationTarget, TSharedRef< FUICommandList > CommandList)
{
	bool bIsTargetSet = false;
	CommandList->MapAction(FOneSkyLocalizationTargetEditorCommands::Get().ImportAllCulturesForTargetFromOneSky, FExecuteAction::CreateRaw(this, &FOneSkyLocalizationServiceProvider::ImportAllCulturesForTargetFromOneSky, InLocalizationTarget, bIsTargetSet));
	ToolbarBuilder.AddToolBarButton(FOneSkyLocalizationTargetEditorCommands::Get().ImportAllCulturesForTargetFromOneSky, NAME_None, TAttribute<FText>(), TAttribute<FText>(), FSlateIcon(FEditorStyle::GetStyleSetName(), "TranslationEditor.ImportLatestFromLocalizationService"));

	// Don't add "export all" buttons for engine targets
	if (!InLocalizationTarget->IsMemberOfEngineTargetSet())
	{
		CommandList->MapAction(FOneSkyLocalizationTargetEditorCommands::Get().ExportAllCulturesForTargetToOneSky, FExecuteAction::CreateRaw(this, &FOneSkyLocalizationServiceProvider::ExportAllCulturesForTargetToOneSky, InLocalizationTarget, bIsTargetSet));
		ToolbarBuilder.AddToolBarButton(FOneSkyLocalizationTargetEditorCommands::Get().ExportAllCulturesForTargetToOneSky, NAME_None, TAttribute<FText>(), TAttribute<FText>(), FSlateIcon(FEditorStyle::GetStyleSetName(), "TranslationEditor.ImportLatestFromLocalizationService"));
	}
}
开发者ID:AndyHuang7601,项目名称:EpicGames-UnrealEngine,代码行数:13,代码来源:OneSkyLocalizationServiceProvider.cpp


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