# 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
                elif z > x and z > y:
                    axis = '-Z' if target[2] < 0 else '+Z'
                else:
                    axis = '-Y' if target[1] < 0 else '+Y'

                cr_inv = AXIS_TO_PLUS_Y[axis]
                cr = cr_inv.conjugated()

            elif op.options['bone_rotation_mode'] == 'NONE':
                cr = Quaternion((1, 0, 0, 0))

            else:
                assert(False)

            vnode.correction_rotation = cr

            # cr(pb)^{-1} r cr(b)
            editbone_r = mul(mul(cr_pb_inv, r), cr)

        else:
            # TODO: we could still use a rotation here.
            # C(b) = 1
            vnode.correction_rotation = Quaternion((1, 0, 0, 0))
            vnode.correction_homscale = 1
            # E(b) = Trans[ Rot[cr(pb)^{-1}] t / cs(pb) ] Rot[cr(pb)^{-1} r]
            # P(b;loadtime) = Scale[s / cs(pb)]
            editbone_r = mul(cr_pb_inv, r)
            vnode.pose_s = s / cs_pb

        vnode.editbone_tr = editbone_t, editbone_r

# 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

                elif z > x and z > y:
                    axis = '-Z' if target[2] < 0 else '+Z'
                else:
                    axis = '-Y' if target[1] < 0 else '+Y'

                cr_inv = AXIS_TO_PLUS_Y[axis]
                cr = cr_inv.conjugated()

            elif op.options['bone_rotation_mode'] == 'NONE':
                cr = Quaternion((1, 0, 0, 0))

            else:
                assert(False)

            vnode.correction_rotation = cr

            # cr(pb)^{-1} r cr(b)
            editbone_r = mul(mul(cr_pb_inv, r), cr)

        else:
            # TODO: we could still use a rotation here.
            # C(b) = 1
            vnode.correction_rotation = Quaternion((1, 0, 0, 0))
            vnode.correction_homscale = 1
            # E(b) = Trans[ Rot[cr(pb)^{-1}] t / cs(pb) ] Rot[cr(pb)^{-1} r]
            # P(b;loadtime) = Scale[s / cs(pb)]
            editbone_r = mul(cr_pb_inv, r)
            vnode.pose_s = s / cs_pb

        vnode.editbone_tr = editbone_t, editbone_r

        vnode.editbone_local_to_armature = mul(