Skip to content
Permalink
Browse files

[Assimp] Added error details if something went wrong (and test if sce…

…ne is null to avoid NullReferenceException).
  • Loading branch information
xen2 committed May 27, 2019
1 parent abef0e8 commit fed4c1c95a2bb5fd8d9055f3010c2baaa722f953
@@ -68,6 +68,8 @@ public override IEnumerable<AssetItem> Import(UFile localPath, AssetImporterPara
var rawAssetReferences = new List<AssetItem>(); // the asset references without subdirectory path

var entityInfo = GetEntityInfo(localPath, importParameters.Logger, importParameters);
if (entityInfo == null)
return rawAssetReferences;

//var isImportingEntity = importParameters.IsTypeSelectedForOutput<PrefabAsset>();

@@ -1451,6 +1451,19 @@ public ref class MeshConverter
aiProcess_SortByPType
| aiProcess_RemoveRedundantMaterials);

// If scene is null, something went wrong inside Assimp
if (scene == nullptr)
{
if (strlen(importer.GetErrorString()) > 0)
{
// Extract error details from Assimp
auto error = gcnew String(importer.GetErrorString());
Logger->Error(String::Format("Assimp: {0}", error),
CallerInfo::Get(__FILEW__, __FUNCTIONW__, __LINE__));
}
return nullptr;
}

std::map<aiMaterial*, std::string> materialNames;
std::map<aiMesh*, std::string> meshNames;
std::map<aiAnimation*, std::string> animationNames;

0 comments on commit fed4c1c

Please sign in to comment.
You can’t perform that action at this time.