@staticmethod
def create(gltf, mesh_idx, skin_idx):
    'Mesh creation.'
    pymesh = gltf.data.meshes[mesh_idx]
    bme = bmesh.new()
    materials = []
    for prim in pymesh.primitives:
        if (prim.material is None):
            material_idx = None
        else:
            pymaterial = gltf.data.materials[prim.material]
            vertex_color = None
            if ('COLOR_0' in prim.attributes):
                vertex_color = 'COLOR_0'
            if (vertex_color not in pymaterial.blender_material):
                BlenderMaterial.create(gltf, prim.material, vertex_color)
            material_name = pymaterial.blender_material[vertex_color]
            material = bpy.data.materials[material_name]
            try:
                material_idx = materials.index(material.name)
            except ValueError:
                materials.append(material.name)
                material_idx = (len(materials) - 1)
        BlenderPrimitive.add_primitive_to_bmesh(gltf, bme, pymesh, prim, skin_idx, material_idx)
    name = (pymesh.name or ('Mesh_' + str(mesh_idx)))
    mesh = bpy.data.meshes.new(name)
    BlenderMesh.bmesh_to_mesh(gltf, pymesh, bme, mesh)
    bme.free()
    for name_material in materials:
        mesh.materials.append(bpy.data.materials[name_material])
    mesh.update()
    set_extras(mesh, pymesh.extras, exclude=['targetNames'])
    gltf.accessor_cache = {}
    return mesh
Mesh creation.
@staticmethod
def create(gltf, mesh_idx, skin_idx):
    
    pymesh = gltf.data.meshes[mesh_idx]
    bme = bmesh.new()
    materials = []
    for prim in pymesh.primitives:
        if (prim.material is None):
            material_idx = None
        else:
            pymaterial = gltf.data.materials[prim.material]
            vertex_color = None
            if ('COLOR_0' in prim.attributes):
                vertex_color = 'COLOR_0'
            if (vertex_color not in pymaterial.blender_material):
                BlenderMaterial.create(gltf, prim.material, vertex_color)
            material_name = pymaterial.blender_material[vertex_color]
            material = bpy.data.materials[material_name]
            try:
                material_idx = materials.index(material.name)
            except ValueError:
                materials.append(material.name)
                material_idx = (len(materials) - 1)
        BlenderPrimitive.add_primitive_to_bmesh(gltf, bme, pymesh, prim, skin_idx, material_idx)
    name = (pymesh.name or ('Mesh_' + str(mesh_idx)))
    mesh = bpy.data.meshes.new(name)
    BlenderMesh.bmesh_to_mesh(gltf, pymesh, bme, mesh)
    bme.free()
    for name_material in materials:
        mesh.materials.append(bpy.data.materials[name_material])
    mesh.update()
    set_extras(mesh, pymesh.extras, exclude=['targetNames'])
    gltf.accessor_cache = {}
    return mesh