diff --git a/XP_import.py b/XP_import.py index 97cea09..774bc69 100644 --- a/XP_import.py +++ b/XP_import.py @@ -26,7 +26,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. # -#--------------------------------------------------------------------------- +#--------------------------------------------------------------------------- import bpy import bmesh @@ -66,8 +66,9 @@ def createMeshFromData(self, name, origin, verts, faces, material, vert_uvs, ver # Create mesh from given verts, faces. me.from_pydata(verts, [], faces) - # Assign the Material to the object - me.materials.append(material) + if material: + # Assign the Material to the object + me.materials.append(material) # Assign the UV coordinates to each vertex me.uv_textures.new(name="UVMap") @@ -111,12 +112,13 @@ def run(self, origo): a_trans = [ origin_temp ] trans_available = False; objects = [] + material = None for lineStr in lines: line = lineStr.split() if (len(line) == 0): continue - if(line[0] == 'TEXTURE'): + if(line[0] == 'TEXTURE') and len(line) > 1: texfilename = line[1] # Create and add a material diff --git a/__init__.py b/__init__.py index 289471a..55d789e 100644 --- a/__init__.py +++ b/__init__.py @@ -49,7 +49,7 @@ from . import XP_import def menu_func(self, context): - self.layout.operator(XP_import.XPlaneImport.bl_idname, text="XPlane Object (.obj)") + self.layout.operator(XP_import.XPlaneImport.bl_idname, text="XPlane OLD Object (.obj)") def register(): bpy.utils.register_class(XP_import.XPlaneImport)