瀏覽代碼

Skip copying a texture if the file exists.

If a file with the same name exists in the export directory, skip
copying it rather than attempting to copy and throwing the error:

```
shutil.SameFileError: '/tmp/example/texture.png' and
'/tmp/example/texture.png' are the same file
```

This error is common if you share a texture among multiple models.

Fixes #182.
Ryan Roden-Corrent 6 年之前
父節點
當前提交
6f1712ed69
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      io_scene_godot/converters/material_node_tree/exporters.py

+ 2 - 1
io_scene_godot/converters/material_node_tree/exporters.py

@@ -44,7 +44,8 @@ def export_texture(escn_file, export_settings, image):
             src_path = bpy.path.abspath(image.filepath_raw)
         else:
             src_path = image.filepath_raw
-        copyfile(src_path, dst_path)
+        if os.path.abspath(src_path) != os.path.abspath(dst_path):
+            copyfile(src_path, dst_path)
 
     img_resource = ExternalResource(dst_path, "Texture")
     return escn_file.add_external_resource(img_resource, image)