瀏覽代碼

Fixes issue with material search materials now showing on windows

On windows, the material search was finding the materials but they
weren't showing up in Godot. It turns out this was due to slash
direction. Godot always uses linux-style-slashes internally, and
so when python used the native OS level slash, godot would fail
to find the requested resource.
Geoffrey Irons 7 年之前
父節點
當前提交
256a79a5a5
共有 1 個文件被更改,包括 4 次插入1 次删除
  1. 4 1
      io_scene_godot/structures.py

+ 4 - 1
io_scene_godot/structures.py

@@ -221,10 +221,13 @@ class ExternalResource(FileEntry):
 
     def fix_path(self, export_settings):
         """Makes the resource path relative to the exported file"""
+        # The replace line is because godot always works in linux
+        # style slashes, and python doing relpath uses the one
+        # from the native OS
         self.heading['path'] = os.path.relpath(
             self.heading['path'],
             os.path.dirname(export_settings["path"]),
-        )
+        ).replace('\\', '/')
 
 
 class InternalResource(FileEntry):