void SBlueprintProfilerView::Construct(const FArguments& InArgs) { CurrentViewType = InArgs._ProfileViewType; BlueprintEditor = InArgs._AssetEditor; // Register for Profiler toggle events FBlueprintCoreDelegates::OnToggleScriptProfiler.AddSP(this, &SBlueprintProfilerView::OnToggleProfiler); // Initialise the number format. FNumberFormattingOptions StatisticNumberFormat; StatisticNumberFormat.MinimumFractionalDigits = 4; StatisticNumberFormat.MaximumFractionalDigits = 4; StatisticNumberFormat.UseGrouping = false; FScriptPerfData::SetNumberFormattingForStats(StatisticNumberFormat); // Create the display text for the user if (GetDefault<UEditorExperimentalSettings>()->bBlueprintPerformanceAnalysisTools) { IBlueprintProfilerInterface* ProfilerInterface = FModuleManager::GetModulePtr<IBlueprintProfilerInterface>("BlueprintProfiler"); const bool bProfilerEnabled = ProfilerInterface && ProfilerInterface->IsProfilerEnabled(); StatusText = bProfilerEnabled ? LOCTEXT("ProfilerNoDataText", "The Blueprint Profiler is active but does not currently have any data to display") : LOCTEXT("ProfilerInactiveText", "The Blueprint Profiler is currently Inactive"); } else { StatusText = LOCTEXT("DisabledProfilerText", "The Blueprint Profiler is experimental and is currently not enabled in the editor preferences"); } // Create the profiler view widgets UpdateActiveProfilerWidget(); }
void SBlueprintProfilerView::OnViewSelectionChanged(const EBlueprintPerfViewType::Type NewViewType) { if (CurrentViewType != NewViewType) { CurrentViewType = NewViewType; UpdateActiveProfilerWidget(); } }
void SBlueprintProfilerView::OnGraphLayoutChanged(TWeakObjectPtr<UBlueprint> Blueprint) { UBlueprint* CurrentBP = BlueprintEditor.IsValid() ? BlueprintEditor.Pin()->GetBlueprintObj() : nullptr; if (CurrentBP == Blueprint) { UpdateStatusMessage(); UpdateActiveProfilerWidget(); } }
void SBlueprintProfilerView::Construct(const FArguments& InArgs) { BlueprintEditor = InArgs._AssetEditor; // Register for Profiler toggle events FBlueprintCoreDelegates::OnToggleScriptProfiler.AddSP(this, &SBlueprintProfilerView::OnToggleProfiler); // Remove delegate for graph structural changes IBlueprintProfilerInterface& ProfilerModule = FModuleManager::LoadModuleChecked<IBlueprintProfilerInterface>("BlueprintProfiler"); ProfilerModule.GetGraphLayoutChangedDelegate().AddSP(this, &SBlueprintProfilerView::OnGraphLayoutChanged); // Initialise the number format. FNumberFormattingOptions StatisticNumberFormat; StatisticNumberFormat.MinimumFractionalDigits = 4; StatisticNumberFormat.MaximumFractionalDigits = 4; StatisticNumberFormat.UseGrouping = false; FNumberFormattingOptions TimeNumberFormat; TimeNumberFormat.MinimumFractionalDigits = 1; TimeNumberFormat.MaximumFractionalDigits = 1; TimeNumberFormat.UseGrouping = false; FScriptPerfData::SetNumberFormattingForStats(StatisticNumberFormat, TimeNumberFormat); // Create the display text for the user if (GetDefault<UEditorExperimentalSettings>()->bBlueprintPerformanceAnalysisTools) { IBlueprintProfilerInterface* ProfilerInterface = FModuleManager::GetModulePtr<IBlueprintProfilerInterface>("BlueprintProfiler"); const bool bProfilerEnabled = ProfilerInterface && ProfilerInterface->IsProfilerEnabled(); StatusText = bProfilerEnabled ? LOCTEXT("ProfilerNoDataText", "The Blueprint Profiler is active but does not currently have any data to display") : LOCTEXT("ProfilerInactiveText", "The Blueprint Profiler is currently Inactive"); } else { StatusText = LOCTEXT("DisabledProfilerText", "The Blueprint Profiler is experimental and is currently not enabled in the editor preferences"); } // Create Display Options if (!DisplayOptions.IsValid()) { DisplayOptions = MakeShareable(new FBlueprintProfilerStatOptions); } // Create the toolbar SAssignNew(ProfilerToolbar, SBlueprintProfilerToolbar) .ProfileViewType(InArgs._ProfileViewType) .DisplayOptions(DisplayOptions) .OnViewChanged(this, &SBlueprintProfilerView::OnViewChanged); // Create the profiler view widgets UpdateActiveProfilerWidget(); }
void SBlueprintProfilerView::OnToggleProfiler(bool bEnabled) { StatusText = bEnabled ? LOCTEXT("ProfilerNoDataText", "The Blueprint Profiler is active but does not currently have any data to display") : LOCTEXT("ProfilerInactiveText", "The Blueprint Profiler is currently Inactive"); UpdateActiveProfilerWidget(); }
void SBlueprintProfilerView::OnToggleProfiler(bool bEnabled) { UpdateStatusMessage(); UpdateActiveProfilerWidget(); }
void SBlueprintProfilerView::OnViewChanged() { UpdateActiveProfilerWidget(); }