Skip to content

Commit

Permalink
Fix build mesh operation
Browse files Browse the repository at this point in the history
StaticMeshSourceModel requires StaticMeshOwner.
It set through AddSourceModel, so don't create it directly.
  • Loading branch information
mik14a committed Jul 14, 2020
1 parent 19e6569 commit e463bdb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Source/VOX4UEditor/Private/VoxelFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,9 @@ UVoxel* UVoxelFactory::CreateVoxel(UObject* InParent, FName InName, EObjectFlags
UStaticMesh* UVoxelFactory::BuildStaticMesh(UStaticMesh* OutStaticMesh, FRawMesh& RawMesh) const
{
check(OutStaticMesh);
TArray<FStaticMeshSourceModel>& SourceModels = OutStaticMesh->GetSourceModels();
FStaticMeshSourceModel* StaticMeshSourceModel = new(SourceModels) FStaticMeshSourceModel();
StaticMeshSourceModel->BuildSettings = ImportOption->GetBuildSettings();
StaticMeshSourceModel->RawMeshBulkData->SaveRawMesh(RawMesh);
FStaticMeshSourceModel& StaticMeshSourceModel = OutStaticMesh->AddSourceModel();
StaticMeshSourceModel.BuildSettings = ImportOption->GetBuildSettings();
StaticMeshSourceModel.RawMeshBulkData->SaveRawMesh(RawMesh);
TArray<FText> Errors;
OutStaticMesh->Build(false, &Errors);
return OutStaticMesh;
Expand Down

0 comments on commit e463bdb

Please sign in to comment.