Blender can't import glb file #95300

Closed
opened 2022-01-28 23:40:11 +01:00 by Eduardo Alarcón Navarro · 7 comments

System Information
Operating system: Windows 10 19044.1466
Graphics card: Nvidia GTX 1060 6GB
Blender Version
Broken: 3.1.0 Beta, branch: master, commit date: 2022-01-28 13:01
Worked: 3.0.1, branch: master, commit date: 2022-01-25 17:19

Short description of error
Blender shows this error when importing a GLB file. I had this problem with a Polycam file
blender_7tvi0vMjXA.png

Exact steps for others to reproduce the error
Try to import a GBL file

**System Information** Operating system: Windows 10 19044.1466 Graphics card: Nvidia GTX 1060 6GB **Blender Version** Broken: 3.1.0 Beta, branch: master, commit date: 2022-01-28 13:01 Worked: 3.0.1, branch: master, commit date: 2022-01-25 17:19 **Short description of error** Blender shows this error when importing a GLB file. I had this problem with a Polycam file ![blender_7tvi0vMjXA.png](https://archive.blender.org/developer/F12831938/blender_7tvi0vMjXA.png) **Exact steps for others to reproduce the error** Try to import a GBL file

Added subscriber: @edu_sombra

Added subscriber: @edu_sombra

Added subscriber: @scurest

Added subscriber: @scurest

This will affect any file that stores an image as binary data (eg. most .glbs). I guess all the tests use separate image files...

It's a simple typo of course. Renaming the img_pack variable fixes it.

Btw this function has become very ugly. The is_binary and is_placeholder variables are no longer needed, and the "image from file" case is needlessly split into two halves on either side of the "image from binary buffer" case. Since the two cases share no code anymore, it would be much cleaner to dispatch to dedicated functions, so the main body would just be

        if img.uri and not img.uri.startswith('data:'):
            blender_image = create_from_file(gltf, img_idx)
        else:
            blender_image = create_from_data(gltf, img_idx)

        if blender_image:
            img.blender_image_name = blender_image.name
This will affect any file that stores an image as binary data (eg. most .glbs). I guess all the tests use separate image files... It's a simple typo of course. Renaming the `img_pack` variable fixes it. Btw this function has become very ugly. The `is_binary` and `is_placeholder` variables are no longer needed, and the "image from file" case is needlessly split into two halves on either side of the "image from binary buffer" case. Since the two cases share no code anymore, it would be much cleaner to dispatch to dedicated functions, so the main body would just be ``` if img.uri and not img.uri.startswith('data:'): blender_image = create_from_file(gltf, img_idx) else: blender_image = create_from_data(gltf, img_idx) if blender_image: img.blender_image_name = blender_image.name ```
Member

Added subscriber: @JulienDuroure

Added subscriber: @JulienDuroure
Julien Duroure self-assigned this 2022-01-29 08:13:22 +01:00
Member

Added subscriber: @PratikPB2123

Added subscriber: @PratikPB2123

This issue was referenced by faa9fc7f98

This issue was referenced by faa9fc7f98e19be54a715c24061185b04dff5b6c
Member

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Sign in to join this conversation.
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#95300
No description provided.