# Path: addons/io_scene_gltf_ksons/compat.py
# def mul(x, y): return x @ y
# 
# Path: addons/io_scene_gltf_ksons/mesh.py
# def mesh_name(op, mesh_spec):
#     mesh_idx, primitive_idx = mesh_spec
#     name = op.gltf['meshes'][mesh_idx].get('name', 'meshes[%d]' % mesh_idx)
#     if primitive_idx is not None:
#         # Look for a name on the extras property
#         extras = op.gltf['meshes'][mesh_idx]['primitives'][primitive_idx].get('extras')
#         if type(extras) == dict and type(extras.get('name')) == str and extras['name']:
#             primitive_name = extras['name']
#         else:
#             primitive_name = 'primitives[%d]' % primitive_idx
#         name += '.' + primitive_name
#     return name


from math import pi
from mathutils import Matrix, Quaternion, Vector, Euler
from .compat import mul
from .mesh import mesh_name
    # Create a vnode for each node
    for node_id, node in enumerate(nodes):
        vnode = VNode()
        vnode.node_id = node_id
        vnode.name = node.get('name', 'nodes[%d]' % node_id)
        vnode.trs = get_node_trs(op, node)
        vnode.type = 'OBJECT'

        if 'mesh' in node:
            vnode.mesh = {
                'mesh': node['mesh'],
                'primitive_idx': None, # use all primitives
                'skin': node.get('skin'),
                'weights': node.get('weights', op.gltf['meshes'][node['mesh']].get('weights')),
            }
        if 'camera' in node:
            vnode.camera = {
                'camera': node['camera'],
            }
        if 'KHR_lights_punctual' in node.get('extensions', {}):
            vnode.light = {
                'light': node['extensions']['KHR_lights_punctual']['light'],
            }

        op.node_id_to_vnode[node_id] = vnode

    # Fill in the parent/child relationships
    for node_id, node in enumerate(nodes):
        vnode = op.node_id_to_vnode[node_id]
        for child_id in node.get('children', []):

# Path: addons/io_scene_gltf_ksons/compat.py
# def mul(x, y): return x @ y
# 
# Path: addons/io_scene_gltf_ksons/mesh.py
# def mesh_name(op, mesh_spec):
#     mesh_idx, primitive_idx = mesh_spec
#     name = op.gltf['meshes'][mesh_idx].get('name', 'meshes[%d]' % mesh_idx)
#     if primitive_idx is not None:
#         # Look for a name on the extras property
#         extras = op.gltf['meshes'][mesh_idx]['primitives'][primitive_idx].get('extras')
#         if type(extras) == dict and type(extras.get('name')) == str and extras['name']:
#             primitive_name = extras['name']
#         else:
#             primitive_name = 'primitives[%d]' % primitive_idx
#         name += '.' + primitive_name
#     return name


# Path: addons/io_scene_gltf_ksons/vnode.py
from math import pi
from mathutils import Matrix, Quaternion, Vector, Euler
from .compat import mul
from .mesh import mesh_name

    # Create a vnode for each node
    for node_id, node in enumerate(nodes):
        vnode = VNode()
        vnode.node_id = node_id
        vnode.name = node.get('name', 'nodes[%d]' % node_id)
        vnode.trs = get_node_trs(op, node)
        vnode.type = 'OBJECT'

        if 'mesh' in node:
            vnode.mesh = {
                'mesh': node['mesh'],
                'primitive_idx': None, # use all primitives
                'skin': node.get('skin'),
                'weights': node.get('weights', op.gltf['meshes'][node['mesh']].get('weights')),
            }
        if 'camera' in node:
            vnode.camera = {
                'camera': node['camera'],
            }
        if 'KHR_lights_punctual' in node.get('extensions', {}):
            vnode.light = {
                'light': node['extensions']['KHR_lights_punctual']['light'],
            }

        op.node_id_to_vnode[node_id] = vnode

    # Fill in the parent/child relationships
    for node_id, node in enumerate(nodes):
        vnode = op.node_id_to_vnode[node_id]
        for child_id in node.get('children', []):

            child_vnode = op.node_id_to_vnode[child_id]