diff --git a/io_scene_dae/__init__.py b/io_scene_dae/__init__.py index 8580efd..89a82d8 100644 --- a/io_scene_dae/__init__.py +++ b/io_scene_dae/__init__.py @@ -142,13 +142,6 @@ class ExportDAE(bpy.types.Operator, ExportHelper): # return self.batch_mode == 'OFF' return True - def check(self, context): - return True - """ - isretur_def_change = super().check(context) - return (is_xna_change or is_def_change) - """ - def execute(self, context): if not self.filepath: raise Exception("filepath not set") diff --git a/io_scene_dae/export_dae.py b/io_scene_dae/export_dae.py index fbf3bbf..6940060 100644 --- a/io_scene_dae/export_dae.py +++ b/io_scene_dae/export_dae.py @@ -161,11 +161,12 @@ class DaeExporter: self.sections[section].append(line) def export_image(self, image): - if (image in self.image_cache): - return self.image_cache[image] + img_id = self.image_cache.get(image) + if img_id: + return img_id imgpath = image.filepath - if (imgpath.find("//") == 0 or imgpath.find("\\\\") == 0): + if imgpath.startswith("//"): # If relative, convert to absolute imgpath = bpy.path.abspath(imgpath) @@ -187,9 +188,7 @@ class DaeExporter: # If file is not found save it as png file in the destination # folder img_tmp_path = image.filepath - if img_tmp_path.endswith((".bmp", ".rgb", ".png", ".jpeg", - ".jpg", ".jp2", ".tga", ".cin", - ".dpx", ".exr", ".hdr", ".tif")): + if img_tmp_path.lower().endswith(bpy.path.extensions_image): image.filepath = basedir + "/" + \ os.path.basename(img_tmp_path) else: @@ -234,8 +233,9 @@ class DaeExporter: return imgid def export_material(self, material, double_sided_hint=True): - if (material in self.material_cache): - return self.material_cache[material] + material_id = self.material_cache.get(material) + if material_id: + return material_id fxid = self.new_id("fx") self.writel(S_FX, 1, '