Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import the A32NX #27

Open
imagitama opened this issue May 28, 2023 · 1 comment
Open

Cannot import the A32NX #27

imagitama opened this issue May 28, 2023 · 1 comment

Comments

@imagitama
Copy link

imagitama commented May 28, 2023

Tried importing best LOD of the cockpit of the A32NX from FlyByWire (A320_NEO_INTERIOR_LOD00.gltf) and I get this error:

Traceback (most recent call last):
  File "C:\Users\\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_msfs_gltf (1).py", line 760, in execute
    ImportProperties.convert_textures_dirs)
  File "C:\Users\\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_msfs_gltf (1).py", line 629, in import_msfs_gltf
    objects = create_objects(gltf['nodes'], meshes)
  File "C:\Users\\AppData\Roaming\Blender Foundation\Blender\2.83\scripts\addons\io_msfs_gltf (1).py", line 242, in create_objects
    mesh = meshes[node['mesh']]
TypeError: list indices must be integers or slices, not NoneType

location: <unknown location>:-1

Tested in Blender 3.1.2, 2.9 and 2.8.

The other LODs and exterior meshes import correctly.

@imagitama
Copy link
Author

Fixed by catching all exceptions and just creating a new mesh:

def create_objects(nodes, meshes):
    objects = []
    for node in nodes:
        name = node['name']
        print(node)
        try:
            mesh = meshes[node['mesh']]
-        except KeyError:
+        except:
            mesh = bpy.data.meshes.new(name)

        obj = bpy.data.objects.new(name, mesh)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant