Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions XP_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down