mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
Gracefully handle unknown entity classes.
Unfortunately, the classname gets lost to blender at this stage, but I have an idea for how to handle that.
This commit is contained in:
parent
54832740c8
commit
154d08a9c7
2 changed files with 10 additions and 3 deletions
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue