From fa5cbcd02b83bb0b1daf136ba1f4bf29348b4359 Mon Sep 17 00:00:00 2001
From: Bastien Montagne <montagne29@wanadoo.fr>
Date: Fri, 28 Mar 2014 18:11:50 +0100
Subject: [PATCH] Fix T39487: Index Of Refraction when export to obj

Patch by Zer0 (vince), many thanks! :)
---
 io_scene_obj/export_obj.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index 9d0f03c50..b4c779d2f 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -84,8 +84,8 @@ def write_mtl(scene, filepath, path_mode, copy_set, mtl_dict):
             fw('Ka %.6f %.6f %.6f\n' % (mat.ambient * world_amb)[:])  # Ambient, uses mirror color,
             fw('Kd %.6f %.6f %.6f\n' % (mat.diffuse_intensity * mat.diffuse_color)[:])  # Diffuse
             fw('Ks %.6f %.6f %.6f\n' % (mat.specular_intensity * mat.specular_color)[:])  # Specular
-            if hasattr(mat, "ior"):
-                fw('Ni %.6f\n' % mat.ior)  # Refraction index
+            if hasattr(mat, "raytrace_transparency") and hasattr(mat.raytrace_transparency, "ior"):
+                fw('Ni %.6f\n' % mat.raytrace_transparency.ior)  # Refraction index
             else:
                 fw('Ni %.6f\n' % 1.0)
             fw('d %.6f\n' % mat.alpha)  # Alpha (obj uses 'd' for dissolve)
-- 
GitLab