本文整理汇总了C++中UStaticMeshComponent::GetMaterials方法的典型用法代码示例。如果您正苦于以下问题:C++ UStaticMeshComponent::GetMaterials方法的具体用法?C++ UStaticMeshComponent::GetMaterials怎么用?C++ UStaticMeshComponent::GetMaterials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UStaticMeshComponent
的用法示例。
在下文中一共展示了UStaticMeshComponent::GetMaterials方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Export
void UJanusExporterTool::Export()
{
TArray<UObject*> ObjectsToExport;
FString Root = FString(ExportPath); // copy so we dont mess with the original reference
FString Index = "<html>\n\t<head>\n\t\t<title>Unreal Export</title>\n\t</head>\n\t<body>\n\t\t<FireBoxRoom>\n\t\t\t<Assets>";
TArray<AActor*> ActorsExported;
TArray<UStaticMesh*> StaticMeshesExp;
TArray<FString> TexturesExp;
TArray<FString> MaterialsExported;
for (TObjectIterator<AActor> Itr; Itr; ++Itr)
{
AActor *Actor = *Itr;
FString Name = Actor->GetName();
/*if (!Name.StartsWith("SM_Floor_R"))
{
continue;
}*/
if (Actor->IsHiddenEd())
{
continue;
}
ActorsExported.Add(Actor);
TArray<UStaticMeshComponent*> StaticMeshes;
Actor->GetComponents<UStaticMeshComponent>(StaticMeshes);
for (int32 i = 0; i < StaticMeshes.Num(); i++)
{
UStaticMeshComponent* Component = StaticMeshes[i];
UStaticMesh *Mesh = Component->StaticMesh;
if (!Mesh)
{
continue;
}
if (Component->LODData.Num() > 0)
//if (false)
{
FStaticMeshComponentLODInfo* LODInfo = &Component->LODData[0];
FLightMap* LightMap = LODInfo->LightMap;
FShadowMap* ShadowMap = LODInfo->ShadowMap;
if (LightMap != NULL)
{
FLightMap2D* LightMap2D = LightMap->GetLightMap2D();
UTexture2D* Texture = LightMap2D->GetTexture(0); // 0 = HQ LightMap
FString TexName = Texture->GetName();
if (TexturesExp.Contains(TexName))
{
continue;
}
TexturesExp.Add(TexName);
ExportPNG(Texture, Root);
}
if (ShadowMap != NULL)
{
FShadowMap2D* ShadowMap2D = ShadowMap->GetShadowMap2D();
UShadowMapTexture2D* ShadowTex = ShadowMap2D->GetTexture();
FString TexName = ShadowTex->GetName();
if (TexturesExp.Contains(TexName))
{
continue;
}
TexturesExp.Add(TexName);
ExportPNG(ShadowTex, Root);
}
}
if (!StaticMeshesExp.Contains(Mesh))
{
StaticMeshesExp.Add(Mesh);
ExportFBX(Mesh, Root);
}
TArray<UMaterialInterface*> Materials = Component->GetMaterials();
for (int32 j = 0; j < Materials.Num(); j++)
{
UMaterialInterface* Material = Materials[j];
if (!Material)
{
continue;
}
FString MatName = Material->GetName();
if (MaterialsExported.Contains(MatName))
{
continue;
}
MaterialsExported.Add(MatName);
ExportMaterial(Root, Material, &TexturesExp);
}
}
//.........这里部分代码省略.........