Unreal/CarlaUE4/Plugins/RoadRunnerImporter/Source/RoadRunnerImporter/Private/RoadRunnerImportUtil.cpp
////////////////////////////////////////////////////////////////////////////////
// Find the texture based off the import path and filename
Find the texture based off the import path and filename
Find the texture based off the import path and filename
UTexture* FRoadRunnerImportUtil::FindTexture(FString absFilePath, FString packagePath)
{
	if (absFilePath.IsEmpty())
	{
		return nullptr;
	}
	FString textureName = FPaths::GetBaseFilename(absFilePath);
	textureName = ObjectTools::SanitizeObjectName(textureName);
	FString basePackageName = FPackageName::GetLongPackagePath(packagePath) / textureName;
	basePackageName = PackageTools::SanitizePackageName(basePackageName);
	FString objectPath = basePackageName + TEXT(".") + textureName;
	UTexture2D* existingTexture = LoadObject<UTexture2D>(NULL, *objectPath, nullptr, LOAD_Quiet | LOAD_NoWarn);
	return existingTexture;
}
UTexture * FRoadRunnerImportUtil :: FindTexture ( FString absFilePath , FString packagePath ) { if ( absFilePath . IsEmpty ( ) ) { return nullptr ; } FString textureName = FPaths :: GetBaseFilename ( absFilePath ) ; textureName = ObjectTools :: SanitizeObjectName ( textureName ) ; FString basePackageName = FPackageName :: GetLongPackagePath ( packagePath ) / textureName ; basePackageName = PackageTools :: SanitizePackageName ( basePackageName ) ; FString objectPath = basePackageName + TEXT ( " " ) + textureName ; UTexture2D * existingTexture = LoadObject < UTexture2D > ( NULL , * objectPath , nullptr , LOAD_Quiet | LOAD_NoWarn ) ; return existingTexture ; }
Find the texture based off the import path and filename
Find the texture based off the import path and filename
// Name the texture with file name // Set where to find the texture in the project // Try to get the object from the package