def get_material_index(glTF, name):
    """
    Return the material index in the glTF array.
    """

    if name is None:
        return -1

    if glTF.get('materials') is None:
        return -1

    index = 0
    for material in glTF['materials']:
        if material['name'] == name:
            return index
        
        index += 1

    return -1