def get_filename(obj):
    """

    :param bpy.types.Object obj:
    :return:
        Filename from object property 'filename' or object name
        (first 8 characters) if object doesn't have property 'filename'.
    :rtype: str
    """
    return (obj.get('filename') or obj.name.split('.')[0])[:8]