def get_used_materials(objects):
    """ Collect Materials used in the selected object.
    """
    m_list = []
    for obj in objects:
        if obj.type == 'MESH':
            for f in obj.data.polygons:
                if f.material_index < len(obj.data.materials):
                    if not obj.data.materials[f.material_index]:
                        continue
                    m_list.append(obj.data.materials[f.material_index].
                        yabee_name)
    return set(m_list)
