diff --git a/tools/io_qfmap/entity.py b/tools/io_qfmap/entity.py index aa916c411..ef3b8a0e9 100644 --- a/tools/io_qfmap/entity.py +++ b/tools/io_qfmap/entity.py @@ -229,7 +229,11 @@ def entity_box(entityclass): def set_entity_props(obj, ent): qfe = obj.qfentity if "classname" in ent.d: - qfe.classname = ent.d["classname"] + try: + qfe.classname = ent.d["classname"] + except TypeError: + #FIXME hmm, maybe an enum wasn't the most brilliant idea? + qfe.classname if "spawnflags" in ent.d: flags = int(float(ent.d["spawnflags"])) for i in range(12): diff --git a/tools/io_qfmap/import_map.py b/tools/io_qfmap/import_map.py index 7aee35bec..745ab3d12 100644 --- a/tools/io_qfmap/import_map.py +++ b/tools/io_qfmap/import_map.py @@ -108,7 +108,6 @@ def build_uvs(verts, faces, texdefs): def process_entity(ent, wads): qfmap = bpy.context.scene.qfmap classname = ent.d["classname"] - entityclass = qfmap.entity_classes.entity_classes[classname] name = classname if "classname" in ent.d and ent.d["classname"][:5] == "light": light = bpy.data.lamps.new("light", 'POINT') @@ -164,7 +163,11 @@ def process_entity(ent, wads): mesh.update() obj = bpy.data.objects.new(name, mesh) else: - if entityclass.size: + try: + entityclass = qfmap.entity_classes.entity_classes[classname] + except KeyError: + entityclass = None + if entityclass and entityclass.size: mesh = entity_box(entityclass) obj = bpy.data.objects.new(name, mesh) else: