Skip to content
Snippets Groups Projects
Commit b4fc375c authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Merge branch 'feature/enableNDisplay' into 'develop'

Adding fix to enable nDisplay on launch and setting config stuff

See merge request VR-Group/unreal-development/NDisplayLaunchButton!6
parents 33a66ab9 cf4ed7c8
Branches
No related tags found
2 merge requests!9Update current master to develop,!6Adding fix to enable nDisplay on launch and setting config stuff
...@@ -45,6 +45,46 @@ void FNDisplayLaunchButtonModule::ShutdownModule() ...@@ -45,6 +45,46 @@ void FNDisplayLaunchButtonModule::ShutdownModule()
FNDisplayLaunchButtonCommands::Unregister(); FNDisplayLaunchButtonCommands::Unregister();
} }
/*
* Copied from DisplayClusterEditorSettings.cpp:
* Switches on the nDisplay Plugin and changes the Editor Runtime
*/
void FNDisplayLaunchButtonModule::ChangeNDisplayStateAndStoreConfig(bool NewState, bool& OldState)
{
static const FString PlatformName = FPlatformProperties::PlatformName();
static const FString DefaultEnginePath = FString::Printf(TEXT("%s/DefaultEngine.ini"), *FPaths::SourceConfigDir());
static const FString DefaultPlatformEnginePath = FString::Printf(TEXT("%s%s/%sEngine.ini"), *FPaths::SourceConfigDir(), *PlatformName, *PlatformName);
static const FString DefaultGamePath = FString::Printf(TEXT("%sDefaultGame.ini"), *FPaths::SourceConfigDir());
FString OldValue;
GConfig->GetString(TEXT("/Script/DisplayClusterEditor.DisplayClusterEditorSettings"), TEXT("bEnabled"), OldValue, DefaultEnginePath);
OldState = OldValue.ToBool();
if (NewState)
{
// DefaultEngine.ini
GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("GameEngine"), TEXT("/Script/DisplayCluster.DisplayClusterGameEngine"), DefaultPlatformEnginePath);
GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("UnrealEdEngine"), TEXT("/Script/DisplayClusterEditor.DisplayClusterEditorEngine"), DefaultPlatformEnginePath);
GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("GameViewportClientClassName"), TEXT("/Script/DisplayCluster.DisplayClusterViewportClient"), DefaultPlatformEnginePath);
// DefaultGame.ini
GConfig->SetString(TEXT("/Script/EngineSettings.GeneralProjectSettings"), TEXT("bUseBorderlessWindow"), TEXT("True"), DefaultGamePath);
}
else
{
GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("GameEngine"), TEXT("/Script/Engine.GameEngine"), DefaultPlatformEnginePath);
GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("UnrealEdEngine"), TEXT("/Script/UnrealEd.UnrealEdEngine"), DefaultPlatformEnginePath);
GConfig->SetString(TEXT("/Script/Engine.Engine"), TEXT("GameViewportClientClassName"), TEXT("/Script/Engine.GameViewportClient"), DefaultPlatformEnginePath);
// DefaultGame.ini
GConfig->SetString(TEXT("/Script/EngineSettings.GeneralProjectSettings"), TEXT("bUseBorderlessWindow"), TEXT("False"), DefaultGamePath);
}
GConfig->Flush(false, DefaultPlatformEnginePath);
GConfig->Flush(false, DefaultGamePath);
}
/** /**
* Since some plugins interfere with nDisplay execution, this function can disable them * Since some plugins interfere with nDisplay execution, this function can disable them
* @param PluginName - Name of the plugin to enable/disable * @param PluginName - Name of the plugin to enable/disable
...@@ -158,9 +198,10 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked() ...@@ -158,9 +198,10 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked()
if (Settings->TracehostIP.Len() > 0) InsightParameters.Append(FString::Printf(TEXT(" -tracehost=%s"), *Settings->TracehostIP)); if (Settings->TracehostIP.Len() > 0) InsightParameters.Append(FString::Printf(TEXT(" -tracehost=%s"), *Settings->TracehostIP));
} }
/* Disable Plugins temporarily */ /* Enable/Disable Plugins temporarily */
if(!ChangePluginStateAndStoreConfig("SteamVR", false, SteamVRState)) return; if(!ChangePluginStateAndStoreConfig("SteamVR", false, SteamVRState)) return;
if(!ChangePluginStateAndStoreConfig("OculusVR", false, OculusVRState)) return; if(!ChangePluginStateAndStoreConfig("OculusVR", false, OculusVRState)) return;
ChangeNDisplayStateAndStoreConfig(true, nDisplayState);
/* Trigger Editor save. Needed, else old version will be launched every time */ /* Trigger Editor save. Needed, else old version will be launched every time */
if (!UEditorLoadingAndSavingUtils::SaveDirtyPackagesWithDialog(true, true)) return; if (!UEditorLoadingAndSavingUtils::SaveDirtyPackagesWithDialog(true, true)) return;
...@@ -271,6 +312,7 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked() ...@@ -271,6 +312,7 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked()
/* Restore Plugin States */ /* Restore Plugin States */
ChangePluginStateAndStoreConfig("SteamVR", SteamVRState, SteamVRState); ChangePluginStateAndStoreConfig("SteamVR", SteamVRState, SteamVRState);
ChangePluginStateAndStoreConfig("OculusVR", OculusVRState, OculusVRState); ChangePluginStateAndStoreConfig("OculusVR", OculusVRState, OculusVRState);
ChangeNDisplayStateAndStoreConfig(nDisplayState, nDisplayState);
} }
/** /**
......
...@@ -20,6 +20,7 @@ public: ...@@ -20,6 +20,7 @@ public:
/** IModuleInterface implementation */ /** IModuleInterface implementation */
virtual void StartupModule() override; virtual void StartupModule() override;
virtual void ShutdownModule() override; virtual void ShutdownModule() override;
static void ChangeNDisplayStateAndStoreConfig(bool NewState, bool& OldState);
bool ChangePluginStateAndStoreConfig(FString PluginName, bool NewState, bool& OldState) const; bool ChangePluginStateAndStoreConfig(FString PluginName, bool NewState, bool& OldState) const;
static FString GetEditorExecutableName(); static FString GetEditorExecutableName();
static FString GetFilePathInProject(FString FileName); static FString GetFilePathInProject(FString FileName);
...@@ -34,4 +35,5 @@ public: ...@@ -34,4 +35,5 @@ public:
private: private:
bool SteamVRState = false; bool SteamVRState = false;
bool OculusVRState = false; bool OculusVRState = false;
bool nDisplayState = false;
}; };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment