Running this project's unit tests locally on a Windows box has apparently been broken for some time now. Specifically the round-trip tests all fail, claiming they can't find texture files.
This morning I got around to git-bisecting the problem, and it pointed to this being introduced with commit 19c1280a1342766f, which is one of @scurest's image importer upgrades. Prior to that, the imported images were apparently being copied to a temp file or something, and there was no error reading the temp file (but it was inefficient). One key difference is the path to the temp file was absolute, but in the new version, the path to the source image file is relative.
This could well be a Blender bug, because the path appears to be correct, and Blender is launched from the correct folder. One such command line is shown here (adjust the output folder path for your own machine of course, and run from the CMD window in the tests folder).
Luckily the fix (or workaround) seems easy, just ask Python to make the path absolute before handing it off to Blender. I've tested and found two places where a fix is effective:
We could modify importer line 61 to wrap path as os.path.abspath(path)
or:
We could modify test's roundtrip line 29 to change argv[0] to os.path.abspath(argv[0])
I'm inclined to ask for the change in the importer itself, rather than in just the tests, in case this fixes some edge case issue with relative imports of glTF files on Windows machines. But I'm OK with either.
I'm inclined to ask for the change in the importer itself, rather than in just the tests, in case this fixes some edge case issue with relative imports of glTF files on Windows machines
Running this project's unit tests locally on a Windows box has apparently been broken for some time now. Specifically the round-trip tests all fail, claiming they can't find texture files.
This morning I got around to git-bisecting the problem, and it pointed to this being introduced with commit 19c1280a1342766f, which is one of @scurest's image importer upgrades. Prior to that, the imported images were apparently being copied to a temp file or something, and there was no error reading the temp file (but it was inefficient). One key difference is the path to the temp file was absolute, but in the new version, the path to the source image file is relative.
An exception is thrown from this line here:
https://github.com/KhronosGroup/glTF-Blender-IO/blob/d3f00cfd9cb328604753c10ae2e175c54a67ec5b/addons/io_scene_gltf2/blender/imp/gltf2_blender_image.py#L61
This could well be a Blender bug, because the
path
appears to be correct, and Blender is launched from the correct folder. One such command line is shown here (adjust the output folder path for your own machine of course, and run from the CMD window in thetests
folder).Luckily the fix (or workaround) seems easy, just ask Python to make the path absolute before handing it off to Blender. I've tested and found two places where a fix is effective:
path
asos.path.abspath(path)
or:
argv[0]
toos.path.abspath(argv[0])
I'm inclined to ask for the change in the importer itself, rather than in just the tests, in case this fixes some edge case issue with relative imports of glTF files on Windows machines. But I'm OK with either.