vault backup: 2024-11-05 18:21:12
This commit is contained in:
parent
4531245b66
commit
a1f267c95e
@ -7,8 +7,39 @@ rating: ⭐
|
||||
---
|
||||
# 前言
|
||||
- StaticMesh:https://zhuanlan.zhihu.com/p/702589732
|
||||
- 其他代码
|
||||
- [RuntimeStaticMeshImporter](https://github.com/RianeDev/RuntimeStaticMeshImporter)
|
||||
- [RuntimeMeshLoader](https://github.com/Chrizey91/RuntimeMeshLoader)
|
||||
|
||||
## 相关函数
|
||||
```text
|
||||
bool FSceneImporter::ProcessMeshData(FAssetData& MeshData)
|
||||
UStaticMesh::BuildFromMeshDescription
|
||||
```
|
||||
|
||||
```c++
|
||||
FDatasmithMeshElementPayload MeshPayload;
|
||||
{
|
||||
if (!Translator->LoadStaticMesh(MeshElement, MeshPayload))
|
||||
{ // If mesh cannot be loaded, add scene's resource path if valid and retry
|
||||
bool bSecondTrySucceeded = false;
|
||||
|
||||
if (FPaths::DirectoryExists(SceneElement->GetResourcePath()) && FPaths::IsRelative(MeshElement->GetFile()))
|
||||
{ MeshElement->SetFile( *FPaths::Combine(SceneElement->GetResourcePath(), MeshElement->GetFile()) );
|
||||
bSecondTrySucceeded = Translator->LoadStaticMesh(MeshElement, MeshPayload);
|
||||
}
|
||||
if (!bSecondTrySucceeded)
|
||||
{ // #ueent_datasmithruntime: TODO : Update FAssetFactory
|
||||
ActionCounter.Add(MeshData.Referencers.Num());
|
||||
FAssetRegistry::UnregisteredAssetsData(StaticMesh, SceneKey, [](FAssetData& AssetData) -> void
|
||||
{
|
||||
AssetData.AddState(EAssetState::Completed);
|
||||
AssetData.Object.Reset();
|
||||
});
|
||||
UE_LOG(LogDatasmithRuntime, Warning, TEXT("CreateStaticMesh: Loading file %s failed. Mesh element %s has not been imported"), MeshElement->GetFile(), MeshElement->GetLabel());
|
||||
|
||||
return true;
|
||||
} }}
|
||||
|
||||
TArray< FMeshDescription >& MeshDescriptions = MeshPayload.LodMeshes;
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user