本文整理汇总了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));
}
}
示例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);
}
}
示例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"));
}
}