Files
UnrealEngineUWP/Engine/Source/Editor/StatsViewer/Private/StatsEntries/StaticMeshLightingInfo.cpp
ryan durand 627baf970a Updating copyright for Engine Editor.
#rnx
#rb none


#ROBOMERGE-SOURCE: CL 10869241 via CL 10869527 via CL 10869904
#ROBOMERGE-BOT: (v613-10869866)

[CL 10870586 by ryan durand in Main branch]
2019-12-26 15:33:43 -05:00

58 lines
1.4 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "StaticMeshLightingInfo.h"
#include "UObject/Package.h"
#include "GameFramework/Actor.h"
#include "Model.h"
#include "Lightmass/LightmappedSurfaceCollection.h"
#define LOCTEXT_NAMESPACE "Editor.StatsViewer"
UStaticMeshLightingInfo::UStaticMeshLightingInfo(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
void UStaticMeshLightingInfo::UpdateNames()
{
if ( LevelName.Len() == 0 || StaticMeshActor.IsValid() )
{
AActor* Actor = Cast<AActor>(StaticMeshActor.Get());
ULightmappedSurfaceCollection* SurfaceCollection = Cast<ULightmappedSurfaceCollection>(StaticMeshActor.Get());
if (SurfaceCollection && SurfaceCollection->SourceModel)
{
LevelName = SurfaceCollection->SourceModel->GetOutermost()->GetName();
}
else if (Actor)
{
LevelName = Actor->GetLevel()->GetOutermost()->GetName();
}
else if (StaticMeshActor.Get())
{
LevelName = StaticMeshActor.Get()->GetOutermost()->GetName();
}
else
{
LevelName = TEXT("<None>");
}
const int32 NameIndex = LevelName.Find( TEXT("/"), ESearchCase::CaseSensitive);
if ( NameIndex != INDEX_NONE )
{
LevelName.RightChopInline( NameIndex + 1, false );
}
}
if( bTextureMapping )
{
TextureMapping = LOCTEXT("LightingUsesTextureMapping", "Texture" ).ToString();
}
else
{
TextureMapping = LOCTEXT("LightingUsesVertexMapping", "Vertex" ).ToString();
}
}
#undef LOCTEXT_NAMESPACE