コード例 #1
0
ファイル: SCAQueryTableRow.cpp プロジェクト: Codermay/Unreal4
FText SCAQueryTableRow::GetTotalTimeText() const
{
	static const FNumberFormattingOptions TimeFormatOptions = FNumberFormattingOptions()
		.SetMinimumFractionalDigits(3)
		.SetMaximumFractionalDigits(3);

	check(Item->bIsGroup)
	return FText::AsNumber(Item->TotalCPUTime, &TimeFormatOptions);
}
コード例 #2
0
ファイル: SDataGraph.cpp プロジェクト: kidaa/UnrealEngineVR
	FText SummaryInformation_GetSummary() const
	{
		FText SummaryText = LOCTEXT("DataGraphSummary_Warning", "Not implemented yet");
		const bool bCanDisplayData = GraphDescription.CombinedGraphDataSource->CanBeDisplayedAsIndexBased() && ParentWidget->GetViewMode() == EDataGraphViewModes::Index;

		const uint32 FrameIndex = OnGetMouseFrameIndex.IsBound() ? (uint32)OnGetMouseFrameIndex.Execute() : 0;
		const FGraphDataSourceRefConst* GraphDataSource = GraphDescription.CombinedGraphDataSource->GetFirstSource();

		if( bCanDisplayData && GraphDataSource && FrameIndex < (*GraphDataSource)->GetNumFrames() )
		{
			const double SampleValue = (*GraphDataSource)->GetValueFromIndex( FrameIndex );
			const EProfilerSampleTypes::Type UnitType = (*GraphDataSource)->GetSampleType();
			const FProfilerAggregatedStat& Aggregated = *(*GraphDataSource)->GetAggregatedStat();

			static const FNumberFormattingOptions SampleValueFormattingOptions = FNumberFormattingOptions()
				.SetMinimumFractionalDigits(2)
				.SetMaximumFractionalDigits(2);

			SummaryText = FText::Format(LOCTEXT("DataGraphSummary_SummaryFmt", "{0} - {1}"), FText::AsNumber(SampleValue, &SampleValueFormattingOptions), FText::FromString(Aggregated.ToString()));
		}

		return SummaryText;
	}
コード例 #3
0
	BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
	virtual TSharedRef<SWidget> GenerateWidgetForColumn(const FName& ColumnName) override
	{
		// Get info to apply to all columns (color and tooltip)
		FSlateColor ResultColor = FSlateColor::UseForeground();
		FText TooltipText = FText::GetEmpty();
		if(Info->bMiss)
		{
			ResultColor = FLinearColor(0.4f,0.4f,0.65f);
			TooltipText = FText::Format(LOCTEXT("MissToolTipFmt", "Miss: {0}"), GetReasonForMiss(Info->Result.Component.Get(), OwnerDetailsPtr.Pin()->GetCurrentQuery()));
		}
		else if(Info->Result.bBlockingHit && Info->Result.bStartPenetrating)
		{
			ResultColor = FLinearColor(1.f,0.25f,0.25f);
		}


		// Generate widget for column
		if (ColumnName == TEXT("Time"))
		{
			static const FNumberFormattingOptions TimeNumberFormat = FNumberFormattingOptions()
				.SetMinimumFractionalDigits(3)
				.SetMaximumFractionalDigits(3);

			return	SNew(STextBlock)
					.ColorAndOpacity( ResultColor )
					.ToolTipText( TooltipText )
					.Text( FText::AsNumber(Info->Result.Time, &TimeNumberFormat) );
		}
		else if (ColumnName == TEXT("Type"))
		{
			FText TypeText = FText::GetEmpty();
			if(Info->bMiss)
			{
				TypeText = LOCTEXT("MissLabel", "Miss");
			}
			else if(Info->Result.bBlockingHit)
			{
				TypeText = LOCTEXT("BlockLabel", "Block");
			}
			else
			{
				TypeText = LOCTEXT("TouchLabel", "Touch");
			}

			return	SNew(STextBlock)
					.ColorAndOpacity( ResultColor )
					.ToolTipText( TooltipText )
					.Text( TypeText );
		}
		else if (ColumnName == TEXT("Component"))
		{
			FText LongName = LOCTEXT("InvalidLabel", "Invalid");
			if(Info->Result.Component.IsValid())
			{
				LongName = FText::FromString(Info->Result.Component.Get()->GetReadableName());
			}

			return	SNew(STextBlock)
					.ColorAndOpacity( ResultColor )
					.ToolTipText( TooltipText )
					.Text( LongName );
		}
		else if (ColumnName == TEXT("Normal"))
		{
			return	SNew(STextBlock)
					.ColorAndOpacity( ResultColor )
					.ToolTipText( TooltipText )
					.Text( FText::FromString(Info->Result.Normal.ToString()) );
		}

		return SNullWidget::NullWidget;
	}
コード例 #4
0
ファイル: SCAQueryTableRow.cpp プロジェクト: Codermay/Unreal4
TSharedRef<SWidget> SCAQueryTableRow::GenerateWidgetForColumn(const FName& ColumnName)
{
	TSharedPtr<SCollisionAnalyzer> OwnerAnalyzerWidget = OwnerAnalyzerWidgetPtr.Pin();

	// GROUP
	if(Item->bIsGroup)
	{
		if (ColumnName == TEXT("ID"))
		{
			return	SNew(SExpanderArrow, SharedThis(this));
		}
		else if (ColumnName == TEXT("Frame") && OwnerAnalyzerWidget->GroupBy == EQueryGroupMode::ByFrameNum)
		{
			return	SNew(STextBlock)
					.Font(FEditorStyle::GetFontStyle("BoldFont"))
					.Text(FText::AsNumber(Item->FrameNum));
		}
		else if (ColumnName == TEXT("Tag") && OwnerAnalyzerWidget->GroupBy == EQueryGroupMode::ByTag)
		{
			return	SNew(STextBlock)
					.Font(FEditorStyle::GetFontStyle("BoldFont"))
					.Text(FText::FromName(Item->GroupName));
		}
		else if (ColumnName == TEXT("Owner") && OwnerAnalyzerWidget->GroupBy == EQueryGroupMode::ByOwnerTag)
		{
			return	SNew(STextBlock)
					.Font(FEditorStyle::GetFontStyle("BoldFont"))
					.Text(FText::FromName(Item->GroupName));
		}
		else if (ColumnName == TEXT("Time"))
		{
			return	SNew(STextBlock)
					.Font(FEditorStyle::GetFontStyle("BoldFont"))
					.Text(this, &SCAQueryTableRow::GetTotalTimeText);
		}
	}
	// ITEM
	else
	{
		const int32 QueryId = Item->QueryIndex;
		if(QueryId >= OwnerAnalyzerWidget->Analyzer->Queries.Num())
		{
			return	SNew(STextBlock)
					.Text( LOCTEXT("ErrorMessage", "ERROR") );
		}

		FCAQuery& Query = OwnerAnalyzerWidget->Analyzer->Queries[QueryId];

		if (ColumnName == TEXT("ID"))
		{	
			return	SNew(STextBlock)
					.Text( FText::AsNumber(QueryId) );
		}
		else if (ColumnName == TEXT("Frame"))
		{
			return	SNew(STextBlock)
					.Text( FText::AsNumber(Query.FrameNum) );
		}
		else if (ColumnName == TEXT("Type"))
		{
			return	SNew(STextBlock)
					.Text(FText::FromString(SCollisionAnalyzer::QueryTypeToString(Query.Type)));
		}
		else if (ColumnName == TEXT("Shape"))
		{
			return	SNew(STextBlock)
					.Text(FText::FromString(SCollisionAnalyzer::QueryShapeToString(Query.Shape)));
		}
		else if (ColumnName == TEXT("Tag"))
		{
			return	SNew(STextBlock)
					.Text(FText::FromName(Query.Params.TraceTag));
		}
		else if (ColumnName == TEXT("Owner"))
		{
			return	SNew(STextBlock)
					.Text(FText::FromName(Query.Params.OwnerTag));
		}
		else if (ColumnName == TEXT("NumBlock"))
		{
			FHitResult* FirstHit = FHitResult::GetFirstBlockingHit(Query.Results);
			bool bStartPenetrating = (FirstHit != NULL) && FirstHit->bStartPenetrating;
			// Draw number in red if we start penetrating
			return	SNew(STextBlock)
					.Text(FText::AsNumber(FHitResult::GetNumBlockingHits(Query.Results)))
					.ColorAndOpacity(bStartPenetrating ? FLinearColor(1.f,0.25f,0.25f) : FSlateColor::UseForeground() );
		}
		else if (ColumnName == TEXT("NumTouch"))
		{
			return	SNew(STextBlock)
					.Text(FText::AsNumber(FHitResult::GetNumOverlapHits(Query.Results)));
		}
		else if (ColumnName == TEXT("Time"))
		{
			static const FNumberFormattingOptions TimeFormatOptions = FNumberFormattingOptions()
				.SetMinimumFractionalDigits(3)
				.SetMaximumFractionalDigits(3);

			return	SNew(STextBlock)
					.Text(FText::AsNumber(Query.CPUTime, &TimeFormatOptions));
		}
	}

	return SNullWidget::NullWidget;
}