diff --git a/Source/NDisplayLaunchButton/Private/NDisplayLaunchButton.cpp b/Source/NDisplayLaunchButton/Private/NDisplayLaunchButton.cpp index 0f2152e97cc2399addbaed3898de921f37ad607d..41335daa3348c76417bdad08990a5f1abf32aad2 100644 --- a/Source/NDisplayLaunchButton/Private/NDisplayLaunchButton.cpp +++ b/Source/NDisplayLaunchButton/Private/NDisplayLaunchButton.cpp @@ -117,6 +117,60 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked() GEngine->AddOnScreenDebugMessage(-1, 3, FColor::White, TEXT("The Button is set to do nothing.")); return; } + FString InsightParameters = ""; + if(Settings->bEnableInsights) + { + if (Settings->bStatNamedEvents) + { + InsightParameters.Append("-statnamedevents"); + } + FString TraceChannels = ""; + if (Settings->bLog) + { + TraceChannels.Append("log,"); + } + if (Settings->bBookmark) + { + TraceChannels.Append("bookmark,"); + } + if (Settings->bFrame) + { + TraceChannels.Append("frame,"); + } + if (Settings->bCPU) + { + TraceChannels.Append("cpu,"); + } + if (Settings->bGPU) + { + TraceChannels.Append("gpu,"); + } + if (Settings->bLoadTime) + { + TraceChannels.Append("loadtime,"); + } + if (Settings->bFile) + { + TraceChannels.Append("file,"); + } + if (Settings->bNet) + { + TraceChannels.Append("net,"); + } + if (TraceChannels.Len() > 0) + { + // There's probably a better way of doing this... + TraceChannels.RemoveFromEnd(","); + InsightParameters.Append(" -trace="); + InsightParameters.Append(TraceChannels); + } + if (Settings->TracehostIP.Len() > 0) + { + InsightParameters.Append(" -tracehost="); + InsightParameters.Append(Settings->TracehostIP); + } + InsightParameters.RemoveFromStart(" "); + } /* Disable Plugins temporarily */ if(!ChangePluginStateAndStoreConfig("SteamVR", false, SteamVRState)) return; @@ -140,7 +194,7 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked() if (Settings->StartDTrack) SendToDTrack(Settings->DTrackIP, Settings->DTrackPort, "dtrack2 tracking start\0"); if (Settings->SwitchProjector) ModeFromBefore = SwitchProjectorToState(Settings->ProjectorIP, Settings->ProjectorPort, Settings->ProjectorType); - FProcHandle Instance = FPlatformProcess::CreateProc(*GetEditorExecutableName(), *(Parameters + " " + Settings->ROLVLaunchParameters), true, false, false, nullptr, 0, nullptr, nullptr); + FProcHandle Instance = FPlatformProcess::CreateProc(*GetEditorExecutableName(), *(Parameters + " " + InsightParameters + " " + Settings->ROLVLaunchParameters), true, false, false, nullptr, 0, nullptr, nullptr); FPlatformProcess::WaitForProc(Instance); if (Settings->StartVRPN) FPlatformProcess::TerminateProc(VRPN); @@ -164,13 +218,13 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked() FProcHandle Processes[Num_Nodes]; for (int i = 0; i < Num_Nodes; i++) { - Processes[i] = FPlatformProcess::CreateProc(*GetEditorExecutableName(), *(Parameters + " " + Windows_Node_Specific_Commands[i]), true, false, false, nullptr, 0, nullptr, nullptr); + Processes[i] = FPlatformProcess::CreateProc(*GetEditorExecutableName(), *(Parameters + " " + InsightParameters + " " + Windows_Node_Specific_Commands[i]), true, false, false, nullptr, 0, nullptr, nullptr); } FPlatformProcess::WaitForProc(Processes[0]); //wait for only one of them } else if (Settings->LaunchType == ButtonLaunchType_TWO_SCREEN) { - const FString Parameters = FString::Printf(TEXT("\"%s\" -game dc_cfg=\"%s\" %s"),*FPaths::GetProjectFilePath(), *GetConfigPath("twoscreen"), *Settings->TwoScreenLaunchParameters); + const FString Parameters = FString::Printf(TEXT("\"%s\" -tracehost=127.0.0.1 -game dc_cfg=\"%s\" %s"),*FPaths::GetProjectFilePath(), *GetConfigPath("twoscreen"), *Settings->TwoScreenLaunchParameters); const int Num_Nodes = 2; FString Windows_Node_Specific_Commands[Num_Nodes] = { @@ -181,7 +235,7 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked() FProcHandle Processes[Num_Nodes]; for (int i = 0; i < Num_Nodes; i++) { - Processes[i] = FPlatformProcess::CreateProc(*GetEditorExecutableName(), *(Parameters + " " + Windows_Node_Specific_Commands[i]), true, false, false, nullptr, 0, nullptr, nullptr); + Processes[i] = FPlatformProcess::CreateProc(*GetEditorExecutableName(), *(Parameters + " " + InsightParameters + " " + Windows_Node_Specific_Commands[i]), true, false, false, nullptr, 0, nullptr, nullptr); } FPlatformProcess::WaitForProc(Processes[0]); //wait for only one of them } @@ -192,7 +246,8 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked() *("\"" + (FPaths::ConvertRelativePathToFull(".") + "/UE4Editor\"") + " " + FPaths::ConvertRelativePathToFull(FPaths::GetProjectFilePath()) + " " + FString::FromInt(FEngineVersion::Current().GetMajor()) - + FString::FromInt(FEngineVersion::Current().GetMinor())), + + FString::FromInt(FEngineVersion::Current().GetMinor()) + + InsightParameters), // Test this true, false, false, nullptr, 0, nullptr, nullptr); FPlatformProcess::WaitForProc(Instance); } diff --git a/Source/NDisplayLaunchButton/Public/NDisplayLaunchButtonSettings.h b/Source/NDisplayLaunchButton/Public/NDisplayLaunchButtonSettings.h index fd45cae835cdbe1caafde73eaf6928dd1a2058da..ccac9e53012c25a858f1f30e2bf9f2a12fb133f0 100644 --- a/Source/NDisplayLaunchButton/Public/NDisplayLaunchButtonSettings.h +++ b/Source/NDisplayLaunchButton/Public/NDisplayLaunchButtonSettings.h @@ -33,6 +33,9 @@ public: UPROPERTY(EditAnywhere, config, Category = "General", meta = (DisplayName = "Start ")) TEnumAsByte<ButtonLaunchType> LaunchType = ButtonLaunchType_MiniCAVE; + UPROPERTY(EditAnywhere, config, Category = "General", meta = (DisplayName = "Unreal Insights ")) + bool bEnableInsights = false; + /* * TwoScreen Options */ @@ -106,4 +109,37 @@ public: FString DTrackIP; UPROPERTY(EditAnywhere, config, Category = "General|ROLV|DTRACK", meta = (DisplayName = "DTrack Port", EditCondition="LaunchType==ButtonLaunchType::ButtonLaunchType_ROLV && StartDTrack")) int DTrackPort = 50105; + + /* + * Insights Options + */ + UPROPERTY(EditAnywhere, config, Category = "General|Insights", meta = (DisplayName = "statnamedevents", EditCondition = "bEnableInsights==true")) + bool bStatNamedEvents = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Trace Channels", meta = (DisplayName = "Log", EditCondition = "bEnableInsights==true")) + bool bLog = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Trace Channels", meta = (DisplayName = "Bookmark", EditCondition = "bEnableInsights==true")) + bool bBookmark = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Trace Channels", meta = (DisplayName = "Frame", EditCondition = "bEnableInsights==true")) + bool bFrame = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Trace Channels", meta = (DisplayName = "CPU", EditCondition = "bEnableInsights==true")) + bool bCPU = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Trace Channels", meta = (DisplayName = "GPU", EditCondition = "bEnableInsights==true")) + bool bGPU = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Trace Channels", meta = (DisplayName = "LoadTime", EditCondition = "bEnableInsights==true")) + bool bLoadTime = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Trace Channels", meta = (DisplayName = "File", EditCondition = "bEnableInsights==true")) + bool bFile = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Trace Channels", meta = (DisplayName = "Net", EditCondition = "bEnableInsights==true")) + bool bNet = true; + + UPROPERTY(EditAnywhere, config, Category = "General|Insights|Tracehost", meta = (DisplayName = "Tracehost IP", EditCondition = "bEnableInsights==true")) + FString TracehostIP = "127.0.0.1"; };