Unreal/CarlaUE4/Plugins/RoadRunnerImporter/Source/RoadRunnerImporter/Private/RoadRunnerImportUtil.cpp
////////////////////////////////////////////////////////////////////////////////
// Helper function to set texture parameter in a material instance
Helper function to set texture parameter in a material instance
Helper function to set texture parameter in a material instance
void FRoadRunnerImportUtil::SetTextureParameter(UMaterialInstanceConstant* material,
	const FName& paramName, const FString& baseFilePath, const FString& texturePath, const FString& packagePath)
{
	if (texturePath.IsEmpty())
		return;
	FString texFileAbsPath = FPaths::ConvertRelativePathToFull(baseFilePath / texturePath);
	UTexture * texture = FindTexture(texFileAbsPath, packagePath);
	if (texture)
	{
#if ENGINE_MINOR_VERSION > 18
		material->SetTextureParameterValueEditorOnly(FMaterialParameterInfo(paramName, EMaterialParameterAssociation::GlobalParameter), texture);
#else
		material->SetTextureParameterValueEditorOnly(paramName, texture);
#endif
	}
}
void FRoadRunnerImportUtil :: SetTextureParameter ( UMaterialInstanceConstant * material , const FName & paramName , const FString & baseFilePath , const FString & texturePath , const FString & packagePath ) { if ( texturePath . IsEmpty ( ) ) return ; FString texFileAbsPath = FPaths :: ConvertRelativePathToFull ( baseFilePath / texturePath ) ; UTexture * texture = FindTexture ( texFileAbsPath , packagePath ) ; if ( texture ) { #if ENGINE_MINOR_VERSION > 18 material -> SetTextureParameterValueEditorOnly ( FMaterialParameterInfo ( paramName , EMaterialParameterAssociation :: GlobalParameter ) , texture ) ; #else material -> SetTextureParameterValueEditorOnly ( paramName , texture ) ; #endif } }
Helper function to set texture parameter in a material instance
Helper function to set texture parameter in a material instance