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


C++ IDesktopPlatform::OpenFileDialog方法代码示例

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


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

示例1: OpenFiles

/**** @param Title                  The title of the dialog
	* @param FileTypes              Filter for which file types are accepted and should be shown
	* @param InOutLastPath    Keep track of the last location from which the user attempted an import
	* @param DialogMode             Multiple items vs single item.
	* @param OutOpenFilenames       The list of filenames that the user attempted to open
	*
	* @return true if the dialog opened successfully and the user accepted; false otherwise.
	*/
bool OpenFiles( const FString& Title, const FString& FileTypes, FString& InOutLastPath, EFileDialogFlags::Type DialogMode, TArray<FString>& OutOpenFilenames ) 
{
	IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
	bool bOpened = false;
	if ( DesktopPlatform )
	{
		bOpened = DesktopPlatform->OpenFileDialog(
			ChooseParentWindowHandle(),
			Title,
			InOutLastPath,
			TEXT(""),
			FileTypes,
			DialogMode,
			OutOpenFilenames
		);
	}

	bOpened = (OutOpenFilenames.Num() > 0);

	if ( bOpened )
	{
		// User successfully chose a file; remember the path for the next time the dialog opens.
		InOutLastPath = OutOpenFilenames[0];
	}

	return bOpened;
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:35,代码来源:SubstanceEditorHelpers.cpp

示例2: PickFile

bool FRealSenseInspectorCustomization::PickFile(FString& OutPath, const void* ParentWindow, const FString& Title, const FString& Filter, bool SaveFlag)
{
	IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
	if (DesktopPlatform)
	{
		TArray<FString> OutFiles;
		if (SaveFlag)
		{
			auto DefaultPath = FEditorDirectories::Get().GetLastDirectory(ELastDirectory::GENERIC_SAVE);
			if (DesktopPlatform->SaveFileDialog(ParentWindow, Title, DefaultPath, TEXT(""), Filter, EFileDialogFlags::None, OutFiles))
			{
				OutPath = OutFiles[0];
				return true;
			}
		}
		else
		{
			auto DefaultPath = FEditorDirectories::Get().GetLastDirectory(ELastDirectory::GENERIC_OPEN);
			if (DesktopPlatform->OpenFileDialog(ParentWindow, Title, DefaultPath, TEXT(""), Filter, EFileDialogFlags::None, OutFiles))
			{
				OutPath = OutFiles[0];
				return true;
			}
		}
	}
	return false;
}
开发者ID:UnaNancyOwen,项目名称:librealsense,代码行数:27,代码来源:RealSenseDetailCustomization.cpp

示例3: HandleLoadCommandExecute

void SVisualLogger::HandleLoadCommandExecute()
{
	FArchive Ar;
	TArray<FVisualLogDevice::FVisualLogEntryItem> RecordedLogs;

	TArray<FString> OpenFilenames;
	IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
	bool bOpened = false;
	if (DesktopPlatform)
	{
		void* ParentWindowWindowHandle = NULL;

		IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame"));
		const TSharedPtr<SWindow>& MainFrameParentWindow = MainFrameModule.GetParentWindow();
		if (MainFrameParentWindow.IsValid() && MainFrameParentWindow->GetNativeWindow().IsValid())
		{
			ParentWindowWindowHandle = MainFrameParentWindow->GetNativeWindow()->GetOSWindowHandle();
		}

		const FString DefaultBrowsePath = FString::Printf(TEXT("%slogs/"), *FPaths::GameSavedDir());

		bOpened = DesktopPlatform->OpenFileDialog(
			ParentWindowWindowHandle,
			LOCTEXT("OpenProjectBrowseTitle", "Open Project").ToString(),
			DefaultBrowsePath,
			TEXT(""),
			LogVisualizer::LoadFileTypes,
			EFileDialogFlags::None,
			OpenFilenames
			);
	}

	if (bOpened && OpenFilenames.Num() > 0)
	{
		OnNewWorld(nullptr);
		for (int FilenameIndex = 0; FilenameIndex < OpenFilenames.Num(); ++FilenameIndex)
		{
			FString CurrentFileName = OpenFilenames[FilenameIndex];
			const bool bIsBinaryFile = CurrentFileName.Find(TEXT(".bvlog")) != INDEX_NONE;
			if (bIsBinaryFile)
			{
				FArchive* FileAr = IFileManager::Get().CreateFileReader(*CurrentFileName);
				FVisualLoggerHelpers::Serialize(*FileAr, RecordedLogs);
				FileAr->Close();
				delete FileAr;
				FileAr = NULL;

				for (FVisualLogDevice::FVisualLogEntryItem& CurrentItem : RecordedLogs)
				{
					OnNewLogEntry(CurrentItem);
				}
			}
		}
	}
}
开发者ID:a3pelawi,项目名称:UnrealEngine,代码行数:55,代码来源:SVisualLogger.cpp

示例4: OpenFileDialog

void AFilePickerCharacter::OpenFileDialog(const FString& DialogTitle, const FString& DefaultPath, const FString& FileTypes, TArray<FString>& OutFileNames)
{
	if (GEngine)
	{
		if (GEngine->GameViewport)
		{
			void* ParentWindowHandle = GEngine->GameViewport->GetWindow()->GetNativeWindow()->GetOSWindowHandle();
			IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
			if (DesktopPlatform)
			{
				//Opening the file picker!
				uint32 SelectionFlag = 0; //A value of 0 represents single file selection while a value of 1 represents multiple file selection
				DesktopPlatform->OpenFileDialog(ParentWindowHandle, DialogTitle, DefaultPath, FString(""), FileTypes, SelectionFlag, OutFileNames);
			}
		}
	}
}
开发者ID:orfeasel,项目名称:UE4-Game-Systems,代码行数:17,代码来源:FilePickerCharacter.cpp

示例5: ProfilerManager_Load_Execute

void FProfilerActionManager::ProfilerManager_Load_Execute()
{
	// @see FStatConstants::StatsFileExtension
	TArray<FString> OutFiles;
	const FString ProfilingDirectory = *FPaths::ConvertRelativePathToFull( *FPaths::ProfilingDir() );

	IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
	bool bOpened = false;
	if( DesktopPlatform != NULL )
	{
		bOpened = DesktopPlatform->OpenFileDialog
		(
			NULL, 
			LOCTEXT("ProfilerManager_Load_Desc", "Open profiler capture file...").ToString(),
			ProfilingDirectory, 
			TEXT(""), 
			LOCTEXT("ProfilerManager_Load_FileFilter", "Stats files (*.ue4stats)|*.ue4stats|Raw Stats files (*.ue4statsraw)|*.ue4statsraw").ToString(), 
			//FProfilerManager::GetSettings().bSingleInstanceMode ? EFileDialogFlags::None : EFileDialogFlags::Multiple, 
			EFileDialogFlags::None,
			OutFiles
		);
	}

	if( bOpened == true )
	{
		if( OutFiles.Num() == 1 )
		{
			const FString DraggedFileExtension = FPaths::GetExtension( OutFiles[0], true );
			if( DraggedFileExtension == FStatConstants::StatsFileExtension )
			{
				This->LoadProfilerCapture( OutFiles[0] );

			}
			else if( DraggedFileExtension == FStatConstants::StatsFileRawExtension )
			{
				This->LoadRawStatsFile( OutFiles[0] );
			}
		}
	}
}
开发者ID:PickUpSU,项目名称:UnrealEngine4,代码行数:40,代码来源:ProfilerCommands.cpp

示例6: OnGizmoHeightmapFilenameButtonClicked

FReply FLandscapeEditorDetailCustomization_CopyPaste::OnGizmoHeightmapFilenameButtonClicked(TSharedRef<IPropertyHandle> HeightmapPropertyHandle)
{
	FEdModeLandscape* LandscapeEdMode = GetEditorMode();
	if (LandscapeEdMode != NULL)
	{
		// Prompt the user for the Filenames
		IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
		if (DesktopPlatform != NULL)
		{
			void* ParentWindowWindowHandle = NULL;

			IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame"));
			const TSharedPtr<SWindow>& MainFrameParentWindow = MainFrameModule.GetParentWindow();
			if (MainFrameParentWindow.IsValid() && MainFrameParentWindow->GetNativeWindow().IsValid())
			{
				ParentWindowWindowHandle = MainFrameParentWindow->GetNativeWindow()->GetOSWindowHandle();
			}

			TArray<FString> OpenFilenames;
			bool bOpened = DesktopPlatform->OpenFileDialog(
				ParentWindowWindowHandle,
				NSLOCTEXT("UnrealEd", "Import", "Import").ToString(),
				LandscapeEdMode->UISettings->LastImportPath,
				TEXT(""),
				TEXT("Raw Heightmap files (*.raw,*.r16)|*.raw;*.r16|All files (*.*)|*.*"),
				EFileDialogFlags::None,
				OpenFilenames);

			if (bOpened)
			{
				//SetGizmoHeightmapFilenameString(FText::FromString(OpenFilenames[0]), ETextCommit::OnEnter);
				HeightmapPropertyHandle->SetValue(OpenFilenames[0]);
				LandscapeEdMode->UISettings->LastImportPath = FPaths::GetPath(OpenFilenames[0]);
			}
		}
	}

	return FReply::Handled();
}
开发者ID:Tigrouzen,项目名称:UnrealEngine-4,代码行数:39,代码来源:LandscapeEditorDetailCustomization_CopyPaste.cpp

示例7: ImportMeshLODDialog

	void ImportMeshLODDialog( class UObject* SelectedMesh, int32 LODLevel )
	{
		if(!SelectedMesh)
		{
			return;
		}

		USkeletalMesh* SkeletonMesh = Cast<USkeletalMesh>(SelectedMesh);
		UStaticMesh* StaticMesh = Cast<UStaticMesh>(SelectedMesh);

		if( !SkeletonMesh && !StaticMesh )
		{
			return;
		}

		FString ExtensionStr;

		ExtensionStr += TEXT("All model files|*.fbx;*.obj|");

		ExtensionStr += TEXT("FBX files|*.fbx|");

		ExtensionStr += TEXT("Object files|*.obj|");

		ExtensionStr += TEXT("All files|*.*");

		// First, display the file open dialog for selecting the file.
		TArray<FString> OpenFilenames;
		IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
		bool bOpen = false;
		if ( DesktopPlatform )
		{
			void* ParentWindowWindowHandle = NULL;

			IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame"));
			const TSharedPtr<SWindow>& MainFrameParentWindow = MainFrameModule.GetParentWindow();
			if ( MainFrameParentWindow.IsValid() && MainFrameParentWindow->GetNativeWindow().IsValid() )
			{
				ParentWindowWindowHandle = MainFrameParentWindow->GetNativeWindow()->GetOSWindowHandle();
			}

			bOpen = DesktopPlatform->OpenFileDialog(
				ParentWindowWindowHandle,
				FText::Format( NSLOCTEXT("UnrealEd", "ImportMeshLOD", "Failed to import mesh for LOD {0}!"), FText::AsNumber( LODLevel ) ).ToString(),
				*FEditorDirectories::Get().GetLastDirectory(ELastDirectory::FBX),
				TEXT(""),
				*ExtensionStr,
				EFileDialogFlags::None,
				OpenFilenames
				);
		}
			
		// Only continue if we pressed OK and have only one file selected.
		if( bOpen )
		{
			if( OpenFilenames.Num() == 0)
			{
				UnFbx::FFbxImporter* FFbxImporter = UnFbx::FFbxImporter::GetInstance();
				FFbxImporter->AddTokenizedErrorMessage(FTokenizedMessage::Create(EMessageSeverity::Error, LOCTEXT("NoFileSelectedForLOD", "No file was selected for the LOD.")), FFbxErrors::Generic_Mesh_LOD_NoFileSelected);
			}
			else if(OpenFilenames.Num() > 1)
			{
				UnFbx::FFbxImporter* FFbxImporter = UnFbx::FFbxImporter::GetInstance();
				FFbxImporter->AddTokenizedErrorMessage(FTokenizedMessage::Create(EMessageSeverity::Error, LOCTEXT("MultipleFilesSelectedForLOD", "You may only select one file for the LOD.")), FFbxErrors::Generic_Mesh_LOD_MultipleFilesSelected);
			}
			else
			{
				FString Filename = OpenFilenames[0];
				FEditorDirectories::Get().SetLastDirectory(ELastDirectory::FBX, FPaths::GetPath(Filename)); // Save path as default for next time.

				if( SkeletonMesh )
				{
					ImportSkeletalMeshLOD(SkeletonMesh, Filename, LODLevel);
				}
				else if( StaticMesh )
				{
					ImportStaticMeshLOD(StaticMesh, Filename, LODLevel);
				}
			}
		}
	}
开发者ID:VZout,项目名称:Team6UnrealEngine,代码行数:80,代码来源:FbxMeshUtils.cpp

示例8: ImportFBXChunks

void FDestructibleMeshEditorViewportClient::ImportFBXChunks()
{
	// Get the FBX that we want to import
	TArray<FString> OpenFilenames;
	IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
	bool bOpened = false;
	if (DesktopPlatform != NULL)
	{
		bOpened = DesktopPlatform->OpenFileDialog(
			NULL, 
			NSLOCTEXT("UnrealEd", "ImportMatineeSequence", "Import UnrealMatinee Sequence").ToString(),
			*(FEditorDirectories::Get().GetLastDirectory(ELastDirectory::GENERIC_IMPORT)),
			TEXT(""),
			TEXT("FBX document|*.fbx"),
			EFileDialogFlags::None, 
			OpenFilenames);
	}

	if (bOpened)
	{
		// Get the filename from dialog
		FString ImportFilename = OpenFilenames[0];
		FString FileName = OpenFilenames[0];
		FEditorDirectories::Get().SetLastDirectory(ELastDirectory::GENERIC_IMPORT, FPaths::GetPath(FileName)); // Save path as default for next time.

		const FString FileExtension = FPaths::GetExtension(FileName);
		const bool bIsFBX = FCString::Stricmp(*FileExtension, TEXT("FBX")) == 0;

		if (bIsFBX)
		{
			FlushRenderingCommands();

			UnFbx::FFbxImporter* FFbxImporter = UnFbx::FFbxImporter::GetInstance();
			if (FFbxImporter->ImportFromFile( *ImportFilename, FPaths::GetExtension( ImportFilename ) ) )
			{
				TArray<FbxNode*> FbxMeshArray;
				FFbxImporter->FillFbxMeshArray(FFbxImporter->Scene->GetRootNode(), FbxMeshArray, FFbxImporter);

				UFbxStaticMeshImportData* ImportData = NewObject<UFbxStaticMeshImportData>(GetTransientPackage(), NAME_None, RF_NoFlags, NULL);

				TArray<UStaticMesh*> ChunkMeshes;

				for (int32 i=0; i < FbxMeshArray.Num(); ++i)
				{
					UStaticMesh* TempStaticMesh = NULL;
					TempStaticMesh = (UStaticMesh*)FFbxImporter->ImportStaticMesh(GetTransientPackage(), FbxMeshArray[i], NAME_None, RF_NoFlags, ImportData, 0);

					ChunkMeshes.Add(TempStaticMesh);
				}

				UDestructibleMesh* DestructibleMesh = DestructibleMeshEditorPtr.Pin()->GetDestructibleMesh();
				if (DestructibleMesh)
				{
					DestructibleMesh->SetupChunksFromStaticMeshes(ChunkMeshes);
				}
			}

			FFbxImporter->ReleaseScene();

			// Update the viewport
			DestructibleMeshEditorPtr.Pin()->RefreshTool();
			DestructibleMeshEditorPtr.Pin()->SetCurrentPreviewDepth(0xFFFFFFFF);	// This will get clamped to the max depth
		}
		else
		{
			// Invalid filename 
		}
	}
#if WITH_APEX
#endif // WITH_APEX
}
开发者ID:Codermay,项目名称:Unreal4,代码行数:71,代码来源:SDestructibleMeshEditorViewport.cpp

示例9: AddExistingLevel

void FStreamingLevelCollectionModel::AddExistingLevel(bool bRemoveInvalidSelectedLevelsAfter)
{
	if (UEditorEngine::IsUsingWorldAssets())
	{
		if (!bAssetDialogOpen)
		{
			bAssetDialogOpen = true;
			FEditorFileUtils::FOnLevelsChosen LevelsChosenDelegate = FEditorFileUtils::FOnLevelsChosen::CreateSP(this, &FStreamingLevelCollectionModel::HandleAddExistingLevelSelected, bRemoveInvalidSelectedLevelsAfter);
			FEditorFileUtils::FOnLevelPickingCancelled LevelPickingCancelledDelegate = FEditorFileUtils::FOnLevelPickingCancelled::CreateSP(this, &FStreamingLevelCollectionModel::HandleAddExistingLevelCancelled);
			const bool bAllowMultipleSelection = true;
			FEditorFileUtils::OpenLevelPickingDialog(LevelsChosenDelegate, LevelPickingCancelledDelegate, bAllowMultipleSelection);
		}
	}
	else
	{
		TArray<FString> OpenFilenames;
		IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
		bool bOpened = false;
		if ( DesktopPlatform )
		{
			void* ParentWindowWindowHandle = NULL;

			IMainFrameModule& MainFrameModule = FModuleManager::LoadModuleChecked<IMainFrameModule>(TEXT("MainFrame"));
			const TSharedPtr<SWindow>& MainFrameParentWindow = MainFrameModule.GetParentWindow();
			if ( MainFrameParentWindow.IsValid() && MainFrameParentWindow->GetNativeWindow().IsValid() )
			{
				ParentWindowWindowHandle = MainFrameParentWindow->GetNativeWindow()->GetOSWindowHandle();
			}

			bOpened = DesktopPlatform->OpenFileDialog(
				ParentWindowWindowHandle,
				NSLOCTEXT("UnrealEd", "Open", "Open").ToString(),
				*FEditorDirectories::Get().GetLastDirectory(ELastDirectory::UNR),
				TEXT(""),
				*FEditorFileUtils::GetFilterString(FI_Load),
				EFileDialogFlags::Multiple,
				OpenFilenames
				);
		}

		if( bOpened )
		{
			// Save the path as default for next time
			FEditorDirectories::Get().SetLastDirectory( ELastDirectory::UNR, FPaths::GetPath( OpenFilenames[ 0 ] ) );

			TArray<FString> Filenames;
			for( int32 FileIndex = 0 ; FileIndex < OpenFilenames.Num() ; ++FileIndex )
			{
				// Strip paths from to get the level package names.
				const FString FilePath( OpenFilenames[FileIndex] );

				// make sure the level is in our package cache, because the async loading code will use this to find it
				if (!FPaths::FileExists(FilePath))
				{
					FMessageDialog::Open( EAppMsgType::Ok, NSLOCTEXT("UnrealEd", "Error_LevelImportFromExternal", "Importing external sublevels is not allowed. Move the level files into the standard content directory and try again.\nAfter moving the level(s), restart the editor.") );
					return;				
				}

				FText ErrorMessage;
				bool bFilenameIsValid = FEditorFileUtils::IsValidMapFilename(OpenFilenames[FileIndex], ErrorMessage);
				if ( !bFilenameIsValid )
				{
					// Start the loop over, prompting for save again
					const FText DisplayFilename = FText::FromString( IFileManager::Get().ConvertToAbsolutePathForExternalAppForRead(*OpenFilenames[FileIndex]) );
					FFormatNamedArguments Arguments;
					Arguments.Add(TEXT("Filename"), DisplayFilename);
					Arguments.Add(TEXT("LineTerminators"), FText::FromString(LINE_TERMINATOR LINE_TERMINATOR));
					Arguments.Add(TEXT("ErrorMessage"), ErrorMessage);
					const FText DisplayMessage = FText::Format( NSLOCTEXT("UnrealEd", "Error_InvalidLevelToAdd", "Unable to add streaming level {Filename}{LineTerminators}{ErrorMessage}"), Arguments );
					FMessageDialog::Open( EAppMsgType::Ok, DisplayMessage );
					return;
				}

				Filenames.Add( FilePath );
			}

			TArray<FString> PackageNames;
			for (const auto& Filename : Filenames)
			{
				const FString& PackageName = FPackageName::FilenameToLongPackageName(Filename);
				PackageNames.Add(PackageName);
			}

			// Save or selected list, adding a new level will clean it up
			FLevelModelList SavedInvalidSelectedLevels = InvalidSelectedLevels;

			EditorLevelUtils::AddLevelsToWorld(CurrentWorld.Get(), PackageNames, AddedLevelStreamingClass);
			
			// Force a cached level list rebuild
			PopulateLevelsList();
			
			if (bRemoveInvalidSelectedLevelsAfter)
			{
				InvalidSelectedLevels = SavedInvalidSelectedLevels;
				RemoveInvalidSelectedLevels_Executed();
			}
		}
	}
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:99,代码来源:StreamingLevelCollectionModel.cpp

示例10: StartupModule

void FRenderDocLoaderPluginModule::StartupModule()
{
	FString BinaryPath;
	if (GConfig)
	{
		GConfig->GetString(TEXT("RenderDoc"), TEXT("BinaryPath"), BinaryPath, GGameIni);
	}

	if (BinaryPath.IsEmpty())
	{
		//Try to localize the installation path and update the BinaryPath
		if (!(FWindowsPlatformMisc::QueryRegKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Classes\\RenderDoc.RDCCapture.1\\DefaultIcon\\"), TEXT(""), BinaryPath) && (BinaryPath.Len() > 0)))
		{
			//Renderdoc does not seem to be installed, but it might be built from source or downloaded by archive, 
			//so prompt the user to navigate to the main exe file
			UE_LOG(RenderDocLoaderPlugin, Log, TEXT("RenderDoc is not installed! Please provide custom exe path..."));

			IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
			if (DesktopPlatform)
			{
				FString Filter = TEXT("Renderdoc executable|renderdocui.exe");

				TArray<FString> OutFiles;

				if (DesktopPlatform->OpenFileDialog(NULL, TEXT("Locate main Renderdoc executable..."), TEXT(""), TEXT(""), Filter, EFileDialogFlags::None, OutFiles))
				{
					BinaryPath = OutFiles[0];
				}
			}
		}

		if (!BinaryPath.IsEmpty())
		{			
			BinaryPath = FPaths::GetPath(BinaryPath);

			if (GConfig)
			{
				GConfig->SetString(TEXT("RenderDoc"), TEXT("BinaryPath"), *BinaryPath, GGameIni);
				GConfig->Flush(false, GGameIni);
			}
		}
	}

	if (BinaryPath.IsEmpty())
	{
		UE_LOG(RenderDocLoaderPlugin, Error, TEXT("Could not locate Renderdoc! Aborting module load..."));
		return;
	}

	RenderDocDLL = NULL;

	FString PathToRenderDocDLL = FPaths::Combine(*BinaryPath, *FString("renderdoc.dll"));
	RenderDocDLL = LoadLibrary(*PathToRenderDocDLL);

	if (!RenderDocDLL)
	{
		FMessageDialog::Open(EAppMsgType::Ok, FText::Format(LOCTEXT("CouldNotLoadDLLDialog", "Could not load renderdoc DLL, if you have moved your renderdoc installation, please amend the path declaration in your Game.ini file. The path that was searched for the module was {0}"), FText::FromString(PathToRenderDocDLL)));
		UE_LOG(RenderDocLoaderPlugin, Error, TEXT("Could not load renderdoc DLL! Aborting module load..."));
		return;
	}

	UE_LOG(RenderDocLoaderPlugin, Log, TEXT("RenderDoc Loader Plugin loaded!"));
}
开发者ID:Marbozz,项目名称:UE4RenderDocPlugin,代码行数:63,代码来源:RenderDocLoaderPluginModule.cpp

示例11: Initialize

void FRenderDocPluginLoader::Initialize()
{
	if (GUsingNullRHI)
	{
		// THIS WILL NEVER TRIGGER because of a sort of chicken-and-egg problem: RenderDoc Loader is a PostConfigInit
		// plugin, and GUsingNullRHI is only initialized properly between PostConfigInit and PreLoadingScreen phases.
		// (nevertheless, keep this comment around for future iterations of UE4)
		UE_LOG(RenderDocPlugin, Warning, TEXT("this plugin will not be loaded because a null RHI (Cook Server, perhaps) is being used."));
		return;
	}
	
	// Look for a renderdoc.dll somewhere in the system:
	UE_LOG(RenderDocPlugin, Log, TEXT("locating RenderDoc library (renderdoc.dll)..."));
	RenderDocDLL = RenderDocAPI = NULL;

	// 1) Check the Game configuration files:
	if (GConfig)
	{
		FString RenderdocPath;
		GConfig->GetString(TEXT("RenderDoc"), TEXT("BinaryPath"), RenderdocPath, GGameIni);
		RenderDocDLL = LoadAndCheckRenderDocLibrary(RenderDocAPI, RenderdocPath);
	}

	// 2) Check for a RenderDoc system installation in the registry:
	if (!RenderDocDLL)
	{
		FString RenderdocPath;
		FWindowsPlatformMisc::QueryRegKey(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Classes\\RenderDoc.RDCCapture.1\\DefaultIcon\\"), TEXT(""), RenderdocPath);
		RenderDocDLL = LoadAndCheckRenderDocLibrary(RenderDocAPI, RenderdocPath);
		if (RenderDocDLL)
			UpdateConfigFiles(RenderdocPath);
	}

	// 3) Check for a RenderDoc custom installation by prompting the user:
	if (!RenderDocDLL)
	{
		//Renderdoc does not seem to be installed, but it might be built from source or downloaded by archive, 
		//so prompt the user to navigate to the main exe file
		UE_LOG(RenderDocPlugin, Log, TEXT("RenderDoc library not found; provide a custom installation location..."));
		FString RenderdocPath;
		// TODO: rework the logic here by improving error checking and reporting
		IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
		if (DesktopPlatform)
		{
			FString Filter = TEXT("Renderdoc executable|renderdocui.exe");
			TArray<FString> OutFiles;
			if (DesktopPlatform->OpenFileDialog(NULL, TEXT("Locate main Renderdoc executable..."), TEXT(""), TEXT(""), Filter, EFileDialogFlags::None, OutFiles))
				RenderdocPath = OutFiles[0];
		}
		RenderdocPath = FPaths::GetPath(RenderdocPath);
		RenderDocDLL = LoadAndCheckRenderDocLibrary(RenderDocAPI, RenderdocPath);
		if (RenderDocDLL)
			UpdateConfigFiles(RenderdocPath);
	}

	// 4) All bets are off; aborting...
	if (!RenderDocDLL)
	{
		UE_LOG(RenderDocPlugin, Error, TEXT("unable to initialize the plugin because no RenderDoc libray has been located."));
		return;
	}

	UE_LOG(RenderDocPlugin, Log, TEXT("plugin has been loaded successfully."));
}
开发者ID:slomp,项目名称:UE4RenderDocPlugin,代码行数:64,代码来源:RenderDocPluginLoader.cpp


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