Files
UnrealEngineUWP/Engine/Source/Editor/StatsViewer/Private/StatsEntries/LightingBuildInfo.cpp
2014-03-14 14:13:41 -04:00

48 lines
1.3 KiB
C++

// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
#include "StatsViewerPrivatePCH.h"
#include "LightingBuildInfo.h"
ULightingBuildInfo::ULightingBuildInfo(const class FPostConstructInitializeProperties& PCIP)
: Super(PCIP)
{
}
void ULightingBuildInfo::Set( TWeakObjectPtr<UObject> InObject, double InLightingTime, float InUnmappedTexelsPercentage, int32 InUnmappedTexelsMemory, int32 InTotalTexelMemory )
{
Object = InObject;
LightingTime = (float)InLightingTime;
UnmappedTexelsPercentage = InUnmappedTexelsPercentage;
UnmappedTexelsMemory = (float)InUnmappedTexelsMemory / 1024.0f;
TotalTexelMemory = (float)InTotalTexelMemory / 1024.0f;
UpdateNames();
}
void ULightingBuildInfo::UpdateNames()
{
if( Object.IsValid() )
{
AActor* Actor = Cast<AActor>(Object.Get());
ULightmappedSurfaceCollection* SurfaceCollection = Cast<ULightmappedSurfaceCollection>(Object.Get());
if (SurfaceCollection && SurfaceCollection->SourceModel)
{
LevelName = SurfaceCollection->SourceModel->GetOutermost()->GetName();
}
else if (Actor)
{
LevelName = Actor->GetLevel()->GetOutermost()->GetName();
}
else
{
LevelName = Object->GetOutermost()->GetName();
}
const int32 NameIndex = LevelName.Find( TEXT("/") );
if ( NameIndex != INDEX_NONE )
{
LevelName = LevelName.RightChop( NameIndex + 1 );
}
}
}