diff --git a/Source/NDisplayLaunchButton/Private/NDisplayLaunchButton.cpp b/Source/NDisplayLaunchButton/Private/NDisplayLaunchButton.cpp index 5e58f220fdb1a7a818b815ef53ed76df4b9933d6..c400aed5ab2ac0f6dd546af40c51b2c8036eb352 100644 --- a/Source/NDisplayLaunchButton/Private/NDisplayLaunchButton.cpp +++ b/Source/NDisplayLaunchButton/Private/NDisplayLaunchButton.cpp @@ -138,6 +138,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; @@ -161,7 +215,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); @@ -185,7 +239,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 */ @@ -204,7 +258,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 */ @@ -212,7 +266,7 @@ void FNDisplayLaunchButtonModule::PluginButtonClicked() } else if (Settings->LaunchType == ButtonLaunchType_TDW) { - const FString Parameters = FString::Printf(TEXT("\"%s\" -game dc_cfg=\"%s\" %s"),*FPaths::GetProjectFilePath(), *GetConfigPath("tileddisplaywall"), *Settings->TiledDisplayWallLaunchParameters); + const FString Parameters = FString::Printf(TEXT("\"%s\" -game dc_cfg=\"%s\" %s"),*FPaths::GetProjectFilePath(), *GetConfigPath("tileddisplaywall") ,*Settings->TiledDisplayWallLaunchParameters); const int Num_Nodes = 6; FString Windows_Node_Specific_Commands[Num_Nodes] = { @@ -227,7 +281,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 */ @@ -240,7 +294,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 4c9ccc44b1b29908ea7070edd420849b1fa1c14f..187ffd80fef402dc5fd1cd709355877beadb9052 100644 --- a/Source/NDisplayLaunchButton/Public/NDisplayLaunchButtonSettings.h +++ b/Source/NDisplayLaunchButton/Public/NDisplayLaunchButtonSettings.h @@ -34,6 +34,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 */ @@ -131,4 +134,28 @@ public: UPROPERTY(EditAnywhere, config, Category = "General|TiledDisplayWall|Log", meta = (DisplayName = "Write Log for BR-Node to Project Directory", EditCondition="LaunchType==ButtonLaunchType::ButtonLaunchType_TDW")) bool TiledDisplayWallLogToProjectDirBR = false; + /* + * Insights Options + */ + UPROPERTY(EditAnywhere, config, Category = "General|Insights", meta = (DisplayName = "Stat Named Events", EditCondition = "bEnableInsights==true")) + bool bStatNamedEvents = true; + UPROPERTY(EditAnywhere, config, Category = "General|Insights", meta = (DisplayName = "Tracehost IP", EditCondition = "bEnableInsights==true")) + FString TracehostIP = "127.0.0.1"; + + 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; };