Minor robustness improvements to map importing.

Allow map parse errors to be reported propertly (the raise was for
debugging) and give up gracefully when the wad file can't be found.
This commit is contained in:
Bill Currie 2012-09-10 19:23:15 +09:00
parent 995547ae6f
commit 7204f8d90d

View file

@ -190,7 +190,6 @@ def import_map(operator, context, filepath):
try:
entities = parse_map (filepath)
except MapError as err:
raise
operator.report({'ERROR'}, repr(err))
return {'CANCELLED'}
wads=[]
@ -204,8 +203,13 @@ def import_map(operator, context, filepath):
try:
wads[i] = WadFile.load(os.path.join(wadpath, wads[i]))
except IOError:
wads[i] = WadFile.load(os.path.join(wadpath,
os.path.basename(wads[i])))
try:
wads[i] = WadFile.load(os.path.join(wadpath,
os.path.basename(wads[i])))
except IOError:
#give up
operator.report({'INFO'}, "Cant't find %s" % wads[i])
wads[i] = None
for ent in entities:
process_entity(ent, wads)
bpy.context.user_preferences.edit.use_global_undo = True