Kupoman / blendergltf

A glTF exporter for Blender
Apache License 2.0
319 stars 49 forks source link

Problems with Images options #134

Closed shenzhuxi closed 6 years ago

shenzhuxi commented 6 years ago

I installed blendergltf-master.zip on Blender v2.79 on Mac. The model I used is https://www.mixamo.com/#/?page=1&query=gonzales&type=Character

The first problem is https://github.com/donmccurdy/three-gltf-viewer/issues/78

The second problem only happened some times when I exported after I opened a saved .blend file. I got this error if I used Copy or Reference instead of Embed for images, and can only find images file1.png file2.png and file3.png but not the gltf file in the output directory.

Traceback (most recent call last): File "/Users/HOME/Library/Application Support/Blender/2.79/scripts/addons/blendergltf-master/init.py", line 488, in execute gltf = export_gltf(data, settings) File "/Users/HOME/Library/Application Support/Blender/2.79/scripts/addons/blendergltf-master/blendergltf.py", line 2254, in export_gltf with open(path, 'wb') as fout: PermissionError: [Errno 13] Permission denied: 'file3.png'

location: :-1

BTW, the output from https://github.com/KhronosGroup/glTF-Blender-Exporter works with drag-and-drop three.js glTF viewer, but only the first 2 images were exported.

Kupoman commented 6 years ago

Can you please provide a .blend file and the settings you used?

shenzhuxi commented 6 years ago

I created this one from mixamo.com following https://donmccurdy.com/2017/11/06/creating-animated-gltf-characters-with-mixamo-and-blender/. Export settings were all default. Eve.blend.zip

Kupoman commented 6 years ago

I am having no problems exporting the supplied blend file with the default settings. It looks like the error could have resulted from some permission issues. Are you sure you are outputting the files somewhere that you have permission to access? You mentioned that you were on Mac OS. I do not have access to a Mac, so I have not done any testing on that. It is possible that something is getting screwed up with paths on Mac OS.

Kupoman commented 6 years ago

If you don't mind editing the source files, it would be helpful if you could print out "path" before it is used on line 2254 in blendergltf. I would like to know if the value of that variable matches up with where you are trying to output the files.

shenzhuxi commented 6 years ago

I don't know what's the right way to debug in Blender and just used logging like this:

    for path, data in state['files'].items():
        logging.debug(path)
        with open(path, 'wb') as fout:
            fout.write(data)

And got "DEBUG:root:file2.png" in the log and error like this

Traceback (most recent call last): File "/Users/HOME/Library/Application Support/Blender/2.79/scripts/addons/blendergltf-master/init.py", line 488, in execute gltf = export_gltf(data, settings) File "/Users/HOME/Library/Application Support/Blender/2.79/scripts/addons/blendergltf-master/blendergltf.py", line 2257, in export_gltf with open(path, 'wb') as fout: PermissionError: [Errno 13] Permission denied: 'file2.png'

location: :-1

I got no file output for the first time run after launch Blender. After the second run, I got the same log and error, but had file1.png, file2.png and file3.png exported.

Then I turned Blender off and on again, left 3 files in the output directory and tried export again. I got log "DEBUG:root:file3.png" and PermissionError: [Errno 13] Permission denied: 'file3.png'.

Kupoman commented 6 years ago

It looks like the output path for packed images was a little different than unpacked images. I have not had a problem with the difference in Linux, but perhaps it was causing this bug. Could you try exporting again with the latest master?

shenzhuxi commented 6 years ago

It's working with the latest master now. Thanks.

Kupoman commented 6 years ago

Thank you for reporting the issue and testing the fix.